Files
ZYZ/shared/pubUtils/dictionary/DicTaskBox.ts
2021-04-20 17:52:50 +08:00

37 lines
1.1 KiB
TypeScript

// 主线任务阶段内容
import {readJsonFile, parseGoodStr} from '../util'
import { FILENAME, TASK_FUN_TYPE } from '../../consts'
import { RewardInter } from '../interface';
export interface DicTaskBox {
// id
readonly id: number;
// 积分
readonly point: number;
// 奖励
readonly reward: RewardInter[];
}
export const dicTaskBox = new Map<number, Map<number, DicTaskBox>>();
const str1 = readJsonFile(FILENAME.DIC_TASK_BOX);
let arr1 = JSON.parse(str1);
arr1.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
});
arr1 = undefined;
const str2 = readJsonFile(FILENAME.DIC_ACHIEVEMENT_BOX);
let arr2 = JSON.parse(str2);
arr2.forEach(o => {
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
}
o.reward = parseGoodStr(o.reward);
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
});
arr2 = undefined;