Files
ZYZ/shared/pubUtils/dictionary/DicApBuy.ts
2021-10-15 18:16:05 +08:00

24 lines
717 B
TypeScript

import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicApBuy {
// 购买次数
readonly times: number;
// 消耗
readonly cost: RewardInter[];
}
export const dicApMaxBuyTimes = { max: 0 };
export const dicApBuy = new Map<number, RewardInter[]>();
export function loadApBuy() {
dicApMaxBuyTimes.max = 0;
dicApBuy.clear();
let arr = readFileAndParse(FILENAME.DIC_AP_BUY_COST);
arr.forEach(o => {
o.cost = parseGoodStr(o.cost);
dicApBuy.set(o.times, o.cost);
if(o.times > dicApMaxBuyTimes.max) dicApMaxBuyTimes.max = o.times;
});
arr = undefined;
}