2024-09-16 17:09:36 +08:00
|
|
|
|
using PSO2SERVER.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2024-09-22 11:14:48 +08:00
|
|
|
|
using System.IO;
|
2024-09-16 17:09:36 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2024-11-27 18:05:53 +08:00
|
|
|
|
namespace PSO2SERVER.Protocol.Packets
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-09-18 20:28:51 +08:00
|
|
|
|
public class NewDefaultPAsPacket : Packet
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
|
|
|
|
public const int FixedLength = 0x1A0; // 416 bytes
|
|
|
|
|
public const int SeekAfter = 0x240; // 576 bytes
|
|
|
|
|
|
|
|
|
|
public List<uint> Default { get; set; }
|
2024-09-16 17:09:36 +08:00
|
|
|
|
|
2024-09-18 20:28:51 +08:00
|
|
|
|
public NewDefaultPAsPacket()
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-09-22 11:14:48 +08:00
|
|
|
|
Default = new List<uint>(FixedLength / sizeof(uint)); // 初始化为 0x1A0 / 4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ReadFromStream(PacketReader reader)
|
|
|
|
|
{
|
|
|
|
|
// 读取 Default
|
|
|
|
|
for (int i = 0; i < Default.Capacity; i++)
|
|
|
|
|
{
|
|
|
|
|
Default.Add(reader.ReadUInt32());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 跳过填充
|
|
|
|
|
reader.BaseStream.Seek(SeekAfter - FixedLength, SeekOrigin.Current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteToStream(PacketWriter writer)
|
|
|
|
|
{
|
|
|
|
|
// 写入 Default
|
|
|
|
|
foreach (var value in Default)
|
|
|
|
|
{
|
|
|
|
|
writer.Write(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 填充到 0x240
|
|
|
|
|
long paddingSize = SeekAfter - FixedLength;
|
|
|
|
|
writer.BaseStream.Seek(paddingSize, SeekOrigin.Current);
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region implemented abstract members of Packet
|
|
|
|
|
|
|
|
|
|
public override byte[] Build()
|
|
|
|
|
{
|
2024-09-22 00:08:44 +08:00
|
|
|
|
var writer = new PacketWriter();
|
|
|
|
|
foreach (var value in Default)
|
|
|
|
|
{
|
|
|
|
|
writer.Write(value);
|
|
|
|
|
}
|
|
|
|
|
return writer.ToArray();
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override PacketHeader GetHeader()
|
|
|
|
|
{
|
2024-09-18 20:28:51 +08:00
|
|
|
|
return new PacketHeader(0x21, 0x0F, PacketFlags.None);
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|