修改playerCe为通用方法

This commit is contained in:
luying
2020-12-17 12:03:00 +08:00
parent 5e39c09f7c
commit b79157b5c9
6 changed files with 43 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import {Application, BackendSession, createTcpMailBox, ChannelService} from 'pinus';
import { handleCost, addItems } from '../../../services/rewardService';
import { calPlayerCeAndSave, getAllAttrStage } from '../../../pubUtils/playerCe';
import { calPlayerCeAndSave, getAllAttrStage } from '../../../services/playerCeService';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts/statusCode';
import {HeroModel} from '../../../db/Hero';

View File

@@ -0,0 +1,22 @@
/**
* 体力系统
*/
import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import { calPlayerCeAndSave as pubCalPlayerCeAndSave } from '../pubUtils/playerCe';
import { HeroType } from '../db/Hero';
const _ = require('underscore');
//修改并下发战力
export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) {
let {role, pushHeros} = await pubCalPlayerCeAndSave(roleId, heros, type, args);
//下发战力
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: role.ce, heros: pushHeros, topFiveCe: 0 }), uids);
return heros;
}