UDP Circuit basics, message changes
This commit is contained in:
99
lib/classes/messages/AgentDataUpdate.ts
Normal file
99
lib/classes/messages/AgentDataUpdate.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
// This file has been automatically generated by writeMessageClasses.js
|
||||
|
||||
import {UUID} from '../UUID';
|
||||
import Long = require('long');
|
||||
import {MessageFlags} from '../../enums/MessageFlags';
|
||||
import {MessageBase} from '../MessageBase';
|
||||
import {Message} from '../../enums/Message';
|
||||
|
||||
export class AgentDataUpdateMessage implements MessageBase
|
||||
{
|
||||
name = 'AgentDataUpdate';
|
||||
messageFlags = MessageFlags.Trusted | MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
||||
id = Message.AgentDataUpdate;
|
||||
|
||||
AgentData: {
|
||||
AgentID: UUID;
|
||||
FirstName: string;
|
||||
LastName: string;
|
||||
GroupTitle: string;
|
||||
ActiveGroupID: UUID;
|
||||
GroupPowers: Long;
|
||||
GroupName: string;
|
||||
};
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return (this.AgentData['FirstName'].length + 1 + this.AgentData['LastName'].length + 1 + this.AgentData['GroupTitle'].length + 1 + this.AgentData['GroupName'].length + 1) + 40;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8(this.AgentData['FirstName'].length, pos++);
|
||||
buf.write(this.AgentData['FirstName'], pos);
|
||||
pos += this.AgentData['FirstName'].length;
|
||||
buf.writeUInt8(this.AgentData['LastName'].length, pos++);
|
||||
buf.write(this.AgentData['LastName'], pos);
|
||||
pos += this.AgentData['LastName'].length;
|
||||
buf.writeUInt8(this.AgentData['GroupTitle'].length, pos++);
|
||||
buf.write(this.AgentData['GroupTitle'], pos);
|
||||
pos += this.AgentData['GroupTitle'].length;
|
||||
this.AgentData['ActiveGroupID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeInt32LE(this.AgentData['GroupPowers'].low, pos);
|
||||
pos += 4;
|
||||
buf.writeInt32LE(this.AgentData['GroupPowers'].high, pos);
|
||||
pos += 4;
|
||||
buf.writeUInt8(this.AgentData['GroupName'].length, pos++);
|
||||
buf.write(this.AgentData['GroupName'], pos);
|
||||
pos += this.AgentData['GroupName'].length;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
let varLength = 0;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
FirstName: string,
|
||||
LastName: string,
|
||||
GroupTitle: string,
|
||||
ActiveGroupID: UUID,
|
||||
GroupPowers: Long,
|
||||
GroupName: string
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
FirstName: '',
|
||||
LastName: '',
|
||||
GroupTitle: '',
|
||||
ActiveGroupID: UUID.zero(),
|
||||
GroupPowers: Long.ZERO,
|
||||
GroupName: ''
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjAgentData['FirstName'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjAgentData['LastName'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjAgentData['GroupTitle'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
newObjAgentData['ActiveGroupID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['GroupPowers'] = new Long(buf.readInt32LE(pos), buf.readInt32LE(pos+4));
|
||||
pos += 8;
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjAgentData['GroupName'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
this.AgentData = newObjAgentData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user