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

185 lines
6.7 KiB
TypeScript
Raw Normal View History

2017-11-26 01:14:02 +00:00
// This file has been automatically generated by writeMessageClasses.js
import { UUID } from '../UUID';
import { Vector3 } from '../Vector3';
import * as Long from 'long';
import { MessageFlags } from '../../enums/MessageFlags';
import { MessageBase } from '../MessageBase';
import { Message } from '../../enums/Message';
2017-11-26 01:14:02 +00:00
export class UpdateParcelMessage implements MessageBase
{
name = 'UpdateParcel';
messageFlags = MessageFlags.Trusted | MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
id = Message.UpdateParcel;
ParcelData: {
ParcelID: UUID;
RegionHandle: Long;
OwnerID: UUID;
GroupOwned: boolean;
Status: number;
Name: Buffer;
Description: Buffer;
MusicURL: Buffer;
2017-11-26 01:14:02 +00:00
RegionX: number;
RegionY: number;
ActualArea: number;
BillableArea: number;
ShowDir: boolean;
IsForSale: boolean;
Category: number;
SnapshotID: UUID;
UserLocation: Vector3;
SalePrice: number;
AuthorizedBuyerID: UUID;
AllowPublish: boolean;
MaturePublish: boolean;
};
getSize(): number
{
return (this.ParcelData['Name'].length + 1 + this.ParcelData['Description'].length + 1 + this.ParcelData['MusicURL'].length + 1) + 111;
}
// @ts-ignore
2017-11-26 01:14:02 +00:00
writeToBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
this.ParcelData['ParcelID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeInt32LE(this.ParcelData['RegionHandle'].low, pos);
pos += 4;
buf.writeInt32LE(this.ParcelData['RegionHandle'].high, pos);
pos += 4;
this.ParcelData['OwnerID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt8((this.ParcelData['GroupOwned']) ? 1 : 0, pos++);
buf.writeUInt8(this.ParcelData['Status'], pos++);
buf.writeUInt8(this.ParcelData['Name'].length, pos++);
this.ParcelData['Name'].copy(buf, pos);
2017-11-26 01:14:02 +00:00
pos += this.ParcelData['Name'].length;
buf.writeUInt8(this.ParcelData['Description'].length, pos++);
this.ParcelData['Description'].copy(buf, pos);
2017-11-26 01:14:02 +00:00
pos += this.ParcelData['Description'].length;
buf.writeUInt8(this.ParcelData['MusicURL'].length, pos++);
this.ParcelData['MusicURL'].copy(buf, pos);
2017-11-26 01:14:02 +00:00
pos += this.ParcelData['MusicURL'].length;
buf.writeFloatLE(this.ParcelData['RegionX'], pos);
pos += 4;
buf.writeFloatLE(this.ParcelData['RegionY'], pos);
pos += 4;
buf.writeInt32LE(this.ParcelData['ActualArea'], pos);
pos += 4;
buf.writeInt32LE(this.ParcelData['BillableArea'], pos);
pos += 4;
buf.writeUInt8((this.ParcelData['ShowDir']) ? 1 : 0, pos++);
buf.writeUInt8((this.ParcelData['IsForSale']) ? 1 : 0, pos++);
buf.writeUInt8(this.ParcelData['Category'], pos++);
this.ParcelData['SnapshotID'].writeToBuffer(buf, pos);
pos += 16;
this.ParcelData['UserLocation'].writeToBuffer(buf, pos, false);
pos += 12;
buf.writeInt32LE(this.ParcelData['SalePrice'], pos);
pos += 4;
this.ParcelData['AuthorizedBuyerID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt8((this.ParcelData['AllowPublish']) ? 1 : 0, pos++);
buf.writeUInt8((this.ParcelData['MaturePublish']) ? 1 : 0, pos++);
return pos - startPos;
}
// @ts-ignore
2017-11-26 01:14:02 +00:00
readFromBuffer(buf: Buffer, pos: number): number
{
const startPos = pos;
let varLength = 0;
const newObjParcelData: {
ParcelID: UUID,
RegionHandle: Long,
OwnerID: UUID,
GroupOwned: boolean,
Status: number,
Name: Buffer,
Description: Buffer,
MusicURL: Buffer,
2017-11-26 01:14:02 +00:00
RegionX: number,
RegionY: number,
ActualArea: number,
BillableArea: number,
ShowDir: boolean,
IsForSale: boolean,
Category: number,
SnapshotID: UUID,
UserLocation: Vector3,
SalePrice: number,
AuthorizedBuyerID: UUID,
AllowPublish: boolean,
MaturePublish: boolean
} = {
ParcelID: UUID.zero(),
RegionHandle: Long.ZERO,
OwnerID: UUID.zero(),
GroupOwned: false,
Status: 0,
Name: Buffer.allocUnsafe(0),
Description: Buffer.allocUnsafe(0),
MusicURL: Buffer.allocUnsafe(0),
2017-11-26 01:14:02 +00:00
RegionX: 0,
RegionY: 0,
ActualArea: 0,
BillableArea: 0,
ShowDir: false,
IsForSale: false,
Category: 0,
SnapshotID: UUID.zero(),
UserLocation: Vector3.getZero(),
SalePrice: 0,
AuthorizedBuyerID: UUID.zero(),
AllowPublish: false,
MaturePublish: false
};
newObjParcelData['ParcelID'] = new UUID(buf, pos);
pos += 16;
newObjParcelData['RegionHandle'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos + 4));
2017-11-26 01:14:02 +00:00
pos += 8;
newObjParcelData['OwnerID'] = new UUID(buf, pos);
pos += 16;
newObjParcelData['GroupOwned'] = (buf.readUInt8(pos++) === 1);
newObjParcelData['Status'] = buf.readUInt8(pos++);
varLength = buf.readUInt8(pos++);
newObjParcelData['Name'] = buf.slice(pos, pos + varLength);
2017-11-26 01:14:02 +00:00
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjParcelData['Description'] = buf.slice(pos, pos + varLength);
2017-11-26 01:14:02 +00:00
pos += varLength;
varLength = buf.readUInt8(pos++);
newObjParcelData['MusicURL'] = buf.slice(pos, pos + varLength);
2017-11-26 01:14:02 +00:00
pos += varLength;
newObjParcelData['RegionX'] = buf.readFloatLE(pos);
pos += 4;
newObjParcelData['RegionY'] = buf.readFloatLE(pos);
pos += 4;
newObjParcelData['ActualArea'] = buf.readInt32LE(pos);
pos += 4;
newObjParcelData['BillableArea'] = buf.readInt32LE(pos);
pos += 4;
newObjParcelData['ShowDir'] = (buf.readUInt8(pos++) === 1);
newObjParcelData['IsForSale'] = (buf.readUInt8(pos++) === 1);
newObjParcelData['Category'] = buf.readUInt8(pos++);
newObjParcelData['SnapshotID'] = new UUID(buf, pos);
pos += 16;
newObjParcelData['UserLocation'] = new Vector3(buf, pos, false);
pos += 12;
newObjParcelData['SalePrice'] = buf.readInt32LE(pos);
pos += 4;
newObjParcelData['AuthorizedBuyerID'] = new UUID(buf, pos);
pos += 16;
newObjParcelData['AllowPublish'] = (buf.readUInt8(pos++) === 1);
newObjParcelData['MaturePublish'] = (buf.readUInt8(pos++) === 1);
this.ParcelData = newObjParcelData;
return pos - startPos;
}
}