40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
// This file has been automatically generated by writePacketClasses.js
|
|
|
|
import {UUID} from '../UUID';
|
|
import {MessageFlags} from '../../enums/MessageFlags';
|
|
import {Packet} from '../Packet';
|
|
|
|
export class AlertMessagePacket implements Packet
|
|
{
|
|
name = 'AlertMessage';
|
|
flags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
|
|
id = 4294901894;
|
|
|
|
AlertData: {
|
|
Message: string;
|
|
};
|
|
AlertInfo: {
|
|
Message: string;
|
|
ExtraParams: string;
|
|
}[];
|
|
AgentInfo: {
|
|
AgentID: UUID;
|
|
}[];
|
|
|
|
getSize(): number
|
|
{
|
|
return (this.AlertData['Message'].length + 1) + ((this.calculateVarVarSize(this.AlertInfo, 'Message', 1) + this.calculateVarVarSize(this.AlertInfo, 'ExtraParams', 1)) * this.AlertInfo.length) + ((16) * this.AgentInfo.length) + 2;
|
|
}
|
|
|
|
calculateVarVarSize(block: object[], paramName: string, extraPerVar: number): number
|
|
{
|
|
let size = 0;
|
|
block.forEach((bl: any) =>
|
|
{
|
|
size += bl[paramName].length + extraPerVar;
|
|
});
|
|
return size;
|
|
}
|
|
|
|
}
|