🐞 fix(gvg): 修复战区问题,不跨服服务器应单列
This commit is contained in:
@@ -11,17 +11,15 @@ import { getGVGPeriodData } from "./gvgService";
|
||||
const gvgBattleMap: Map<string, GVGBattleData> = new Map();
|
||||
|
||||
class GVGBattleData {
|
||||
public groupId: number; // 战区
|
||||
public serverType: number; // 单服还是跨服
|
||||
public groupKey: string; // 战区
|
||||
|
||||
private teams: Map<string, GVGTeamMem> = new Map(); // 队伍, teamCode => team
|
||||
private rolePoints: Map<string, Map<number, string>> = new Map(); // roleId => pointId[],用于更新玩家的积分
|
||||
private roleToTeam: Map<string, string[]> = new Map(); // roleId => teamCode
|
||||
public areaToTeams: Map<number, Set<string>> = new Map(); // areaId => teamCode set,用于定时下发地图玩家数据
|
||||
|
||||
constructor(groupId: number, serverType: number) {
|
||||
this.groupId = groupId;
|
||||
this.serverType = serverType;
|
||||
constructor(groupKey: string) {
|
||||
this.groupKey = groupKey;
|
||||
}
|
||||
|
||||
public findTeamsByArea(areaId: number) {
|
||||
@@ -158,12 +156,11 @@ class GVGBattleData {
|
||||
}
|
||||
}
|
||||
|
||||
export function getGVGBattleData(groupId: number, serverType: number) {
|
||||
let key = `${groupId}_${serverType}`;
|
||||
if(!gvgBattleMap.has(key)) {
|
||||
gvgBattleMap.set(key, new GVGBattleData(groupId, serverType));
|
||||
export function getGVGBattleData(groupKey: string) {
|
||||
if(!gvgBattleMap.has(groupKey)) {
|
||||
gvgBattleMap.set(groupKey, new GVGBattleData(groupKey));
|
||||
}
|
||||
return gvgBattleMap.get(key);
|
||||
return gvgBattleMap.get(groupKey);
|
||||
}
|
||||
|
||||
export function getGVGBattleMap() {
|
||||
@@ -178,7 +175,7 @@ export async function initTeamToMem() {
|
||||
let teams = await GVGTeamModel.findByConfigId(configId);
|
||||
for(let team of teams) {
|
||||
if(dispatch(team.cityId.toString(), servers)?.id == sid) {
|
||||
let teamObj = getGVGBattleData(team.groupId, team.serverType);
|
||||
let teamObj = getGVGBattleData(team.groupKey);
|
||||
teamObj.enterCity(team);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user