Update gts

This commit is contained in:
Dean 2025-04-01 14:24:15 -07:00
parent 3e875810de
commit 55e7079c82
2 changed files with 5 additions and 6 deletions

View File

@ -985,12 +985,11 @@ function doTradeReceivedSequence(
function generateRandomTraderName() { function generateRandomTraderName() {
const length = TrainerType.YOUNGSTER - TrainerType.ACE_TRAINER + 1; const length = TrainerType.YOUNGSTER - TrainerType.ACE_TRAINER + 1;
// +1 avoids TrainerType.UNKNOWN // +1 avoids TrainerType.UNKNOWN
const trainerTypePool = i18next.t("trainersCommon:" + TrainerType[randInt(length) + 1], { returnObjects: true }); const classKey = `trainersCommon:${TrainerType[randInt(length) + 1]}`;
// Some trainers have 2 gendered pools, some do not // Some trainers have 2 gendered pools, some do not
const gender = randInt(2) === 0 ? "MALE" : "FEMALE"; const genderKey = i18next.exists(`${classKey}.MALE`) ? (randInt(2) === 0 ? ".MALE" : ".FEMALE") : "";
const trainerNameString = randSeedItem( const trainerNameKey = randSeedItem(Object.keys(i18next.t(`${classKey}${genderKey}`, { returnObjects: true })));
Object.values(trainerTypePool.hasOwnProperty(gender) ? trainerTypePool[gender] : trainerTypePool), const trainerNameString = i18next.t(`${classKey}${genderKey}.${trainerNameKey}`);
) 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)];

View File

@ -70,7 +70,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
? variant === TrainerVariant.FEMALE ? variant === TrainerVariant.FEMALE
? ".FEMALE" ? ".FEMALE"
: ".MALE" : ".MALE"
: undefined; : "";
const trainerKey = Utils.randSeedItem( const trainerKey = Utils.randSeedItem(
Object.keys(i18next.t(`${classKey}${genderKey}`, { returnObjects: true })), Object.keys(i18next.t(`${classKey}${genderKey}`, { returnObjects: true })),
); );