PSO2SERVER/Server/Protocol/Packets/04-ObjectRelatedPacket/04-15-ObjectActionPacket.cs

48 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using PSO2SERVER.Models;
namespace PSO2SERVER.Protocol.Packets
{
class ObjectActionPacket : Packet
{
private ObjectHeader headerA; // Destination player / object?
private ObjectHeader headerB; // Calling player / object?
private ObjectHeader headerC; // Maybe argument player / object?
private ObjectHeader headerD; // Probably another arg I guess?
private string command; // ASCII command
public ObjectActionPacket(ObjectHeader headerA, ObjectHeader headerB, ObjectHeader headerC, ObjectHeader headerD, string command)
{
this.headerA = headerA;
this.headerB = headerB;
this.headerC = headerC;
this.headerD = headerD;
this.command = command;
}
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
headerA.WriteObjectHeaderToStream(writer);
headerB.WriteObjectHeaderToStream(writer);
writer.Write((uint)0); // Padding
headerC.WriteObjectHeaderToStream(writer);
headerD.WriteObjectHeaderToStream(writer);
writer.Write((uint)0); // Padding
writer.WriteAscii(command, 0x5CCF, 0x15);
return writer.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x04, 0x15, (PacketFlags.OBJECT_RELATED | PacketFlags.PACKED));
}
}
}