From 8b9bed0e0b44af758078c32b57006de2e8f5ae4a Mon Sep 17 00:00:00 2001 From: FloPinguin <25036848+FloPinguin@users.noreply.github.com> Date: Wed, 17 Dec 2025 04:16:03 +0100 Subject: [PATCH] =?UTF-8?q?Hotfix:=20Max=20troops=20instead=20of=20troops?= =?UTF-8?q?=20for=20team=20stats=20=F0=9F=93=8A=20(#2631)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: Missing i18n key because I forgot to add maxTroops to the team leaderboard... I completely forgot that troops are also shown on the team leaderboard Before: Screenshot 2025-12-17 022043 After: Screenshot 2025-12-17 025028 ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin --- src/client/graphics/layers/TeamStats.ts | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/client/graphics/layers/TeamStats.ts b/src/client/graphics/layers/TeamStats.ts index 120b4b60c..58feb7f39 100644 --- a/src/client/graphics/layers/TeamStats.ts +++ b/src/client/graphics/layers/TeamStats.ts @@ -3,7 +3,7 @@ import { customElement, property } from "lit/decorators.js"; import { EventBus } from "../../../core/EventBus"; import { GameMode, Team, UnitType } from "../../../core/game/Game"; import { GameView, PlayerView } from "../../../core/game/GameView"; -import { renderNumber, translateText } from "../../Utils"; +import { renderNumber, renderTroops, translateText } from "../../Utils"; import { Layer } from "./Layer"; interface TeamEntry { @@ -11,7 +11,7 @@ interface TeamEntry { isMyTeam: boolean; totalScoreStr: string; totalGold: string; - totalTroops: string; + totalMaxTroops: string; totalSAMs: string; totalLaunchers: string; totalWarShips: string; @@ -71,7 +71,7 @@ export class TeamStats extends LitElement implements Layer { this.teams = Object.entries(grouped) .map(([teamStr, teamPlayers]) => { let totalGold = 0n; - let totalTroops = 0; + let totalMaxTroops = 0; let totalScoreSort = 0; let totalSAMs = 0; let totalLaunchers = 0; @@ -80,7 +80,7 @@ export class TeamStats extends LitElement implements Layer { for (const p of teamPlayers) { if (p.isAlive()) { - totalTroops += p.troops(); + totalMaxTroops += this.game.config().maxTroops(p); totalGold += p.gold(); totalScoreSort += p.numTilesOwned(); totalLaunchers += p.totalUnitLevels(UnitType.MissileSilo); @@ -100,7 +100,7 @@ export class TeamStats extends LitElement implements Layer { totalScoreStr: formatPercentage(totalScorePercent), totalScoreSort, totalGold: renderNumber(totalGold), - totalTroops: renderNumber(totalTroops / 10), + totalMaxTroops: renderTroops(totalMaxTroops), players: teamPlayers, totalLaunchers: renderNumber(totalLaunchers), @@ -134,47 +134,47 @@ export class TeamStats extends LitElement implements Layer { >
-
+
${translateText("leaderboard.team")}
${this.showUnits ? html`
${translateText("leaderboard.launchers")}
${translateText("leaderboard.sams")}
${translateText("leaderboard.warships")}
${translateText("leaderboard.cities")}
` : html`
${translateText("leaderboard.owned")}
${translateText("leaderboard.gold")}
- ${translateText("leaderboard.troops")} + ${translateText("leaderboard.maxtroops")}
`}
@@ -221,7 +221,7 @@ export class TeamStats extends LitElement implements Layer { ${team.totalGold}
- ${team.totalTroops} + ${team.totalMaxTroops}
`,