事件本检查时间刷新并推送
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { BattleSweepRecordModel } from '../../../db/BattleSweepRecord';
|
||||
import { getWarById, getGoodById } from '../../../util/gamedata';
|
||||
import { getWarById, } from '../../../util/gamedata';
|
||||
import { genCode } from '../../../util/util';
|
||||
import { getAp, setAp, WarReward } from './battleUtils';
|
||||
import { WAR_TYPE } from '../../../consts/consts';
|
||||
import { WAR_TYPE, EVENT_START_BATTLE } from '../../../consts/consts';
|
||||
import { checkDaily, checkDailyAndIncrease } from './dailyBattleHandler';
|
||||
import { setBattleStatus, startEvent } from './eventBattleHandler';
|
||||
import { queryMethod } from '@typegoose/typegoose';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new NormalBattleHandler(app);
|
||||
@@ -129,6 +131,9 @@ export class NormalBattleHandler {
|
||||
return {code: 202, data: checkResult.msg}
|
||||
}
|
||||
dailyNum = { type: checkResult.type, count: checkResult.count, sum: checkResult.sum };
|
||||
} else if (warInfo.war_type == WAR_TYPE.EVENT) {
|
||||
// 记录事件状态
|
||||
await setBattleStatus(roleId, battleId, isSuccess, battleCode, session.get('eventStatus'));
|
||||
}
|
||||
|
||||
let warReward = new WarReward(roleId, roleName, battleId, isSuccess);
|
||||
@@ -165,6 +170,12 @@ export class NormalBattleHandler {
|
||||
const updateResult = await BattleRecordModel.updateBattleRecordByCode(battleCode, params, true);
|
||||
let { status } = updateResult;
|
||||
|
||||
// 主线关卡某个关卡触发事件开启
|
||||
let eventStatus = session.get('eventStatus')||0;
|
||||
if(battleId == EVENT_START_BATTLE && eventStatus == 0) {
|
||||
// console.log('*******startEvent')
|
||||
await startEvent(this.app, session);
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user