// 军团诸侯混战城池表
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME } from '../../consts'

export interface DicCityActivity {

    // 城池id
    readonly id: number;
    // 城池类型
    readonly type: number;
    // 下一次自动宣战城池
    readonly nextCity: number;
    // 上一个可解锁的
    readonly preCity: number[];
    // 难度系数
    readonly difficult: number;
    // 相应的出兵表
    readonly warid: number;
    // 城门血条
    readonly hp: number;
    // 可开启星期
    readonly week: number[];
}

export const dicCityActivity = new Map<number, DicCityActivity>();
export function loadCityActivity() {
    dicCityActivity.clear();
    let arr = readFileAndParse(FILENAME.DIC_CITY_ACTIVITY);

    arr.forEach(o => {
        o.preCity = parseNumberList(o.preCity);
        o.week = parseNumberList(o.week);
        dicCityActivity.set( o.id, o );
    });
    arr = undefined;
}