任务:埋点48/71

This commit is contained in:
luying
2021-04-19 13:17:17 +08:00
parent 9f4f346447
commit 4bd4513ae6
11 changed files with 186 additions and 37 deletions
@@ -3,7 +3,7 @@ import { BattleRecordModel } from '../../../db/BattleRecord';
import { BattleSweepRecordModel } from '../../../db/BattleSweepRecord';
import { getWarById, } from '../../../pubUtils/gamedata';
import { genCode } from '../../../pubUtils/util';
import { WAR_TYPE, EVENT_STATUS, FUNC_OPT_TYPE, MSG_SOURCE, REDIS_KEY } from '../../../consts';
import { WAR_TYPE, EVENT_STATUS, FUNC_OPT_TYPE, MSG_SOURCE, REDIS_KEY, TASK_TYPE } from '../../../consts';
import { checkDaily, checkDailyAndIncrease } from '../../../services/dailyBattleService';
import { checkTowerWar, towerBattleEnd } from '../../../services/battleService';
import { WarReward } from '../../../services/warRewardService';
@@ -20,6 +20,7 @@ import { gameData } from '../../../pubUtils/data';
import { pushMysteryFirstMsg, pushTowerMsg, pushVestigeFirstMsg } from '../../../services/chatService';
import { nowSeconds } from '../../../pubUtils/timeUtil';
import { Rank } from '../../../services/rankService';
import { checkTaskWithWar, checkTaskInBattleEnd } from '../../../services/taskService';
export default function(app: Application) {
return new NormalBattleHandler(app);
@@ -31,7 +32,7 @@ export class NormalBattleHandler {
// 获取关卡列表
async checkBattle(msg: {battleId: number, heroes: Array<number> }, session: BackendSession) {
const { battleId, heroes } = msg;
const { battleId, heroes: seqIds } = msg;
let roleId = session.get('roleId');
let roleName = session.get('roleName');
let warInfo = getWarById(battleId);
@@ -56,8 +57,8 @@ export class NormalBattleHandler {
if(preBattle == -1) return resResult(STATUS.BATTLE_NEED_PREVIOUS_GK);
}
let checkHeroes = await checkBattleHeroes(roleId, heroes);
if(!checkHeroes) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
let { isOK, heroes } = await checkBattleHeroes(roleId, seqIds);
if(!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
const battleCode = genCode(8); // 关卡唯一值
let dailyNum = {};
@@ -96,7 +97,7 @@ export class NormalBattleHandler {
status: 0,
warName: warInfo.gk_name,
warType: warInfo.warType,
record: { heroes }
record: { heroes, seqIds }
}
}, true);
@@ -175,9 +176,9 @@ export class NormalBattleHandler {
}
let flag = 1; // 对比hero信息
let { record: { heroes: dbHeroes } } = BattleRecord;
for(let hid of heroes) {
if(dbHeroes.indexOf(hid) == -1) flag = 0;
let { record: { heroes: dbHeroes, seqIds: dbSeqIds } } = BattleRecord;
for(let seqId of dbSeqIds) {
if(dbSeqIds.indexOf(seqId) == -1) flag = 0;
}
if(!flag) {
return resResult(STATUS.BATTLE_INFO_VALIDATE_ERR);
@@ -268,6 +269,7 @@ export class NormalBattleHandler {
let actordata = await roleLevelup(roleId, isSuccess?warInfo.kingExp:0, session);// 主公升级经验
await checkTaskInBattleEnd(roleId, sid, battleId, dbHeroes, star);
// 返回值:
// towerStatus: false-本层未通过, true-本层已通过
return resResult(STATUS.SUCCESS, {
@@ -339,6 +341,9 @@ export class NormalBattleHandler {
$inc: { count }
});
// 任务
await checkTaskWithWar(roleId, sid, TASK_TYPE.BATTLE_MAIN_SWEEP, warInfo, [], count, 0);
return resResult(STATUS.SUCCESS, {
battleId, count,
battleGoods: result,