当主公经验到达满级时,关卡不再获得经验
This commit is contained in:
@@ -17,6 +17,7 @@ import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
||||
import { updateWarStar, checkBattleHeroes, roleLevelup } from '../../../services/normalBattleService';
|
||||
import { checkDungeonNum, checkDungeonAndIncrease } from '../../../services/dungeonService';
|
||||
import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||
import { gameData } from '../../../pubUtils/data';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new NormalBattleHandler(app);
|
||||
@@ -157,7 +158,7 @@ export class NormalBattleHandler {
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
let serverId = session.get('serverId');
|
||||
let warInfo = getWarById(battleId);
|
||||
let warInfo = gameData.war.get(battleId);
|
||||
if(!warInfo) {
|
||||
return resResult(STATUS.BATTLE_MISS_INFO);
|
||||
}
|
||||
@@ -165,9 +166,6 @@ export class NormalBattleHandler {
|
||||
if (warInfo.warType == WAR_TYPE.WARLOARDS) {
|
||||
return resResult(STATUS.BATTLE_END_WRONG_TYPE);
|
||||
}
|
||||
if(!warInfo.hasOwnProperty('cost')) {
|
||||
warInfo['cost'] = 0;
|
||||
}
|
||||
|
||||
const BattleRecord = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
|
||||
if(!BattleRecord || BattleRecord.status != 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import { HeroModel } from '../db/Hero';
|
||||
import Role, { RoleModel } from '../db/Role'
|
||||
import { getLvByExp, getExpByLv } from '../pubUtils/gamedata';
|
||||
import { getLvByExp, getExpByLv, gameData } from '../pubUtils/data';
|
||||
import { redisUserInfoUpdate } from './redisService';
|
||||
import { switchOnFunc } from './funcSwitchService';
|
||||
import { FUNC_OPT_TYPE } from '../consts';
|
||||
@@ -10,13 +10,15 @@ import { BackendSession } from 'pinus';
|
||||
export async function roleLevelup(roleId: string, kingExp: number, session: BackendSession) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let {lv = 1, exp = 0} = role;
|
||||
let newExp = exp + kingExp;
|
||||
let canGetExp = lv < gameData.maxPlayerLv; // 当主公超过最大级后,挑战结算不再获得经验值
|
||||
let newExp = canGetExp? exp + kingExp: exp;
|
||||
let newLv = getLvByExp(newExp);
|
||||
let nextExpObj = getExpByLv(newLv + 1);
|
||||
let curExpObj = getExpByLv(newLv);
|
||||
if(curExpObj && !nextExpObj && newExp > curExpObj.sum) {
|
||||
newExp = curExpObj.sum;
|
||||
}
|
||||
// 等级超过最高级之后,经验依然可以稍微溢出一些,以备下一次提升等级
|
||||
// let nextExpObj = getExpByLv(newLv + 1);
|
||||
// let curExpObj = getExpByLv(newLv);
|
||||
// if(curExpObj && !nextExpObj && newExp > curExpObj.sum) {
|
||||
// newExp = curExpObj.sum;
|
||||
// }
|
||||
|
||||
role = await RoleModel.levelup(roleId, newLv, newExp);
|
||||
if(newLv > lv) { // 升级
|
||||
@@ -37,7 +39,7 @@ export async function roleLevelup(roleId: string, kingExp: number, session: Back
|
||||
actordata.push({
|
||||
lv : i,
|
||||
exp : startExp, // 升级前经验
|
||||
getExp : getExp, // 获得的经验
|
||||
getExp : getExp > 0? getExp: 0, // 获得的经验
|
||||
mostExp : cur
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user