Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -29,4 +29,62 @@ export class AvatarSitResponsePacket implements Packet
|
||||
return 66;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.SitObject['ID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8((this.SitTransform['AutoPilot']) ? 1 : 0, pos++);
|
||||
this.SitTransform['SitPosition'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.SitTransform['SitRotation'].writeToBuffer(buf, pos);
|
||||
pos += 12;
|
||||
this.SitTransform['CameraEyeOffset'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.SitTransform['CameraAtOffset'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
buf.writeUInt8((this.SitTransform['ForceMouselook']) ? 1 : 0, pos++);
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjSitObject: {
|
||||
ID: UUID
|
||||
} = {
|
||||
ID: UUID.zero()
|
||||
};
|
||||
newObjSitObject['ID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.SitObject = newObjSitObject;
|
||||
const newObjSitTransform: {
|
||||
AutoPilot: boolean,
|
||||
SitPosition: Vector3,
|
||||
SitRotation: Quaternion,
|
||||
CameraEyeOffset: Vector3,
|
||||
CameraAtOffset: Vector3,
|
||||
ForceMouselook: boolean
|
||||
} = {
|
||||
AutoPilot: false,
|
||||
SitPosition: Vector3.getZero(),
|
||||
SitRotation: Quaternion.getIdentity(),
|
||||
CameraEyeOffset: Vector3.getZero(),
|
||||
CameraAtOffset: Vector3.getZero(),
|
||||
ForceMouselook: false
|
||||
};
|
||||
newObjSitTransform['AutoPilot'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjSitTransform['SitPosition'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjSitTransform['SitRotation'] = new Quaternion(buf, pos);
|
||||
pos += 12;
|
||||
newObjSitTransform['CameraEyeOffset'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjSitTransform['CameraAtOffset'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjSitTransform['ForceMouselook'] = (buf.readUInt8(pos++) === 1);
|
||||
this.SitTransform = newObjSitTransform;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user