✨ feat(gvg): 激战期挑战相关接口整理
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
// 存在激战期的内存数据
|
||||
|
||||
import { GVGTeamType } from "../../db/GVGTeam";
|
||||
import { pinus } from "pinus";
|
||||
import { GVG_PERIOD } from "../../consts";
|
||||
import { GVGTeamModel, GVGTeamType } from "../../db/GVGTeam";
|
||||
import { GVGTeamMem } from "../../domain/battleField/gvgBattle";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { getGVGPeriodData } from "./gvgService";
|
||||
|
||||
// 积分点占领情况,groupId_serverType_cityId -> GVGBattleData
|
||||
const gvgBattleMap: Map<string, GVGBattleData> = new Map();
|
||||
@@ -44,7 +48,6 @@ class GVGBattleData {
|
||||
for(let team of teams) {
|
||||
let fromAreaId = this.teams.get(team.teamCode)?.areaId||0;
|
||||
|
||||
console.log('#### team', team.teamCode)
|
||||
if(!this.teams.has(team.teamCode)) {
|
||||
this.teams.set(team.teamCode, new GVGTeamMem(team))
|
||||
}
|
||||
@@ -107,4 +110,18 @@ export function getGVGBattleData(groupId: number, serverType: number) {
|
||||
gvgBattleMap.set(key, new GVGBattleData(groupId, serverType));
|
||||
}
|
||||
return gvgBattleMap.get(key);
|
||||
}
|
||||
|
||||
export async function initTeamToMem() {
|
||||
let sid = pinus.app.getServerId();
|
||||
let servers = pinus.app.getServersByType('guild');
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
if(period != GVG_PERIOD.BATTLE) return;
|
||||
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);
|
||||
teamObj.enterCity([team]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user