// 武将特技表
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';

export interface DicRefine {

    // 精炼id
    readonly id: number;
    // 精炼等级
    readonly level: number;
    // 精炼次数
    readonly count: number;
    // 等级限制
    readonly levelLimited: number;
    // 提高属性百分比
    readonly upPercent: number;
    // 材料
    readonly consume: Array<RewardInter>;
}

export const dicRefine = new Map<number, DicRefine>();
export function loadRefine() {
    dicRefine.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_REFINE);

    arr.forEach(o => {
        o.consume = parseGoodStr(o.consume)
        dicRefine.set(o.id, o);
    });
    
    arr = undefined;
}