🐞 fix(gvg): 离开城池的时候未解锁
This commit is contained in:
@@ -10,7 +10,7 @@ import { getGVGBattleData, getGVGBattleMap } from "./gvgBattleMemory";
|
||||
import { GVGAttackSpine, GVGCityMapInfo, GVGTeamInList, GVGTeamInListOnPoint, GVGTeamSpineInMap } from "../../domain/gvgField/returnData";
|
||||
import { GVG } from "../../pubUtils/dicParam";
|
||||
import { GVGHeroInfo, PvpEnemies, PvpHeroInfo } from "../../domain/dbGeneral";
|
||||
import { getGroupKey, getGVGConfig, getGVGPeriodData } from "./gvgService";
|
||||
import { getGroupKey, getGVGConfig, getGVGConfigFromRemote, getGVGPeriodData } from "./gvgService";
|
||||
import { GVGLeaguePrepareModel } from "../../db/GVGLeaguePrepare";
|
||||
import { pinus } from "pinus";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
@@ -219,30 +219,31 @@ export async function generNewLineup(roleId: string, heroes: HeroType[], lineup:
|
||||
export async function leaveCity(isForce: boolean, roleId: string, serverId: number, guildCode: string, myLeague?: GVGLeagueType) {
|
||||
if(!myLeague) myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
let { configId } = getGVGConfig();
|
||||
let { configId } = await getGVGConfigFromRemote();
|
||||
let teams = await GVGTeamModel.findByRole(roleId);
|
||||
let hasPoint = !!teams.find(team => team.pointId > 0);
|
||||
|
||||
// console.log('######### leaveCity', configId, groupKey)
|
||||
if(isForce || !hasPoint) {
|
||||
await GVGTeamModel.leaveCity(roleId);
|
||||
await GVGCityModel.decreasePlayer(configId, groupKey, roleId);
|
||||
if(myLeague) await GVGUserDataModel.changeCity(configId, myLeague.leagueCode, roleId, 0);
|
||||
await GVGCityAreaPointModel.playerLeave(configId, groupKey, roleId);
|
||||
// 处理内存数据
|
||||
await pinus.app.rpc.guild.guildRemote.leaveCityMem.broadcast(groupKey, roleId, teams);
|
||||
await pinus.app.rpc.guild.guildRemote.leaveCityMem.broadcast(groupKey, roleId);
|
||||
for(let team of teams) {
|
||||
if(team.cityId > 0 && team.areaId > 0) {
|
||||
await sendMessageToGVGAreaByTeamWithSuc(groupKey, team.areaId, PUSH_ROUTE.GVG_PLAYER_LEAVE_AREA, {
|
||||
cityId: team.cityId, areaId: team.areaId, teamCode: team.teamCode
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function leaveCityMem(groupKey: string, roleId: string, teams: GVGTeamType[]) {
|
||||
export async function leaveCityMem(groupKey: string, roleId: string) {
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
teamObj.leaveCity(roleId);
|
||||
for(let team of teams) {
|
||||
if(team.cityId > 0 && team.areaId > 0) {
|
||||
await sendMessageToGVGAreaByTeamWithSuc(groupKey, team.areaId, PUSH_ROUTE.GVG_PLAYER_LEAVE_AREA, {
|
||||
cityId: team.cityId, areaId: team.areaId, teamCode: team.teamCode
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 复活cd
|
||||
@@ -478,6 +479,7 @@ export async function gvgBattleSeconds() {
|
||||
const serverNames = await getAllServerName();
|
||||
let keys: { groupKey: string, cityId: number }[] = []
|
||||
for(let [_key, teamObj] of getGVGBattleMap()) {
|
||||
// console.log('#### gvgBattleSeconds groupKey: ', _key, 'areas', teamObj.findAreas(), 'appid', pinus.app.getServerId());
|
||||
if(startFightTime <= nowSeconds() && endFightTime >= nowSeconds()) {
|
||||
// 每5秒给据点上的人加积分
|
||||
let teams = teamObj.findSettledPoint();
|
||||
@@ -500,12 +502,13 @@ export async function gvgBattleSeconds() {
|
||||
if(index == -1) keys.push({ groupKey: teamObj.groupKey, cityId: dicArea.cityId });
|
||||
}
|
||||
for(let [cityId, spines] of spinesByCity) {
|
||||
await sendMessageToGVGCityWithSuc(teamObj.groupKey, cityId, PUSH_ROUTE.GVG_AREA_SPINE_CHANGE, { cityId, spines });
|
||||
if(spines.length > 0) await sendMessageToGVGCityWithSuc(teamObj.groupKey, cityId, PUSH_ROUTE.GVG_AREA_SPINE_CHANGE, { cityId, spines });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(startFightTime <= nowSeconds() && endFightTime >= nowSeconds()) {
|
||||
// console.log('#### cityRank keys', JSON.stringify(keys), 'appid', pinus.app.getServerId())
|
||||
for(let { groupKey, cityId } of keys) {
|
||||
let { ranks } = await getBattleRanksByCity(configId, groupKey, cityId);
|
||||
await sendMessageToGVGCityWithSuc(groupKey, cityId, PUSH_ROUTE.GVG_CITY_RANK_UPDATE, { cityId, ranks });
|
||||
|
||||
Reference in New Issue
Block a user