fix 秘境json字段
This commit is contained in:
@@ -7,7 +7,7 @@ import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { calculateSumCE, genCode } from '../../../pubUtils/util';
|
||||
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies } from '../../../services/expeditionService';
|
||||
import { EXPEDITION_CONST } from '../../../consts/consts';
|
||||
import { EXPEDITION_CONST, EXPEDITION_WAR_RECORD_STATUS } from '../../../consts/consts';
|
||||
import { WarReward } from '../../../services/warRewardService';
|
||||
import { handleFixedReward } from '../../../services/rewardService';
|
||||
import { getAp, setAp } from '../../../services/actionPointService';
|
||||
@@ -39,7 +39,7 @@ export class ExpeditionBattleHandler {
|
||||
expeditionRecord = await ExpeditionRecordModel.createRecord({
|
||||
roleId, roleName, heroes: [], myCe
|
||||
});
|
||||
await findOrCreateEnemies(roleId, myCe, expeditionRecord.expeditionCode, 1, 0);
|
||||
await findOrCreateEnemies(roleId, myCe, expeditionRecord.expeditionCode, 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
|
||||
}
|
||||
|
||||
// 每一关的挑战状态
|
||||
@@ -90,7 +90,7 @@ export class ExpeditionBattleHandler {
|
||||
let { expeditionCode, heroes } = await ExpeditionRecordModel.createRecord({
|
||||
roleId, roleName, heroes: [], myCe
|
||||
});
|
||||
await findOrCreateEnemies(roleId, myCe, expeditionCode, 1, 0);
|
||||
await findOrCreateEnemies(roleId, myCe, expeditionCode, 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
|
||||
await RoleModel.increaseExpeditionResetCnt(roleId, needRefresh, curTime);
|
||||
let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCode(expeditionCode);
|
||||
let curLv = 0;
|
||||
@@ -119,13 +119,13 @@ export class ExpeditionBattleHandler {
|
||||
|
||||
let { myCe } = await ExpeditionRecordModel.getExpeditionRecordByCode(expeditionCode);
|
||||
|
||||
let curExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId, 0);
|
||||
let curExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId, EXPEDITION_WAR_RECORD_STATUS.WAITING);
|
||||
if(!curExpeditionWarRecord) {
|
||||
return resResult(STATUS.EXPEDITION_MATCH_NO_PLAYER);
|
||||
}
|
||||
let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
|
||||
let nextCe = 0; // 下一关战力
|
||||
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, -1);
|
||||
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE);
|
||||
if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce;
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
@@ -171,7 +171,7 @@ export class ExpeditionBattleHandler {
|
||||
if(!expeditionWarRecord ) {
|
||||
return resResult(STATUS.EXPEDITION_MISS_WAR_RECORD);
|
||||
}
|
||||
if(expeditionWarRecord.battleStatus == 1) {
|
||||
if(expeditionWarRecord.battleStatus == EXPEDITION_WAR_RECORD_STATUS.SUCCESS) {
|
||||
return resResult(STATUS.EXPEDITION_DUPLICATE_CHALLENGE);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ export class ExpeditionBattleHandler {
|
||||
}
|
||||
}, true);
|
||||
|
||||
let result = await ExpeditionWarRecordModel.updateBattleCode(expeditionCode, expeditionId, 0, battleCode);
|
||||
let result = await ExpeditionWarRecordModel.updateBattleCode(expeditionCode, expeditionId, EXPEDITION_WAR_RECORD_STATUS.WAITING, battleCode);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
expeditionCode,
|
||||
@@ -245,7 +245,8 @@ export class ExpeditionBattleHandler {
|
||||
// 更新我方剩余血量
|
||||
await ExpeditionRecordModel.updateHeroStatus(expeditionCode, expeditionRecord.heroes, heroes);
|
||||
// 更新敌人剩余状态及战斗状态
|
||||
expeditionWarRecord = await ExpeditionWarRecordModel.updateEnemiesStatus(expeditionCode, expeditionId, isSuccess?1:2, enemies);
|
||||
let battleStatus = isSuccess?EXPEDITION_WAR_RECORD_STATUS.SUCCESS:EXPEDITION_WAR_RECORD_STATUS.FAIL;
|
||||
expeditionWarRecord = await ExpeditionWarRecordModel.updateEnemiesStatus(expeditionCode, expeditionId, battleStatus, enemies);
|
||||
// 更新battleRecord状态
|
||||
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
|
||||
$set: { status: isSuccess?1: 2, star }
|
||||
@@ -259,9 +260,11 @@ export class ExpeditionBattleHandler {
|
||||
let reward = await warReward.saveReward(1);
|
||||
|
||||
let actordata = await roleLevelup(roleId, isSuccess?warInfo.kingExp:0);// 主公升级经验
|
||||
// 更新下一关状态
|
||||
await ExpeditionWarRecordModel.updateStatus(expeditionCode, expeditionId + 1, 0);
|
||||
|
||||
if(isSuccess) {
|
||||
// 更新下一关状态
|
||||
await ExpeditionWarRecordModel.updateStatus(expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
expeditionCode, expeditionId,
|
||||
battleCode, battleId,
|
||||
|
||||
Reference in New Issue
Block a user