UDP Circuit basics, message changes
This commit is contained in:
89
lib/classes/messages/ScriptDialogReply.ts
Normal file
89
lib/classes/messages/ScriptDialogReply.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
// 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 ScriptDialogReplyMessage implements MessageBase
|
||||
{
|
||||
name = 'ScriptDialogReply';
|
||||
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
||||
id = Message.ScriptDialogReply;
|
||||
|
||||
AgentData: {
|
||||
AgentID: UUID;
|
||||
SessionID: UUID;
|
||||
};
|
||||
Data: {
|
||||
ObjectID: UUID;
|
||||
ChatChannel: number;
|
||||
ButtonIndex: number;
|
||||
ButtonLabel: string;
|
||||
};
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return (this.Data['ButtonLabel'].length + 1) + 56;
|
||||
}
|
||||
|
||||
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['ObjectID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeInt32LE(this.Data['ChatChannel'], pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.Data['ButtonIndex'], pos);
|
||||
pos += 4;
|
||||
buf.writeUInt8(this.Data['ButtonLabel'].length, pos++);
|
||||
buf.write(this.Data['ButtonLabel'], pos);
|
||||
pos += this.Data['ButtonLabel'].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 newObjData: {
|
||||
ObjectID: UUID,
|
||||
ChatChannel: number,
|
||||
ButtonIndex: number,
|
||||
ButtonLabel: string
|
||||
} = {
|
||||
ObjectID: UUID.zero(),
|
||||
ChatChannel: 0,
|
||||
ButtonIndex: 0,
|
||||
ButtonLabel: ''
|
||||
};
|
||||
newObjData['ObjectID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjData['ChatChannel'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjData['ButtonIndex'] = buf.readInt32LE(pos);
|
||||
pos += 4;
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjData['ButtonLabel'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
this.Data = newObjData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user