🐞 fix(gvg): 投石车路由
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { GVGTeamMem } from "../../domain/battleField/gvgBattle";
|
import { GVGTeamMem } from "../../domain/battleField/gvgBattle";
|
||||||
import { GVGLeagueModel, GVGLeagueType } from "../../db/GVGLeague";
|
import { GVGLeagueModel, GVGLeagueType } from "../../db/GVGLeague";
|
||||||
import { GVGTeamModel, GVGTeamType, GVGTeamUpdate } from "../../db/GVGTeam";
|
import GVGTeam, { GVGTeamModel, GVGTeamType, GVGTeamUpdate } from "../../db/GVGTeam";
|
||||||
import { GVGCityModel, GVGCityType } from "../../db/GVGCity";
|
import { GVGCityModel, GVGCityType } from "../../db/GVGCity";
|
||||||
import { gameData, getGVGBattleRankReward } from "../../pubUtils/data";
|
import { gameData, getGVGBattleRankReward } from "../../pubUtils/data";
|
||||||
import { COUNTER, GVG_AREA_TYPE, GVG_ATTACK_TYPE, GVG_BATTLE_RANK_TYPE, GVG_PERIOD, GVG_POINT_TYPE, GVG_SERVER_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROUTE, REDIS_KEY, STATUS } from "../../consts";
|
import { COUNTER, GVG_AREA_TYPE, GVG_ATTACK_TYPE, GVG_BATTLE_RANK_TYPE, GVG_PERIOD, GVG_POINT_TYPE, GVG_SERVER_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROUTE, REDIS_KEY, SERVER_GROUP_FUN_TYPE, STATUS } from "../../consts";
|
||||||
import { getTimeFun, nowSeconds } from "../../pubUtils/timeUtil";
|
import { getTimeFun, nowSeconds } from "../../pubUtils/timeUtil";
|
||||||
import { DicGVGAreaPoint } from "../../pubUtils/dictionary/DicGVGAreaPoint";
|
import { DicGVGAreaPoint } from "../../pubUtils/dictionary/DicGVGAreaPoint";
|
||||||
import { getGVGBattleData, getGVGBattleMap } from "../memoryCache/gvgBattleData";
|
import { getGVGBattleData, getGVGBattleMap } from "../memoryCache/gvgBattleData";
|
||||||
@@ -29,6 +29,7 @@ import { HeroModel, HeroType } from "../../db/Hero";
|
|||||||
import { ArtifactModel } from "../../db/Artifact";
|
import { ArtifactModel } from "../../db/Artifact";
|
||||||
import { getHeroesAttributes } from "../playerCeService";
|
import { getHeroesAttributes } from "../playerCeService";
|
||||||
import { CounterModel } from "../../db/Counter";
|
import { CounterModel } from "../../db/Counter";
|
||||||
|
import { getGroupIdOfServer } from "../serverService";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取本联军上周占领的城池
|
* 获取本联军上周占领的城池
|
||||||
@@ -353,12 +354,11 @@ export function checkGVGBattleStart(roleId: string, attackTeam: GVGTeamType, def
|
|||||||
// —————————— 定时器相关 —————————— //
|
// —————————— 定时器相关 —————————— //
|
||||||
// gvg激战期开始定时器
|
// gvg激战期开始定时器
|
||||||
export async function gvgBattleStart() {
|
export async function gvgBattleStart() {
|
||||||
let servers = pinus.app.getServersByType('guild');
|
|
||||||
|
|
||||||
let { configId } = getGVGConfig();
|
let { configId } = getGVGConfig();
|
||||||
let guardCities = await GVGCityModel.findAllGuardCities(configId);
|
let guardCities = await GVGCityModel.findAllGuardCities(configId);
|
||||||
for(let { cityId, groupKey, guardLeague, guardLeagueName } of guardCities) {
|
for(let { cityId, groupKey, guardLeague, guardLeagueName } of guardCities) {
|
||||||
let sid = (await dispatch(redisClient(), cityId.toString(), servers, 'guild'))?.id;
|
let sid = await dispatchTeam(groupKey, cityId);
|
||||||
await pinus.app.rpc.guild.guildRemote.initCatapult.toServer(sid, cityId, groupKey, guardLeague, guardLeagueName);
|
await pinus.app.rpc.guild.guildRemote.initCatapult.toServer(sid, cityId, groupKey, guardLeague, guardLeagueName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -774,9 +774,24 @@ export async function initTeamToMem() {
|
|||||||
let teams = await GVGTeamModel.findByConfigId(configId);
|
let teams = await GVGTeamModel.findByConfigId(configId);
|
||||||
for(let team of teams) {
|
for(let team of teams) {
|
||||||
if(team.isBroken) continue;
|
if(team.isBroken) continue;
|
||||||
if((await dispatch(redisClient(), team.cityId.toString(), servers, 'guild'))?.id == sid) {
|
let dispacthSid = await dispatchTeam(team.groupKey, team.cityId);
|
||||||
|
if(dispacthSid == sid) {
|
||||||
let teamObj = getGVGBattleData(team.groupKey);
|
let teamObj = getGVGBattleData(team.groupKey);
|
||||||
teamObj.enterCity(team);
|
teamObj.enterCity(team);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function dispatchTeam(groupKey: string, cityId: number) {
|
||||||
|
let groupId = '';
|
||||||
|
if(groupKey.startsWith('s')) {
|
||||||
|
let serverId = parseInt(groupKey.slice(1));
|
||||||
|
groupId = (await getGroupIdOfServer(serverId, SERVER_GROUP_FUN_TYPE.GVG)).toString();
|
||||||
|
} else {
|
||||||
|
groupId = groupKey.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let servers = pinus.app.getServersByType('guild');
|
||||||
|
let sid = (await dispatch(redisClient(), `${groupId}_${cityId}`, servers, 'guild'))?.id;
|
||||||
|
return sid;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user