114 lines
3.7 KiB
TypeScript
114 lines
3.7 KiB
TypeScript
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
import { UUID } from '../UUID';
|
|
import { IPAddress } from '../IPAddress';
|
|
import { MessageFlags } from '../../enums/MessageFlags';
|
|
import { MessageBase } from '../MessageBase';
|
|
import { Message } from '../../enums/Message';
|
|
|
|
export class LogFailedMoneyTransactionMessage implements MessageBase
|
|
{
|
|
name = 'LogFailedMoneyTransaction';
|
|
messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
|
|
id = Message.LogFailedMoneyTransaction;
|
|
|
|
TransactionData: {
|
|
TransactionID: UUID;
|
|
TransactionTime: number;
|
|
TransactionType: number;
|
|
SourceID: UUID;
|
|
DestID: UUID;
|
|
Flags: number;
|
|
Amount: number;
|
|
SimulatorIP: IPAddress;
|
|
GridX: number;
|
|
GridY: number;
|
|
FailureType: number;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 74;
|
|
}
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.TransactionData['TransactionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt32LE(this.TransactionData['TransactionTime'], pos);
|
|
pos += 4;
|
|
buf.writeInt32LE(this.TransactionData['TransactionType'], pos);
|
|
pos += 4;
|
|
this.TransactionData['SourceID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.TransactionData['DestID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt8(this.TransactionData['Flags'], pos++);
|
|
buf.writeInt32LE(this.TransactionData['Amount'], pos);
|
|
pos += 4;
|
|
this.TransactionData['SimulatorIP'].writeToBuffer(buf, pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.TransactionData['GridX'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.TransactionData['GridY'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8(this.TransactionData['FailureType'], pos++);
|
|
return pos - startPos;
|
|
}
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
let varLength = 0;
|
|
const newObjTransactionData: {
|
|
TransactionID: UUID,
|
|
TransactionTime: number,
|
|
TransactionType: number,
|
|
SourceID: UUID,
|
|
DestID: UUID,
|
|
Flags: number,
|
|
Amount: number,
|
|
SimulatorIP: IPAddress,
|
|
GridX: number,
|
|
GridY: number,
|
|
FailureType: number
|
|
} = {
|
|
TransactionID: UUID.zero(),
|
|
TransactionTime: 0,
|
|
TransactionType: 0,
|
|
SourceID: UUID.zero(),
|
|
DestID: UUID.zero(),
|
|
Flags: 0,
|
|
Amount: 0,
|
|
SimulatorIP: IPAddress.zero(),
|
|
GridX: 0,
|
|
GridY: 0,
|
|
FailureType: 0
|
|
};
|
|
newObjTransactionData['TransactionID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjTransactionData['TransactionTime'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjTransactionData['TransactionType'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
newObjTransactionData['SourceID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjTransactionData['DestID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjTransactionData['Flags'] = buf.readUInt8(pos++);
|
|
newObjTransactionData['Amount'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
newObjTransactionData['SimulatorIP'] = new IPAddress(buf, pos);
|
|
pos += 4;
|
|
newObjTransactionData['GridX'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjTransactionData['GridY'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjTransactionData['FailureType'] = buf.readUInt8(pos++);
|
|
this.TransactionData = newObjTransactionData;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|