fix bug 远征关卡最后一关获取失败
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Application, BackendSession } from 'pinus';
|
import { Application, BackendSession } from 'pinus';
|
||||||
import { getGamedata, getWarById } from '../../../pubUtils/gamedata';
|
import { getGamedata, getWarById, hasExpeditionById } from '../../../pubUtils/gamedata';
|
||||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||||
import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
|
import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
|
||||||
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
|
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
|
||||||
@@ -125,8 +125,11 @@ export class ExpeditionBattleHandler {
|
|||||||
}
|
}
|
||||||
let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
|
let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
|
||||||
let nextCe = 0; // 下一关战力
|
let nextCe = 0; // 下一关战力
|
||||||
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE);
|
|
||||||
if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce;
|
if(hasExpeditionById(expeditionId + 1)) {
|
||||||
|
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE);
|
||||||
|
if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce;
|
||||||
|
}
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
expeditionCode, expeditionId, battleId,
|
expeditionCode, expeditionId, battleId,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/
|
|||||||
import { WAR_JSON_ATTRIBUTE_TYPE, EXPEDITION_CONST } from '../consts/consts';
|
import { WAR_JSON_ATTRIBUTE_TYPE, EXPEDITION_CONST } from '../consts/consts';
|
||||||
import Actor from '../pubUtils/actor';
|
import Actor from '../pubUtils/actor';
|
||||||
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||||
import { stat } from 'fs';
|
|
||||||
|
|
||||||
export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) {
|
export async function findOrCreateEnemies(roleId: string, myCe: number, expeditionCode: string, expeditionId: number, battleStatus: number) {
|
||||||
|
|
||||||
@@ -46,7 +45,6 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti
|
|||||||
let {enemiesCurHpAp, enemies} = expeditionWarRecord;
|
let {enemiesCurHpAp, enemies} = expeditionWarRecord;
|
||||||
for(let enemy of enemies) {
|
for(let enemy of enemies) {
|
||||||
let cur = {"hp": 0, "ap": 0};
|
let cur = {"hp": 0, "ap": 0};
|
||||||
console.log(enemiesCurHpAp)
|
|
||||||
let getHp = enemiesCurHpAp && enemiesCurHpAp.find(cur => cur.dataId == enemy.dataId);
|
let getHp = enemiesCurHpAp && enemiesCurHpAp.find(cur => cur.dataId == enemy.dataId);
|
||||||
if(getHp) {
|
if(getHp) {
|
||||||
cur.hp = getHp.hp;
|
cur.hp = getHp.hp;
|
||||||
|
|||||||
@@ -299,4 +299,8 @@ export function getOlySeidByType(type: number) {
|
|||||||
|
|
||||||
export function getExpeditionById(id: number) {
|
export function getExpeditionById(id: number) {
|
||||||
return expeditionInfo.get(id);
|
return expeditionInfo.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasExpeditionById(id: number) {
|
||||||
|
return expeditionInfo.has(id);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user