Files
node-metaverse/lib/classes/packets/LogDwellTime.ts

90 lines
2.7 KiB
TypeScript

// This file has been automatically generated by writePacketClasses.js
import {UUID} from '../UUID';
import {MessageFlags} from '../../enums/MessageFlags';
import {Packet} from '../Packet';
export class LogDwellTimePacket implements Packet
{
name = 'LogDwellTime';
flags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
id = 4294901778;
DwellInfo: {
AgentID: UUID;
SessionID: UUID;
Duration: number;
SimName: string;
RegionX: number;
RegionY: number;
AvgAgentsInView: number;
AvgViewerFPS: number;
};
getSize(): number
{
return (this.DwellInfo['SimName'].length + 1) + 46;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
this.DwellInfo['AgentID'].writeToBuffer(buf, pos);
pos += 16;
this.DwellInfo['SessionID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeFloatLE(this.DwellInfo['Duration'], pos);
pos += 4;
buf.write(this.DwellInfo['SimName'], pos);
pos += this.DwellInfo['SimName'].length;
buf.writeUInt32LE(this.DwellInfo['RegionX'], pos);
pos += 4;
buf.writeUInt32LE(this.DwellInfo['RegionY'], pos);
pos += 4;
buf.writeUInt8(this.DwellInfo['AvgAgentsInView'], pos++);
buf.writeUInt8(this.DwellInfo['AvgViewerFPS'], pos++);
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
const newObjDwellInfo: {
AgentID: UUID,
SessionID: UUID,
Duration: number,
SimName: string,
RegionX: number,
RegionY: number,
AvgAgentsInView: number,
AvgViewerFPS: number
} = {
AgentID: UUID.zero(),
SessionID: UUID.zero(),
Duration: 0,
SimName: '',
RegionX: 0,
RegionY: 0,
AvgAgentsInView: 0,
AvgViewerFPS: 0
};
newObjDwellInfo['AgentID'] = new UUID(buf, pos);
pos += 16;
newObjDwellInfo['SessionID'] = new UUID(buf, pos);
pos += 16;
newObjDwellInfo['Duration'] = buf.readFloatLE(pos);
pos += 4;
newObjDwellInfo['SimName'] = buf.toString('utf8', pos, length);
pos += length;
newObjDwellInfo['RegionX'] = buf.readUInt32LE(pos);
pos += 4;
newObjDwellInfo['RegionY'] = buf.readUInt32LE(pos);
pos += 4;
newObjDwellInfo['AvgAgentsInView'] = buf.readUInt8(pos++);
newObjDwellInfo['AvgViewerFPS'] = buf.readUInt8(pos++);
this.DwellInfo = newObjDwellInfo;
return pos - startPos;
}
}