Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -27,4 +27,76 @@ export class ParcelAccessListReplyPacket implements Packet
|
||||
return ((24) * this.List.length) + 29;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.Data['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeInt32LE(this.Data['SequenceID'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.Data['Flags'], pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.Data['LocalID'], pos);
|
||||
pos += 4;
|
||||
const count = this.List.length;
|
||||
buf.writeUInt8(this.List.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
this.List[i]['ID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeInt32LE(this.List[i]['Time'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.List[i]['Flags'], pos);
|
||||
pos += 4;
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjData: {
|
||||
AgentID: UUID,
|
||||
SequenceID: number,
|
||||
Flags: number,
|
||||
LocalID: number
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SequenceID: 0,
|
||||
Flags: 0,
|
||||
LocalID: 0
|
||||
};
|
||||
newObjData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjData['SequenceID'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjData['Flags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjData['LocalID'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
this.Data = newObjData;
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.List = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjList: {
|
||||
ID: UUID,
|
||||
Time: number,
|
||||
Flags: number
|
||||
} = {
|
||||
ID: UUID.zero(),
|
||||
Time: 0,
|
||||
Flags: 0
|
||||
};
|
||||
newObjList['ID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjList['Time'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjList['Flags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.List.push(newObjList);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user