From 23d2822fa0f3d3fd3b93677e6031ec77e3907f8d Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Wed, 16 Mar 2022 23:48:13 -0300 Subject: [PATCH] Make SetActivatedBadgesComposer dynamic --- .../badges/SetActivatedBadgesComposer.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts b/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts index 4524b6e3..48cad882 100644 --- a/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts +++ b/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts @@ -7,22 +7,21 @@ export class SetActivatedBadgesComposer implements IMessageComposer public getMessageArray() { const data = []; - let local2 = 1; - while(local2 <= 5) + + for(let i = 0; i < this._badges.length; i++) { - if(local2 <= this._badges.length) + if(i <= this._badges.length) { - data.push(local2); - data.push(this._badges[(local2 - 1)]); + data.push(i + 1); + data.push(this._badges[i]); } else { - data.push(local2); + data.push(i + 1); data.push(''); } - - local2++; } + return data; } @@ -33,8 +32,6 @@ export class SetActivatedBadgesComposer implements IMessageComposer public addActivatedBadge(badge: string): void { - if(this._badges.length >= 5) return; - this._badges.push(badge); } }