using PSO2SERVER.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PSO2SERVER.Protocol.Packets { public class ActionEndPacket : Packet { public ObjectHeader unk1 { get; set; } = new ObjectHeader(); /// Object that was performing an action. public ObjectHeader performer { get; set; } = new ObjectHeader(); public uint unk2 { get; set; } = 0; public ObjectHeader unk3 { get; set; } = new ObjectHeader(); public ObjectHeader unk4 { get; set; } = new ObjectHeader(); public byte[] unk5 { get; set; } = new byte[0x04]; public string action { get; set; } = string.Empty;//Ascii // 带参数的构造函数,用来初始化字段 public ActionEndPacket(ObjectHeader unk1, ObjectHeader performer, uint unk2, ObjectHeader unk3, ObjectHeader unk4, byte[] unk5, string action) { this.unk1 = unk1; // 如果传入的值为 null, 使用默认值 this.performer = performer; this.unk2 = unk2; this.unk3 = unk3; this.unk4 = unk4; this.unk5 = unk5 ?? new byte[0x04]; // 如果传入的值为 null, 使用默认字节数组 this.action = action ?? string.Empty; // 如果传入的值为 null, 使用空字符串 } #region implemented abstract members of Packet public override byte[] Build() { var pkt = new PacketWriter(); pkt.WriteStruct(unk1); pkt.WriteStruct(performer); pkt.Write(unk2); pkt.WriteStruct(unk3); pkt.WriteStruct(unk4); pkt.WriteByteArray(unk5); pkt.WriteAscii(action, 0x83EF, 0x40); return pkt.ToArray(); } public override PacketHeader GetHeader() { return new PacketHeader(0x04, 0x75, PacketFlags.PACKED_OBJECT_RELATED); } #endregion } }