mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 12:00:44 +00:00
Record missing stats (#2407)
## Description: Some stats are missing from the recorded game stats: - Unit upgrade - Gold from trade and from steal The gold from trade/steal was introduced with [PR 784](https://github.com/openfrontio/OpenFrontIO/pull/784) but was quickly reverted with [PR 927](https://github.com/openfrontio/OpenFrontIO/pull/927), probably involuntarily. ## 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: IngloriousTom
This commit is contained in:
@@ -148,6 +148,10 @@ export class TradeShipExecution implements Execution {
|
||||
this.tradeShip!.owner().id(),
|
||||
gold,
|
||||
);
|
||||
// Record stats
|
||||
this.mg
|
||||
.stats()
|
||||
.boatCapturedTrade(this.tradeShip!.owner(), this.origOwner, gold);
|
||||
} else {
|
||||
this.srcPort.owner().addGold(gold);
|
||||
this._dstPort.owner().addGold(gold, this._dstPort.tile());
|
||||
@@ -163,6 +167,10 @@ export class TradeShipExecution implements Execution {
|
||||
this.srcPort.owner().id(),
|
||||
gold,
|
||||
);
|
||||
// Record stats
|
||||
this.mg
|
||||
.stats()
|
||||
.boatArriveTrade(this.srcPort.owner(), this._dstPort.owner(), gold);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ describe("TradeShipExecution", () => {
|
||||
units: jest.fn(() => [dstPort]),
|
||||
unitCount: jest.fn(() => 1),
|
||||
id: jest.fn(() => 1),
|
||||
clientID: jest.fn(() => 1),
|
||||
canTrade: jest.fn(() => true),
|
||||
} as any;
|
||||
|
||||
@@ -38,6 +39,7 @@ describe("TradeShipExecution", () => {
|
||||
displayName: jest.fn(() => "Destination"),
|
||||
units: jest.fn(() => [dstPort]),
|
||||
unitCount: jest.fn(() => 1),
|
||||
clientID: jest.fn(() => 2),
|
||||
canTrade: jest.fn(() => true),
|
||||
} as any;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user