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

@@ -23,4 +23,40 @@ export class SimStatusPacket implements Packet
return 10;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
buf.writeUInt8((this.SimStatus['CanAcceptAgents']) ? 1 : 0, pos++);
buf.writeUInt8((this.SimStatus['CanAcceptTasks']) ? 1 : 0, pos++);
buf.writeInt32LE(this.SimFlags['Flags'].low, pos);
pos += 4;
buf.writeInt32LE(this.SimFlags['Flags'].high, pos);
pos += 4;
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjSimStatus: {
CanAcceptAgents: boolean,
CanAcceptTasks: boolean
} = {
CanAcceptAgents: false,
CanAcceptTasks: false
};
newObjSimStatus['CanAcceptAgents'] = (buf.readUInt8(pos++) === 1);
newObjSimStatus['CanAcceptTasks'] = (buf.readUInt8(pos++) === 1);
this.SimStatus = newObjSimStatus;
const newObjSimFlags: {
Flags: Long
} = {
Flags: Long.ZERO
};
newObjSimFlags['Flags'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
pos += 8;
this.SimFlags = newObjSimFlags;
return pos - startPos;
}
}