// 各种操作可以增加的活跃
import { readFileAndParse, decodeIdCntArrayStr } from '../util'
import { FILENAME } from '../../consts'

export interface DicGuildActiveWays {

    // id
    readonly id: number;
    // 最大次数
    readonly count: number;
    // 奖励
    readonly activePoint: Map<string, number>;

}

export const dicGuildActiveWays = new Map<number, DicGuildActiveWays>();
export function loadGuildActiveWays() {
    dicGuildActiveWays.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_ARMY_ACTIVE_POINT_WAYS);

    arr.forEach(o => {
        o.activePoint = decodeIdCntArrayStr(o.activePoint, 1);
        if(!o.count) o.count = o.cout;
        dicGuildActiveWays.set(o.id, o);
    });
    arr = undefined;
}