Files
node-metaverse/lib/classes/messages/ChildAgentAlive.ts

72 lines
2.1 KiB
TypeScript

// This file has been automatically generated by writeMessageClasses.js
import { UUID } from '../UUID';
import * as Long from 'long';
import { MessageFlags } from '../../enums/MessageFlags';
import { MessageBase } from '../MessageBase';
import { Message } from '../../enums/Message';
export class ChildAgentAliveMessage implements MessageBase
{
name = 'ChildAgentAlive';
messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyHigh;
id = Message.ChildAgentAlive;
AgentData: {
RegionHandle: Long;
ViewerCircuitCode: number;
AgentID: UUID;
SessionID: UUID;
};
getSize(): number
{
return 44;
}
// @ts-ignore
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
buf.writeInt32LE(this.AgentData['RegionHandle'].low, pos);
pos += 4;
buf.writeInt32LE(this.AgentData['RegionHandle'].high, pos);
pos += 4;
buf.writeUInt32LE(this.AgentData['ViewerCircuitCode'], pos);
pos += 4;
this.AgentData['AgentID'].writeToBuffer(buf, pos);
pos += 16;
this.AgentData['SessionID'].writeToBuffer(buf, pos);
pos += 16;
return pos - startPos;
}
// @ts-ignore
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjAgentData: {
RegionHandle: Long,
ViewerCircuitCode: number,
AgentID: UUID,
SessionID: UUID
} = {
RegionHandle: Long.ZERO,
ViewerCircuitCode: 0,
AgentID: UUID.zero(),
SessionID: UUID.zero()
};
newObjAgentData['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos + 4));
pos += 8;
newObjAgentData['ViewerCircuitCode'] = buf.readUInt32LE(pos);
pos += 4;
newObjAgentData['AgentID'] = new UUID(buf, pos);
pos += 16;
newObjAgentData['SessionID'] = new UUID(buf, pos);
pos += 16;
this.AgentData = newObjAgentData;
return pos - startPos;
}
}