119 lines
3.6 KiB
TypeScript
119 lines
3.6 KiB
TypeScript
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
import {UUID} from '../UUID';
|
|
import {MessageFlags} from '../../enums/MessageFlags';
|
|
import {MessageBase} from '../MessageBase';
|
|
import {Message} from '../../enums/Message';
|
|
|
|
export class DeRezObjectMessage implements MessageBase
|
|
{
|
|
name = 'DeRezObject';
|
|
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
|
id = Message.DeRezObject;
|
|
|
|
AgentData: {
|
|
AgentID: UUID;
|
|
SessionID: UUID;
|
|
};
|
|
AgentBlock: {
|
|
GroupID: UUID;
|
|
Destination: number;
|
|
DestinationID: UUID;
|
|
TransactionID: UUID;
|
|
PacketCount: number;
|
|
PacketNumber: number;
|
|
};
|
|
ObjectData: {
|
|
ObjectLocalID: number;
|
|
}[];
|
|
|
|
getSize(): number
|
|
{
|
|
return ((4) * this.ObjectData.length) + 84;
|
|
}
|
|
|
|
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.AgentBlock['GroupID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt8(this.AgentBlock['Destination'], pos++);
|
|
this.AgentBlock['DestinationID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentBlock['TransactionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt8(this.AgentBlock['PacketCount'], pos++);
|
|
buf.writeUInt8(this.AgentBlock['PacketNumber'], pos++);
|
|
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;
|
|
let varLength = 0;
|
|
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 newObjAgentBlock: {
|
|
GroupID: UUID,
|
|
Destination: number,
|
|
DestinationID: UUID,
|
|
TransactionID: UUID,
|
|
PacketCount: number,
|
|
PacketNumber: number
|
|
} = {
|
|
GroupID: UUID.zero(),
|
|
Destination: 0,
|
|
DestinationID: UUID.zero(),
|
|
TransactionID: UUID.zero(),
|
|
PacketCount: 0,
|
|
PacketNumber: 0
|
|
};
|
|
newObjAgentBlock['GroupID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentBlock['Destination'] = buf.readUInt8(pos++);
|
|
newObjAgentBlock['DestinationID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentBlock['TransactionID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentBlock['PacketCount'] = buf.readUInt8(pos++);
|
|
newObjAgentBlock['PacketNumber'] = buf.readUInt8(pos++);
|
|
this.AgentBlock = newObjAgentBlock;
|
|
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;
|
|
}
|
|
}
|
|
|