40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// GVG城池
|
||
import { FILENAME } from '../../consts'
|
||
import { parseNumberList, readFileAndParse } from '../util'
|
||
|
||
export interface DicGVGArea {
|
||
// 区域id
|
||
readonly areaId: number;
|
||
// 大地图id
|
||
readonly mapId: string
|
||
// 大地图类型 1-单服 2-跨服
|
||
readonly mapType: number;
|
||
// 城池id
|
||
readonly cityId: number;
|
||
// 城池类型
|
||
readonly cityType: number;
|
||
// 区域类型 1-守方备战区 2-攻方备战区 3-大据点区 4-中据点区 5-小据点区 6-投石车区
|
||
readonly areaType: number;
|
||
// 区域管理
|
||
readonly relateArea: number[];
|
||
// 0表不能被投石车选中作为攻击区域,1表能
|
||
readonly catapultAttack: number;
|
||
}
|
||
|
||
export const dicGVGArea = new Map<number, DicGVGArea>();
|
||
export const dicGVGCity = new Map<number, { cityType: number, areaIds: number[] }>();
|
||
export function loadGVGArea() {
|
||
dicGVGArea.clear();
|
||
dicGVGCity.clear();
|
||
|
||
let arr = readFileAndParse(FILENAME.DIC_GVG_AREA);
|
||
arr.forEach(o => {
|
||
o.relateArea = parseNumberList(o.relateArea);
|
||
if(!dicGVGCity.has(o.cityId)) {
|
||
dicGVGCity.set(o.cityId, { cityType: o.cityType, areaIds: [] });
|
||
}
|
||
dicGVGCity.get(o.cityId)?.areaIds.push(o.areaId);
|
||
dicGVGArea.set(o.areaId, o);
|
||
});
|
||
arr = undefined;
|
||
} |