Latest packet handling, parsing, enums, generators, etc..

This commit is contained in:
Casper Warden
2017-11-24 17:45:34 +00:00
parent ec300e33ac
commit 261f28698a
496 changed files with 30448 additions and 57 deletions

View File

@@ -22,4 +22,42 @@ export class UpdateSimulatorPacket implements Packet
return (this.SimulatorInfo['SimName'].length + 1) + 21;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
this.SimulatorInfo['RegionID'].writeToBuffer(buf, pos);
pos += 16;
buf.write(this.SimulatorInfo['SimName'], pos);
pos += this.SimulatorInfo['SimName'].length;
buf.writeUInt32LE(this.SimulatorInfo['EstateID'], pos);
pos += 4;
buf.writeUInt8(this.SimulatorInfo['SimAccess'], pos++);
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjSimulatorInfo: {
RegionID: UUID,
SimName: string,
EstateID: number,
SimAccess: number
} = {
RegionID: UUID.zero(),
SimName: '',
EstateID: 0,
SimAccess: 0
};
newObjSimulatorInfo['RegionID'] = new UUID(buf, pos);
pos += 16;
newObjSimulatorInfo['SimName'] = buf.toString('utf8', pos, length);
pos += length;
newObjSimulatorInfo['EstateID'] = buf.readUInt32LE(pos);
pos += 4;
newObjSimulatorInfo['SimAccess'] = buf.readUInt8(pos++);
this.SimulatorInfo = newObjSimulatorInfo;
return pos - startPos;
}
}