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

export interface DicGVGContributeBox {
    // 唯一id
    readonly id: number;
    // 职能 1-贤臣 2-猛将
    readonly job: number;
    // 所需积分点
    readonly boxPoint: number;
    // 奖励，普通背包物品
    readonly boxReward: RewardInter[];
    // 奖励，联军相关道具物品
    readonly boxLeagueReward: RewardInter[];
}

export const dicGVGContributeBox = new Map<number, DicGVGContributeBox>();
export function loadGVGContributeBox() {
    dicGVGContributeBox.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_GVG_CONTRIBUTE_BOX);
    arr.forEach(o => {
        o.boxReward = parseGoodStr(o.boxReward);
        o.boxLeagueReward = parseGoodStr(o.boxLeagueReward)
        dicGVGContributeBox.set(o.id, o);
    });
    arr = undefined;
}