秘境:首通信息
This commit is contained in:
@@ -6,6 +6,8 @@ import { handleCost } from '../../../services/rewardService';
|
||||
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
||||
import { getDungeonData, getDungeonBuyCountCost } from '../../../services/dungeonService';
|
||||
import * as dicParam from '../../../pubUtils/dicParam';
|
||||
import { DungeonFirstModel } from '../../../db/DungeonFirst';
|
||||
import { DungeonResultParam } from '../../../domain/battleField/dungeon';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new DungeonBattleHandler(app);
|
||||
@@ -64,4 +66,15 @@ export class DungeonBattleHandler {
|
||||
buyCount: dicParam.DUNGEON_CONST.DUNGEON_CONST_BUY - dungeonBuyCnt - count
|
||||
});
|
||||
}
|
||||
|
||||
// 购买每日次数
|
||||
async getFirstInfo(msg: { movePoint: number }, session: BackendSession) {
|
||||
const { movePoint } = msg;
|
||||
const serverId: number = session.get('serverId');
|
||||
const firstInfos = await DungeonFirstModel.findByMovePoint(serverId, movePoint);
|
||||
let result: DungeonResultParam[] = firstInfos.map(firstInfo => {
|
||||
return new DungeonResultParam(firstInfo);
|
||||
});
|
||||
return resResult(STATUS.SUCCESS, { infos: result });
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import { resResult } from '../../../pubUtils/util';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
||||
import { updateWarStar, checkBattleHeroes, roleLevelup, getBattleList } from '../../../services/normalBattleService';
|
||||
import { checkDungeonNum, checkDungeonAndIncrease } from '../../../services/dungeonService';
|
||||
import { checkDungeonNum, checkDungeonAndIncrease, saveDungeonFirst } from '../../../services/dungeonService';
|
||||
import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||
import { gameData } from '../../../pubUtils/data';
|
||||
import { pushMysteryFirstMsg, pushTowerMsg, pushVestigeFirstMsg } from '../../../services/chatService';
|
||||
@@ -58,7 +58,7 @@ export class NormalBattleHandler {
|
||||
if (preBattle == -1) return resResult(STATUS.BATTLE_NEED_PREVIOUS_GK);
|
||||
}
|
||||
|
||||
let { isOK, heroes } = await checkBattleHeroes(roleId, seqIds);
|
||||
let { isOK, heroes, lineup } = await checkBattleHeroes(roleId, seqIds);
|
||||
if (!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
|
||||
|
||||
const battleCode = genCode(8); // 关卡唯一值
|
||||
@@ -98,7 +98,7 @@ export class NormalBattleHandler {
|
||||
status: 0,
|
||||
warName: warInfo.gk_name,
|
||||
warType: warInfo.warType,
|
||||
record: { heroes, seqIds }
|
||||
record: { heroes, seqIds, lineup }
|
||||
}
|
||||
}, true);
|
||||
|
||||
@@ -192,8 +192,7 @@ export class NormalBattleHandler {
|
||||
let checkResult = await checkDungeonAndIncrease(roleId, 1, false);
|
||||
let role = await RoleModel.saveDungeonHero(roleId, battleId, heroes, isSuccess);
|
||||
if (role) {
|
||||
let r = new Rank(REDIS_KEY.DUNGEON_RANK, { serverId });
|
||||
await r.setRankWithRoleInfo(roleId, role.dungeonWarId, role.dungeonUpdatedAt, role);
|
||||
await saveDungeonFirst(role, battleId, BattleRecord);
|
||||
}
|
||||
|
||||
if (checkResult.status == -1) {
|
||||
|
||||
@@ -78,7 +78,7 @@ export class DonationHandler {
|
||||
//活动任务
|
||||
await checkActivityTask(serverId, sid, funcs, roleId, TASK_TYPE.GUILD_DONATE, 1);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { donateFund, reports, donateCnt, goods });
|
||||
return resResult(STATUS.SUCCESS, { donateFund, reports, donateCnt, simpleGoods: goods });
|
||||
}
|
||||
/**
|
||||
* 领取宝箱
|
||||
|
||||
@@ -6,6 +6,11 @@ import { resResult, shouldRefresh, } from '../pubUtils/util';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
import * as dicParam from '../pubUtils/dicParam';
|
||||
import { RankParam } from '../domain/rank';
|
||||
import { BattleRecordType } from '../db/BattleRecord';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { DungeonFirstModel } from '../db/DungeonFirst';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
|
||||
/**
|
||||
* 获取秘境本数据
|
||||
@@ -85,4 +90,13 @@ export function getDungeonBuyCountCost(num:number) {
|
||||
cost = dicParam.DUNGEON_CONST.DUNGEON_CONST_TOP;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) {
|
||||
let userInfo = new RankParam(role, true);
|
||||
let lineup = battleRecord.record.lineup;
|
||||
let dicWar = gameData.war.get(warId);
|
||||
await DungeonFirstModel.createDungeonFirst(role.serverId, dicWar.movePoint, warId, {
|
||||
time: nowSeconds(), roleId: role.roleId, userInfo, lineup
|
||||
})
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { accomplishTask } from '../pubUtils/taskUtil';
|
||||
import { RScriptRecordModel } from '../db/RScriptRecord';
|
||||
import { setAp } from './actionPointService';
|
||||
import { resResult } from '../pubUtils/util';
|
||||
import { LineupParam } from '../domain/rank';
|
||||
|
||||
export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) {
|
||||
const serverId = session.get('serverId');
|
||||
@@ -82,7 +83,7 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
|
||||
|
||||
|
||||
export async function checkBattleHeroes(roleId: string, seqIds: Array<number> = []) {
|
||||
let heroes: number[] = [];
|
||||
let heroes: number[] = [], lineup: LineupParam[] = [];
|
||||
let flag = true;
|
||||
// if (seqIds.length <= 0) flag = false;
|
||||
|
||||
@@ -94,8 +95,9 @@ export async function checkBattleHeroes(roleId: string, seqIds: Array<number> =
|
||||
flag = false; break;
|
||||
}
|
||||
heroes.push(hero.hid);
|
||||
lineup.push(new LineupParam(hero));
|
||||
}
|
||||
return { isOK: flag, heroes };
|
||||
return { isOK: flag, heroes, seqIds, lineup };
|
||||
}
|
||||
|
||||
export async function checkBattleHeroesByHid(roleId: string, heroes: Array<number> = []) {
|
||||
|
||||
Reference in New Issue
Block a user