当主公经验到达满级时,关卡不再获得经验
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
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,26 +3,6 @@ module.exports = {
|
||||
'console': {
|
||||
'type': 'console'
|
||||
},
|
||||
'logger': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/logger.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/log.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'con-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
|
||||
@@ -80,16 +60,7 @@ module.exports = {
|
||||
},
|
||||
'pinus': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-default.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'error': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/error.log',
|
||||
'filename': '${opts:base}/logs/pinus-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
@@ -118,49 +89,42 @@ module.exports = {
|
||||
|
||||
'categories': {
|
||||
'default': {
|
||||
'appenders': ['console'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus': {
|
||||
'appenders': ['console', 'pinus'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'con-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['con-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['rpc-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'forward-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['forward-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-debug': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['rpc-debug'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'crash-log': {
|
||||
'appenders': ['console', 'crash-log'],
|
||||
'appenders': ['crash-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'admin-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['admin-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-admin': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['pinus-admin'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-rpc': {
|
||||
'appenders': ['console', 'log'],
|
||||
'appenders': ['pinus-rpc'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'logger': {
|
||||
'appenders': ['console', 'logger'],
|
||||
'level': 'error'
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
'prefix': '${opts:serverId} ',
|
||||
|
||||
@@ -340,7 +340,7 @@ export default class GMUsers extends Service {
|
||||
let lv = parseInt(_lv);
|
||||
if(isNaN(lv)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
for(let roleId of uids) {
|
||||
let exp = ctx.service.utils.getExpByLv(lv);
|
||||
let exp = ctx.service.utils.getExpByLv(lv - 1);
|
||||
await RoleModel.levelup(roleId, lv, exp?exp.sum:0);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { dicExpeditionPoint } from "./dictionary/DicExpeditionPoint";
|
||||
import { dicFuncSwitch } from "./dictionary/DicFuncSwitch";
|
||||
import { dicHeroSkill } from "./dictionary/DicHeroSkill";
|
||||
import { dicJob, jobClassAndgrades, jobClassMaxGrades } from "./dictionary/DicJob";
|
||||
import { dicKingExp } from "./dictionary/DicKingExp";
|
||||
import { dicKingExp, maxPlayerLv } from "./dictionary/DicKingExp";
|
||||
import { dicCharExp } from "./dictionary/DicCharExp";
|
||||
import { dicQuestion } from "./dictionary/DicQuestion";
|
||||
import { dicSe } from "./dictionary/DicSe";
|
||||
@@ -55,6 +55,7 @@ export const gameData = {
|
||||
jobClassMaxGrades: jobClassMaxGrades,
|
||||
jobClassAndgrades: jobClassAndgrades,
|
||||
kingexp: dicKingExp,
|
||||
maxPlayerLv: maxPlayerLv,
|
||||
charexp: dicCharExp,
|
||||
question: dicQuestion,
|
||||
se: dicSe,
|
||||
|
||||
@@ -13,9 +13,12 @@ const str = readJsonFile(FILENAME.DIC_KING_EXP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicKingExp = new Map<number, {sum: number, cur: number}>();
|
||||
export let maxPlayerLv = 0;
|
||||
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||
});
|
||||
});
|
||||
arr = null;
|
||||
Reference in New Issue
Block a user