// 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 ObjectAnimationMessage implements MessageBase { name = 'ObjectAnimation'; messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyHigh; id = Message.ObjectAnimation; Sender: { ID: UUID; }; AnimationList: { AnimID: UUID; AnimSequenceID: number; }[]; getSize(): number { return ((20) * this.AnimationList.length) + 17; } // @ts-ignore writeToBuffer(buf: Buffer, pos: number): number { const startPos = pos; this.Sender['ID'].writeToBuffer(buf, pos); pos += 16; const count = this.AnimationList.length; buf.writeUInt8(this.AnimationList.length, pos++); for (let i = 0; i < count; i++) { this.AnimationList[i]['AnimID'].writeToBuffer(buf, pos); pos += 16; buf.writeInt32LE(this.AnimationList[i]['AnimSequenceID'], pos); pos += 4; } return pos - startPos; } // @ts-ignore readFromBuffer(buf: Buffer, pos: number): number { const startPos = pos; const newObjSender: { ID: UUID } = { ID: UUID.zero() }; newObjSender['ID'] = new UUID(buf, pos); pos += 16; this.Sender = newObjSender; if (pos >= buf.length) { return pos - startPos; } const count = buf.readUInt8(pos++); this.AnimationList = []; for (let i = 0; i < count; i++) { const newObjAnimationList: { AnimID: UUID, AnimSequenceID: number } = { AnimID: UUID.zero(), AnimSequenceID: 0 }; newObjAnimationList['AnimID'] = new UUID(buf, pos); pos += 16; newObjAnimationList['AnimSequenceID'] = buf.readInt32LE(pos); pos += 4; this.AnimationList.push(newObjAnimationList); } return pos - startPos; } }