// This file has been automatically generated by writePacketClasses.js import {UUID} from '../UUID'; import {MessageFlags} from '../../enums/MessageFlags'; import {Packet} from '../Packet'; export class PlacesReplyPacket implements Packet { name = 'PlacesReply'; flags = MessageFlags.Trusted | MessageFlags.Zerocoded | MessageFlags.Deprecated | MessageFlags.FrequencyLow; id = 4294901790; AgentData: { AgentID: UUID; QueryID: UUID; }; TransactionData: { TransactionID: UUID; }; QueryData: { OwnerID: UUID; Name: string; Desc: string; ActualArea: number; BillableArea: number; Flags: number; GlobalX: number; GlobalY: number; GlobalZ: number; SimName: string; SnapshotID: UUID; Dwell: number; Price: number; }[]; getSize(): number { return ((this.calculateVarVarSize(this.QueryData, 'Name', 1) + this.calculateVarVarSize(this.QueryData, 'Desc', 1) + this.calculateVarVarSize(this.QueryData, 'SimName', 1) + 61) * this.QueryData.length) + 49; } calculateVarVarSize(block: object[], paramName: string, extraPerVar: number): number { let size = 0; block.forEach((bl: any) => { size += bl[paramName].length + extraPerVar; }); return size; } writeToBuffer(buf: Buffer, pos: number): number { const startPos = pos; this.AgentData['AgentID'].writeToBuffer(buf, pos); pos += 16; this.AgentData['QueryID'].writeToBuffer(buf, pos); pos += 16; this.TransactionData['TransactionID'].writeToBuffer(buf, pos); pos += 16; const count = this.QueryData.length; buf.writeUInt8(this.QueryData.length, pos++); for (let i = 0; i < count; i++) { this.QueryData[i]['OwnerID'].writeToBuffer(buf, pos); pos += 16; buf.write(this.QueryData[i]['Name'], pos); pos += this.QueryData[i]['Name'].length; buf.write(this.QueryData[i]['Desc'], pos); pos += this.QueryData[i]['Desc'].length; buf.writeInt32LE(this.QueryData[i]['ActualArea'], pos); pos += 4; buf.writeInt32LE(this.QueryData[i]['BillableArea'], pos); pos += 4; buf.writeUInt8(this.QueryData[i]['Flags'], pos++); buf.writeFloatLE(this.QueryData[i]['GlobalX'], pos); pos += 4; buf.writeFloatLE(this.QueryData[i]['GlobalY'], pos); pos += 4; buf.writeFloatLE(this.QueryData[i]['GlobalZ'], pos); pos += 4; buf.write(this.QueryData[i]['SimName'], pos); pos += this.QueryData[i]['SimName'].length; this.QueryData[i]['SnapshotID'].writeToBuffer(buf, pos); pos += 16; buf.writeFloatLE(this.QueryData[i]['Dwell'], pos); pos += 4; buf.writeInt32LE(this.QueryData[i]['Price'], pos); pos += 4; } return pos - startPos; } readFromBuffer(buf: Buffer, pos: number): number { const startPos = pos; const newObjAgentData: { AgentID: UUID, QueryID: UUID } = { AgentID: UUID.zero(), QueryID: UUID.zero() }; newObjAgentData['AgentID'] = new UUID(buf, pos); pos += 16; newObjAgentData['QueryID'] = new UUID(buf, pos); pos += 16; this.AgentData = newObjAgentData; const newObjTransactionData: { TransactionID: UUID } = { TransactionID: UUID.zero() }; newObjTransactionData['TransactionID'] = new UUID(buf, pos); pos += 16; this.TransactionData = newObjTransactionData; const count = buf.readUInt8(pos++); this.QueryData = []; for (let i = 0; i < count; i++) { const newObjQueryData: { OwnerID: UUID, Name: string, Desc: string, ActualArea: number, BillableArea: number, Flags: number, GlobalX: number, GlobalY: number, GlobalZ: number, SimName: string, SnapshotID: UUID, Dwell: number, Price: number } = { OwnerID: UUID.zero(), Name: '', Desc: '', ActualArea: 0, BillableArea: 0, Flags: 0, GlobalX: 0, GlobalY: 0, GlobalZ: 0, SimName: '', SnapshotID: UUID.zero(), Dwell: 0, Price: 0 }; newObjQueryData['OwnerID'] = new UUID(buf, pos); pos += 16; newObjQueryData['Name'] = buf.toString('utf8', pos, length); pos += length; newObjQueryData['Desc'] = buf.toString('utf8', pos, length); pos += length; newObjQueryData['ActualArea'] = buf.readInt32LE(pos); pos += 4; newObjQueryData['BillableArea'] = buf.readInt32LE(pos); pos += 4; newObjQueryData['Flags'] = buf.readUInt8(pos++); newObjQueryData['GlobalX'] = buf.readFloatLE(pos); pos += 4; newObjQueryData['GlobalY'] = buf.readFloatLE(pos); pos += 4; newObjQueryData['GlobalZ'] = buf.readFloatLE(pos); pos += 4; newObjQueryData['SimName'] = buf.toString('utf8', pos, length); pos += length; newObjQueryData['SnapshotID'] = new UUID(buf, pos); pos += 16; newObjQueryData['Dwell'] = buf.readFloatLE(pos); pos += 4; newObjQueryData['Price'] = buf.readInt32LE(pos); pos += 4; this.QueryData.push(newObjQueryData); } return pos - startPos; } }