Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -26,4 +26,58 @@ export class SetStartLocationPacket implements Packet
|
||||
return 68;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.StartLocationData['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.StartLocationData['RegionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt32LE(this.StartLocationData['LocationID'], pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.StartLocationData['RegionHandle'].low, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.StartLocationData['RegionHandle'].high, pos);
|
||||
pos += 4;
|
||||
this.StartLocationData['LocationPos'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.StartLocationData['LocationLookAt'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjStartLocationData: {
|
||||
AgentID: UUID,
|
||||
RegionID: UUID,
|
||||
LocationID: number,
|
||||
RegionHandle: Long,
|
||||
LocationPos: Vector3,
|
||||
LocationLookAt: Vector3
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
RegionID: UUID.zero(),
|
||||
LocationID: 0,
|
||||
RegionHandle: Long.ZERO,
|
||||
LocationPos: Vector3.getZero(),
|
||||
LocationLookAt: Vector3.getZero()
|
||||
};
|
||||
newObjStartLocationData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjStartLocationData['RegionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjStartLocationData['LocationID'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjStartLocationData['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
|
||||
pos += 8;
|
||||
newObjStartLocationData['LocationPos'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjStartLocationData['LocationLookAt'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
this.StartLocationData = newObjStartLocationData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user