Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -25,4 +25,52 @@ export class SetScriptRunningPacket implements Packet
|
||||
return 65;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.Script['ObjectID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.Script['ItemID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8((this.Script['Running']) ? 1 : 0, pos++);
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero()
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData = newObjAgentData;
|
||||
const newObjScript: {
|
||||
ObjectID: UUID,
|
||||
ItemID: UUID,
|
||||
Running: boolean
|
||||
} = {
|
||||
ObjectID: UUID.zero(),
|
||||
ItemID: UUID.zero(),
|
||||
Running: false
|
||||
};
|
||||
newObjScript['ObjectID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjScript['ItemID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjScript['Running'] = (buf.readUInt8(pos++) === 1);
|
||||
this.Script = newObjScript;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user