Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -19,4 +19,38 @@ export class RegionPresenceRequestByHandlePacket implements Packet
|
||||
return ((8) * this.RegionData.length) + 1;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const count = this.RegionData.length;
|
||||
buf.writeUInt8(this.RegionData.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
buf.writeInt32LE(this.RegionData[i]['RegionHandle'].low, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.RegionData[i]['RegionHandle'].high, pos);
|
||||
pos += 4;
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.RegionData = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjRegionData: {
|
||||
RegionHandle: Long
|
||||
} = {
|
||||
RegionHandle: Long.ZERO
|
||||
};
|
||||
newObjRegionData['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
|
||||
pos += 8;
|
||||
this.RegionData.push(newObjRegionData);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user