// 排行榜奖励表
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';

export interface DicRankReward {

    // 奖励id
    readonly id: number;
    // 排行榜id
    readonly rankId: number;
    // 条件
    readonly condition: number;
    // 奖励
    readonly reward: Array<RewardInter>;

}

export const dicRankReward = new Map<number, DicRankReward>();
export function loadRankReward() {
    dicRankReward.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_RANK_REWARD);

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