聊天:系统推送(精炼,合成套装或橙装)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Application, BackendSession } from "pinus";
|
||||
import { STATUS, EQUIP_STRENGTHEN_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, CONSUME_TYPE, GOOD_TYPE, HERO_GROW_MAX } from "../../../consts";
|
||||
import { STATUS, EQUIP_STRENGTHEN_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, CONSUME_TYPE, GOOD_TYPE, HERO_GROW_MAX, MSG_SOURCE } from "../../../consts";
|
||||
import { ItemInter } from "../../../pubUtils/interface";
|
||||
|
||||
import { resResult, parseGoodStr, getRandomByLen, deepCopy, mergeSameGoods, getRandValueByMinMax, getRandEelm } from "../../../pubUtils/util";
|
||||
@@ -11,10 +11,11 @@ import Role from "../../../db/Role";
|
||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||
import { getHeroJob, getGoodById, gameData, getSuit, getHeroEquipByClassId } from "../../../pubUtils/data";
|
||||
import { EQUIP } from "../../../pubUtils/dicParam";
|
||||
import { ITID, SPEICAL_ITEM, RANDOM_SE_COUNT } from "../../../consts/constModules/itemConst";
|
||||
import { ITID, SPEICAL_ITEM, RANDOM_SE_COUNT, QUALITY_TYPE } from "../../../consts/constModules/itemConst";
|
||||
import { changeEquip, dressEquip, checkMaterialEnough, takeOffEquipAndCalPlayerCe } from "../../../services/equipService";
|
||||
|
||||
import { indexOf, findIndex } from 'underscore';
|
||||
import { pushEquipComposeOrangeMsg, pushEquipComposeSuitMsg, pushEquipRefineSucMsg, pushNormalEquipMsg } from "../../../services/chatService";
|
||||
|
||||
export default function (app: Application) {
|
||||
return new EquipHandler(app);
|
||||
@@ -41,6 +42,7 @@ export class EquipHandler {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
const serverId = session.get('serverId');
|
||||
// 消耗材料
|
||||
// 获得装备
|
||||
let { gid, originalEquip } = msg;
|
||||
@@ -76,6 +78,12 @@ export class EquipHandler {
|
||||
|
||||
let items = [{ id: gid, count: 1 }];
|
||||
let goods = await addItems(roleId, roleName, sid, items);
|
||||
if (targetGood.suitId) {
|
||||
pushNormalEquipMsg(roleId, roleName, serverId, MSG_SOURCE.EQUIP_COMPOSE_SUIT, gid, targetGood.name);
|
||||
}
|
||||
if (targetGood.quality >= QUALITY_TYPE.ORANGE) {
|
||||
pushNormalEquipMsg(roleId, roleName, serverId, MSG_SOURCE.EQUIP_COMPOSE_ORANGE, gid, targetGood.name);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { goods });
|
||||
}
|
||||
|
||||
@@ -208,7 +216,8 @@ export class EquipHandler {
|
||||
// 装备栏精炼
|
||||
public async refine(msg: { hid: number, ePlaceId: number, material: { id: number, count: number }[] }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
// let roleName: string = session.get('roleName');
|
||||
let roleName: string = session.get('roleName');
|
||||
let serverId = session.get('serverId');
|
||||
let sid: string = session.get('sid');
|
||||
|
||||
let { hid, ePlaceId, material } = msg;
|
||||
@@ -267,6 +276,10 @@ export class EquipHandler {
|
||||
hid,
|
||||
ePlace: [curEplace]
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
pushEquipRefineSucMsg(roleId, roleName, serverId, curEplace);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { isSuccess, curHero });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user