当主公经验到达满级时,关卡不再获得经验
This commit is contained in:
@@ -17,6 +17,7 @@ import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
|||||||
import { updateWarStar, checkBattleHeroes, roleLevelup } from '../../../services/normalBattleService';
|
import { updateWarStar, checkBattleHeroes, roleLevelup } from '../../../services/normalBattleService';
|
||||||
import { checkDungeonNum, checkDungeonAndIncrease } from '../../../services/dungeonService';
|
import { checkDungeonNum, checkDungeonAndIncrease } from '../../../services/dungeonService';
|
||||||
import { switchOnFunc } from '../../../services/funcSwitchService';
|
import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||||
|
import { gameData } from '../../../pubUtils/data';
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new NormalBattleHandler(app);
|
return new NormalBattleHandler(app);
|
||||||
@@ -157,7 +158,7 @@ export class NormalBattleHandler {
|
|||||||
let roleName = session.get('roleName');
|
let roleName = session.get('roleName');
|
||||||
let sid = session.get('sid');
|
let sid = session.get('sid');
|
||||||
let serverId = session.get('serverId');
|
let serverId = session.get('serverId');
|
||||||
let warInfo = getWarById(battleId);
|
let warInfo = gameData.war.get(battleId);
|
||||||
if(!warInfo) {
|
if(!warInfo) {
|
||||||
return resResult(STATUS.BATTLE_MISS_INFO);
|
return resResult(STATUS.BATTLE_MISS_INFO);
|
||||||
}
|
}
|
||||||
@@ -165,9 +166,6 @@ export class NormalBattleHandler {
|
|||||||
if (warInfo.warType == WAR_TYPE.WARLOARDS) {
|
if (warInfo.warType == WAR_TYPE.WARLOARDS) {
|
||||||
return resResult(STATUS.BATTLE_END_WRONG_TYPE);
|
return resResult(STATUS.BATTLE_END_WRONG_TYPE);
|
||||||
}
|
}
|
||||||
if(!warInfo.hasOwnProperty('cost')) {
|
|
||||||
warInfo['cost'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BattleRecord = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
|
const BattleRecord = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
|
||||||
if(!BattleRecord || BattleRecord.status != 0) {
|
if(!BattleRecord || BattleRecord.status != 0) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { HeroModel } from '../db/Hero';
|
import { HeroModel } from '../db/Hero';
|
||||||
import Role, { RoleModel } from '../db/Role'
|
import Role, { RoleModel } from '../db/Role'
|
||||||
import { getLvByExp, getExpByLv } from '../pubUtils/gamedata';
|
import { getLvByExp, getExpByLv, gameData } from '../pubUtils/data';
|
||||||
import { redisUserInfoUpdate } from './redisService';
|
import { redisUserInfoUpdate } from './redisService';
|
||||||
import { switchOnFunc } from './funcSwitchService';
|
import { switchOnFunc } from './funcSwitchService';
|
||||||
import { FUNC_OPT_TYPE } from '../consts';
|
import { FUNC_OPT_TYPE } from '../consts';
|
||||||
@@ -10,13 +10,15 @@ import { BackendSession } from 'pinus';
|
|||||||
export async function roleLevelup(roleId: string, kingExp: number, session: BackendSession) {
|
export async function roleLevelup(roleId: string, kingExp: number, session: BackendSession) {
|
||||||
let role = await RoleModel.findByRoleId(roleId);
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
let {lv = 1, exp = 0} = role;
|
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 newLv = getLvByExp(newExp);
|
||||||
let nextExpObj = getExpByLv(newLv + 1);
|
// 等级超过最高级之后,经验依然可以稍微溢出一些,以备下一次提升等级
|
||||||
let curExpObj = getExpByLv(newLv);
|
// let nextExpObj = getExpByLv(newLv + 1);
|
||||||
if(curExpObj && !nextExpObj && newExp > curExpObj.sum) {
|
// let curExpObj = getExpByLv(newLv);
|
||||||
newExp = curExpObj.sum;
|
// if(curExpObj && !nextExpObj && newExp > curExpObj.sum) {
|
||||||
}
|
// newExp = curExpObj.sum;
|
||||||
|
// }
|
||||||
|
|
||||||
role = await RoleModel.levelup(roleId, newLv, newExp);
|
role = await RoleModel.levelup(roleId, newLv, newExp);
|
||||||
if(newLv > lv) { // 升级
|
if(newLv > lv) { // 升级
|
||||||
@@ -37,7 +39,7 @@ export async function roleLevelup(roleId: string, kingExp: number, session: Back
|
|||||||
actordata.push({
|
actordata.push({
|
||||||
lv : i,
|
lv : i,
|
||||||
exp : startExp, // 升级前经验
|
exp : startExp, // 升级前经验
|
||||||
getExp : getExp, // 获得的经验
|
getExp : getExp > 0? getExp: 0, // 获得的经验
|
||||||
mostExp : cur
|
mostExp : cur
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,6 @@ module.exports = {
|
|||||||
'console': {
|
'console': {
|
||||||
'type': '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': {
|
'con-log': {
|
||||||
'type': 'file',
|
'type': 'file',
|
||||||
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
|
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
|
||||||
@@ -80,16 +60,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
'pinus': {
|
'pinus': {
|
||||||
'type': 'file',
|
'type': 'file',
|
||||||
'filename': '${opts:base}/logs/pinus-default.log',
|
'filename': '${opts:base}/logs/pinus-${opts:serverId}.log',
|
||||||
'maxLogSize': 1048576,
|
|
||||||
'layout': {
|
|
||||||
'type': 'basic'
|
|
||||||
},
|
|
||||||
'backups': 5
|
|
||||||
},
|
|
||||||
'error': {
|
|
||||||
'type': 'file',
|
|
||||||
'filename': '${opts:base}/logs/error.log',
|
|
||||||
'maxLogSize': 1048576,
|
'maxLogSize': 1048576,
|
||||||
'layout': {
|
'layout': {
|
||||||
'type': 'basic'
|
'type': 'basic'
|
||||||
@@ -118,49 +89,42 @@ module.exports = {
|
|||||||
|
|
||||||
'categories': {
|
'categories': {
|
||||||
'default': {
|
'default': {
|
||||||
'appenders': ['console'],
|
|
||||||
'level': 'debug'
|
|
||||||
},
|
|
||||||
'pinus': {
|
|
||||||
'appenders': ['console', 'pinus'],
|
'appenders': ['console', 'pinus'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'con-log': {
|
'con-log': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['con-log'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'rpc-log': {
|
'rpc-log': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['rpc-log'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'forward-log': {
|
'forward-log': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['forward-log'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'rpc-debug': {
|
'rpc-debug': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['rpc-debug'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'crash-log': {
|
'crash-log': {
|
||||||
'appenders': ['console', 'crash-log'],
|
'appenders': ['crash-log'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'admin-log': {
|
'admin-log': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['admin-log'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'pinus-admin': {
|
'pinus-admin': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['pinus-admin'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'pinus-rpc': {
|
'pinus-rpc': {
|
||||||
'appenders': ['console', 'log'],
|
'appenders': ['pinus-rpc'],
|
||||||
'level': 'debug'
|
'level': 'debug'
|
||||||
},
|
},
|
||||||
'logger': {
|
|
||||||
'appenders': ['console', 'logger'],
|
|
||||||
'level': 'error'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'prefix': '${opts:serverId} ',
|
'prefix': '${opts:serverId} ',
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ export default class GMUsers extends Service {
|
|||||||
let lv = parseInt(_lv);
|
let lv = parseInt(_lv);
|
||||||
if(isNaN(lv)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
if(isNaN(lv)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||||
for(let roleId of uids) {
|
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);
|
await RoleModel.levelup(roleId, lv, exp?exp.sum:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { dicExpeditionPoint } from "./dictionary/DicExpeditionPoint";
|
|||||||
import { dicFuncSwitch } from "./dictionary/DicFuncSwitch";
|
import { dicFuncSwitch } from "./dictionary/DicFuncSwitch";
|
||||||
import { dicHeroSkill } from "./dictionary/DicHeroSkill";
|
import { dicHeroSkill } from "./dictionary/DicHeroSkill";
|
||||||
import { dicJob, jobClassAndgrades, jobClassMaxGrades } from "./dictionary/DicJob";
|
import { dicJob, jobClassAndgrades, jobClassMaxGrades } from "./dictionary/DicJob";
|
||||||
import { dicKingExp } from "./dictionary/DicKingExp";
|
import { dicKingExp, maxPlayerLv } from "./dictionary/DicKingExp";
|
||||||
import { dicCharExp } from "./dictionary/DicCharExp";
|
import { dicCharExp } from "./dictionary/DicCharExp";
|
||||||
import { dicQuestion } from "./dictionary/DicQuestion";
|
import { dicQuestion } from "./dictionary/DicQuestion";
|
||||||
import { dicSe } from "./dictionary/DicSe";
|
import { dicSe } from "./dictionary/DicSe";
|
||||||
@@ -55,6 +55,7 @@ export const gameData = {
|
|||||||
jobClassMaxGrades: jobClassMaxGrades,
|
jobClassMaxGrades: jobClassMaxGrades,
|
||||||
jobClassAndgrades: jobClassAndgrades,
|
jobClassAndgrades: jobClassAndgrades,
|
||||||
kingexp: dicKingExp,
|
kingexp: dicKingExp,
|
||||||
|
maxPlayerLv: maxPlayerLv,
|
||||||
charexp: dicCharExp,
|
charexp: dicCharExp,
|
||||||
question: dicQuestion,
|
question: dicQuestion,
|
||||||
se: dicSe,
|
se: dicSe,
|
||||||
|
|||||||
@@ -13,9 +13,12 @@ const str = readJsonFile(FILENAME.DIC_KING_EXP);
|
|||||||
let arr = JSON.parse(str);
|
let arr = JSON.parse(str);
|
||||||
|
|
||||||
export const dicKingExp = new Map<number, {sum: number, cur: number}>();
|
export const dicKingExp = new Map<number, {sum: number, cur: number}>();
|
||||||
|
export let maxPlayerLv = 0;
|
||||||
|
|
||||||
let exp = 0;
|
let exp = 0;
|
||||||
arr.forEach(o => {
|
arr.forEach(o => {
|
||||||
exp += o.exp;
|
exp += o.exp;
|
||||||
|
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||||
});
|
});
|
||||||
|
arr = null;
|
||||||
Reference in New Issue
Block a user