Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -59,4 +59,228 @@ export class RezObjectPacket implements Packet
|
||||
return (this.InventoryData['Name'].length + 1 + this.InventoryData['Description'].length + 1) + 260;
|
||||
}
|
||||
|
||||
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.RezData['FromTaskID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8(this.RezData['BypassRaycast'], pos++);
|
||||
this.RezData['RayStart'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.RezData['RayEnd'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
this.RezData['RayTargetID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8((this.RezData['RayEndIsIntersection']) ? 1 : 0, pos++);
|
||||
buf.writeUInt8((this.RezData['RezSelected']) ? 1 : 0, pos++);
|
||||
buf.writeUInt8((this.RezData['RemoveItem']) ? 1 : 0, pos++);
|
||||
buf.writeUInt32LE(this.RezData['ItemFlags'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.RezData['GroupMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.RezData['EveryoneMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.RezData['NextOwnerMask'], pos);
|
||||
pos += 4;
|
||||
this.InventoryData['ItemID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.InventoryData['FolderID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.InventoryData['CreatorID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.InventoryData['OwnerID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.InventoryData['GroupID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt32LE(this.InventoryData['BaseMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.InventoryData['OwnerMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.InventoryData['GroupMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.InventoryData['EveryoneMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.InventoryData['NextOwnerMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt8((this.InventoryData['GroupOwned']) ? 1 : 0, pos++);
|
||||
this.InventoryData['TransactionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeInt8(this.InventoryData['Type'], pos++);
|
||||
buf.writeInt8(this.InventoryData['InvType'], pos++);
|
||||
buf.writeUInt32LE(this.InventoryData['Flags'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt8(this.InventoryData['SaleType'], pos++);
|
||||
buf.writeInt32LE(this.InventoryData['SalePrice'], pos);
|
||||
pos += 4;
|
||||
buf.write(this.InventoryData['Name'], pos);
|
||||
pos += this.InventoryData['Name'].length;
|
||||
buf.write(this.InventoryData['Description'], pos);
|
||||
pos += this.InventoryData['Description'].length;
|
||||
buf.writeInt32LE(this.InventoryData['CreationDate'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.InventoryData['CRC'], pos);
|
||||
pos += 4;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID,
|
||||
GroupID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero(),
|
||||
GroupID: UUID.zero()
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['GroupID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData = newObjAgentData;
|
||||
const newObjRezData: {
|
||||
FromTaskID: UUID,
|
||||
BypassRaycast: number,
|
||||
RayStart: Vector3,
|
||||
RayEnd: Vector3,
|
||||
RayTargetID: UUID,
|
||||
RayEndIsIntersection: boolean,
|
||||
RezSelected: boolean,
|
||||
RemoveItem: boolean,
|
||||
ItemFlags: number,
|
||||
GroupMask: number,
|
||||
EveryoneMask: number,
|
||||
NextOwnerMask: number
|
||||
} = {
|
||||
FromTaskID: UUID.zero(),
|
||||
BypassRaycast: 0,
|
||||
RayStart: Vector3.getZero(),
|
||||
RayEnd: Vector3.getZero(),
|
||||
RayTargetID: UUID.zero(),
|
||||
RayEndIsIntersection: false,
|
||||
RezSelected: false,
|
||||
RemoveItem: false,
|
||||
ItemFlags: 0,
|
||||
GroupMask: 0,
|
||||
EveryoneMask: 0,
|
||||
NextOwnerMask: 0
|
||||
};
|
||||
newObjRezData['FromTaskID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjRezData['BypassRaycast'] = buf.readUInt8(pos++);
|
||||
newObjRezData['RayStart'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjRezData['RayEnd'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjRezData['RayTargetID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjRezData['RayEndIsIntersection'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjRezData['RezSelected'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjRezData['RemoveItem'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjRezData['ItemFlags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjRezData['GroupMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjRezData['EveryoneMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjRezData['NextOwnerMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.RezData = newObjRezData;
|
||||
const newObjInventoryData: {
|
||||
ItemID: UUID,
|
||||
FolderID: UUID,
|
||||
CreatorID: UUID,
|
||||
OwnerID: UUID,
|
||||
GroupID: UUID,
|
||||
BaseMask: number,
|
||||
OwnerMask: number,
|
||||
GroupMask: number,
|
||||
EveryoneMask: number,
|
||||
NextOwnerMask: number,
|
||||
GroupOwned: boolean,
|
||||
TransactionID: UUID,
|
||||
Type: number,
|
||||
InvType: number,
|
||||
Flags: number,
|
||||
SaleType: number,
|
||||
SalePrice: number,
|
||||
Name: string,
|
||||
Description: string,
|
||||
CreationDate: number,
|
||||
CRC: number
|
||||
} = {
|
||||
ItemID: UUID.zero(),
|
||||
FolderID: UUID.zero(),
|
||||
CreatorID: UUID.zero(),
|
||||
OwnerID: UUID.zero(),
|
||||
GroupID: UUID.zero(),
|
||||
BaseMask: 0,
|
||||
OwnerMask: 0,
|
||||
GroupMask: 0,
|
||||
EveryoneMask: 0,
|
||||
NextOwnerMask: 0,
|
||||
GroupOwned: false,
|
||||
TransactionID: UUID.zero(),
|
||||
Type: 0,
|
||||
InvType: 0,
|
||||
Flags: 0,
|
||||
SaleType: 0,
|
||||
SalePrice: 0,
|
||||
Name: '',
|
||||
Description: '',
|
||||
CreationDate: 0,
|
||||
CRC: 0
|
||||
};
|
||||
newObjInventoryData['ItemID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['FolderID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['CreatorID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['OwnerID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['GroupID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['BaseMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['OwnerMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['GroupMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['EveryoneMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['NextOwnerMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['GroupOwned'] = (buf.readUInt8(pos++) === 1);
|
||||
newObjInventoryData['TransactionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjInventoryData['Type'] = buf.readInt8(pos++);
|
||||
newObjInventoryData['InvType'] = buf.readInt8(pos++);
|
||||
newObjInventoryData['Flags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['SaleType'] = buf.readUInt8(pos++);
|
||||
newObjInventoryData['SalePrice'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['Name'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjInventoryData['Description'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjInventoryData['CreationDate'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjInventoryData['CRC'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.InventoryData = newObjInventoryData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user