// 藏宝图合成表
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME } from '../../consts'
const _ = require('lodash');

export interface DicHeroEquip {
    readonly itId: number;
    readonly classId: Array<number>;
}

type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicHeroEquipKeys: KeysEnum<DicHeroEquip> = {
    itId: true, 
    classId: true
}
export const dicHeroEquip = new Map<number, DicHeroEquip>();
export function loadHeroEquip() {
    let arr = readFileAndParse(FILENAME.DIC_HERO_EQUIP);

    arr.forEach(o => {
        o.classId = parseNumberList(o.classId);
        dicHeroEquip.set(o.itId, _.pick(o, Object.keys(DicHeroEquipKeys)));
    });
    
    arr = undefined;
}