Use bigint for gold (#1000)

## Description:

- Switch gold to bigint.
- Remove unused or untrusted values from event payloads.

## 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
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Scott Anderson
2025-06-02 12:48:24 -07:00
committed by GitHub
co-authored by Scott Anderson coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent df0d99e212
commit 73a6853fd7
19 changed files with 125 additions and 100 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ import { Stats } from "./Stats";
export type PlayerID = string;
export type Tick = number;
export type Gold = number;
export type Gold = bigint;
export const AllPlayers = "AllPlayers" as const;
@@ -450,7 +450,7 @@ export interface Player {
troops(): number;
targetTroopRatio(): number;
addGold(toAdd: Gold): void;
removeGold(toRemove: Gold): void;
removeGold(toRemove: Gold): Gold;
addWorkers(toAdd: number): void;
removeWorkers(toRemove: number): void;
setTargetTroopRatio(target: number): void;
@@ -506,8 +506,8 @@ export interface Player {
// Donation
canDonate(recipient: Player): boolean;
donateTroops(recipient: Player, troops: number): void;
donateGold(recipient: Player, gold: number): void;
donateTroops(recipient: Player, troops: number): boolean;
donateGold(recipient: Player, gold: Gold): boolean;
// Embargo
hasEmbargoAgainst(other: Player): boolean;
@@ -619,7 +619,7 @@ export interface PlayerActions {
export interface BuildableUnit {
canBuild: TileRef | false;
type: UnitType;
cost: number;
cost: Gold;
}
export interface PlayerProfile {