mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 23:12:20 +02:00
Compare commits
No commits in common. "87f55a8a1adddff38b95c383e2840a0fb3f3bfec" and "60aa61e56e06ff263b2d7a718be31001efde607c" have entirely different histories.
87f55a8a1a
...
60aa61e56e
@ -42431,6 +42431,7 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.TORTERRA,
|
||||
Species.BUDEW,
|
||||
Species.ROSERADE,
|
||||
Species.WORMADAM,
|
||||
Species.CHERUBI,
|
||||
Species.CHERRIM,
|
||||
Species.CARNIVINE,
|
||||
@ -42448,7 +42449,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.PETILIL,
|
||||
Species.LILLIGANT,
|
||||
Species.MARACTUS,
|
||||
Species.MINCCINO,
|
||||
Species.CINCCINO,
|
||||
Species.DEERLING,
|
||||
Species.SAWSBUCK,
|
||||
@ -42511,10 +42511,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.DIPPLIN,
|
||||
Species.OGERPON,
|
||||
Species.HYDRAPPLE,
|
||||
[
|
||||
Species.WORMADAM,
|
||||
"plant",
|
||||
],
|
||||
Species.ALOLA_EXEGGUTOR,
|
||||
Species.HISUI_VOLTORB,
|
||||
Species.HISUI_ELECTRODE,
|
||||
@ -45988,7 +45984,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.TEDDIURSA,
|
||||
Species.URSARING,
|
||||
Species.HITMONTOP,
|
||||
Species.COMBUSKEN,
|
||||
Species.BLAZIKEN,
|
||||
Species.BRELOOM,
|
||||
Species.MAKUHITA,
|
||||
@ -48617,7 +48612,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.WOOBAT,
|
||||
Species.SWOOBAT,
|
||||
Species.SEWADDLE,
|
||||
Species.SWADLOON,
|
||||
Species.LEAVANNY,
|
||||
Species.SIGILYPH,
|
||||
Species.ARCHEOPS,
|
||||
@ -48647,9 +48641,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.ROWLET,
|
||||
Species.DARTRIX,
|
||||
Species.DECIDUEYE,
|
||||
Species.PIKIPEK,
|
||||
Species.TRUMBEAK,
|
||||
Species.TOUCANNON,
|
||||
Species.VIKAVOLT,
|
||||
Species.ORICORIO,
|
||||
Species.TYPE_NULL,
|
||||
@ -49171,8 +49162,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.AZELF,
|
||||
Species.REGIGIGAS,
|
||||
Species.DARKRAI,
|
||||
Species.PIGNITE,
|
||||
Species.EMBOAR,
|
||||
Species.AUDINO,
|
||||
Species.TIMBURR,
|
||||
Species.GURDURR,
|
||||
@ -49803,13 +49792,10 @@ export const tmSpecies: TmSpecies = {
|
||||
],
|
||||
[Moves.BRAVE_BIRD]: [
|
||||
Species.PIDGEY,
|
||||
Species.PIDGEOTTO,
|
||||
Species.PIDGEOT,
|
||||
Species.ZUBAT,
|
||||
Species.GOLBAT,
|
||||
Species.FARFETCHD,
|
||||
Species.DODUO,
|
||||
Species.DODRIO,
|
||||
Species.ARTICUNO,
|
||||
Species.ZAPDOS,
|
||||
Species.MOLTRES,
|
||||
@ -49820,7 +49806,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MURKROW,
|
||||
Species.DELIBIRD,
|
||||
Species.SKARMORY,
|
||||
Species.LUGIA,
|
||||
Species.HO_OH,
|
||||
Species.BLAZIKEN,
|
||||
Species.TAILLOW,
|
||||
@ -49848,8 +49833,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.DARTRIX,
|
||||
Species.DECIDUEYE,
|
||||
Species.PIKIPEK,
|
||||
Species.TRUMBEAK,
|
||||
Species.TOUCANNON,
|
||||
Species.TAPU_KOKO,
|
||||
Species.ROOKIDEE,
|
||||
Species.CORVISQUIRE,
|
||||
@ -50025,7 +50008,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MUDSDALE,
|
||||
Species.SANDYGAST,
|
||||
Species.PALOSSAND,
|
||||
Species.MINIOR,
|
||||
Species.NECROZMA,
|
||||
Species.RILLABOOM,
|
||||
Species.DREDNAW,
|
||||
@ -51986,7 +51968,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.BEHEEYEM,
|
||||
Species.CRYOGONAL,
|
||||
Species.DRUDDIGON,
|
||||
Species.GOLETT,
|
||||
Species.GOLURK,
|
||||
Species.PAWNIARD,
|
||||
Species.BISHARP,
|
||||
@ -52029,7 +52010,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MELTAN,
|
||||
Species.MELMETAL,
|
||||
Species.CORVIKNIGHT,
|
||||
Species.PERRSERKER,
|
||||
Species.CUFANT,
|
||||
Species.COPPERAJAH,
|
||||
Species.DURALUDON,
|
||||
@ -53219,8 +53199,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.NUMEL,
|
||||
Species.CAMERUPT,
|
||||
Species.TORKOAL,
|
||||
Species.TRAPINCH,
|
||||
Species.VIBRAVA,
|
||||
Species.FLYGON,
|
||||
Species.LUNATONE,
|
||||
Species.SOLROCK,
|
||||
@ -53464,9 +53442,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.NUMEL,
|
||||
Species.CAMERUPT,
|
||||
Species.TORKOAL,
|
||||
Species.TRAPINCH,
|
||||
Species.VIBRAVA,
|
||||
Species.FLYGON,
|
||||
Species.LUNATONE,
|
||||
Species.SOLROCK,
|
||||
Species.BARBOACH,
|
||||
@ -53549,7 +53524,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.HYDREIGON,
|
||||
Species.COBALION,
|
||||
Species.TERRAKION,
|
||||
Species.ZEKROM,
|
||||
Species.LANDORUS,
|
||||
Species.BINACLE,
|
||||
Species.BARBARACLE,
|
||||
@ -54596,7 +54570,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.SLOWBRO,
|
||||
Species.DROWZEE,
|
||||
Species.HYPNO,
|
||||
Species.EXEGGCUTE,
|
||||
Species.EXEGGUTOR,
|
||||
Species.STARMIE,
|
||||
Species.MR_MIME,
|
||||
@ -54648,7 +54621,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MESPRIT,
|
||||
Species.AZELF,
|
||||
Species.CRESSELIA,
|
||||
Species.DARKRAI,
|
||||
Species.ARCEUS,
|
||||
Species.VICTINI,
|
||||
Species.MUNNA,
|
||||
@ -54672,7 +54644,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.ESPURR,
|
||||
Species.MEOWSTIC,
|
||||
Species.AROMATISSE,
|
||||
Species.INKAY,
|
||||
Species.MALAMAR,
|
||||
Species.SYLVEON,
|
||||
Species.KLEFKI,
|
||||
@ -55090,7 +55061,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.NIDOQUEEN,
|
||||
Species.NIDOKING,
|
||||
Species.VILEPLUME,
|
||||
Species.VENOMOTH,
|
||||
Species.DUGTRIO,
|
||||
Species.BELLSPROUT,
|
||||
Species.WEEPINBELL,
|
||||
@ -55195,7 +55165,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MAGNEMITE,
|
||||
Species.MAGNETON,
|
||||
Species.ONIX,
|
||||
Species.RHYHORN,
|
||||
Species.RHYDON,
|
||||
Species.SNORLAX,
|
||||
Species.MEW,
|
||||
@ -55228,7 +55197,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.TURTWIG,
|
||||
Species.GROTLE,
|
||||
Species.TORTERRA,
|
||||
Species.RAMPARDOS,
|
||||
Species.SHIELDON,
|
||||
Species.BASTIODON,
|
||||
Species.BRONZOR,
|
||||
@ -55244,8 +55212,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.REGIGIGAS,
|
||||
Species.ARCEUS,
|
||||
Species.TEPIG,
|
||||
Species.PIGNITE,
|
||||
Species.EMBOAR,
|
||||
Species.ROGGENROLA,
|
||||
Species.BOLDORE,
|
||||
Species.GIGALITH,
|
||||
@ -55256,7 +55222,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.BEARTIC,
|
||||
Species.GOLETT,
|
||||
Species.GOLURK,
|
||||
Species.COBALION,
|
||||
Species.CARBINK,
|
||||
Species.AVALUGG,
|
||||
Species.VOLCANION,
|
||||
@ -55338,7 +55303,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.FLAAFFY,
|
||||
Species.AMPHAROS,
|
||||
Species.ELEKID,
|
||||
Species.RAIKOU,
|
||||
Species.ELECTRIKE,
|
||||
Species.MANECTRIC,
|
||||
Species.PLUSLE,
|
||||
@ -55350,8 +55314,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MAGNEZONE,
|
||||
Species.ELECTIVIRE,
|
||||
Species.ROTOM,
|
||||
Species.BLITZLE,
|
||||
Species.ZEBSTRIKA,
|
||||
Species.EMOLGA,
|
||||
Species.JOLTIK,
|
||||
Species.GALVANTULA,
|
||||
@ -59723,7 +59685,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.NIDORINO,
|
||||
Species.NIDOKING,
|
||||
Species.RAPIDASH,
|
||||
Species.DODRIO,
|
||||
Species.SEEL,
|
||||
Species.DEWGONG,
|
||||
Species.CLOYSTER,
|
||||
@ -59738,7 +59699,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.FORRETRESS,
|
||||
Species.DUNSPARCE,
|
||||
Species.STEELIX,
|
||||
Species.SKARMORY,
|
||||
Species.DELIBIRD,
|
||||
Species.HITMONTOP,
|
||||
Species.BALTOY,
|
||||
@ -60592,7 +60552,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.ARCANINE,
|
||||
Species.PONYTA,
|
||||
Species.RAPIDASH,
|
||||
Species.DEWGONG,
|
||||
Species.MEW,
|
||||
Species.CYNDAQUIL,
|
||||
Species.QUILAVA,
|
||||
@ -60623,8 +60582,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.SKITTY,
|
||||
Species.DELCATTY,
|
||||
Species.MAWILE,
|
||||
Species.PLUSLE,
|
||||
Species.MINUN,
|
||||
Species.VOLBEAT,
|
||||
Species.ILLUMISE,
|
||||
Species.SWABLU,
|
||||
@ -60646,7 +60603,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.UXIE,
|
||||
Species.MESPRIT,
|
||||
Species.AZELF,
|
||||
Species.SHAYMIN,
|
||||
Species.LILLIPUP,
|
||||
Species.HERDIER,
|
||||
Species.STOUTLAND,
|
||||
@ -66320,13 +66276,8 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.BLOODMOON_URSALUNA,
|
||||
],
|
||||
[Moves.ICE_SPINNER]: [
|
||||
Species.SQUIRTLE,
|
||||
Species.WARTORTLE,
|
||||
Species.BLASTOISE,
|
||||
Species.JIGGLYPUFF,
|
||||
Species.WIGGLYTUFF,
|
||||
Species.SEEL,
|
||||
Species.DEWGONG,
|
||||
Species.SHELLDER,
|
||||
Species.CLOYSTER,
|
||||
Species.ARTICUNO,
|
||||
@ -66339,12 +66290,9 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.DUNSPARCE,
|
||||
Species.DELIBIRD,
|
||||
Species.DONPHAN,
|
||||
Species.HITMONTOP,
|
||||
Species.LUDICOLO,
|
||||
Species.SNORUNT,
|
||||
Species.GLALIE,
|
||||
Species.REGICE,
|
||||
Species.REGISTEEL,
|
||||
Species.PIPLUP,
|
||||
Species.PRINPLUP,
|
||||
Species.EMPOLEON,
|
||||
@ -66356,14 +66304,10 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.ABOMASNOW,
|
||||
Species.WEAVILE,
|
||||
Species.FROSLASS,
|
||||
Species.CINCCINO,
|
||||
Species.CRYOGONAL,
|
||||
Species.MIENSHAO,
|
||||
Species.BERGMITE,
|
||||
Species.AVALUGG,
|
||||
Species.POPPLIO,
|
||||
Species.BRIONNE,
|
||||
Species.PRIMARINA,
|
||||
Species.CRABOMINABLE,
|
||||
Species.MAREANIE,
|
||||
Species.TOXAPEX,
|
||||
@ -66901,9 +66845,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.BLOODMOON_URSALUNA,
|
||||
],
|
||||
[Moves.CHILLING_WATER]: [
|
||||
Species.SQUIRTLE,
|
||||
Species.WARTORTLE,
|
||||
Species.BLASTOISE,
|
||||
Species.CLEFAIRY,
|
||||
Species.CLEFABLE,
|
||||
Species.JIGGLYPUFF,
|
||||
@ -66915,19 +66856,12 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.POLIWAG,
|
||||
Species.POLIWHIRL,
|
||||
Species.POLIWRATH,
|
||||
Species.TENTACOOL,
|
||||
Species.TENTACRUEL,
|
||||
Species.SLOWPOKE,
|
||||
Species.SLOWBRO,
|
||||
Species.SEEL,
|
||||
Species.DEWGONG,
|
||||
Species.SHELLDER,
|
||||
Species.CLOYSTER,
|
||||
Species.CHANSEY,
|
||||
Species.HORSEA,
|
||||
Species.SEADRA,
|
||||
Species.GYARADOS,
|
||||
Species.LAPRAS,
|
||||
Species.VAPOREON,
|
||||
Species.SNORLAX,
|
||||
Species.DRATINI,
|
||||
@ -66935,13 +66869,8 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.DRAGONITE,
|
||||
Species.MEWTWO,
|
||||
Species.MEW,
|
||||
Species.TOTODILE,
|
||||
Species.CROCONAW,
|
||||
Species.FERALIGATR,
|
||||
Species.SENTRET,
|
||||
Species.FURRET,
|
||||
Species.CHINCHOU,
|
||||
Species.LANTURN,
|
||||
Species.CLEFFA,
|
||||
Species.MARILL,
|
||||
Species.AZUMARILL,
|
||||
@ -66953,13 +66882,7 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.DUNSPARCE,
|
||||
Species.QWILFISH,
|
||||
Species.DELIBIRD,
|
||||
Species.KINGDRA,
|
||||
Species.BLISSEY,
|
||||
Species.SUICUNE,
|
||||
Species.LUGIA,
|
||||
Species.MUDKIP,
|
||||
Species.MARSHTOMP,
|
||||
Species.SWAMPERT,
|
||||
Species.LOTAD,
|
||||
Species.LOMBRE,
|
||||
Species.LUDICOLO,
|
||||
@ -66985,8 +66908,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.MILOTIC,
|
||||
Species.SNORUNT,
|
||||
Species.GLALIE,
|
||||
Species.LATIAS,
|
||||
Species.LATIOS,
|
||||
Species.KYOGRE,
|
||||
Species.PIPLUP,
|
||||
Species.PRINPLUP,
|
||||
@ -67012,8 +66933,6 @@ export const tmSpecies: TmSpecies = {
|
||||
"",
|
||||
"origin",
|
||||
],
|
||||
Species.PHIONE,
|
||||
Species.MANAPHY,
|
||||
Species.ARCEUS,
|
||||
Species.OSHAWOTT,
|
||||
Species.DEWOTT,
|
||||
@ -67024,8 +66943,6 @@ export const tmSpecies: TmSpecies = {
|
||||
"blue-striped",
|
||||
"white-striped",
|
||||
],
|
||||
Species.MINCCINO,
|
||||
Species.CINCCINO,
|
||||
Species.DUCKLETT,
|
||||
Species.SWANNA,
|
||||
Species.ALOMOMOLA,
|
||||
@ -67033,7 +66950,6 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.BEARTIC,
|
||||
Species.CRYOGONAL,
|
||||
Species.TORNADUS,
|
||||
Species.KELDEO,
|
||||
Species.FROAKIE,
|
||||
Species.FROGADIER,
|
||||
[
|
||||
@ -67054,17 +66970,12 @@ export const tmSpecies: TmSpecies = {
|
||||
Species.GOODRA,
|
||||
Species.BERGMITE,
|
||||
Species.AVALUGG,
|
||||
Species.POPPLIO,
|
||||
Species.BRIONNE,
|
||||
Species.PRIMARINA,
|
||||
Species.YUNGOOS,
|
||||
Species.GUMSHOOS,
|
||||
Species.CRABRAWLER,
|
||||
Species.CRABOMINABLE,
|
||||
Species.MAREANIE,
|
||||
Species.TOXAPEX,
|
||||
Species.DEWPIDER,
|
||||
Species.ARAQUANID,
|
||||
Species.ORANGURU,
|
||||
Species.PASSIMIAN,
|
||||
Species.SANDYGAST,
|
||||
|
@ -342,8 +342,8 @@ export class LoadingScene extends SceneBase {
|
||||
|
||||
this.loadLoadingScreen();
|
||||
|
||||
initAchievements();
|
||||
initVouchers();
|
||||
initAchievements();
|
||||
initStatsKeys();
|
||||
initPokemonPrevolutions();
|
||||
initBiomes();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { clientSessionId } from "#app/account";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { getCharVariantFromDialogue } from "#app/data/dialogue";
|
||||
import { miscDialogue, getCharVariantFromDialogue } from "#app/data/dialogue";
|
||||
import { pokemonEvolutions } from "#app/data/pokemon-evolutions";
|
||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { trainerConfigs } from "#app/data/trainer-config";
|
||||
@ -136,16 +136,12 @@ export class GameOverPhase extends BattlePhase {
|
||||
};
|
||||
|
||||
if (this.victory && this.scene.gameMode.isClassic) {
|
||||
const dialogueKey = "miscDialogue:ending";
|
||||
const message = miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1];
|
||||
|
||||
if (!this.scene.ui.shouldSkipDialogue(dialogueKey)) {
|
||||
if (!this.scene.ui.shouldSkipDialogue(message)) {
|
||||
this.scene.ui.fadeIn(500).then(() => {
|
||||
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
// Dialogue has to be retrieved so that the rival's expressions can be loaded and shown via getCharVariantFromDialogue
|
||||
const dialogue = i18next.t(dialogueKey, { context: genderStr });
|
||||
this.scene.charSprite.showCharacter(`rival_${this.scene.gameData.gender === PlayerGender.FEMALE ? "m" : "f"}`, getCharVariantFromDialogue(dialogue)).then(() => {
|
||||
this.scene.ui.showDialogue(dialogueKey, this.scene.gameData.gender === PlayerGender.FEMALE ? trainerConfigs[TrainerType.RIVAL].name : trainerConfigs[TrainerType.RIVAL].nameFemale, null, () => {
|
||||
this.scene.charSprite.showCharacter(`rival_${this.scene.gameData.gender === PlayerGender.FEMALE ? "m" : "f"}`, getCharVariantFromDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1])).then(() => {
|
||||
this.scene.ui.showDialogue(message, this.scene.gameData.gender === PlayerGender.FEMALE ? trainerConfigs[TrainerType.RIVAL].name : trainerConfigs[TrainerType.RIVAL].nameFemale, null, () => {
|
||||
this.scene.ui.fadeOut(500).then(() => {
|
||||
this.scene.charSprite.hide().then(() => {
|
||||
const endCardPhase = new EndCardPhase(this.scene);
|
||||
|
@ -324,7 +324,7 @@ export const achvs = {
|
||||
HATCH_SHINY: new Achv("HATCH_SHINY", "", "HATCH_SHINY.description", "golden_egg", 100).setSecret(),
|
||||
HIDDEN_ABILITY: new Achv("HIDDEN_ABILITY", "", "HIDDEN_ABILITY.description", "ability_charm", 75),
|
||||
PERFECT_IVS: new Achv("PERFECT_IVS", "", "PERFECT_IVS.description", "blunder_policy", 100),
|
||||
CLASSIC_VICTORY: new Achv("CLASSIC_VICTORY", "", "CLASSIC_VICTORY.description", "relic_crown", 150, c => c.gameData.gameStats.sessionsWon === 0),
|
||||
CLASSIC_VICTORY: new Achv("CLASSIC_VICTORY", "", "CLASSIC_VICTORY.description", "relic_crown", 150),
|
||||
UNEVOLVED_CLASSIC_VICTORY: new Achv("UNEVOLVED_CLASSIC_VICTORY", "", "UNEVOLVED_CLASSIC_VICTORY.description", "eviolite", 175, c => c.getParty().some(p => p.getSpeciesForm(true).speciesId in pokemonEvolutions)),
|
||||
MONO_GEN_ONE_VICTORY: new ChallengeAchv("MONO_GEN_ONE", "", "MONO_GEN_ONE.description", "ribbon_gen1", 100, (c, scene) => c instanceof SingleGenerationChallenge && c.value === 1 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
||||
MONO_GEN_TWO_VICTORY: new ChallengeAchv("MONO_GEN_TWO", "", "MONO_GEN_TWO.description", "ribbon_gen2", 100, (c, scene) => c instanceof SingleGenerationChallenge && c.value === 2 && !scene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0)),
|
||||
|
22
src/ui/ui.ts
22
src/ui/ui.ts
@ -306,32 +306,30 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||
}
|
||||
}
|
||||
|
||||
showDialogue(keyOrText: string, name: string | undefined, delay: integer | null = 0, callback: Function, callbackDelay?: integer, promptDelay?: integer): void {
|
||||
showDialogue(i18nKey: string, name: string | undefined, delay: integer | null = 0, callback: Function, callbackDelay?: integer, promptDelay?: integer): void {
|
||||
const battleScene = this.scene as BattleScene;
|
||||
|
||||
// Get localized dialogue (if available)
|
||||
let hasi18n = false;
|
||||
let text = keyOrText;
|
||||
if (i18next.exists(i18nKey) ) {
|
||||
const genderIndex = battleScene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
|
||||
if (i18next.exists(keyOrText) ) {
|
||||
const i18nKey = keyOrText;
|
||||
i18nKey = i18next.t(i18nKey, { context: genderStr });
|
||||
hasi18n = true;
|
||||
text = i18next.t(i18nKey, { context: genderStr }); // override text with translation
|
||||
|
||||
// Skip dialogue if the player has enabled the option and the dialogue has been already seen
|
||||
if (battleScene.skipSeenDialogues && battleScene.gameData.getSeenDialogues()[i18nKey] === true) {
|
||||
if (battleScene.skipSeenDialogues &&battleScene.gameData.getSeenDialogues()[i18nKey] === true) {
|
||||
console.log(`Dialogue ${i18nKey} skipped`);
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
let showMessageAndCallback = () => {
|
||||
hasi18n && battleScene.gameData.saveSeenDialogue(keyOrText);
|
||||
hasi18n && battleScene.gameData.saveSeenDialogue(i18nKey);
|
||||
callback();
|
||||
};
|
||||
if (text.indexOf("$") > -1) {
|
||||
const messagePages = text.split(/\$/g).map(m => m.trim());
|
||||
if (i18nKey.indexOf("$") > -1) {
|
||||
const messagePages = i18nKey.split(/\$/g).map(m => m.trim());
|
||||
for (let p = messagePages.length - 1; p >= 0; p--) {
|
||||
const originalFunc = showMessageAndCallback;
|
||||
showMessageAndCallback = () => this.showDialogue(messagePages[p], name, null, originalFunc);
|
||||
@ -340,9 +338,9 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||
} else {
|
||||
const handler = this.getHandler();
|
||||
if (handler instanceof MessageUiHandler) {
|
||||
(handler as MessageUiHandler).showDialogue(text, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
|
||||
(handler as MessageUiHandler).showDialogue(i18nKey, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
|
||||
} else {
|
||||
this.getMessageHandler().showDialogue(text, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
|
||||
this.getMessageHandler().showDialogue(i18nKey, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user