mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-19 06:42:20 +02:00
Update locale key usage
This commit is contained in:
parent
9a435552c4
commit
99d10b78af
@ -23,7 +23,7 @@ import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
|
|||||||
import { getTypeRgb } from "#app/data/type";
|
import { getTypeRgb } from "#app/data/type";
|
||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { NumberHolder, isNullOrUndefined, randInt, randSeedInt, randSeedShuffle } from "#app/utils";
|
import { NumberHolder, isNullOrUndefined, randInt, randSeedInt, randSeedShuffle, randSeedItem } from "#app/utils";
|
||||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||||
@ -986,8 +986,10 @@ function generateRandomTraderName() {
|
|||||||
// +1 avoids TrainerType.UNKNOWN
|
// +1 avoids TrainerType.UNKNOWN
|
||||||
const trainerTypePool = i18next.t("trainersCommon:" + TrainerType[randInt(length) + 1], { returnObjects: true });
|
const trainerTypePool = i18next.t("trainersCommon:" + TrainerType[randInt(length) + 1], { returnObjects: true });
|
||||||
// Some trainers have 2 gendered pools, some do not
|
// Some trainers have 2 gendered pools, some do not
|
||||||
const genderedPool = trainerTypePool[randInt(trainerTypePool.length)];
|
const gender = randInt(2) === 0 ? "MALE" : "FEMALE";
|
||||||
const trainerNameString = Array.isArray(genderedPool) ? genderedPool[randInt(genderedPool.length)] : genderedPool;
|
const trainerNameString = randSeedItem(
|
||||||
|
Object.values(trainerTypePool.hasOwnProperty(gender) ? trainerTypePool[gender] : trainerTypePool),
|
||||||
|
) as string;
|
||||||
// Some names have an '&' symbol and need to be trimmed to a single name instead of a double name
|
// Some names have an '&' symbol and need to be trimmed to a single name instead of a double name
|
||||||
const trainerNames = trainerNameString.split(" & ");
|
const trainerNames = trainerNameString.split(" & ");
|
||||||
return trainerNames[randInt(trainerNames.length)];
|
return trainerNames[randInt(trainerNames.length)];
|
||||||
|
@ -61,10 +61,16 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
this.config.partyTemplates.length - 1,
|
this.config.partyTemplates.length - 1,
|
||||||
);
|
);
|
||||||
if (i18next.exists("trainersCommon:" + TrainerType[trainerType], { returnObjects: true })) {
|
if (i18next.exists("trainersCommon:" + TrainerType[trainerType], { returnObjects: true })) {
|
||||||
const namePool = i18next.t("trainersCommon:" + TrainerType[trainerType], { returnObjects: true }) as any;
|
const namePool = i18next.t("trainersCommon:" + TrainerType[trainerType], { returnObjects: true });
|
||||||
this.name =
|
this.name =
|
||||||
name ||
|
name ||
|
||||||
Utils.randSeedItem(Array.isArray(namePool[0]) ? namePool[variant === TrainerVariant.FEMALE ? 1 : 0] : namePool);
|
Utils.randSeedItem(
|
||||||
|
Object.values(
|
||||||
|
namePool.hasOwnProperty("MALE")
|
||||||
|
? namePool[variant === TrainerVariant.FEMALE ? "FEMALE" : "MALE"]
|
||||||
|
: namePool,
|
||||||
|
),
|
||||||
|
);
|
||||||
if (variant === TrainerVariant.DOUBLE) {
|
if (variant === TrainerVariant.DOUBLE) {
|
||||||
if (this.config.doubleOnly) {
|
if (this.config.doubleOnly) {
|
||||||
if (partnerName) {
|
if (partnerName) {
|
||||||
@ -73,7 +79,9 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
[this.name, this.partnerName] = this.name.split(" & ");
|
[this.name, this.partnerName] = this.name.split(" & ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.partnerName = partnerName || Utils.randSeedItem(Array.isArray(namePool[0]) ? namePool[1] : namePool);
|
this.partnerName =
|
||||||
|
partnerName ||
|
||||||
|
Utils.randSeedItem(Object.values(namePool.hasOwnProperty("FEMALE") ? namePool["FEMALE"] : namePool));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user