import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';

export interface DicHeroRewads {
    readonly id: number;
    readonly min: number;
    readonly max: number;
    readonly heroscore: number;
    readonly reward:  Array<RewardInter>;

}

export const dicHeroRewads = new Array<DicHeroRewads>();
export function loadPvpHeroReward() {
    dicHeroRewads.splice(0, dicHeroRewads.length);
    let arr = readFileAndParse(FILENAME.DIC_PVP_HERO_REWARD);

    arr.forEach(o => {
        o.reward = parseGoodStr(o.reward);
        dicHeroRewads.push(o);
    });
    arr = undefined;
}