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

135 lines
4.9 KiB
TypeScript

// 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 AvatarPropertiesReplyMessage implements MessageBase
{
name = 'AvatarPropertiesReply';
messageFlags = MessageFlags.Trusted | MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
id = Message.AvatarPropertiesReply;
AgentData: {
AgentID: UUID;
AvatarID: UUID;
};
PropertiesData: {
ImageID: UUID;
FLImageID: UUID;
PartnerID: UUID;
AboutText: Buffer;
FLAboutText: Buffer;
BornOn: Buffer;
ProfileURL: Buffer;
CharterMember: Buffer;
Flags: number;
};
getSize(): number
{
return (this.PropertiesData['AboutText'].length + 2 + this.PropertiesData['FLAboutText'].length + 1 + this.PropertiesData['BornOn'].length + 1 + this.PropertiesData['ProfileURL'].length + 1 + this.PropertiesData['CharterMember'].length + 1) + 84;
}
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
this.AgentData['AgentID'].writeToBuffer(buf, pos);
pos += 16;
this.AgentData['AvatarID'].writeToBuffer(buf, pos);
pos += 16;
this.PropertiesData['ImageID'].writeToBuffer(buf, pos);
pos += 16;
this.PropertiesData['FLImageID'].writeToBuffer(buf, pos);
pos += 16;
this.PropertiesData['PartnerID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt16LE(this.PropertiesData['AboutText'].length, pos);
pos += 2;
this.PropertiesData['AboutText'].copy(buf, pos);
pos += this.PropertiesData['AboutText'].length;
buf.writeUInt8(this.PropertiesData['FLAboutText'].length, pos++);
this.PropertiesData['FLAboutText'].copy(buf, pos);
pos += this.PropertiesData['FLAboutText'].length;
buf.writeUInt8(this.PropertiesData['BornOn'].length, pos++);
this.PropertiesData['BornOn'].copy(buf, pos);
pos += this.PropertiesData['BornOn'].length;
buf.writeUInt8(this.PropertiesData['ProfileURL'].length, pos++);
this.PropertiesData['ProfileURL'].copy(buf, pos);
pos += this.PropertiesData['ProfileURL'].length;
buf.writeUInt8(this.PropertiesData['CharterMember'].length, pos++);
this.PropertiesData['CharterMember'].copy(buf, pos);
pos += this.PropertiesData['CharterMember'].length;
buf.writeUInt32LE(this.PropertiesData['Flags'], pos);
pos += 4;
return pos - startPos;
}
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
let varLength = 0;
const newObjAgentData: {
AgentID: UUID,
AvatarID: UUID
} = {
AgentID: UUID.zero(),
AvatarID: UUID.zero()
};
newObjAgentData['AgentID'] = new UUID(buf, pos);
pos += 16;
newObjAgentData['AvatarID'] = new UUID(buf, pos);
pos += 16;
this.AgentData = newObjAgentData;
const newObjPropertiesData: {
ImageID: UUID,
FLImageID: UUID,
PartnerID: UUID,
AboutText: Buffer,
FLAboutText: Buffer,
BornOn: Buffer,
ProfileURL: Buffer,
CharterMember: Buffer,
Flags: number
} = {
ImageID: UUID.zero(),
FLImageID: UUID.zero(),
PartnerID: UUID.zero(),
AboutText: Buffer.allocUnsafe(0),
FLAboutText: Buffer.allocUnsafe(0),
BornOn: Buffer.allocUnsafe(0),
ProfileURL: Buffer.allocUnsafe(0),
CharterMember: Buffer.allocUnsafe(0),
Flags: 0
};
newObjPropertiesData['ImageID'] = new UUID(buf, pos);
pos += 16;
newObjPropertiesData['FLImageID'] = new UUID(buf, pos);
pos += 16;
newObjPropertiesData['PartnerID'] = new UUID(buf, pos);
pos += 16;
varLength = buf.readUInt16LE(pos);
pos += 2;
newObjPropertiesData['AboutText'] = buf.slice(pos, pos + varLength);
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjPropertiesData['FLAboutText'] = buf.slice(pos, pos + varLength);
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjPropertiesData['BornOn'] = buf.slice(pos, pos + varLength);
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjPropertiesData['ProfileURL'] = buf.slice(pos, pos + varLength);
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjPropertiesData['CharterMember'] = buf.slice(pos, pos + varLength);
pos += varLength;
newObjPropertiesData['Flags'] = buf.readUInt32LE(pos);
pos += 4;
this.PropertiesData = newObjPropertiesData;
return pos - startPos;
}
}