试炼
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicArmyTrainJuDian {
|
||||
|
||||
readonly id: number;
|
||||
// 目标品质
|
||||
readonly trainInstances: Array<{hid: number, warId: number, progress: number}>;
|
||||
readonly heroRewards: Array<{id: number, count: number}>;
|
||||
}
|
||||
|
||||
const DicArmyTrainJuDianKeys: KeysEnum<DicArmyTrainJuDian> = {
|
||||
id: true,
|
||||
trainInstances: true,
|
||||
heroRewards: true
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_TRAIN_JU_DIAN);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyTrainJuDian = new Map<number, DicArmyTrainJuDian>();
|
||||
arr.forEach(o => {
|
||||
o.trainInstances = o.gkid.split('|').map(element => {
|
||||
let arr = element.split('&');
|
||||
return {hid: parseInt(arr[0]), warId: parseInt(arr[1]), progress: parseInt(arr[2])};
|
||||
});
|
||||
|
||||
o.heroRewards = parseGoodStr(o.shilianReward);
|
||||
|
||||
dicArmyTrainJuDian.set(o.id,_.pick(o, Object.keys(DicArmyTrainJuDianKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
Reference in New Issue
Block a user