战斗:参数改为使用系统参数表
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { GOLD_COST_RATIO, DUNGEON_CONST } from '../../../consts';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult, calculateNum, shouldRefresh } from '../../../pubUtils/util';
|
||||
import { resResult, shouldRefresh } from '../../../pubUtils/util';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { handleCost } from '../../../services/rewardService';
|
||||
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
||||
import { getDungeonData } from '../../../services/dungeonService';
|
||||
import { getDungeonData, getDungeonBuyCountCost } from '../../../services/dungeonService';
|
||||
import * as dicParam from '../../../pubUtils/dicParam';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new DungeonBattleHandler(app);
|
||||
@@ -37,7 +37,7 @@ export class DungeonBattleHandler {
|
||||
dungeonCnt = 0; dungeonBuyCnt = 0;
|
||||
}
|
||||
|
||||
let timesCanBuy = DUNGEON_CONST.MAX_BUY_CNT;
|
||||
let timesCanBuy = dicParam.DUNGEON_CONST.DUNGEON_CONST_BUY;
|
||||
let { vLv } = await RoleModel.findByRoleId(roleId);
|
||||
if(vLv > 0) {
|
||||
timesCanBuy += 0; // 暂留,用于处理vip等级增加最大购买次数
|
||||
@@ -47,8 +47,7 @@ export class DungeonBattleHandler {
|
||||
}
|
||||
let buyCost = 0;
|
||||
for(let i = 1; i <= count; i++) {
|
||||
let num = dungeonBuyCnt + i;
|
||||
buyCost += calculateNum(GOLD_COST_RATIO.DUNGRON_BUY_NUM, {num}, 50);
|
||||
buyCost += getDungeonBuyCountCost(dungeonBuyCnt + i);
|
||||
}
|
||||
let {gold} = await RoleModel.findByRoleId(roleId);
|
||||
if(buyCost > gold) {
|
||||
@@ -57,12 +56,12 @@ export class DungeonBattleHandler {
|
||||
await handleCost(roleId, sid, [getGoldObject(buyCost)]);
|
||||
await RoleModel.buyCnt(roleId, needRefresh, count, curTime);
|
||||
|
||||
let nextCostGold = calculateNum(GOLD_COST_RATIO.DUNGRON_BUY_NUM, {num: dungeonBuyCnt + count + 1 }, 50);
|
||||
let nextCostGold = getDungeonBuyCountCost(dungeonBuyCnt + count + 1);
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
costGold: buyCost,
|
||||
nextCostGold,
|
||||
battleCount: DUNGEON_CONST.MAX_CNT + dungeonBuyCnt + count - dungeonCnt,
|
||||
buyCount: DUNGEON_CONST.MAX_BUY_CNT - dungeonBuyCnt - count
|
||||
battleCount: dicParam.DUNGEON_CONST.DUNGEON_CONST_FREE + dungeonBuyCnt + count - dungeonCnt,
|
||||
buyCount: dicParam.DUNGEON_CONST.DUNGEON_CONST_BUY - dungeonBuyCnt - count
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user