Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -31,4 +31,88 @@ export class RezSingleAttachmentFromInvPacket implements Packet
|
||||
return (this.ObjectData['Name'].length + 1 + this.ObjectData['Description'].length + 1) + 81;
|
||||
}
|
||||
|
||||
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.ObjectData['ItemID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.ObjectData['OwnerID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8(this.ObjectData['AttachmentPt'], pos++);
|
||||
buf.writeUInt32LE(this.ObjectData['ItemFlags'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.ObjectData['GroupMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.ObjectData['EveryoneMask'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt32LE(this.ObjectData['NextOwnerMask'], pos);
|
||||
pos += 4;
|
||||
buf.write(this.ObjectData['Name'], pos);
|
||||
pos += this.ObjectData['Name'].length;
|
||||
buf.write(this.ObjectData['Description'], pos);
|
||||
pos += this.ObjectData['Description'].length;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero()
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData = newObjAgentData;
|
||||
const newObjObjectData: {
|
||||
ItemID: UUID,
|
||||
OwnerID: UUID,
|
||||
AttachmentPt: number,
|
||||
ItemFlags: number,
|
||||
GroupMask: number,
|
||||
EveryoneMask: number,
|
||||
NextOwnerMask: number,
|
||||
Name: string,
|
||||
Description: string
|
||||
} = {
|
||||
ItemID: UUID.zero(),
|
||||
OwnerID: UUID.zero(),
|
||||
AttachmentPt: 0,
|
||||
ItemFlags: 0,
|
||||
GroupMask: 0,
|
||||
EveryoneMask: 0,
|
||||
NextOwnerMask: 0,
|
||||
Name: '',
|
||||
Description: ''
|
||||
};
|
||||
newObjObjectData['ItemID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjObjectData['OwnerID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjObjectData['AttachmentPt'] = buf.readUInt8(pos++);
|
||||
newObjObjectData['ItemFlags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjObjectData['GroupMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjObjectData['EveryoneMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjObjectData['NextOwnerMask'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjObjectData['Name'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjObjectData['Description'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
this.ObjectData = newObjObjectData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user