// 军团活动
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME } from '../../consts'

export interface DicGuildActivity {

    // id
    readonly id: number;
    // 开启日期 星期几
    readonly openDay: number[];
    // 持续时间 秒
    duringTime: number;
    // 开启时间 几点
    startTime: number;
    // 开启时间 几点
    startMinute: number;
    // 开始倒计时 几点
    startSeconds: number;
    // 开始倒计时 几点
    readonly countDown: number;
    // 对应关卡id
    readonly warid: number;
    // 基础功勋值
    readonly honour: number;

}

export const dicGuildActivity = new Map<number, DicGuildActivity>();
export function loadGuildActivity() {
    dicGuildActivity.clear();
    
    let arr = readFileAndParse(FILENAME.DIC_GUILD_ACTIVITY);

    arr.forEach(o => {
        o.openDay = parseNumberList(o.openDay);
        let time = o.startTime.split(':');
        o.startTime = parseInt(time[0]);
        o.startMinute = parseInt(time[1]);
        o.startSeconds = parseInt(time[2]);
        dicGuildActivity.set( o.id, o );
    });
    arr = undefined;
}