Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -33,4 +33,98 @@ export class ObjectDuplicateOnRayPacket implements Packet
|
||||
return ((4) * this.ObjectData.length) + 97;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData['GroupID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData['RayStart'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.AgentData['RayEnd'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
buf.writeUInt8((this.AgentData['BypassRaycast']) ? 1 : 0, pos++);
|
||||
buf.writeUInt8((this.AgentData['RayEndIsIntersection']) ? 1 : 0, pos++);
|
||||
buf.writeUInt8((this.AgentData['CopyCenters']) ? 1 : 0, pos++);
|
||||
buf.writeUInt8((this.AgentData['CopyRotates']) ? 1 : 0, pos++);
|
||||
this.AgentData['RayTargetID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt32LE(this.AgentData['DuplicateFlags'], pos);
|
||||
pos += 4;
|
||||
const count = this.ObjectData.length;
|
||||
buf.writeUInt8(this.ObjectData.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
buf.writeUInt32LE(this.ObjectData[i]['ObjectLocalID'], pos);
|
||||
pos += 4;
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID,
|
||||
GroupID: UUID,
|
||||
RayStart: Vector3,
|
||||
RayEnd: Vector3,
|
||||
BypassRaycast: boolean,
|
||||
RayEndIsIntersection: boolean,
|
||||
CopyCenters: boolean,
|
||||
CopyRotates: boolean,
|
||||
RayTargetID: UUID,
|
||||
DuplicateFlags: number
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero(),
|
||||
GroupID: UUID.zero(),
|
||||
RayStart: Vector3.getZero(),
|
||||
RayEnd: Vector3.getZero(),
|
||||
BypassRaycast: false,
|
||||
RayEndIsIntersection: false,
|
||||
CopyCenters: false,
|
||||
CopyRotates: false,
|
||||
RayTargetID: UUID.zero(),
|
||||
DuplicateFlags: 0
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['GroupID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['RayStart'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjAgentData['RayEnd'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjAgentData['BypassRaycast'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjAgentData['RayEndIsIntersection'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjAgentData['CopyCenters'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjAgentData['CopyRotates'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjAgentData['RayTargetID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['DuplicateFlags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.AgentData = newObjAgentData;
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.ObjectData = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjObjectData: {
|
||||
ObjectLocalID: number
|
||||
} = {
|
||||
ObjectLocalID: 0
|
||||
};
|
||||
newObjObjectData['ObjectLocalID'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.ObjectData.push(newObjObjectData);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user