mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Update voucher.ts
This commit is contained in:
parent
13f2cafe5e
commit
2feb4a9a66
@ -2,6 +2,7 @@ import BattleScene from "../battle-scene";
|
|||||||
import { TrainerType } from "../data/enums/trainer-type";
|
import { TrainerType } from "../data/enums/trainer-type";
|
||||||
import { ModifierTier } from "../modifier/modifier-tier";
|
import { ModifierTier } from "../modifier/modifier-tier";
|
||||||
import { Achv, AchvTier, achvs } from "./achv";
|
import { Achv, AchvTier, achvs } from "./achv";
|
||||||
|
import i18next from '../plugins/i18n';
|
||||||
|
|
||||||
export enum VoucherType {
|
export enum VoucherType {
|
||||||
REGULAR,
|
REGULAR,
|
||||||
@ -52,13 +53,13 @@ export class Voucher {
|
|||||||
export function getVoucherTypeName(voucherType: VoucherType): string {
|
export function getVoucherTypeName(voucherType: VoucherType): string {
|
||||||
switch (voucherType) {
|
switch (voucherType) {
|
||||||
case VoucherType.REGULAR:
|
case VoucherType.REGULAR:
|
||||||
return 'Egg Voucher';
|
return i18next.t("voucher:eggVoucher");
|
||||||
case VoucherType.PLUS:
|
case VoucherType.PLUS:
|
||||||
return 'Egg Voucher Plus';
|
return i18next.t("voucher:eggVoucherPlus");
|
||||||
case VoucherType.PREMIUM:
|
case VoucherType.PREMIUM:
|
||||||
return 'Egg Voucher Premium';
|
return i18next.t("voucher:eggVoucherPremium");
|
||||||
case VoucherType.GOLDEN:
|
case VoucherType.GOLDEN:
|
||||||
return 'Egg Voucher Gold';
|
return i18next.t("voucher:eggVoucherGold");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,9 +76,8 @@ export function getVoucherTypeIcon(voucherType: VoucherType): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface Vouchers {
|
export interface Vouchers {
|
||||||
[key: string]: Voucher
|
[key: string]: Voucher;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const vouchers: Vouchers = {};
|
export const vouchers: Vouchers = {};
|
||||||
@ -87,6 +87,8 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
|
|||||||
{
|
{
|
||||||
(function() {
|
(function() {
|
||||||
import('../data/trainer-config').then(tc => {
|
import('../data/trainer-config').then(tc => {
|
||||||
|
const trainerConfigs = tc.trainerConfigs;
|
||||||
|
|
||||||
for (let achv of voucherAchvs) {
|
for (let achv of voucherAchvs) {
|
||||||
const voucherType = achv.score >= 150
|
const voucherType = achv.score >= 150
|
||||||
? VoucherType.GOLDEN
|
? VoucherType.GOLDEN
|
||||||
@ -98,7 +100,6 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
|
|||||||
vouchers[achv.id] = new Voucher(voucherType, achv.description);
|
vouchers[achv.id] = new Voucher(voucherType, achv.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
const trainerConfigs = tc.trainerConfigs;
|
|
||||||
const bossTrainerTypes = Object.keys(trainerConfigs)
|
const bossTrainerTypes = Object.keys(trainerConfigs)
|
||||||
.filter(tt => trainerConfigs[tt].isBoss && trainerConfigs[tt].getDerivedType() !== TrainerType.RIVAL);
|
.filter(tt => trainerConfigs[tt].isBoss && trainerConfigs[tt].getDerivedType() !== TrainerType.RIVAL);
|
||||||
|
|
||||||
@ -107,12 +108,17 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
|
|||||||
? VoucherType.PLUS
|
? VoucherType.PLUS
|
||||||
: VoucherType.PREMIUM;
|
: VoucherType.PREMIUM;
|
||||||
const key = TrainerType[trainerType];
|
const key = TrainerType[trainerType];
|
||||||
vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`);
|
const trainerName = trainerConfigs[trainerType].name;
|
||||||
|
vouchers[key] = new Voucher(
|
||||||
|
voucherType,
|
||||||
|
i18next.t("voucher:defeatTrainer", { trainerName })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const voucherKeys = Object.keys(vouchers);
|
const voucherKeys = Object.keys(vouchers);
|
||||||
for (let k of voucherKeys)
|
for (let k of voucherKeys) {
|
||||||
vouchers[k].id = k;
|
vouchers[k].id = k;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user