41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { readFileAndParse, parseGoodStr, parseNumberList } from '../util'
|
|
import { FILENAME } from '../../consts'
|
|
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
|
import { RewardInter } from '../interface';
|
|
const _ = require('lodash');
|
|
|
|
// 训练场关卡信息(按攻击的武将区分)
|
|
export interface DicGuildTrainInfo {
|
|
|
|
readonly id: number;
|
|
readonly trainId: number;
|
|
readonly trainLv: number; // 试炼场等级
|
|
readonly heroId: number;
|
|
readonly heroRewards: RewardInter[]; // 翻牌子的奖励,随机其中一个
|
|
readonly difficulty: number[]; // 难度
|
|
}
|
|
|
|
const DicGuildTrainInfoKeys: KeysEnum<DicGuildTrainInfo> = {
|
|
id: true,
|
|
trainId: true,
|
|
trainLv: true,
|
|
heroId: true,
|
|
heroRewards: true,
|
|
difficulty: true,
|
|
};
|
|
|
|
export const dicGuildTrainInfo = new Map<string, DicGuildTrainInfo>();
|
|
export function loadGuildTrainInfo() {
|
|
dicGuildTrainInfo.clear();
|
|
|
|
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_INFO);
|
|
|
|
arr.forEach(o => {
|
|
o.heroId = o.heroid;
|
|
o.heroRewards = parseGoodStr(o.shilianReward);
|
|
o.difficulty = parseNumberList(o.war_id);
|
|
|
|
dicGuildTrainInfo.set(`${o.trainId}_${o.heroId}`,_.pick(o, Object.keys(DicGuildTrainInfoKeys)));
|
|
});
|
|
arr = undefined;
|
|
} |