This commit is contained in:
mamengke01
2020-12-31 11:11:27 +08:00
parent 98beb023a8
commit 7b76752e86
2 changed files with 5 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
import { STATUS } from '../../../consts/statusCode';
import { RoleModel } from './../../../db/Role';
import { HeroModel } from '../../../db/Hero';
import { resResult, decodeIdCntArrayStr, parseGoodStr } from '../../../pubUtils/util';
import { resResult, decodeIdCntArrayStr, parseGoodStr, reduceCe } from '../../../pubUtils/util';
import {Application, BackendSession} from 'pinus';
import { handleCost } from '../../../services/rewardService';
import { getTitle, getTeraph, gameData, getScollByStar } from '../../../pubUtils/data';
@@ -80,6 +80,7 @@ export class RoleHandler {
async roleTitleLevelUp(msg: {}, session: BackendSession){
let roleId = session.get('roleId');
let role = await RoleModel.findByRoleId(roleId);
let oldCe = role.ce;
let sid: string = session.get('sid');
let title = ++role.title;
let titleInfo = getTitle(role.title);
@@ -92,8 +93,8 @@ export class RoleHandler {
if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
await RoleModel.updateRoleInfo(roleId, { title });
let {ce} = await calAllHeroCe( sid, roleId, 2, [title]);
return resResult(STATUS.SUCCESS, { roleId, title, ce});
let {ce} = await calAllHeroCe( sid, roleId, HERO_SYSTEM_TYPE.TITLE, [title]);
return resResult(STATUS.SUCCESS, { roleId, title, oldCe: reduceCe(oldCe), incRoleCe: ce - reduceCe(oldCe)});
}
//神像强化

View File

@@ -862,6 +862,7 @@ function calTitle(args: Array<number>, ceAttr: CeAttrRole) {
}
for (let attr of titleInfo.assiAttrValue) {
let attrName = getAtrrNameById(attr.id);
if (!attrName) continue;
res[attrName] = res[attrName] || { fixUp: ceAttr[attrName].fixUp, ratioUp: ceAttr[attrName].ratioUp };
res[attrName].ratioUp += attr.number * HERO_CE_RATIO;
}