// 主线任务阶段内容
import {readFileAndParse, parseNumberList, parseGoodStr} from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';

export interface DicMainTaskStage {
    // id
    readonly id: number;
    // 阶段
    readonly stageId: number;
    // 包括哪些id
    readonly mainTaskId: number[];
    // 奖励
    readonly reward: RewardInter[];
}

export const dicMainTaskStage = new Map<number, DicMainTaskStage>();
export function loadMainTaskStage() {
    dicMainTaskStage.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_MAIN_TASK_STAGE);

    arr.forEach(o => {
        o.mainTaskId = parseNumberList(o.mainTaskId);
        o.reward = parseGoodStr(o.reward);
        dicMainTaskStage.set(o.id, o);
    });
    arr = undefined;
}