// 公会权限
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../../pubUtils/interface';

export interface DicGuildAuction {

    // 活动类型 1-蛮夷入侵 2-诸侯混战 3-粮草先行
    readonly id: number;
    // 最低名次
    readonly min: number;
    // 最高名次
    readonly max: number;
    // 奖励
    readonly rewards: RewardInter[];
}

export const dicGuildAuction = new Map<number, DicGuildAuction[]>();
export function loadGuildAuction() {

    let arr = readFileAndParse(FILENAME.DIC_GUILD_AUCTION);

    arr.forEach(o => {
        o.rewards = parseGoodStr(o.rewards);
        let rank = dicGuildAuction.get(o.id)||[];
        rank.push(o);
        dicGuildAuction.set(o.id, rank);
    });
    arr = undefined;
}