Skip to content

Commit

Permalink
Merge pull request #789 from The-International-Screeps-Bot/feature/ad…
Browse files Browse the repository at this point in the history
…d-etrd-stat-tracking

Feature add etrd stat tracking
  • Loading branch information
CarsonBurke authored Apr 7, 2024
2 parents 54b0ded + 2863e47 commit 84a2aa0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/constants/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export enum RoomStatsKeys {
MinHaulerCost = 'mhc',
EnergyOutputTransactionCosts = 'eotc',
EnergyTerminalSentDomestic = 'etsd',
EnergyTerminalReceivedDomestic = 'etrd',
EnergyTerminalSentOther = 'etso',
CpuUsed = 'cpu',

Expand Down Expand Up @@ -61,6 +62,7 @@ export const averageStatNames: Set<keyof CommuneStats | keyof RoomStats> = new S
RoomStatsKeys.RemoteEnergyOutputBuild,
RoomStatsKeys.EnergyOutputTransactionCosts,
RoomStatsKeys.EnergyTerminalSentDomestic,
RoomStatsKeys.EnergyTerminalReceivedDomestic,
RoomStatsKeys.EnergyTerminalSentOther,
RoomStatsKeys.CpuUsed,
])
1 change: 1 addition & 0 deletions src/international/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class StatsManager {
[RoomStatsKeys.MinHaulerCost]: 0,
[RoomStatsKeys.EnergyOutputTransactionCosts]: 0,
[RoomStatsKeys.EnergyTerminalSentDomestic]: 0,
[RoomStatsKeys.EnergyTerminalReceivedDomestic]: 0,
[RoomStatsKeys.EnergyTerminalSentOther]: 0,
[RoomStatsKeys.CpuUsed]: 0,
})
Expand Down
5 changes: 5 additions & 0 deletions src/international/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export class TransactionsManager {
RoomStatsKeys.EnergyTerminalSentDomestic,
transaction.amount,
)
StatsManager.updateCommuneStat(
transaction.to,
RoomStatsKeys.EnergyTerminalReceivedDomestic,
transaction.amount,
)
}
// Not a domestic trade
else {
Expand Down
1 change: 1 addition & 0 deletions src/types/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface CommuneStats extends RoomStats {
[RoomStatsKeys.MinHaulerCost]: number
[RoomStatsKeys.EnergyOutputTransactionCosts]: number
[RoomStatsKeys.EnergyTerminalSentDomestic]: number
[RoomStatsKeys.EnergyTerminalReceivedDomestic]: number
[RoomStatsKeys.EnergyTerminalSentOther]: number
[RoomStatsKeys.BatteriesStoredTimes10]: number
[RoomStatsKeys.CpuUsed]: number
Expand Down

0 comments on commit 84a2aa0

Please sign in to comment.