🐞 fix(gvg): 积分点交换问题
This commit is contained in:
@@ -474,6 +474,7 @@ export class GVGBattleHandler {
|
|||||||
if(!record) return resResult(STATUS.GVG_BATTLEREC_NOT_FOUND);
|
if(!record) return resResult(STATUS.GVG_BATTLEREC_NOT_FOUND);
|
||||||
if(record.battleEndTime > 0) return resResult(STATUS.GVG_BATTLEREC_HAS_SUMMIT);
|
if(record.battleEndTime > 0) return resResult(STATUS.GVG_BATTLEREC_HAS_SUMMIT);
|
||||||
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(record.attackTeam.teamCode, record.defenseTeam.teamCode);
|
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(record.attackTeam.teamCode, record.defenseTeam.teamCode);
|
||||||
|
let attackOriginId = attackTeam.pointId;
|
||||||
if(defenseTeam.lockTeamCode != attackTeam.teamCode) return resResult(STATUS.GVG_LOCK_TIME_OUT)
|
if(defenseTeam.lockTeamCode != attackTeam.teamCode) return resResult(STATUS.GVG_LOCK_TIME_OUT)
|
||||||
|
|
||||||
let groupKey = await getGroupKey(serverId);
|
let groupKey = await getGroupKey(serverId);
|
||||||
@@ -498,10 +499,8 @@ export class GVGBattleHandler {
|
|||||||
if(defenseTeam.curTeamBreak) {
|
if(defenseTeam.curTeamBreak) {
|
||||||
let attackScore = calBattleScoreByCe(isSuccess, defenseTeam.lineupCe);
|
let attackScore = calBattleScoreByCe(isSuccess, defenseTeam.lineupCe);
|
||||||
let attackCurTeamBreak = attackTeam.curTeamBreak;
|
let attackCurTeamBreak = attackTeam.curTeamBreak;
|
||||||
let originPointId = attackTeam.originPointId;
|
|
||||||
attackTeam = await GVGTeamModel.addScore(attackTeam.teamCode, attackScore, 0);
|
attackTeam = await GVGTeamModel.addScore(attackTeam.teamCode, attackScore, 0);
|
||||||
attackTeam.curTeamBreak = attackCurTeamBreak;
|
attackTeam.curTeamBreak = attackCurTeamBreak;
|
||||||
attackTeam.originPointId = originPointId;
|
|
||||||
await redisAddBattleScore(attackTeam, attackScore);
|
await redisAddBattleScore(attackTeam, attackScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +509,7 @@ export class GVGBattleHandler {
|
|||||||
teamObj.battleEnd([attackTeam, defenseTeam]);
|
teamObj.battleEnd([attackTeam, defenseTeam]);
|
||||||
// 更新rec
|
// 更新rec
|
||||||
let rec = await GVGBattleRecModel.battleEnd(battleCode, isSuccess, attackTeam, defenseTeam);
|
let rec = await GVGBattleRecModel.battleEnd(battleCode, isSuccess, attackTeam, defenseTeam);
|
||||||
await battleEndSendMessage(groupKey, cityId, defenseTeam, attackTeam, GVG_ATTACK_TYPE.PLAYER);
|
await battleEndSendMessage(groupKey, cityId, defenseTeam, {...attackTeam, originPointId: attackOriginId}, GVG_ATTACK_TYPE.PLAYER);
|
||||||
addBattleEndRec(rec);
|
addBattleEndRec(rec);
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
|
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
|
||||||
@@ -533,6 +532,7 @@ export class GVGBattleHandler {
|
|||||||
let groupKey = await getGroupKey(serverId);
|
let groupKey = await getGroupKey(serverId);
|
||||||
|
|
||||||
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(teamCode, oppoTeamCode);
|
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(teamCode, oppoTeamCode);
|
||||||
|
let attackOriginId = attackTeam.pointId;
|
||||||
let checkStatus = checkGVGBattleStart(roleId, attackTeam, defenseTeam);
|
let checkStatus = checkGVGBattleStart(roleId, attackTeam, defenseTeam);
|
||||||
if(checkStatus.code != 0) return resResult(checkStatus);
|
if(checkStatus.code != 0) return resResult(checkStatus);
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ export class GVGBattleHandler {
|
|||||||
let teamObj = getGVGBattleData(groupKey);
|
let teamObj = getGVGBattleData(groupKey);
|
||||||
teamObj.battleEnd([attackTeam, defenseTeam]);
|
teamObj.battleEnd([attackTeam, defenseTeam]);
|
||||||
|
|
||||||
await battleEndSendMessage(groupKey, cityId, defenseTeam, attackTeam, GVG_ATTACK_TYPE.KNIFE);
|
await battleEndSendMessage(groupKey, cityId, defenseTeam, {...attackTeam, originPointId: attackOriginId}, GVG_ATTACK_TYPE.KNIFE);
|
||||||
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
|
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -672,14 +672,13 @@ export async function battleEndSendMessage(groupKey: string, cityId: number, def
|
|||||||
|
|
||||||
// 队伍移动
|
// 队伍移动
|
||||||
export async function pushTeamBeHurtMessage(team: GVGTeamType, replaceTeam?: GVGTeamType) {
|
export async function pushTeamBeHurtMessage(team: GVGTeamType, replaceTeam?: GVGTeamType) {
|
||||||
|
|
||||||
if(team.curTeamBreak && team.originPointId > 0) {
|
if(team.curTeamBreak && team.originPointId > 0) {
|
||||||
await sendMessageToGVGAreaByTeamWithSuc(team.groupKey, team.fromAreaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
|
await sendMessageToGVGAreaByTeamWithSuc(team.groupKey, team.fromAreaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
|
||||||
cityId: team.cityId, areaId: team.fromAreaId, targetPointId: team.originPointId, originPointId: replaceTeam?.pointId??0, point: new GVGTeamInListOnPoint(team.pointId, true, team)
|
cityId: team.cityId, areaId: team.fromAreaId, targetPointId: team.originPointId, originPointId: replaceTeam?.originPointId??0, point: new GVGTeamInListOnPoint(replaceTeam.pointId||team.pointId, true, replaceTeam||team)
|
||||||
});
|
});
|
||||||
if(!team.curTeamBreak) {
|
if(!replaceTeam.curTeamBreak && replaceTeam.originPointId > 0) {
|
||||||
await sendMessageToGVGAreaByTeamWithSuc(replaceTeam.groupKey, replaceTeam.fromAreaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
|
await sendMessageToGVGAreaByTeamWithSuc(replaceTeam.groupKey, replaceTeam.fromAreaId, PUSH_ROUTE.GVG_AREA_POINT_CHANGE, {
|
||||||
cityId: replaceTeam.cityId, areaId: replaceTeam.fromAreaId, targetPointId: replaceTeam.pointId, originPointId: replaceTeam.originPointId, point: new GVGTeamInListOnPoint(replaceTeam.pointId, true, replaceTeam)
|
cityId: replaceTeam.cityId, areaId: replaceTeam.fromAreaId, targetPointId: replaceTeam.originPointId, originPointId: 0, point: new GVGTeamInListOnPoint(replaceTeam.pointId, true, replaceTeam)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user