2024-09-18 00:55:35 +08:00
|
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
|
|
using PSO2SERVER.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.Remoting.Messaging;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using static PSO2SERVER.Models.PSOObject;
|
|
|
|
|
|
|
|
|
|
namespace PSO2SERVER.Packets.PSOPackets
|
|
|
|
|
{
|
|
|
|
|
public class ObjectSpawnPacket : Packet
|
|
|
|
|
{
|
|
|
|
|
private readonly PSOObject _obj;
|
|
|
|
|
public ObjectSpawnPacket(PSOObject obj)
|
|
|
|
|
{
|
|
|
|
|
_obj = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region implemented abstract members of Packet
|
|
|
|
|
|
|
|
|
|
public override byte[] Build()
|
|
|
|
|
{
|
|
|
|
|
PacketWriter writer = new PacketWriter();
|
|
|
|
|
writer.WriteStruct(_obj.Header);
|
2024-09-21 09:23:14 +08:00
|
|
|
|
writer.WritePosition(_obj.Position);
|
2024-09-18 00:55:35 +08:00
|
|
|
|
writer.Seek(2, SeekOrigin.Current); // Padding I guess...
|
|
|
|
|
writer.WriteFixedLengthASCII(_obj.Name, 0x34);
|
|
|
|
|
writer.Write(_obj.ThingFlag);
|
|
|
|
|
writer.Write(_obj.Things.Length);
|
|
|
|
|
foreach (PSOObjectThing thing in _obj.Things)
|
|
|
|
|
{
|
|
|
|
|
writer.WriteStruct(thing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return writer.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override PacketHeader GetHeader()
|
|
|
|
|
{
|
|
|
|
|
return new PacketHeader(0x08, 0x0B, PacketFlags.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|