// 武将特技表
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'

export interface DicServerName {
    // id
    readonly id: number;
    // 小区名
    readonly name: string;
}

export const dicServerName = new Map<number, string>();
export const dicServerGroupName = new Map<number, string>();
export function loadServerName() {
    dicServerName.clear();
    dicServerGroupName.clear();
    
    {
        let arr = readFileAndParse(FILENAME.DIC_SERVER_NAME);
    
        arr.forEach(o => {
            let { id, sname } = o;
            dicServerName.set(id, sname);
        });
        arr = undefined;
    }

    {
        let arr = readFileAndParse(FILENAME.DIC_SERVER_GROUP_NAME);
    
        arr.forEach(o => {
            let { id, groupName } = o;
            dicServerGroupName.set(id, groupName);
        });
        arr = undefined;
    }
}