// 任务奖励主公经验
import { readFileAndParse, } from '../util'
import { FILENAME, KING_EXP_RATIO_TYPE, } from '../../consts'

export interface DicKingExpRatio {
    // 主公等级
    readonly lv: number;
    // 主公经验
    readonly exp: number;
    // 关卡获得的武将经验
    readonly expGk: number;
}

export const dicKingExpRatio = new Map<number, Map<KING_EXP_RATIO_TYPE, number>>();
export function loadKingExpRatio() {
    dicKingExpRatio.clear();
    
    let arr1 = readFileAndParse(FILENAME.DIC_EXP_RATIO);
    arr1.forEach(o => {
        let map = new Map<KING_EXP_RATIO_TYPE, number>();
        map.set(KING_EXP_RATIO_TYPE.TASK, o.exp);
        map.set(KING_EXP_RATIO_TYPE.BATTLE, o.expGk);
        dicKingExpRatio.set(o.lv, map);
    });
    arr1 = undefined;
}