PSO2SERVER/Server/Protocol/Packets/08-SpawnPacket/08-0D-EnemySpawnPacket.cs

85 lines
2.7 KiB
C#
Raw Normal View History

2024-09-18 03:47:04 +08:00
using PSO2SERVER.Models;
2024-12-06 22:06:01 +08:00
using PSO2SERVER.Zone;
2024-09-18 03:47:04 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Protocol.Packets
2024-09-18 03:47:04 +08:00
{
public class EnemySpawnPacket : Packet
{
2024-12-06 22:06:01 +08:00
public ObjectHeader objHeader { get; set; } = new ObjectHeader();
public PSOLocation objPosition { get; set; } = new PSOLocation();
public ushort unk1 { get; set; } = 0;
/// Enemy name.
public string objName { get; set; } = string.Empty;//0x20
public uint unk2 { get; set; } = 0;
/// Enemy HP.
public uint hp { get; set; } = 0;
public uint unk4 { get; set; } = 0;
/// Enemy level.
public uint level { get; set; } = 0;
public uint unk5 { get; set; } = 0;
public uint unk6 { get; set; } = 0;
public ushort unk7 { get; set; } = 0;
public ushort unk8 { get; set; } = 0;
public uint[] unk9 { get; set; } = new uint[0x10];
public string unk10 { get; set; } = string.Empty; //Ascii
public byte unk11 { get; set; } = 0;
public byte unk12 { get; set; } = 0;
public ushort unk13 { get; set; } = 0;
public byte[] unk14 { get; set; } = new byte[0x0C];
public EnemySpawnPacket(PSOObject obj)
2024-09-18 03:47:04 +08:00
{
2024-12-06 22:06:01 +08:00
objHeader = obj.Header;
objPosition = obj.Position;
objName = obj.Name;
unk2 = 2;
unk4 = 2;
unk6 = 1029;
unk7 = 255;
unk8 = 65535;
unk9 = new uint[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1062804813, 3212836864, 0, 1570802465, 0, 0, 0
};
unk11 = 1;
unk12 = 255;
2024-09-18 03:47:04 +08:00
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
2024-12-06 22:06:01 +08:00
pkt.WriteStruct(objHeader);
pkt.WritePosition(objPosition);
pkt.Write(unk1); // Padding?
pkt.WriteFixedLengthASCII(objName, 0x20);
pkt.Write(unk2);
pkt.Write(hp);
pkt.Write(unk4);
pkt.Write(level);
pkt.Write(unk5);
pkt.Write(unk6);
pkt.Write(unk7);
pkt.Write(unk8);
pkt.WriteUintArray(unk9);
pkt.WriteAscii(unk10, 0x258B, 0x32);
pkt.Write(unk11);
pkt.Write(unk12);
pkt.Write(unk13);
pkt.Write(unk14);
2024-09-18 03:47:04 +08:00
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
2024-12-06 22:06:01 +08:00
return new PacketHeader(0x08, 0x0D, PacketFlags.PACKED);
2024-09-18 03:47:04 +08:00
}
#endregion
}
}