武将养成1
This commit is contained in:
@@ -22,7 +22,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
|
||||||
}
|
}
|
||||||
@@ -111,9 +111,16 @@ export const STATUS = {
|
|||||||
// 秘境 20700 - 20799
|
// 秘境 20700 - 20799
|
||||||
DUNGEON_REFRESH_TIMES_LACK: { code: 20701, simStr: '购买次数不足' },
|
DUNGEON_REFRESH_TIMES_LACK: { code: 20701, simStr: '购买次数不足' },
|
||||||
DUNGEON_TIMES_LACK: { code: 20701, simStr: '挑战次数不足' },
|
DUNGEON_TIMES_LACK: { code: 20701, simStr: '挑战次数不足' },
|
||||||
// 养成相关状态 30000 - 39999
|
|
||||||
HERO_JOB_REACH_MAX_STAGE: {code: 30001, simStr: '武将已达到最大的职业阶级'},
|
// 通用 30000 - 30099
|
||||||
HERO_JOB_STAGE_REACH_MAX_STAGE: {code: 30001, simStr: '武将已训练到最大阶段'},
|
ROLE_INFO_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||||
|
// 武将养成通用 30100 - 30199
|
||||||
|
HERO_JOB_REACH_MAX_STAGE: {code: 30100, simStr: '武将已达到最大的职业阶级'},
|
||||||
|
HERO_JOB_STAGE_REACH_MAX_STAGE: {code: 30101, simStr: '武将已训练到最大阶段'},
|
||||||
|
// 武将合成,升级,升星,升品相关 30200 - 30299
|
||||||
|
|
||||||
|
// 武将训练,好感度,羁绊,时装相关 30300 - 30399
|
||||||
|
|
||||||
// 社交相关状态 40000 - 49999
|
// 社交相关状态 40000 - 49999
|
||||||
// 运营模块相关状态 50000 - 59999
|
// 运营模块相关状态 50000 - 59999
|
||||||
// GM后台相关状态 60000 - 69999
|
// GM后台相关状态 60000 - 69999
|
||||||
|
|||||||
@@ -134,8 +134,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