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

@@ -24,4 +24,46 @@ export class DataHomeLocationReplyPacket implements Packet
return 48;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
this.Info['AgentID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeInt32LE(this.Info['RegionHandle'].low, pos);
pos += 4;
buf.writeInt32LE(this.Info['RegionHandle'].high, pos);
pos += 4;
this.Info['Position'].writeToBuffer(buf, pos, false);
pos += 12;
this.Info['LookAt'].writeToBuffer(buf, pos, false);
pos += 12;
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjInfo: {
AgentID: UUID,
RegionHandle: Long,
Position: Vector3,
LookAt: Vector3
} = {
AgentID: UUID.zero(),
RegionHandle: Long.ZERO,
Position: Vector3.getZero(),
LookAt: Vector3.getZero()
};
newObjInfo['AgentID'] = new UUID(buf, pos);
pos += 16;
newObjInfo['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
pos += 8;
newObjInfo['Position'] = new Vector3(buf, pos, false);
pos += 12;
newObjInfo['LookAt'] = new Vector3(buf, pos, false);
pos += 12;
this.Info = newObjInfo;
return pos - startPos;
}
}