Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -22,4 +22,40 @@ export class SimulatorSetMapPacket implements Packet
|
||||
return 28;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
buf.writeInt32LE(this.MapData['RegionHandle'].low, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.MapData['RegionHandle'].high, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.MapData['Type'], pos);
|
||||
pos += 4;
|
||||
this.MapData['MapImage'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjMapData: {
|
||||
RegionHandle: Long,
|
||||
Type: number,
|
||||
MapImage: UUID
|
||||
} = {
|
||||
RegionHandle: Long.ZERO,
|
||||
Type: 0,
|
||||
MapImage: UUID.zero()
|
||||
};
|
||||
newObjMapData['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
|
||||
pos += 8;
|
||||
newObjMapData['Type'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjMapData['MapImage'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.MapData = newObjMapData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user