mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Added command and script packets. Finished the SetActorProperty packet. Fixed bug with manually send packets from console.
This commit is contained in:
parent
ba68546cc9
commit
0a6b005a0c
9 changed files with 198 additions and 43 deletions
|
@ -9,13 +9,16 @@ namespace FFXIVClassic_Map_Server.packets.send.script
|
|||
{
|
||||
class CommandStartRequestPacket
|
||||
{
|
||||
bool invalidPacket = false;
|
||||
public const ushort OPCODE = 0x012E;
|
||||
public const uint PACKET_SIZE = 0x78;
|
||||
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public uint actorID;
|
||||
public uint scriptOwnerActorID;
|
||||
public uint val1;
|
||||
public uint val2;
|
||||
public string callbackName;
|
||||
public ScriptParamReader reader;
|
||||
|
||||
public CommandStartRequestPacket(byte[] data)
|
||||
{
|
||||
|
@ -30,14 +33,8 @@ namespace FFXIVClassic_Map_Server.packets.send.script
|
|||
val2 = binReader.ReadUInt32();
|
||||
binReader.ReadByte();
|
||||
|
||||
while (true)
|
||||
{
|
||||
byte inByte = binReader.ReadByte();
|
||||
if (inByte == 0)
|
||||
break;
|
||||
callbackName += (char)inByte;
|
||||
}
|
||||
|
||||
binReader.BaseStream.Seek(0x31, SeekOrigin.Begin);
|
||||
reader = new ScriptParamReader(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -9,14 +9,16 @@ namespace FFXIVClassic_Map_Server.packets.send.script
|
|||
{
|
||||
class ScriptResultPacket
|
||||
{
|
||||
bool invalidPacket = false;
|
||||
public const ushort OPCODE = 0x012E;
|
||||
public const uint PACKET_SIZE = 0xD8;
|
||||
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public uint actorID;
|
||||
public uint scriptOwnerActorID;
|
||||
public uint val1;
|
||||
public uint val2;
|
||||
public uint val3;
|
||||
public uint val4;
|
||||
public uint val5;
|
||||
ScriptParamReader reader;
|
||||
|
||||
public ScriptResultPacket(byte[] data)
|
||||
{
|
||||
|
@ -26,11 +28,11 @@ namespace FFXIVClassic_Map_Server.packets.send.script
|
|||
{
|
||||
try{
|
||||
actorID = binReader.ReadUInt32();
|
||||
scriptOwnerActorID = binReader.ReadUInt32();
|
||||
val1 = binReader.ReadUInt32();
|
||||
val2 = binReader.ReadUInt32();
|
||||
val3 = binReader.ReadUInt32();
|
||||
val4 = binReader.ReadUInt32();
|
||||
val5 = binReader.ReadUInt32();
|
||||
binReader.ReadByte();
|
||||
reader = new ScriptParamReader(binReader);
|
||||
}
|
||||
catch (Exception){
|
||||
invalidPacket = true;
|
||||
|
|
|
@ -66,14 +66,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
|
||||
private ushort runningByteTotal = 0;
|
||||
private byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
private string script;
|
||||
|
||||
private MemoryStream mem;
|
||||
private BinaryWriter binWriter;
|
||||
|
||||
public SetActorPropetyPacket(string script)
|
||||
public SetActorPropetyPacket()
|
||||
{
|
||||
this.script = script;
|
||||
mem = new MemoryStream(data);
|
||||
binWriter = new BinaryWriter(mem);
|
||||
binWriter.Seek(1, SeekOrigin.Begin);
|
||||
|
@ -87,7 +85,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
|
||||
public bool addByte(uint id, byte value)
|
||||
{
|
||||
if (runningByteTotal + 6 + Encoding.ASCII.GetByteCount(script) > MAXBYTES)
|
||||
if (runningByteTotal + 6 > MAXBYTES)
|
||||
return false;
|
||||
|
||||
binWriter.Write((byte)1);
|
||||
|
@ -100,7 +98,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
|
||||
public bool addShort(uint id, ushort value)
|
||||
{
|
||||
if (runningByteTotal + 7 + Encoding.ASCII.GetByteCount(script) > MAXBYTES)
|
||||
if (runningByteTotal + 7 > MAXBYTES)
|
||||
return false;
|
||||
|
||||
binWriter.Write((byte)2);
|
||||
|
@ -113,7 +111,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
|
||||
public bool addInt(uint id, uint value)
|
||||
{
|
||||
if (runningByteTotal + 9 + Encoding.ASCII.GetByteCount(script) > MAXBYTES)
|
||||
if (runningByteTotal + 9 > MAXBYTES)
|
||||
return false;
|
||||
|
||||
binWriter.Write((byte)4);
|
||||
|
@ -124,11 +122,29 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool addBuffer(uint id, byte[] buffer)
|
||||
{
|
||||
if (runningByteTotal + 5 + buffer.Length > MAXBYTES)
|
||||
return false;
|
||||
|
||||
binWriter.Write((byte)buffer.Length);
|
||||
binWriter.Write((UInt32)id);
|
||||
binWriter.Write(buffer);
|
||||
runningByteTotal += (ushort)(5 + buffer.Length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTarget(string target)
|
||||
{
|
||||
binWriter.Write((byte)(0x82 + target.Length));
|
||||
binWriter.Write(target);
|
||||
runningByteTotal += (ushort)(1 + target.Length);
|
||||
|
||||
}
|
||||
|
||||
public SubPacket buildPacket(uint playerActorID, uint actorID)
|
||||
{
|
||||
binWriter.Write((ushort)00);
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(script));
|
||||
|
||||
binWriter.Seek(0, SeekOrigin.Begin);
|
||||
binWriter.Write((byte)runningByteTotal);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue