Files
ZYZ/shared/pubUtils/dictionary/DicGVGArea.ts
2023-02-28 10:51:18 +08:00

49 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// GVG城池
import { FILENAME, GVG_AREA_TYPE } from '../../consts'
import { parseNumberList, readFileAndParse } from '../util'
export interface DicGVGArea {
// 区域id
readonly areaId: number;
// 区域名
readonly areaName: string;
// 大地图id
readonly mapId: string
// 大地图类型 1-单服 2-跨服
readonly mapType: number;
// 城池id
readonly cityId: number;
// 城池类型
readonly cityType: number;
// 城池名字
readonly cityName: string;
// 区域类型 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, mapType: number, battleAreaIds: number[], catapultAreaIds: number[], areaIds: number[], defenseBirth: number, attackBirth: number, cityName: string }>();
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, mapType: o.mapType, battleAreaIds: [], catapultAreaIds: [], areaIds: [], defenseBirth: 0, attackBirth: 0, cityName: o.cityName });
}
if(o.areaType == GVG_AREA_TYPE.BIG || o.areaType == GVG_AREA_TYPE.MIDDLE || o.areaType == GVG_AREA_TYPE.SMALL)
dicGVGCity.get(o.cityId)?.battleAreaIds.push(o.areaId);
if(o.areaType == GVG_AREA_TYPE.CATAPULT) dicGVGCity.get(o.cityId)?.catapultAreaIds.push(o.areaId);
if(o.areaType == GVG_AREA_TYPE.DEFENSER) dicGVGCity.get(o.cityId).defenseBirth = o.areaId;
if(o.areaType == GVG_AREA_TYPE.ATTACKER) dicGVGCity.get(o.cityId).attackBirth = o.areaId;
dicGVGCity.get(o.cityId)?.areaIds.push(o.areaId);
dicGVGArea.set(o.areaId, o);
});
arr = undefined;
}