From 2735af953d7e9aa76b999b343f053b012004ed7e Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Sat, 3 Jul 2021 23:09:59 -0300 Subject: [PATCH] Fix ModtoolRoomInfoParser --- .../parser/modtool/ModtoolRoomInfoParser.ts | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/nitro/communication/messages/parser/modtool/ModtoolRoomInfoParser.ts b/src/nitro/communication/messages/parser/modtool/ModtoolRoomInfoParser.ts index bc45146b..84fe6673 100644 --- a/src/nitro/communication/messages/parser/modtool/ModtoolRoomInfoParser.ts +++ b/src/nitro/communication/messages/parser/modtool/ModtoolRoomInfoParser.ts @@ -8,14 +8,20 @@ export class ModtoolRoomInfoParser implements IMessageParser private _ownerInRoom: boolean; private _ownerId: number; private _ownerName: string; - private _bool: boolean; private _name: string; private _description: string; - private _tagsTotal: number; + private _tags: string[]; public flush(): boolean { this._id = null; + this._playerAmount = 0; + this._ownerInRoom = false; + this._ownerId = 0; + this._ownerName = null; + this._name = null; + this._description = null; + this._tags = []; return true; } @@ -24,15 +30,22 @@ export class ModtoolRoomInfoParser implements IMessageParser { if(!wrapper) return false; - this._id = wrapper.readInt(); + this._id = wrapper.readInt(); this._playerAmount = wrapper.readInt(); this._ownerInRoom = wrapper.readBoolean(); this._ownerId = wrapper.readInt(); this._ownerName = wrapper.readString(); - this._bool = wrapper.readBoolean(); + wrapper.readBoolean(); this._name = wrapper.readString(); this._description = wrapper.readString(); - this._tagsTotal = wrapper.readInt(); + const tagsTotal = wrapper.readInt(); + + this._tags = []; + + for(let i = 0; i < tagsTotal; i++) + { + this._tags.push(wrapper.readString()); + } return true; } @@ -71,4 +84,9 @@ export class ModtoolRoomInfoParser implements IMessageParser { return this._description; } + + public get tags(): string[] + { + return this._tags; + } }