🐞 fix(gvg): 修复零散小问题

This commit is contained in:
luying
2023-03-01 19:43:35 +08:00
parent bea3361cbe
commit 0f28628a64
8 changed files with 31 additions and 16 deletions
@@ -134,10 +134,19 @@ export class GVGBattleHandler {
// 进入城池之前的检查
async checkMyTeam(msg: { cityId: number }, session: BackendSession) {
const roleId = session.get('roleId');
const serverId = session.get('serverId');
const guildCode = session.get('guildCode');
const { cityId } = msg;
let hasSettled = false, otherCityId = 0;
const teams = await GVGTeamModel.findByRole(roleId, 'cityId');
let { configId, period } = getGVGPeriodData();
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
let groupKey = await getGroupKey(serverId);
let teams = await refreshTeams(configId, groupKey, roleId, myLeague);
// 玩家队伍信息中城池id不一致,说明玩家已经进入了其他城池
for(let { cityId: teamCityId } of teams) {
if(teamCityId > 0 && teamCityId != cityId) {
@@ -384,6 +393,9 @@ export class GVGBattleHandler {
// addTeamSettleRec(curTeam);
await sendMessageToGVGAreaByTeamWithSuc(groupKey, curTeam.areaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
cityId: curTeam.cityId, areaId: curTeam.areaId, point: new GVGTeamInListOnPoint(curTeam.pointId, true, curTeam)
});
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) });
}
@@ -408,6 +420,9 @@ export class GVGBattleHandler {
let teamObj = getGVGBattleData(groupKey);
teamObj.teamSettle(roleId, teamCode, 0);
await sendMessageToGVGAreaByTeamWithSuc(groupKey, curTeam.areaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
cityId: curTeam.cityId, areaId: curTeam.areaId, point: new GVGTeamInListOnPoint(myTeam.pointId, true, curTeam)
});
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) });
}
@@ -474,7 +489,9 @@ export class GVGBattleHandler {
}
if(defenseTeam.curTeamBreak) {
let attackScore = calBattleScoreByCe(isSuccess, defenseTeam.lineupCe);
let attackCurTeamBreak = attackTeam.curTeamBreak;
attackTeam = await GVGTeamModel.addScore(attackTeam.teamCode, attackScore, 0);
attackTeam.curTeamBreak = attackCurTeamBreak;
await redisAddBattleScore(attackTeam, attackScore);
}