// 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 ParcelClaimMessage implements MessageBase { name = 'ParcelClaim'; messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow; id = Message.ParcelClaim; AgentData: { AgentID: UUID; SessionID: UUID; }; Data: { GroupID: UUID; IsGroupOwned: boolean; Final: boolean; }; ParcelData: { West: number; South: number; East: number; North: number; }[]; getSize(): number { return ((16) * this.ParcelData.length) + 51; } 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.Data['GroupID'].writeToBuffer(buf, pos); pos += 16; buf.writeUInt8((this.Data['IsGroupOwned']) ? 1 : 0, pos++); buf.writeUInt8((this.Data['Final']) ? 1 : 0, pos++); const count = this.ParcelData.length; buf.writeUInt8(this.ParcelData.length, pos++); for (let i = 0; i < count; i++) { buf.writeFloatLE(this.ParcelData[i]['West'], pos); pos += 4; buf.writeFloatLE(this.ParcelData[i]['South'], pos); pos += 4; buf.writeFloatLE(this.ParcelData[i]['East'], pos); pos += 4; buf.writeFloatLE(this.ParcelData[i]['North'], 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 newObjData: { GroupID: UUID, IsGroupOwned: boolean, Final: boolean } = { GroupID: UUID.zero(), IsGroupOwned: false, Final: false }; newObjData['GroupID'] = new UUID(buf, pos); pos += 16; newObjData['IsGroupOwned'] = (buf.readUInt8(pos++) === 1); newObjData['Final'] = (buf.readUInt8(pos++) === 1); this.Data = newObjData; if (pos >= buf.length) { return pos - startPos; } const count = buf.readUInt8(pos++); this.ParcelData = []; for (let i = 0; i < count; i++) { const newObjParcelData: { West: number, South: number, East: number, North: number } = { West: 0, South: 0, East: 0, North: 0 }; newObjParcelData['West'] = buf.readFloatLE(pos); pos += 4; newObjParcelData['South'] = buf.readFloatLE(pos); pos += 4; newObjParcelData['East'] = buf.readFloatLE(pos); pos += 4; newObjParcelData['North'] = buf.readFloatLE(pos); pos += 4; this.ParcelData.push(newObjParcelData); } return pos - startPos; } }