Display betrayal count (Continue #744) (#849)

## Description:
. #744 became a mess. Rewrote it


![Screenshot](https://github.com/user-attachments/assets/0e43547f-514a-4e93-9bbc-d022d8dfb75c)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
dovg
This commit is contained in:
tnhnblgl
2025-05-24 00:14:57 +03:00
committed by GitHub
parent f00f911477
commit 773c9566fc
4 changed files with 14 additions and 0 deletions
+1
View File
@@ -402,6 +402,7 @@
"player_panel": {
"gold": "Gold",
"troops": "Troops",
"betrayals": "Number of betrayals",
"traitor": "Traitor",
"alliance_time_remaining": "Time Remaining",
"embargo": "Stopped trading with you",
+10
View File
@@ -308,6 +308,16 @@ export class PlayerPanel extends LitElement implements Layer {
</div>
</div>
<!-- Betrayals -->
<div class="flex flex-col gap-1">
<div class="text-white text-opacity-80 text-sm px-2">
${translateText("player_panel.betrayals")}
</div>
<div class="bg-opacity-50 bg-gray-700 rounded p-2 text-white">
${other.data.betrayals ?? 0}
</div>
</div>
<!-- Embargo -->
<div class="flex flex-col gap-1">
<div class="text-white text-opacity-80 text-sm px-2">
+1
View File
@@ -118,6 +118,7 @@ export interface PlayerUpdate {
incomingAttacks: AttackUpdate[];
outgoingAllianceRequests: PlayerID[];
hasSpawned: boolean;
betrayals?: number;
}
export interface AllianceRequestUpdate {
+2
View File
@@ -123,6 +123,7 @@ export class PlayerImpl implements Player {
const outgoingAllianceRequests = this.outgoingAllianceRequests().map((ar) =>
ar.recipient().id(),
);
const stats = this.mg.stats().getPlayerStats(this);
return {
type: GameUpdateType.Player,
@@ -169,6 +170,7 @@ export class PlayerImpl implements Player {
),
outgoingAllianceRequests: outgoingAllianceRequests,
hasSpawned: this.hasSpawned(),
betrayals: stats?.betrayals,
};
}