73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using PSO2SERVER.Models;
|
||
using System.IO;
|
||
using static PSO2SERVER.Models.PSOPalette;
|
||
|
||
namespace PSO2SERVER.Protocol.Packets
|
||
{
|
||
public class LoadPalettePacket : Packet
|
||
{
|
||
#region implemented abstract members of Packet
|
||
|
||
public uint CurPalette { get; set; }
|
||
public uint CurSubpalette { get; set; }
|
||
public uint CurBook { get; set; }
|
||
public WeaponPalette[] Palettes { get; set; } = new WeaponPalette[6];
|
||
public SubPalette[] Subpalettes { get; set; } = new SubPalette[6];
|
||
|
||
public LoadPalettePacket(PSOPalette palette)
|
||
{
|
||
CurPalette = palette.CurPalette;
|
||
CurSubpalette = palette.CurSubpalette;
|
||
CurBook = palette.CurBook;
|
||
|
||
// 初始化 Palettes
|
||
for (int i = 0; i < Palettes.Length; i++)
|
||
{
|
||
Palettes[i] = palette.Palettes[i];
|
||
}
|
||
|
||
// 初始化 Subpalettes(根据需要可以进行自定义初始化)
|
||
for (int i = 0; i < Subpalettes.Length; i++)
|
||
{
|
||
Subpalettes[i] = palette.Subpalettes[i]; // 这里可以根据需要进行初始化
|
||
}
|
||
}
|
||
|
||
public override byte[] Build()
|
||
{
|
||
var pkt = new PacketWriter();
|
||
//pkt.Write(CurPalette);
|
||
//pkt.Write(CurSubpalette);
|
||
//pkt.Write(CurBook);
|
||
|
||
//// 初始化 Palettes
|
||
//for (int i = 0; i < Palettes.Length; i++)
|
||
//{
|
||
// Palettes[i].WriteToStream(pkt);
|
||
//}
|
||
|
||
//// 初始化 Subpalettes(根据需要可以进行自定义初始化)
|
||
//for (int i = 0; i < Subpalettes.Length; i++)
|
||
//{
|
||
// Subpalettes[i].WriteToStream(pkt);
|
||
//}
|
||
|
||
//// Enable flag
|
||
//pkt.Write((byte) 1);
|
||
|
||
//// Blank out the rest (skills)
|
||
//for (var i = 0; i < 1091; i++)
|
||
// pkt.Write((byte) 0);
|
||
|
||
pkt.Write(File.ReadAllBytes("packets/0000_10_45_17_271399100.bin"));
|
||
return pkt.ToArray();
|
||
}
|
||
|
||
public override PacketHeader GetHeader()
|
||
{
|
||
return new PacketHeader(0x21, 0x01, PacketFlags.None);
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
} |