From e1465f665a4debb91dd130c94b322525215f9dbc Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 13 Jun 2026 15:43:20 +0200 Subject: [PATCH] fix(communication): read trailing totalBadges int in UserProfileParser UserProfileComposer appends getTotalBadges() as the final int of the profile packet, but UserProfileParser returned after displayOrder and never read it, so the _totalBadges getter always returned its flush default 0. The extended-profile summary (UserContainerView) reads userProfile.totalBadges with a `?? userBadges.length` fallback, but since the getter returned 0 (not undefined) the fallback never triggered and the badge count rendered 0. Add a 5th optional-trailing tier reading the int (bytesAvailable-guarded so older servers that don't emit it still parse cleanly). --- .../src/messages/parser/user/data/UserProfileParser.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/communication/src/messages/parser/user/data/UserProfileParser.ts b/packages/communication/src/messages/parser/user/data/UserProfileParser.ts index 09c3fb4..952cf13 100644 --- a/packages/communication/src/messages/parser/user/data/UserProfileParser.ts +++ b/packages/communication/src/messages/parser/user/data/UserProfileParser.ts @@ -89,6 +89,7 @@ export class UserProfileParser implements IMessageParser // block 2: card background (1 int) // block 3: nick icon (1 string) // block 4: prefix decoration set (6 strings) + // block 5: total badge count (1 int) // Each tier early-returns to keep the parser tolerant of older // servers that don't ship the later blocks. Defaults set by flush(). if(!wrapper.bytesAvailable) return true; @@ -114,6 +115,10 @@ export class UserProfileParser implements IMessageParser this._prefixFont = wrapper.readString(); this._displayOrder = wrapper.readString(); + if(!wrapper.bytesAvailable) return true; + + this._totalBadges = wrapper.readInt(); + return true; }