// pvp三个对手
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';

export interface DicPvpRefreshConsume {
    // id
    readonly id: number;
    // 次数
    readonly count: number;
    // 消耗
    readonly consume: RewardInter[]
}

export const dicPvpRefreshConsume = new Map<number, RewardInter[]>();
export const maxPvpRefreshCnt = { max: 0 };
export function loadPvpRefreshConsume() {
    dicPvpRefreshConsume.clear();
    maxPvpRefreshCnt.max = 0;
    
    let arr = readFileAndParse(FILENAME.DIC_PVP_REFRESH_CONSUME);

    arr.forEach(o => {
        o.consume = parseGoodStr(o.consume);
        if(o.count > maxPvpRefreshCnt.max) maxPvpRefreshCnt.max = o.count;
        dicPvpRefreshConsume.set(o.count, o.consume);
    });
    
    arr = undefined;
}