handleCost方法去掉channelService传参
This commit is contained in:
@@ -20,7 +20,7 @@ export class HeroHandler {
|
|||||||
|
|
||||||
let {id, count} = msg;
|
let {id, count} = msg;
|
||||||
|
|
||||||
let result = await handleCost(this.channelService, roleId, sid, [{id, count}] );
|
let result = await handleCost(roleId, sid, [{id, count}] );
|
||||||
if(!result) {
|
if(!result) {
|
||||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ import { EquipModel } from './../db/Equip';
|
|||||||
import { CounterModel } from './../db/Counter';
|
import { CounterModel } from './../db/Counter';
|
||||||
import { decodeStr, resResult } from '../pubUtils/util';
|
import { decodeStr, resResult } from '../pubUtils/util';
|
||||||
import { getGoodById } from '../pubUtils/gamedata';
|
import { getGoodById } from '../pubUtils/gamedata';
|
||||||
import Role, { RoleModel } from '../db/Role';
|
import { RoleModel } from '../db/Role';
|
||||||
import { setAp } from './actionPointService';
|
import { setAp } from './actionPointService';
|
||||||
import { ItemModel } from '../db/Item';
|
import { ItemModel } from '../db/Item';
|
||||||
import { ChannelService } from 'pinus';
|
|
||||||
import { isRegExp } from 'util';
|
|
||||||
import { STATUS } from '../consts/statusCode';
|
import { STATUS } from '../consts/statusCode';
|
||||||
|
import { pinus } from 'pinus';
|
||||||
|
|
||||||
export async function handleFixedReward(roleId: string, roleName: string, rewardStr: string, multi: number) {
|
export async function handleFixedReward(roleId: string, roleName: string, rewardStr: string, multi: number) {
|
||||||
let reward = decodeStr('fixReward', rewardStr);
|
let reward = decodeStr('fixReward', rewardStr);
|
||||||
@@ -124,7 +123,7 @@ async function rewardCurrency (roleId: string, dicGood: any, data: {id:number,cn
|
|||||||
return goods;
|
return goods;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handleCost(channelService: ChannelService, roleId: string, sid: string, goods: Array<{id: number, count: number}>) {
|
export async function handleCost(roleId: string, sid: string, goods: Array<{id: number, count: number}>) {
|
||||||
// 检查道具数量
|
// 检查道具数量
|
||||||
let role, costGold = 0, costCoin = 0, items = new Array<{id: number, count: number}>(), ids = new Array<number>() ;
|
let role, costGold = 0, costCoin = 0, items = new Array<{id: number, count: number}>(), ids = new Array<number>() ;
|
||||||
for(let {id, count} of goods) {
|
for(let {id, count} of goods) {
|
||||||
@@ -173,7 +172,7 @@ export async function handleCost(channelService: ChannelService, roleId: string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
let uids = [{uid: roleId, sid}];
|
let uids = [{uid: roleId, sid}];
|
||||||
channelService.pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: resultGoods, gold, coin} ), uids);
|
pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: resultGoods, gold, coin} ), uids);
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -129,8 +129,8 @@ function parseHeroSkill() {
|
|||||||
data.forEach(elem => {
|
data.forEach(elem => {
|
||||||
if (elem && elem.skillid) {
|
if (elem && elem.skillid) {
|
||||||
const seidLvUpArr = new Array<number>();
|
const seidLvUpArr = new Array<number>();
|
||||||
let skillArr = (elem.seid as string).split('&');
|
let skillArr = (elem.starSeid as string).split('&');
|
||||||
let lvUpArr = (elem.selv_up as string).split('&');
|
let lvUpArr = (elem.starSkill as string).split('&');
|
||||||
|
|
||||||
for(let i = 0;i < skillArr.length;i++){
|
for(let i = 0;i < skillArr.length;i++){
|
||||||
if(skillArr[i]==="") continue;
|
if(skillArr[i]==="") continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user