远征:更新下一关状态

This commit is contained in:
luying
2022-07-20 17:01:18 +08:00
parent 220c635ff1
commit 083201462e
2 changed files with 15 additions and 2 deletions

View File

@@ -217,6 +217,10 @@ export class ExpeditionBattleHandler {
if (!expeditionRecord || !expeditionWarRecord) {
return resResult(STATUS.EXPEDITION_MISS_WAR_RECORD);
}
if(expeditionWarRecord.battleStatus == EXPEDITION_WAR_RECORD_STATUS.SUCCESS) {
return resResult(STATUS.EXPEDITION_DUPLICATE_CHALLENGE);
}
// 更新敌人剩余状态及战斗状态
expeditionWarRecord = await ExpeditionWarRecordModel.updateEnemiesStatus(expeditionCode, expeditionId, EXPEDITION_WAR_RECORD_STATUS.SUCCESS, []);
// 更新点数
@@ -236,6 +240,13 @@ export class ExpeditionBattleHandler {
if (gameData.expedition.has(expeditionId + 1)) {
await findOrCreateEnemies(roleId, expeditionRecord.myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
}
let expeditionWarRecords = await ExpeditionWarRecordModel.getRecordByCode(expeditionCode);
let curLv = 0;
if (expeditionWarRecords.length > 0) {
curLv = expeditionWarRecords[expeditionWarRecords.length - 1].expeditionId;
}
await checkTaskInSkipExpedition(serverId, roleId, sid, battleId);
return resResult(STATUS.SUCCESS, {
@@ -243,7 +254,9 @@ export class ExpeditionBattleHandler {
expeditionId,
battleId,
goods: reward,
expeditionPoint: role.expeditionPoint
expeditionPoint: role.expeditionPoint,
expeditionWarRecord: expeditionWarRecords,
curLv
});
}

View File

@@ -67,7 +67,7 @@ export async function getExpeditionStatus(roleId: string, roleName: string, isEn
*/
export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) {
let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCodeAndId(expeditionCode, expeditionId);
let expeditionWarRecord = await ExpeditionWarRecordModel.updateStatus(expeditionCode, expeditionId, battleStatus);
if(!expeditionWarRecord) { // 如果没有信息
let curDicExpedition = gameData.expedition.get(expeditionId);
if(curDicExpedition) {