import { readFileAndParse, parseGoodStr } from '../util' import { FILENAME } from '../../consts' type KeysEnum = { [P in keyof Required]: 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[]; // 翻牌子的奖励,随机其中一个 } const DicGuildTrainInfoKeys: KeysEnum = { id: true, trainId: true, trainLv: true, heroId: true, heroRewards: true }; export const dicGuildTrainInfo = new Map(); 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); // TODO 这个改到 dicGuildTrainInfo.set(`${o.trainId}_${o.heroId}`,_.pick(o, Object.keys(DicGuildTrainInfoKeys))); }); arr = undefined; }