This commit is contained in:
mamengke01
2020-12-28 17:10:38 +08:00
parent 1e246ecb72
commit 8cad1f80d4
9 changed files with 359 additions and 282 deletions

View File

@@ -9,6 +9,7 @@ import { RoleModel } from '../../../db/Role';
import { ItemModel } from '../../../db/Item';
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById } from '../../../pubUtils/data';
import { RewardInter } from '../../../pubUtils/interface';
import { getDropItems } from '../../../consts/constModules/itemConst'
export default function(app: Application) {
return new HeroHandler(app);
@@ -44,7 +45,14 @@ export class HeroHandler {
let {id, count} = msg;
//let result = await handleCost(roleId, sid, [{id, count}] );
let result = await addItems(roleId, roleName, sid, [{id, count}] );
let items = [{id, count}];
if (id == 999999) {
items = getDropItems();
let role = await RoleModel.findByRoleId(roleId);
role.lv = 60;
await RoleModel.updateRoleInfo(roleId, role);
}
let result = await addItems(roleId, roleName, sid, items );
if(!result) {
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
}

View File

@@ -92,6 +92,7 @@ export class RoleHandler {
if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
await RoleModel.updateRoleInfo(roleId, { title });
await calAllHeroCe( sid, roleId, 2, [title]);
return resResult(STATUS.SUCCESS, { roleId, title });
}
@@ -284,7 +285,6 @@ export class RoleHandler {
});
}
// 激活/升级名将谱
async activeHeroScroll(msg: { hid: number }, session: BackendSession) {
let roleId = session.get('roleId');

View File

@@ -21,7 +21,7 @@ export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Arr
}
export async function calAllHeroCe(sid: string, roleId: string, type?:number, args?:Array<number>) {
let {ce, pushHeros}= await reCalAllHeroCe(roleId,type, args);
let {ce, pushHeros}= await reCalAllHeroCe(roleId, type, args);
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topFiveCe: 0 }), uids);
return;

View File

@@ -1,11 +1,5 @@
import { getRandNum, getRandomArr } from '../pubUtils/util';
import { EquipModel } from "../db/Equip";
import { HeroModel, EPlace } from "../db/Hero";
import { ITID } from "../consts/constModules/itemConst";
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../pubUtils/data";
import { calPlayerCeAndSave } from "./playerCeService";
import { TERAPH_RANDOM } from "../consts/consts";
import { getTeraphAttr } from '../consts/constModules/abilityConst';
const _ = require('underscore');
const TERAPH_STRENGTHEN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
export function checkMaterialEnough(count: number, attrs:Array<any>, teraphInfo: any, teraph: any) {