战力,出生皮肤

This commit is contained in:
mamengke01
2020-12-22 14:07:43 +08:00
parent ba4f58509d
commit eec53b688f
17 changed files with 1173 additions and 314 deletions
+8 -2
View File
@@ -6,7 +6,7 @@ import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import { calPlayerCeAndSave as pubCalPlayerCeAndSave } from '../pubUtils/playerCe';
import { calPlayerCeAndSave as pubCalPlayerCeAndSave, reCalAllHeroCe } from '../pubUtils/playerCe';
import { HeroType } from '../db/Hero';
const _ = require('underscore');
@@ -14,9 +14,15 @@ 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;
}
export async function calAllHeroCe(sid: string, roleId: string, type:number, args:Array<number>) {
let {ce, pushHeros}= await reCalAllHeroCe(roleId,type, args);
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: ce, heros: pushHeros, topFiveCe: 0 }), uids);
return;
}
+6 -2
View File
@@ -4,6 +4,7 @@ import { resResult, parseReward } from '../pubUtils/util';
import { getGoodById } from '../pubUtils/gamedata';
import { RoleModel } from '../db/Role';
import { setAp } from './actionPointService';
import { calAllHeroCe } from './playerCeService';
import { ItemModel } from '../db/Item';
import { STATUS } from '../consts/statusCode';
import { pinus } from 'pinus';
@@ -139,21 +140,24 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
showItems.push({id: item.id, count: item.count});
bagInfos.push(bagInfo);
}
//背包除去装备推送
if (!!bagInfos.length)
pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: bagInfos}), uids);
let skinInfos = [];
let addSkinIds = [];
for (let skinId of skins) {//皮肤推送
let result = await addSkins(roleId, skinId);
if (!!result) {
showItems.push({id: skinId, count: 1});
skinInfos.push(result);
addSkinIds.push(skinId);
}
}
if (!!skinInfos.length)
if (!!skinInfos.length) {
calAllHeroCe(sid, roleId, 1, addSkinIds)
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
}
return showItems;
}