修正08数据集

This commit is contained in:
Sancaros 2024-12-06 22:06:01 +08:00
parent 42a5fa364f
commit 181d882a8e
3 changed files with 121 additions and 66 deletions

View File

@ -1,16 +1,43 @@
using PSO2SERVER.Models;
using PSO2SERVER.Zone;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static PSO2SERVER.Models.PSOObject;
namespace PSO2SERVER.Protocol.Packets
{
public class EventSpawnPacket : Packet
{
public readonly PSOObject _obj;
public ObjectHeader objHeader { get; set; } = new ObjectHeader();
public PSOLocation objPosition { get; set; } = new PSOLocation();
public ushort unk1 { get; set; } = 0;
public string objName { get; set; } = string.Empty;
public uint unk3 { get; set; } = 0;
public byte[] unk4 { get; set; } = new byte[0x0C];
public ushort unk5 { get; set; } = 0;
public ushort unk6 { get; set; } = 0;
public uint unk7 { get; set; } = 0;
public uint unk8 { get; set; } = 0;
public uint unk9 { get; set; } = 0;
public uint unk10 { get; set; } = 0;
public uint unk11 { get; set; } = 0;
public uint unk12 { get; set; } = 0;
public uint unk13 { get; set; } = 0;
public uint unk14 { get; set; } = 0;
public uint flags { get; set; } = 0;
/// Event data.
public List<uint> data { get; set; } = new List<uint>();
public EventSpawnPacket()
public EventSpawnPacket(PSOObject obj)
{
objHeader = obj.Header;
objPosition = obj.Position;
objName = obj.Name;
flags = 4;
_obj = obj;
}
#region implemented abstract members of Packet
@ -18,6 +45,29 @@ namespace PSO2SERVER.Protocol.Packets
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.WriteStruct(objHeader);
pkt.WritePosition(objPosition);
pkt.Write(unk1); // Padding?
pkt.WriteFixedLengthASCII(objName, 0x20);
pkt.Write(unk3);
pkt.Write(unk4);
pkt.Write(unk5);
pkt.Write(unk6);
pkt.Write(unk7);
pkt.Write(unk8);
pkt.Write(unk9);
pkt.Write(unk10);
pkt.Write(unk11);
pkt.Write(unk12);
pkt.Write(unk13);
pkt.Write(unk14);
pkt.Write(flags);
pkt.Write(_obj.Things.Length);
foreach (PSOObjectThing thing in _obj.Things)
{
pkt.WriteStruct(thing);
}
return pkt.ToArray();
}

View File

@ -13,46 +13,22 @@ namespace PSO2SERVER.Protocol.Packets
{
public class ObjectSpawnPacket : Packet
{
//private readonly PSOObject _obj;
public readonly PSOObject _obj;
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 uint[] unk2 { get; set; } = new uint[0x05];
public uint flags { get; set; } = 0;
public List<uint> data { get; set; } = new List<uint>();
public ObjectSpawnPacket(PSOObject obj)
{
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;
//_obj = obj;
flags = 4;
_obj = obj;
}
#region implemented abstract members of Packet
@ -64,45 +40,20 @@ namespace PSO2SERVER.Protocol.Packets
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);
//pkt.WriteStruct(_obj.Header);
//pkt.WritePosition(_obj.Position);
//pkt.Seek(2, SeekOrigin.Current); // Padding I guess...
//pkt.WriteFixedLengthASCII(_obj.Name, 0x34);
//pkt.Write(_obj.ThingFlag);
//pkt.Write(_obj.Things.Length);
//foreach (PSOObjectThing thing in _obj.Things)
//{
// pkt.WriteStruct(thing);
//}
pkt.WriteUintArray(unk2);
pkt.Write(flags);
pkt.Write(_obj.Things.Length);
foreach (PSOObjectThing thing in _obj.Things)
{
pkt.WriteStruct(thing);
}
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x08, 0x0B, PacketFlags.PACKED);
return new PacketHeader(0x08, 0x0B, PacketFlags.None);
}
#endregion

View File

@ -1,4 +1,5 @@
using PSO2SERVER.Models;
using PSO2SERVER.Zone;
using System;
using System.Collections.Generic;
using System.Linq;
@ -9,8 +10,43 @@ namespace PSO2SERVER.Protocol.Packets
public class EnemySpawnPacket : Packet
{
public EnemySpawnPacket()
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)
{
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;
}
#region implemented abstract members of Packet
@ -18,12 +54,30 @@ namespace PSO2SERVER.Protocol.Packets
public override byte[] Build()
{
var pkt = new PacketWriter();
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);
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x08, 0x0D, PacketFlags.None);
return new PacketHeader(0x08, 0x0D, PacketFlags.PACKED);
}
#endregion