mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Update game-stats-ui-handler.ts
This commit is contained in:
parent
642d9fab5b
commit
6122d2f528
@ -7,6 +7,7 @@ import * as Utils from "../utils";
|
|||||||
import { DexAttr, GameData } from "../system/game-data";
|
import { DexAttr, GameData } from "../system/game-data";
|
||||||
import { speciesStarters } from "../data/pokemon-species";
|
import { speciesStarters } from "../data/pokemon-species";
|
||||||
import {Button} from "../enums/buttons";
|
import {Button} from "../enums/buttons";
|
||||||
|
import i18next from '../plugins/i18n';
|
||||||
|
|
||||||
interface DisplayStat {
|
interface DisplayStat {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -22,68 +23,68 @@ const displayStats: DisplayStats = {
|
|||||||
playTime: {
|
playTime: {
|
||||||
sourceFunc: gameData => Utils.getPlayTimeString(gameData.gameStats.playTime)
|
sourceFunc: gameData => Utils.getPlayTimeString(gameData.gameStats.playTime)
|
||||||
},
|
},
|
||||||
battles: 'Total Battles',
|
battles: i18next.t("gameStatsUiHandler:totalBattles"),
|
||||||
startersUnlocked: {
|
startersUnlocked: {
|
||||||
label: 'Starters',
|
label: i18next.t("gameStatsUiHandler:starters"),
|
||||||
sourceFunc: gameData => {
|
sourceFunc: gameData => {
|
||||||
const starterCount = gameData.getStarterCount(d => !!d.caughtAttr);
|
const starterCount = gameData.getStarterCount(d => !!d.caughtAttr);
|
||||||
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
|
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
shinyStartersUnlocked: {
|
shinyStartersUnlocked: {
|
||||||
label: 'Shiny Starters',
|
label: i18next.t("gameStatsUiHandler:shinyStarters"),
|
||||||
sourceFunc: gameData => {
|
sourceFunc: gameData => {
|
||||||
const starterCount = gameData.getStarterCount(d => !!(d.caughtAttr & DexAttr.SHINY));
|
const starterCount = gameData.getStarterCount(d => !!(d.caughtAttr & DexAttr.SHINY));
|
||||||
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
|
return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dexSeen: {
|
dexSeen: {
|
||||||
label: 'Species Seen',
|
label: i18next.t("gameStatsUiHandler:speciesSeen"),
|
||||||
sourceFunc: gameData => {
|
sourceFunc: gameData => {
|
||||||
const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr);
|
const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr);
|
||||||
return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
|
return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dexCaught: {
|
dexCaught: {
|
||||||
label: 'Species Caught',
|
label: i18next.t("gameStatsUiHandler:speciesCaught"),
|
||||||
sourceFunc: gameData => {
|
sourceFunc: gameData => {
|
||||||
const caughtCount = gameData.getSpeciesCount(d => !!d.caughtAttr);
|
const caughtCount = gameData.getSpeciesCount(d => !!d.caughtAttr);
|
||||||
return `${caughtCount} (${Math.floor((caughtCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
|
return `${caughtCount} (${Math.floor((caughtCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ribbonsOwned: 'Ribbons Owned',
|
ribbonsOwned: i18next.t("gameStatsUiHandler:ribbonsOwned"),
|
||||||
classicSessionsPlayed: 'Classic Runs',
|
classicSessionsPlayed: i18next.t("gameStatsUiHandler:classicRuns"),
|
||||||
sessionsWon: 'Classic Wins',
|
sessionsWon: i18next.t("gameStatsUiHandler:classicWins"),
|
||||||
dailyRunSessionsPlayed: 'Daily Run Attempts',
|
dailyRunSessionsPlayed: i18next.t("gameStatsUiHandler:dailyRunAttempts"),
|
||||||
dailyRunSessionsWon: 'Daily Run Wins',
|
dailyRunSessionsWon: i18next.t("gameStatsUiHandler:dailyRunWins"),
|
||||||
endlessSessionsPlayed: 'Endless Runs?',
|
endlessSessionsPlayed: i18next.t("gameStatsUiHandler:endlessRuns"),
|
||||||
highestEndlessWave: 'Highest Wave (Endless)?',
|
highestEndlessWave: i18next.t("gameStatsUiHandler:highestWaveEndless"),
|
||||||
highestMoney: 'Highest Money',
|
highestMoney: i18next.t("gameStatsUiHandler:highestMoney"),
|
||||||
highestDamage: 'Highest Damage',
|
highestDamage: i18next.t("gameStatsUiHandler:highestDamage"),
|
||||||
highestHeal: 'Highest HP Healed',
|
highestHeal: i18next.t("gameStatsUiHandler:highestHPHealed"),
|
||||||
pokemonSeen: 'Pokémon Encountered',
|
pokemonSeen: i18next.t("gameStatsUiHandler:pokemonEncountered"),
|
||||||
pokemonDefeated: 'Pokémon Defeated',
|
pokemonDefeated: i18next.t("gameStatsUiHandler:pokemonDefeated"),
|
||||||
pokemonCaught: 'Pokémon Caught',
|
pokemonCaught: i18next.t("gameStatsUiHandler:pokemonCaught"),
|
||||||
pokemonHatched: 'Eggs Hatched',
|
pokemonHatched: i18next.t("gameStatsUiHandler:eggsHatched"),
|
||||||
subLegendaryPokemonSeen: 'Sub-Legends Seen?',
|
subLegendaryPokemonSeen: i18next.t("gameStatsUiHandler:subLegendsSeen"),
|
||||||
subLegendaryPokemonCaught: 'Sub-Legends Caught?',
|
subLegendaryPokemonCaught: i18next.t("gameStatsUiHandler:subLegendsCaught"),
|
||||||
subLegendaryPokemonHatched: 'Sub-Legends Hatched?',
|
subLegendaryPokemonHatched: i18next.t("gameStatsUiHandler:subLegendsHatched"),
|
||||||
legendaryPokemonSeen: 'Legends Seen?',
|
legendaryPokemonSeen: i18next.t("gameStatsUiHandler:legendsSeen"),
|
||||||
legendaryPokemonCaught: 'Legends Caught?',
|
legendaryPokemonCaught: i18next.t("gameStatsUiHandler:legendsCaught"),
|
||||||
legendaryPokemonHatched: 'Legends Hatched?',
|
legendaryPokemonHatched: i18next.t("gameStatsUiHandler:legendsHatched"),
|
||||||
mythicalPokemonSeen: 'Mythicals Seen?',
|
mythicalPokemonSeen: i18next.t("gameStatsUiHandler:mythicalsSeen"),
|
||||||
mythicalPokemonCaught: 'Mythicals Caught?',
|
mythicalPokemonCaught: i18next.t("gameStatsUiHandler:mythicalsCaught"),
|
||||||
mythicalPokemonHatched: 'Mythicals Hatched?',
|
mythicalPokemonHatched: i18next.t("gameStatsUiHandler:mythicalsHatched"),
|
||||||
shinyPokemonSeen: 'Shinies Seen?',
|
shinyPokemonSeen: i18next.t("gameStatsUiHandler:shiniesSeen"),
|
||||||
shinyPokemonCaught: 'Shinies Caught?',
|
shinyPokemonCaught: i18next.t("gameStatsUiHandler:shiniesCaught"),
|
||||||
shinyPokemonHatched: 'Shinies Hatched?',
|
shinyPokemonHatched: i18next.t("gameStatsUiHandler:shiniesHatched"),
|
||||||
pokemonFused: 'Pokémon Fused?',
|
pokemonFused: i18next.t("gameStatsUiHandler:pokemonFused"),
|
||||||
trainersDefeated: 'Trainers Defeated',
|
trainersDefeated: i18next.t("gameStatsUiHandler:trainersDefeated"),
|
||||||
eggsPulled: 'Eggs Pulled',
|
eggsPulled: i18next.t("gameStatsUiHandler:eggsPulled"),
|
||||||
rareEggsPulled: 'Rare Eggs Pulled?',
|
rareEggsPulled: i18next.t("gameStatsUiHandler:rareEggsPulled"),
|
||||||
epicEggsPulled: 'Epic Eggs Pulled?',
|
epicEggsPulled: i18next.t("gameStatsUiHandler:epicEggsPulled"),
|
||||||
legendaryEggsPulled: 'Legendary Eggs Pulled?',
|
legendaryEggsPulled: i18next.t("gameStatsUiHandler:legendaryEggsPulled"),
|
||||||
manaphyEggsPulled: 'Manaphy Eggs Pulled?'
|
manaphyEggsPulled: i18next.t("gameStatsUiHandler:manaphyEggsPulled")
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class GameStatsUiHandler extends UiHandler {
|
export default class GameStatsUiHandler extends UiHandler {
|
||||||
@ -110,7 +111,7 @@ export default class GameStatsUiHandler extends UiHandler {
|
|||||||
const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24);
|
const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24);
|
||||||
headerBg.setOrigin(0, 0);
|
headerBg.setOrigin(0, 0);
|
||||||
|
|
||||||
const headerText = addTextObject(this.scene, 0, 0, 'Stats', TextStyle.SETTINGS_LABEL);
|
const headerText = addTextObject(this.scene, 0, 0, i18next.t("gameStatsUiHandler:stats"), TextStyle.SETTINGS_LABEL);
|
||||||
headerText.setOrigin(0, 0);
|
headerText.setOrigin(0, 0);
|
||||||
headerText.setPositionRelative(headerBg, 8, 4);
|
headerText.setPositionRelative(headerBg, 8, 4);
|
||||||
|
|
||||||
@ -251,4 +252,4 @@ export default class GameStatsUiHandler extends UiHandler {
|
|||||||
(displayStats[key] as DisplayStat).label = Utils.toReadableString(`${splittableKey[0].toUpperCase()}${splittableKey.slice(1)}`);
|
(displayStats[key] as DisplayStat).label = Utils.toReadableString(`${splittableKey[0].toUpperCase()}${splittableKey.slice(1)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user