diff --git a/game-server/app/services/playerCeService.ts b/game-server/app/services/playerCeService.ts index 3cba95207..b8f4b82bc 100644 --- a/game-server/app/services/playerCeService.ts +++ b/game-server/app/services/playerCeService.ts @@ -4,24 +4,28 @@ import { ActionPointModel } from '../db/ActionPoint'; import { ACTION_POIN } from '../consts/consts'; -import { ChannelService, pinus } from 'pinus'; +import { pinus } from 'pinus'; import { STATUS } from '../consts/statusCode'; import {resResult } from '../pubUtils/util'; import {HeroModel} from '../db/Hero'; import {RoleModel} from '../db/Role'; //战力计算TODO -export function calPlayerCe(hero:any) { +export function calPlayerCe(hero:any, type: number, args: Array<{id: number}>) { let ce = 0; + let incCe; + if (type == 1) { + incCe = calHeroStarIncCe(hero, args); + } return ce; } //修改并下发战力 -export async function calPlayerCeAndSave(sid: string, roleId: string, heros:Array) { +export async function calPlayerCeAndSave(sid: string, roleId: string, heros:Array, type?: number, args?: Array<{id: number}>) { let playerCe = 0; let pushHeros = []; for (let hero of heros) { - hero.ce = calPlayerCe(hero); + hero.ce = calPlayerCe(hero, type, args); playerCe = playerCe + hero.ce; await hero.save(); pushHeros.push({ @@ -37,3 +41,8 @@ export async function calPlayerCeAndSave(sid: string, roleId: string, heros:Arra pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, {ce: playerCe, heros:pushHeros, topFiveCe:0}), uids); return heros; } + +export function calHeroStarIncCe (hero:any, args: Array<{id: number}>) { + let incCe = 0; + return {incCe};//属性增量可以是多个 +} \ No newline at end of file