// This file has been automatically generated by writeMessageClasses.js import {UUID} from '../UUID'; import {Vector3} from '../Vector3'; import {MessageFlags} from '../../enums/MessageFlags'; import {MessageBase} from '../MessageBase'; import {Message} from '../../enums/Message'; export class EventInfoReplyMessage implements MessageBase { name = 'EventInfoReply'; messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyLow; id = Message.EventInfoReply; AgentData: { AgentID: UUID; }; EventData: { EventID: number; Creator: Buffer; Name: Buffer; Category: Buffer; Desc: Buffer; Date: Buffer; DateUTC: number; Duration: number; Cover: number; Amount: number; SimName: Buffer; GlobalPos: Vector3; EventFlags: number; }; getSize(): number { return (this.EventData['Creator'].length + 1 + this.EventData['Name'].length + 1 + this.EventData['Category'].length + 1 + this.EventData['Desc'].length + 2 + this.EventData['Date'].length + 1 + this.EventData['SimName'].length + 1) + 64; } writeToBuffer(buf: Buffer, pos: number): number { const startPos = pos; this.AgentData['AgentID'].writeToBuffer(buf, pos); pos += 16; buf.writeUInt32LE(this.EventData['EventID'], pos); pos += 4; buf.writeUInt8(this.EventData['Creator'].length, pos++); this.EventData['Creator'].copy(buf, pos); pos += this.EventData['Creator'].length; buf.writeUInt8(this.EventData['Name'].length, pos++); this.EventData['Name'].copy(buf, pos); pos += this.EventData['Name'].length; buf.writeUInt8(this.EventData['Category'].length, pos++); this.EventData['Category'].copy(buf, pos); pos += this.EventData['Category'].length; buf.writeUInt16LE(this.EventData['Desc'].length, pos); pos += 2; this.EventData['Desc'].copy(buf, pos); pos += this.EventData['Desc'].length; buf.writeUInt8(this.EventData['Date'].length, pos++); this.EventData['Date'].copy(buf, pos); pos += this.EventData['Date'].length; buf.writeUInt32LE(this.EventData['DateUTC'], pos); pos += 4; buf.writeUInt32LE(this.EventData['Duration'], pos); pos += 4; buf.writeUInt32LE(this.EventData['Cover'], pos); pos += 4; buf.writeUInt32LE(this.EventData['Amount'], pos); pos += 4; buf.writeUInt8(this.EventData['SimName'].length, pos++); this.EventData['SimName'].copy(buf, pos); pos += this.EventData['SimName'].length; this.EventData['GlobalPos'].writeToBuffer(buf, pos, true); pos += 24; buf.writeUInt32LE(this.EventData['EventFlags'], pos); pos += 4; return pos - startPos; } readFromBuffer(buf: Buffer, pos: number): number { const startPos = pos; let varLength = 0; const newObjAgentData: { AgentID: UUID } = { AgentID: UUID.zero() }; newObjAgentData['AgentID'] = new UUID(buf, pos); pos += 16; this.AgentData = newObjAgentData; const newObjEventData: { EventID: number, Creator: Buffer, Name: Buffer, Category: Buffer, Desc: Buffer, Date: Buffer, DateUTC: number, Duration: number, Cover: number, Amount: number, SimName: Buffer, GlobalPos: Vector3, EventFlags: number } = { EventID: 0, Creator: Buffer.allocUnsafe(0), Name: Buffer.allocUnsafe(0), Category: Buffer.allocUnsafe(0), Desc: Buffer.allocUnsafe(0), Date: Buffer.allocUnsafe(0), DateUTC: 0, Duration: 0, Cover: 0, Amount: 0, SimName: Buffer.allocUnsafe(0), GlobalPos: Vector3.getZero(), EventFlags: 0 }; newObjEventData['EventID'] = buf.readUInt32LE(pos); pos += 4; varLength = buf.readUInt8(pos++); newObjEventData['Creator'] = buf.slice(pos, pos + varLength); pos += varLength; varLength = buf.readUInt8(pos++); newObjEventData['Name'] = buf.slice(pos, pos + varLength); pos += varLength; varLength = buf.readUInt8(pos++); newObjEventData['Category'] = buf.slice(pos, pos + varLength); pos += varLength; varLength = buf.readUInt16LE(pos); pos += 2; newObjEventData['Desc'] = buf.slice(pos, pos + varLength); pos += varLength; varLength = buf.readUInt8(pos++); newObjEventData['Date'] = buf.slice(pos, pos + varLength); pos += varLength; newObjEventData['DateUTC'] = buf.readUInt32LE(pos); pos += 4; newObjEventData['Duration'] = buf.readUInt32LE(pos); pos += 4; newObjEventData['Cover'] = buf.readUInt32LE(pos); pos += 4; newObjEventData['Amount'] = buf.readUInt32LE(pos); pos += 4; varLength = buf.readUInt8(pos++); newObjEventData['SimName'] = buf.slice(pos, pos + varLength); pos += varLength; newObjEventData['GlobalPos'] = new Vector3(buf, pos, true); pos += 24; newObjEventData['EventFlags'] = buf.readUInt32LE(pos); pos += 4; this.EventData = newObjEventData; return pos - startPos; } }