Files
node-metaverse/lib/classes/messages/UserReport.ts
2017-11-26 01:14:02 +00:00

149 lines
5.3 KiB
TypeScript

// 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 UserReportMessage implements MessageBase
{
name = 'UserReport';
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
id = Message.UserReport;
AgentData: {
AgentID: UUID;
SessionID: UUID;
};
ReportData: {
ReportType: number;
Category: number;
Position: Vector3;
CheckFlags: number;
ScreenshotID: UUID;
ObjectID: UUID;
AbuserID: UUID;
AbuseRegionName: string;
AbuseRegionID: UUID;
Summary: string;
Details: string;
VersionString: string;
};
getSize(): number
{
return (this.ReportData['AbuseRegionName'].length + 1 + this.ReportData['Summary'].length + 1 + this.ReportData['Details'].length + 2 + this.ReportData['VersionString'].length + 1) + 111;
}
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;
buf.writeUInt8(this.ReportData['ReportType'], pos++);
buf.writeUInt8(this.ReportData['Category'], pos++);
this.ReportData['Position'].writeToBuffer(buf, pos, false);
pos += 12;
buf.writeUInt8(this.ReportData['CheckFlags'], pos++);
this.ReportData['ScreenshotID'].writeToBuffer(buf, pos);
pos += 16;
this.ReportData['ObjectID'].writeToBuffer(buf, pos);
pos += 16;
this.ReportData['AbuserID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt8(this.ReportData['AbuseRegionName'].length, pos++);
buf.write(this.ReportData['AbuseRegionName'], pos);
pos += this.ReportData['AbuseRegionName'].length;
this.ReportData['AbuseRegionID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt8(this.ReportData['Summary'].length, pos++);
buf.write(this.ReportData['Summary'], pos);
pos += this.ReportData['Summary'].length;
buf.writeUInt16LE(this.ReportData['Details'].length, pos);
pos += 2;
buf.write(this.ReportData['Details'], pos);
pos += this.ReportData['Details'].length;
buf.writeUInt8(this.ReportData['VersionString'].length, pos++);
buf.write(this.ReportData['VersionString'], pos);
pos += this.ReportData['VersionString'].length;
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 newObjReportData: {
ReportType: number,
Category: number,
Position: Vector3,
CheckFlags: number,
ScreenshotID: UUID,
ObjectID: UUID,
AbuserID: UUID,
AbuseRegionName: string,
AbuseRegionID: UUID,
Summary: string,
Details: string,
VersionString: string
} = {
ReportType: 0,
Category: 0,
Position: Vector3.getZero(),
CheckFlags: 0,
ScreenshotID: UUID.zero(),
ObjectID: UUID.zero(),
AbuserID: UUID.zero(),
AbuseRegionName: '',
AbuseRegionID: UUID.zero(),
Summary: '',
Details: '',
VersionString: ''
};
newObjReportData['ReportType'] = buf.readUInt8(pos++);
newObjReportData['Category'] = buf.readUInt8(pos++);
newObjReportData['Position'] = new Vector3(buf, pos, false);
pos += 12;
newObjReportData['CheckFlags'] = buf.readUInt8(pos++);
newObjReportData['ScreenshotID'] = new UUID(buf, pos);
pos += 16;
newObjReportData['ObjectID'] = new UUID(buf, pos);
pos += 16;
newObjReportData['AbuserID'] = new UUID(buf, pos);
pos += 16;
varLength = buf.readUInt8(pos++);
newObjReportData['AbuseRegionName'] = buf.toString('utf8', pos, pos + (varLength - 1));
pos += varLength;
newObjReportData['AbuseRegionID'] = new UUID(buf, pos);
pos += 16;
varLength = buf.readUInt8(pos++);
newObjReportData['Summary'] = buf.toString('utf8', pos, pos + (varLength - 1));
pos += varLength;
varLength = buf.readUInt16LE(pos);
pos += 2;
newObjReportData['Details'] = buf.toString('utf8', pos, pos + (varLength - 1));
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjReportData['VersionString'] = buf.toString('utf8', pos, pos + (varLength - 1));
pos += varLength;
this.ReportData = newObjReportData;
return pos - startPos;
}
}