Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -30,4 +30,88 @@ export class ParcelDisableObjectsPacket implements Packet
|
||||
return ((16) * this.TaskIDs.length) + ((16) * this.OwnerIDs.length) + 42;
|
||||
}
|
||||
|
||||
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;
|
||||
let count = this.TaskIDs.length;
|
||||
buf.writeUInt8(this.TaskIDs.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
this.TaskIDs[i]['TaskID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
}
|
||||
count = this.OwnerIDs.length;
|
||||
buf.writeUInt8(this.OwnerIDs.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
this.OwnerIDs[i]['OwnerID'].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;
|
||||
let count = buf.readUInt8(pos++);
|
||||
this.TaskIDs = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjTaskIDs: {
|
||||
TaskID: UUID
|
||||
} = {
|
||||
TaskID: UUID.zero()
|
||||
};
|
||||
newObjTaskIDs['TaskID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.TaskIDs.push(newObjTaskIDs);
|
||||
}
|
||||
count = buf.readUInt8(pos++);
|
||||
this.OwnerIDs = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjOwnerIDs: {
|
||||
OwnerID: UUID
|
||||
} = {
|
||||
OwnerID: UUID.zero()
|
||||
};
|
||||
newObjOwnerIDs['OwnerID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.OwnerIDs.push(newObjOwnerIDs);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user