109 lines
3.1 KiB
TypeScript
109 lines
3.1 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 ParcelBuyMessage implements MessageBase
|
|
{
|
|
name = 'ParcelBuy';
|
|
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
|
id = Message.ParcelBuy;
|
|
|
|
AgentData: {
|
|
AgentID: UUID;
|
|
SessionID: UUID;
|
|
};
|
|
Data: {
|
|
GroupID: UUID;
|
|
IsGroupOwned: boolean;
|
|
RemoveContribution: boolean;
|
|
LocalID: number;
|
|
Final: boolean;
|
|
};
|
|
ParcelData: {
|
|
Price: number;
|
|
Area: number;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 63;
|
|
}
|
|
|
|
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;
|
|
this.Data['GroupID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt8((this.Data['IsGroupOwned']) ? 1 : 0, pos++);
|
|
buf.writeUInt8((this.Data['RemoveContribution']) ? 1 : 0, pos++);
|
|
buf.writeInt32LE(this.Data['LocalID'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8((this.Data['Final']) ? 1 : 0, pos++);
|
|
buf.writeInt32LE(this.ParcelData['Price'], pos);
|
|
pos += 4;
|
|
buf.writeInt32LE(this.ParcelData['Area'], pos);
|
|
pos += 4;
|
|
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 newObjData: {
|
|
GroupID: UUID,
|
|
IsGroupOwned: boolean,
|
|
RemoveContribution: boolean,
|
|
LocalID: number,
|
|
Final: boolean
|
|
} = {
|
|
GroupID: UUID.zero(),
|
|
IsGroupOwned: false,
|
|
RemoveContribution: false,
|
|
LocalID: 0,
|
|
Final: false
|
|
};
|
|
newObjData['GroupID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjData['IsGroupOwned'] = (buf.readUInt8(pos++) === 1);
|
|
newObjData['RemoveContribution'] = (buf.readUInt8(pos++) === 1);
|
|
newObjData['LocalID'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
newObjData['Final'] = (buf.readUInt8(pos++) === 1);
|
|
this.Data = newObjData;
|
|
const newObjParcelData: {
|
|
Price: number,
|
|
Area: number
|
|
} = {
|
|
Price: 0,
|
|
Area: 0
|
|
};
|
|
newObjParcelData['Price'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
newObjParcelData['Area'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
this.ParcelData = newObjParcelData;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|