Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -27,4 +27,68 @@ export class ParcelSelectObjectsPacket implements Packet
|
||||
return ((16) * this.ReturnIDs.length) + 41;
|
||||
}
|
||||
|
||||
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;
|
||||
buf.writeInt32LE(this.ParcelData['LocalID'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.ParcelData['ReturnType'], pos);
|
||||
pos += 4;
|
||||
const count = this.ReturnIDs.length;
|
||||
buf.writeUInt8(this.ReturnIDs.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
this.ReturnIDs[i]['ReturnID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
}
|
||||
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 newObjParcelData: {
|
||||
LocalID: number,
|
||||
ReturnType: number
|
||||
} = {
|
||||
LocalID: 0,
|
||||
ReturnType: 0
|
||||
};
|
||||
newObjParcelData['LocalID'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjParcelData['ReturnType'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.ParcelData = newObjParcelData;
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.ReturnIDs = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjReturnIDs: {
|
||||
ReturnID: UUID
|
||||
} = {
|
||||
ReturnID: UUID.zero()
|
||||
};
|
||||
newObjReturnIDs['ReturnID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.ReturnIDs.push(newObjReturnIDs);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user