diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 69902853b18..d95dc6140f5 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1264,7 +1264,7 @@ export default class BattleScene extends SceneBase { } updateMoneyText(): void { - this.moneyText.setText(`₽${Utils.formatLargeNumber(this.money, 1000)}`); + this.moneyText.setText(`₽${Utils.formatFancyLargeNumber(this.money, 3)}`); this.moneyText.setVisible(true); } diff --git a/src/loading-scene.ts b/src/loading-scene.ts index d21f23cd667..ae14283c4c6 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -9,7 +9,6 @@ import { WindowVariant, getWindowVariantSuffix } from "./ui/ui-theme"; import { isMobile } from "./touch-controls"; import * as Utils from "./utils"; import { initI18n } from "./plugins/i18n"; -import {initStatsKeys} from "#app/ui/game-stats-ui-handler"; import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions"; import {initBiomes} from "#app/data/biomes"; import {initEggMoves} from "#app/data/egg-moves"; @@ -310,7 +309,6 @@ export class LoadingScene extends SceneBase { this.loadLoadingScreen(); - initStatsKeys(); initPokemonPrevolutions(); initBiomes(); initEggMoves(); diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 4e6d389a70b..a808dc49140 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const deConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/de/game-stats-ui-handler.ts b/src/locales/de/game-stats-ui-handler.ts new file mode 100644 index 00000000000..8c582b33eb1 --- /dev/null +++ b/src/locales/de/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Statistiken", + "playTime": "Spielzeit", + "totalBattles": "Kämpfe insgesamt", + "starters": "Starter", + "shinyStarters": "Schillernde Starter", + "speciesSeen": "Gesehene Arten", + "speciesCaught": "Gefangene Arten", + "ribbonsOwned": "Bänder im Besitz", + "classicRuns": "Klassik-Modus Versuche", + "classicWins": "Klassik-Modus Siege", + "dailyRunAttempts": "Täglicher-Modus Versuche", + "dailyRunWins": "Täglicher-Modus Siege", + "endlessRuns": "Endlos-Modus Versuche", + "highestWaveEndless": "Höchste Welle (Endlos)", + "highestMoney": "Max. Geld im Besitz", + "highestDamage": "Höchster Schaden", + "highestHPHealed": "Höchste Heilung", + "pokemonEncountered": "Getroffene Pokémon", + "pokemonDefeated": "Besiegte Pokémon", + "pokemonCaught": "Gefangene Pokémon", + "eggsHatched": "Ausgebrütete Eier", + "subLegendsSeen": "Getroffene Sub-Legenden", + "subLegendsCaught": "Gefangene Sub-Legenden", + "subLegendsHatched": "Ausgebrütete Sub-Legenden", + "legendsSeen": "Getroffene Legenden", + "legendsCaught": "Gefangene Legenden", + "legendsHatched": "Ausgebrütete Legenden", + "mythicalsSeen": "Getroffene Mythische", + "mythicalsCaught": "Gefangene Mythische", + "mythicalsHatched": "Ausgebrütete Mythische", + "shiniesSeen": "Getroffene Schillernde", + "shiniesCaught": "Gefangene Schillernde", + "shiniesHatched": "Ausgebrütete Schillernde", + "pokemonFused": "Pokémon fusioniert", + "trainersDefeated": "Besiegte Trainer", + "eggsPulled": "Gezogene Eier", + "rareEggsPulled": "Seltene Eier Gezogen", + "epicEggsPulled": "Epische Eier Gezogen", + "legendaryEggsPulled": "Legendäre Eier Gezogen", + "manaphyEggsPulled": "Manaphy Eier Gezogen", +} as const; diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 3effb412648..4f0f097ff14 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const enConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/en/game-stats-ui-handler.ts b/src/locales/en/game-stats-ui-handler.ts new file mode 100644 index 00000000000..64e4e2af5e3 --- /dev/null +++ b/src/locales/en/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Stats", + "playTime": "Play Time", + "totalBattles": "Total Battles", + "starters": "Starters", + "shinyStarters": "Shiny Starters", + "speciesSeen": "Species Seen", + "speciesCaught": "Species Caught", + "ribbonsOwned": "Ribbons Owned", + "classicRuns": "Classic Runs", + "classicWins": "Classic Wins", + "dailyRunAttempts": "Daily Run Attempts", + "dailyRunWins": "Daily Run Wins", + "endlessRuns": "Endless Runs", + "highestWaveEndless": "Highest Wave (Endless)", + "highestMoney": "Highest Money", + "highestDamage": "Highest Damage", + "highestHPHealed": "Highest HP Healed", + "pokemonEncountered": "Pokémon Encountered", + "pokemonDefeated": "Pokémon Defeated", + "pokemonCaught": "Pokémon Caught", + "eggsHatched": "Eggs Hatched", + "subLegendsSeen": "Sub-Legends Seen", + "subLegendsCaught": "Sub-Legends Caught", + "subLegendsHatched": "Sub-Legends Hatched", + "legendsSeen": "Legends Seen", + "legendsCaught": "Legends Caught", + "legendsHatched": "Legends Hatched", + "mythicalsSeen": "Mythicals Seen", + "mythicalsCaught": "Mythicals Caught", + "mythicalsHatched": "Mythicals Hatched", + "shiniesSeen": "Shinies Seen", + "shiniesCaught": "Shinies Caught", + "shiniesHatched": "Shinies Hatched", + "pokemonFused": "Pokémon Fused", + "trainersDefeated": "Trainers Defeated", + "eggsPulled": "Eggs Pulled", + "rareEggsPulled": "Rare Eggs Pulled", + "epicEggsPulled": "Epic Eggs Pulled", + "legendaryEggsPulled": "Legendary Eggs Pulled", + "manaphyEggsPulled": "Manaphy Eggs Pulled", +} as const; diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index fe7d045c7ae..a38e287a29f 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const esConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/es/game-stats-ui-handler.ts b/src/locales/es/game-stats-ui-handler.ts new file mode 100644 index 00000000000..64e4e2af5e3 --- /dev/null +++ b/src/locales/es/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Stats", + "playTime": "Play Time", + "totalBattles": "Total Battles", + "starters": "Starters", + "shinyStarters": "Shiny Starters", + "speciesSeen": "Species Seen", + "speciesCaught": "Species Caught", + "ribbonsOwned": "Ribbons Owned", + "classicRuns": "Classic Runs", + "classicWins": "Classic Wins", + "dailyRunAttempts": "Daily Run Attempts", + "dailyRunWins": "Daily Run Wins", + "endlessRuns": "Endless Runs", + "highestWaveEndless": "Highest Wave (Endless)", + "highestMoney": "Highest Money", + "highestDamage": "Highest Damage", + "highestHPHealed": "Highest HP Healed", + "pokemonEncountered": "Pokémon Encountered", + "pokemonDefeated": "Pokémon Defeated", + "pokemonCaught": "Pokémon Caught", + "eggsHatched": "Eggs Hatched", + "subLegendsSeen": "Sub-Legends Seen", + "subLegendsCaught": "Sub-Legends Caught", + "subLegendsHatched": "Sub-Legends Hatched", + "legendsSeen": "Legends Seen", + "legendsCaught": "Legends Caught", + "legendsHatched": "Legends Hatched", + "mythicalsSeen": "Mythicals Seen", + "mythicalsCaught": "Mythicals Caught", + "mythicalsHatched": "Mythicals Hatched", + "shiniesSeen": "Shinies Seen", + "shiniesCaught": "Shinies Caught", + "shiniesHatched": "Shinies Hatched", + "pokemonFused": "Pokémon Fused", + "trainersDefeated": "Trainers Defeated", + "eggsPulled": "Eggs Pulled", + "rareEggsPulled": "Rare Eggs Pulled", + "epicEggsPulled": "Epic Eggs Pulled", + "legendaryEggsPulled": "Legendary Eggs Pulled", + "manaphyEggsPulled": "Manaphy Eggs Pulled", +} as const; diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index c3e047f422e..37d698c5a22 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const frConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/fr/game-stats-ui-handler.ts b/src/locales/fr/game-stats-ui-handler.ts new file mode 100644 index 00000000000..1f368f1ff43 --- /dev/null +++ b/src/locales/fr/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Statistiques", + "playTime": "Temps de jeu", + "totalBattles": "Total combats", + "shinyStarters": "Starters chroma", + "starters": "Starters", + "speciesSeen": "Espèces vues", + "speciesCaught": "Espèces capt.", + "ribbonsOwned": "Rubans possédés", + "classicRuns": "Parties en Classique", + "classicWins": "Victoires en Classique", + "dailyRunAttempts": "Essais Défi du jour", + "dailyRunWins": "Victoires Défi du jour", + "endlessRuns": "Parties en Infini", + "highestWaveEndless": "Record vagues (Infini)", + "highestMoney": "Record d’argent", + "highestDamage": "Record de dégâts", + "highestHPHealed": "Record PV soignés", + "pokemonEncountered": "Pokémon rencontrés", + "pokemonDefeated": "Pokémon battus", + "pokemonCaught": "Pokémon capturés", + "eggsHatched": "Œufs éclos", + "subLegendsSeen": "Semi-légendaires vus", + "subLegendsCaught": "Semi-légendaires capt.", + "subLegendsHatched": "Semi-légendaires éclos", + "legendsSeen": "Legendaires vus", + "legendsCaught": "Légendaires capt.", + "legendsHatched": "Légendaires éclos", + "mythicalsSeen": "Fabuleux vus", + "mythicalsCaught": "Fabuleux capt.", + "mythicalsHatched": "Fabuleux éclos", + "shiniesSeen": "Chromatiques vus", + "shiniesCaught": "Chromatiques capt.", + "shiniesHatched": "Chromatiques éclos", + "pokemonFused": "Pokémon fusionnés", + "trainersDefeated": "Dresseurs battus", + "eggsPulled": "Œufs obtenus", + "rareEggsPulled": "Œufs Rares", + "epicEggsPulled": "Œufs Épiques", + "legendaryEggsPulled": "Œufs Légendaires", + "manaphyEggsPulled": "Œufs de Manaphy", +} as const; diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index 8b90b3a32f6..e630914db1a 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const itConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/it/game-stats-ui-handler.ts b/src/locales/it/game-stats-ui-handler.ts new file mode 100644 index 00000000000..64e4e2af5e3 --- /dev/null +++ b/src/locales/it/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Stats", + "playTime": "Play Time", + "totalBattles": "Total Battles", + "starters": "Starters", + "shinyStarters": "Shiny Starters", + "speciesSeen": "Species Seen", + "speciesCaught": "Species Caught", + "ribbonsOwned": "Ribbons Owned", + "classicRuns": "Classic Runs", + "classicWins": "Classic Wins", + "dailyRunAttempts": "Daily Run Attempts", + "dailyRunWins": "Daily Run Wins", + "endlessRuns": "Endless Runs", + "highestWaveEndless": "Highest Wave (Endless)", + "highestMoney": "Highest Money", + "highestDamage": "Highest Damage", + "highestHPHealed": "Highest HP Healed", + "pokemonEncountered": "Pokémon Encountered", + "pokemonDefeated": "Pokémon Defeated", + "pokemonCaught": "Pokémon Caught", + "eggsHatched": "Eggs Hatched", + "subLegendsSeen": "Sub-Legends Seen", + "subLegendsCaught": "Sub-Legends Caught", + "subLegendsHatched": "Sub-Legends Hatched", + "legendsSeen": "Legends Seen", + "legendsCaught": "Legends Caught", + "legendsHatched": "Legends Hatched", + "mythicalsSeen": "Mythicals Seen", + "mythicalsCaught": "Mythicals Caught", + "mythicalsHatched": "Mythicals Hatched", + "shiniesSeen": "Shinies Seen", + "shiniesCaught": "Shinies Caught", + "shiniesHatched": "Shinies Hatched", + "pokemonFused": "Pokémon Fused", + "trainersDefeated": "Trainers Defeated", + "eggsPulled": "Eggs Pulled", + "rareEggsPulled": "Rare Eggs Pulled", + "epicEggsPulled": "Epic Eggs Pulled", + "legendaryEggsPulled": "Legendary Eggs Pulled", + "manaphyEggsPulled": "Manaphy Eggs Pulled", +} as const; diff --git a/src/locales/pt_BR/config.ts b/src/locales/pt_BR/config.ts index 3bb7f213448..0710fc07924 100644 --- a/src/locales/pt_BR/config.ts +++ b/src/locales/pt_BR/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const ptBrConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/pt_BR/game-stats-ui-handler.ts b/src/locales/pt_BR/game-stats-ui-handler.ts new file mode 100644 index 00000000000..64e4e2af5e3 --- /dev/null +++ b/src/locales/pt_BR/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Stats", + "playTime": "Play Time", + "totalBattles": "Total Battles", + "starters": "Starters", + "shinyStarters": "Shiny Starters", + "speciesSeen": "Species Seen", + "speciesCaught": "Species Caught", + "ribbonsOwned": "Ribbons Owned", + "classicRuns": "Classic Runs", + "classicWins": "Classic Wins", + "dailyRunAttempts": "Daily Run Attempts", + "dailyRunWins": "Daily Run Wins", + "endlessRuns": "Endless Runs", + "highestWaveEndless": "Highest Wave (Endless)", + "highestMoney": "Highest Money", + "highestDamage": "Highest Damage", + "highestHPHealed": "Highest HP Healed", + "pokemonEncountered": "Pokémon Encountered", + "pokemonDefeated": "Pokémon Defeated", + "pokemonCaught": "Pokémon Caught", + "eggsHatched": "Eggs Hatched", + "subLegendsSeen": "Sub-Legends Seen", + "subLegendsCaught": "Sub-Legends Caught", + "subLegendsHatched": "Sub-Legends Hatched", + "legendsSeen": "Legends Seen", + "legendsCaught": "Legends Caught", + "legendsHatched": "Legends Hatched", + "mythicalsSeen": "Mythicals Seen", + "mythicalsCaught": "Mythicals Caught", + "mythicalsHatched": "Mythicals Hatched", + "shiniesSeen": "Shinies Seen", + "shiniesCaught": "Shinies Caught", + "shiniesHatched": "Shinies Hatched", + "pokemonFused": "Pokémon Fused", + "trainersDefeated": "Trainers Defeated", + "eggsPulled": "Eggs Pulled", + "rareEggsPulled": "Rare Eggs Pulled", + "epicEggsPulled": "Epic Eggs Pulled", + "legendaryEggsPulled": "Legendary Eggs Pulled", + "manaphyEggsPulled": "Manaphy Eggs Pulled", +} as const; diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index b9b17339ab5..102f0823133 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { gameStatsUiHandler } from "./game-stats-ui-handler"; import { voucher } from "./voucher"; import { PGMdialogue, @@ -56,6 +57,7 @@ export const zhCnConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, + gameStatsUiHandler: gameStatsUiHandler, voucher: voucher, biome: biome, PGMdialogue: PGMdialogue, diff --git a/src/locales/zh_CN/game-stats-ui-handler.ts b/src/locales/zh_CN/game-stats-ui-handler.ts new file mode 100644 index 00000000000..64e4e2af5e3 --- /dev/null +++ b/src/locales/zh_CN/game-stats-ui-handler.ts @@ -0,0 +1,44 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const gameStatsUiHandler: SimpleTranslationEntries = { + "stats": "Stats", + "playTime": "Play Time", + "totalBattles": "Total Battles", + "starters": "Starters", + "shinyStarters": "Shiny Starters", + "speciesSeen": "Species Seen", + "speciesCaught": "Species Caught", + "ribbonsOwned": "Ribbons Owned", + "classicRuns": "Classic Runs", + "classicWins": "Classic Wins", + "dailyRunAttempts": "Daily Run Attempts", + "dailyRunWins": "Daily Run Wins", + "endlessRuns": "Endless Runs", + "highestWaveEndless": "Highest Wave (Endless)", + "highestMoney": "Highest Money", + "highestDamage": "Highest Damage", + "highestHPHealed": "Highest HP Healed", + "pokemonEncountered": "Pokémon Encountered", + "pokemonDefeated": "Pokémon Defeated", + "pokemonCaught": "Pokémon Caught", + "eggsHatched": "Eggs Hatched", + "subLegendsSeen": "Sub-Legends Seen", + "subLegendsCaught": "Sub-Legends Caught", + "subLegendsHatched": "Sub-Legends Hatched", + "legendsSeen": "Legends Seen", + "legendsCaught": "Legends Caught", + "legendsHatched": "Legends Hatched", + "mythicalsSeen": "Mythicals Seen", + "mythicalsCaught": "Mythicals Caught", + "mythicalsHatched": "Mythicals Hatched", + "shiniesSeen": "Shinies Seen", + "shiniesCaught": "Shinies Caught", + "shiniesHatched": "Shinies Hatched", + "pokemonFused": "Pokémon Fused", + "trainersDefeated": "Trainers Defeated", + "eggsPulled": "Eggs Pulled", + "rareEggsPulled": "Rare Eggs Pulled", + "epicEggsPulled": "Epic Eggs Pulled", + "legendaryEggsPulled": "Legendary Eggs Pulled", + "manaphyEggsPulled": "Manaphy Eggs Pulled", +} as const; diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 7d2e8e66904..5dbd3879238 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -178,7 +178,8 @@ declare module "i18next" { modifierType: ModifierTypeTranslationEntries; battleMessageUiHandler: SimpleTranslationEntries; berry: BerryTranslationEntries; - voucher: SimpleTranslationEntries; + gameStatsUiHandler: SimpleTranslationEntries; + voucher: SimpleTranslationEntries; biome: SimpleTranslationEntries; PGMdialogue: DialogueTranslationEntries; PGMbattleSpecDialogue: SimpleTranslationEntries; diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index b4823010734..fed9ec11b48 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -7,9 +7,10 @@ import * as Utils from "../utils"; import { DexAttr, GameData } from "../system/game-data"; import { speciesStarters } from "../data/pokemon-species"; import {Button} from "../enums/buttons"; +import i18next from "../plugins/i18n"; interface DisplayStat { - label?: string; + label_key?: string; sourceFunc?: (gameData: GameData) => string; hidden?: boolean; } @@ -20,70 +21,193 @@ interface DisplayStats { const displayStats: DisplayStats = { playTime: { + label_key: "playTime", sourceFunc: gameData => Utils.getPlayTimeString(gameData.gameStats.playTime) }, - battles: "Total Battles", + battles: { + label_key: "totalBattles", + sourceFunc: gameData => gameData.gameStats.battles.toString(), + }, startersUnlocked: { - label: "Starters", + label_key: "starters", sourceFunc: gameData => { const starterCount = gameData.getStarterCount(d => !!d.caughtAttr); return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`; } }, shinyStartersUnlocked: { - label: "Shiny Starters", + label_key: "shinyStarters", sourceFunc: gameData => { const starterCount = gameData.getStarterCount(d => !!(d.caughtAttr & DexAttr.SHINY)); return `${starterCount} (${Math.floor((starterCount / Object.keys(speciesStarters).length) * 1000) / 10}%)`; } }, dexSeen: { - label: "Species Seen", + label_key: "speciesSeen", sourceFunc: gameData => { const seenCount = gameData.getSpeciesCount(d => !!d.seenAttr); return `${seenCount} (${Math.floor((seenCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`; } }, dexCaught: { - label: "Species Caught", + label_key: "speciesCaught", sourceFunc: gameData => { const caughtCount = gameData.getSpeciesCount(d => !!d.caughtAttr); return `${caughtCount} (${Math.floor((caughtCount / Object.keys(gameData.dexData).length) * 1000) / 10}%)`; } }, - ribbonsOwned: "Ribbons Owned", - classicSessionsPlayed: "Classic Runs", - sessionsWon: "Classic Wins", - dailyRunSessionsPlayed: "Daily Run Attempts", - dailyRunSessionsWon: "Daily Run Wins", - endlessSessionsPlayed: "Endless Runs?", - highestEndlessWave: "Highest Wave (Endless)?", - highestMoney: "Highest Money", - highestDamage: "Highest Damage", - highestHeal: "Highest HP Healed", - pokemonSeen: "Pokémon Encountered", - pokemonDefeated: "Pokémon Defeated", - pokemonCaught: "Pokémon Caught", - pokemonHatched: "Eggs Hatched", - subLegendaryPokemonSeen: "Sub-Legends Seen?", - subLegendaryPokemonCaught: "Sub-Legends Caught?", - subLegendaryPokemonHatched: "Sub-Legends Hatched?", - legendaryPokemonSeen: "Legends Seen?", - legendaryPokemonCaught: "Legends Caught?", - legendaryPokemonHatched: "Legends Hatched?", - mythicalPokemonSeen: "Mythicals Seen?", - mythicalPokemonCaught: "Mythicals Caught?", - mythicalPokemonHatched: "Mythicals Hatched?", - shinyPokemonSeen: "Shinies Seen?", - shinyPokemonCaught: "Shinies Caught?", - shinyPokemonHatched: "Shinies Hatched?", - pokemonFused: "Pokémon Fused?", - trainersDefeated: "Trainers Defeated", - eggsPulled: "Eggs Pulled", - rareEggsPulled: "Rare Eggs Pulled?", - epicEggsPulled: "Epic Eggs Pulled?", - legendaryEggsPulled: "Legendary Eggs Pulled?", - manaphyEggsPulled: "Manaphy Eggs Pulled?" + ribbonsOwned: { + label_key: "ribbonsOwned", + sourceFunc: gameData => gameData.gameStats.ribbonsOwned.toString(), + }, + classicSessionsPlayed:{ + label_key: "classicRuns", + sourceFunc: gameData => gameData.gameStats.classicSessionsPlayed.toString(), + }, + sessionsWon: { + label_key: "classicWins", + sourceFunc: gameData => gameData.gameStats.sessionsWon.toString(), + }, + dailyRunSessionsPlayed: { + label_key: "dailyRunAttempts", + sourceFunc: gameData => gameData.gameStats.dailyRunSessionsPlayed.toString(), + }, + dailyRunSessionsWon: { + label_key: "dailyRunWins", + sourceFunc: gameData => gameData.gameStats.dailyRunSessionsWon.toString(), + }, + endlessSessionsPlayed: { + label_key: "endlessRuns", + sourceFunc: gameData => gameData.gameStats.endlessSessionsPlayed.toString(), + hidden: true + }, + highestEndlessWave: { + label_key: "highestWaveEndless", + sourceFunc: gameData => gameData.gameStats.highestEndlessWave.toString(), + hidden: true + }, + highestMoney: { + label_key: "highestMoney", + sourceFunc: gameData => Utils.formatFancyLargeNumber(gameData.gameStats.highestMoney, 3), + }, + highestDamage: { + label_key: "highestDamage", + sourceFunc: gameData => gameData.gameStats.highestDamage.toString(), + }, + highestHeal: { + label_key: "highestHPHealed", + sourceFunc: gameData => gameData.gameStats.highestHeal.toString(), + }, + pokemonSeen: { + label_key: "pokemonEncountered", + sourceFunc: gameData => gameData.gameStats.pokemonSeen.toString(), + }, + pokemonDefeated: { + label_key: "pokemonDefeated", + sourceFunc: gameData => gameData.gameStats.pokemonDefeated.toString(), + }, + pokemonCaught: { + label_key: "pokemonCaught", + sourceFunc: gameData => gameData.gameStats.pokemonCaught.toString(), + }, + pokemonHatched: { + label_key: "eggsHatched", + sourceFunc: gameData => gameData.gameStats.pokemonHatched.toString(), + }, + subLegendaryPokemonSeen: { + label_key: "subLegendsSeen", + sourceFunc: gameData => gameData.gameStats.subLegendaryPokemonSeen.toString(), + hidden: true + }, + subLegendaryPokemonCaught: { + label_key: "subLegendsCaught", + sourceFunc: gameData => gameData.gameStats.subLegendaryPokemonCaught.toString(), + hidden: true + }, + subLegendaryPokemonHatched: { + label_key: "subLegendsHatched", + sourceFunc: gameData => gameData.gameStats.subLegendaryPokemonHatched.toString(), + hidden: true + }, + legendaryPokemonSeen: { + label_key: "legendsSeen", + sourceFunc: gameData => gameData.gameStats.legendaryPokemonSeen.toString(), + hidden: true + }, + legendaryPokemonCaught: { + label_key: "legendsCaught", + sourceFunc: gameData => gameData.gameStats.legendaryPokemonCaught.toString(), + hidden: true + }, + legendaryPokemonHatched: { + label_key: "legendsHatched", + sourceFunc: gameData => gameData.gameStats.legendaryPokemonHatched.toString(), + hidden: true + }, + mythicalPokemonSeen: { + label_key: "mythicalsSeen", + sourceFunc: gameData => gameData.gameStats.mythicalPokemonSeen.toString(), + hidden: true + }, + mythicalPokemonCaught: { + label_key: "mythicalsCaught", + sourceFunc: gameData => gameData.gameStats.mythicalPokemonCaught.toString(), + hidden: true + }, + mythicalPokemonHatched: { + label_key: "mythicalsHatched", + sourceFunc: gameData => gameData.gameStats.legendaryPokemonHatched.toString(), + hidden: true + }, + shinyPokemonSeen: { + label_key: "shiniesSeen", + sourceFunc: gameData => gameData.gameStats.shinyPokemonSeen.toString(), + hidden: true + }, + shinyPokemonCaught: { + label_key: "shiniesCaught", + sourceFunc: gameData => gameData.gameStats.shinyPokemonCaught.toString(), + hidden: true + }, + shinyPokemonHatched: { + label_key: "shiniesHatched", + sourceFunc: gameData => gameData.gameStats.shinyPokemonHatched.toString(), + hidden: true + }, + pokemonFused: { + label_key: "pokemonFused", + sourceFunc: gameData => gameData.gameStats.pokemonFused.toString(), + hidden: true + }, + trainersDefeated: { + label_key: "trainersDefeated", + sourceFunc: gameData => gameData.gameStats.trainersDefeated.toString(), + }, + eggsPulled: { + label_key: "eggsPulled", + sourceFunc: gameData => gameData.gameStats.eggsPulled.toString(), + hidden: true + }, + rareEggsPulled: { + label_key: "rareEggsPulled", + sourceFunc: gameData => gameData.gameStats.rareEggsPulled.toString(), + hidden: true + }, + epicEggsPulled: { + label_key: "epicEggsPulled", + sourceFunc: gameData => gameData.gameStats.epicEggsPulled.toString(), + hidden: true + }, + legendaryEggsPulled: { + label_key: "legendaryEggsPulled", + sourceFunc: gameData => gameData.gameStats.legendaryEggsPulled.toString(), + hidden: true + }, + manaphyEggsPulled: { + label_key: "manaphyEggsPulled", + sourceFunc: gameData => gameData.gameStats.manaphyEggsPulled.toString(), + hidden: true + }, }; export default class GameStatsUiHandler extends UiHandler { @@ -110,7 +234,7 @@ export default class GameStatsUiHandler extends UiHandler { const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24); 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.setPositionRelative(headerBg, 8, 4); @@ -127,13 +251,15 @@ export default class GameStatsUiHandler extends UiHandler { this.statsContainer = this.scene.add.container(0, 0); + new Array(18).fill(null).map((_, s) => { - const statLabel = addTextObject(this.scene, 8 + (s % 2 === 1 ? statsBgWidth : 0), 28 + Math.floor(s / 2) * 16, "", TextStyle.SETTINGS_LABEL); + + const statLabel = addTextObject(this.scene, 8 + (s % 2 === 1 ? statsBgWidth : 0), 28 + Math.floor(s / 2) * 16, "", TextStyle.STATS_LABEL); statLabel.setOrigin(0, 0); this.statsContainer.add(statLabel); this.statLabels.push(statLabel); - const statValue = addTextObject(this.scene, (statsBgWidth * ((s % 2) + 1)) - 8, statLabel.y, "", TextStyle.WINDOW); + const statValue = addTextObject(this.scene, (statsBgWidth * ((s % 2) + 1)) - 8, statLabel.y, "", TextStyle.STATS_VALUE); statValue.setOrigin(1, 0); this.statsContainer.add(statValue); this.statValues.push(statValue); @@ -173,7 +299,7 @@ export default class GameStatsUiHandler extends UiHandler { statKeys.forEach((key, s) => { const stat = displayStats[key] as DisplayStat; const value = stat.sourceFunc(this.scene.gameData); - this.statLabels[s].setText(!stat.hidden || isNaN(parseInt(value)) || parseInt(value) ? stat.label : "???"); + this.statLabels[s].setText(!stat.hidden || isNaN(parseInt(value)) || parseInt(value) ? i18next.t(`gameStatsUiHandler:${stat.label_key}`) : "???"); this.statValues[s].setText(value); }); if (statKeys.length < 18) { @@ -229,31 +355,3 @@ export default class GameStatsUiHandler extends UiHandler { this.gameStatsContainer.setVisible(false); } } - -export function initStatsKeys() { - const statKeys = Object.keys(displayStats); - - for (const key of statKeys) { - if (typeof displayStats[key] === "string") { - let label = displayStats[key] as string; - let hidden = false; - if (label.endsWith("?")) { - label = label.slice(0, -1); - hidden = true; - } - displayStats[key] = { - label: label, - sourceFunc: gameData => gameData.gameStats[key].toString(), - hidden: hidden - }; - } else if (displayStats[key] === null) { - displayStats[key] = { - sourceFunc: gameData => gameData.gameStats[key].toString() - }; - } - if (!(displayStats[key] as DisplayStat).label) { - const splittableKey = key.replace(/([a-z]{2,})([A-Z]{1}(?:[^A-Z]|$))/g, "$1_$2"); - (displayStats[key] as DisplayStat).label = Utils.toReadableString(`${splittableKey[0].toUpperCase()}${splittableKey.slice(1)}`); - } - } -} diff --git a/src/ui/text.ts b/src/ui/text.ts index c9f75360f95..e3bfb1445aa 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -22,6 +22,8 @@ export enum TextStyle { SUMMARY_GRAY, SUMMARY_GREEN, MONEY, + STATS_LABEL, + STATS_VALUE, SETTINGS_LABEL, SETTINGS_SELECTED, TOOLTIP_TITLE, @@ -112,6 +114,33 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio case TextStyle.WINDOW_ALT: shadowXpos = 3; shadowYpos = 3; + break; + case TextStyle.STATS_LABEL: + let fontSizeLabel = "96px"; + switch (lang) { + case "de": + fontSizeLabel = "80px"; + break; + default: + fontSizeLabel = "96px"; + break; + } + styleOptions.fontSize = fontSizeLabel; + break; + case TextStyle.STATS_VALUE: + shadowXpos = 3; + shadowYpos = 3; + let fontSizeValue = "96px"; + switch (lang) { + case "de": + fontSizeValue = "80px"; + break; + default: + fontSizeValue = "96px"; + break; + } + styleOptions.fontSize = fontSizeValue; + break; case TextStyle.MESSAGE: case TextStyle.SETTINGS_LABEL: case TextStyle.SETTINGS_SELECTED: @@ -199,6 +228,10 @@ export function getTextColor(textStyle: TextStyle, shadow?: boolean, uiTheme: Ui return !shadow ? "#e8e8a8" : "#a0a060"; case TextStyle.SUMMARY_GRAY: return !shadow ? "#a0a0a0" : "#636363"; + case TextStyle.STATS_LABEL: + return !shadow ? "#f8b050" : "#c07800"; + case TextStyle.STATS_VALUE: + return !shadow ? "#f8f8f8" : "#6b5a73"; case TextStyle.SUMMARY_GREEN: return !shadow ? "#78c850" : "#306850"; case TextStyle.SETTINGS_LABEL: diff --git a/src/utils.ts b/src/utils.ts index 995eef1bba2..faf3d8f54bf 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -217,6 +217,26 @@ export function formatLargeNumber(count: integer, threshold: integer): string { return `${ret.slice(0, digits)}${decimalNumber ? `.${decimalNumber}` : ""}${suffix}`; } +// Abbreviations from 10^0 to 10^33 +const AbbreviationsLargeNumber: string[] = ["", "K", "M", "B", "t", "q", "Q", "s", "S", "o", "n", "d"]; + +export function formatFancyLargeNumber(number: number, rounded: number = 2): string { + let exponent: number; + + if (number < 1000) { + exponent = 0; + } else { + const maxExp = AbbreviationsLargeNumber.length - 1; + + exponent = Math.floor(Math.log(number) / Math.log(1000)); + exponent = Math.min(exponent, maxExp); + + number /= Math.pow(1000, exponent); + } + + return `${(exponent === 0) ? number : number.toFixed(rounded)}${AbbreviationsLargeNumber[exponent]}`; +} + export function formatStat(stat: integer, forHp: boolean = false): string { return formatLargeNumber(stat, forHp ? 100000 : 1000000); }