From 14c14e59f2eb224ecd309926fd6cdc2cff33df27 Mon Sep 17 00:00:00 2001 From: yanir <100792995+Boostry123@users.noreply.github.com> Date: Fri, 22 Aug 2025 22:10:40 +0300 Subject: [PATCH] added the ability to see players Flag inside the player panel with full flag name. (#1892) ## Description: Sometimes I found it interesting to know what flag players choose, now its possible with this new feature. Feature added to the players panel. - Added the Full flag name - Added the flag svg - countries with no flag, the whole section will be hidden My own Flag Bot with flag Bot with no flag ## 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 ( Made local tests seems to all work with long or short names) - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## My discord: boostry --------- Co-authored-by: evanpelle --- resources/lang/en.json | 3 ++- src/client/graphics/layers/PlayerPanel.ts | 24 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index 46048063f..a984f9a57 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -537,7 +537,8 @@ "yes": "Yes", "no": "No", "none": "None", - "alliances": "Alliances" + "alliances": "Alliances", + "flag": "Flag" }, "replay_panel": { "replay_speed": "Replay speed", diff --git a/src/client/graphics/layers/PlayerPanel.ts b/src/client/graphics/layers/PlayerPanel.ts index 78ded064b..a2c18ef5a 100644 --- a/src/client/graphics/layers/PlayerPanel.ts +++ b/src/client/graphics/layers/PlayerPanel.ts @@ -14,6 +14,7 @@ import { import { customElement, state } from "lit/decorators.js"; import { renderNumber, renderTroops } from "../../Utils"; import { ChatModal } from "./ChatModal"; +import Countries from "../../data/countries.json"; import { EmojiTable } from "./EmojiTable"; import { EventBus } from "../../../core/EventBus"; import { Layer } from "./Layer"; @@ -243,6 +244,11 @@ export class PlayerPanel extends LitElement implements Layer { const canTarget = this.actions?.interaction?.canTarget; const canEmbargo = this.actions?.interaction?.canEmbargo; + //flag icon in the playerPanel + const flagCode = other.cosmetics.flag; + const country = typeof flagCode === "string" ? Countries.find((c) => c.code === flagCode) : undefined; + const flagName = country?.name; + return html`
- + + ${country + ? html` +
+
+ ${translateText("player_panel.flag")} +
+
+ ${flagName} +
+
+ ` + : ""}