装备
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
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 { ItemInter } from "../../../pubUtils/interface";
|
||||
import { resResult, parseReward, getRandomByLen } from "../../../pubUtils/util";
|
||||
import { resResult, parseReward, getRandomByLen, getItems } from "../../../pubUtils/util";
|
||||
import { addItems, handleCost } from "../../../services/rewardService";
|
||||
import { EquipModel, RandSe } from "../../../db/Equip";
|
||||
import { HeroModel, EPlace } from "../../../db/Hero";
|
||||
import Role from "../../../db/Role";
|
||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||
import { getGoodById, gameData, getJewelById } from "../../../pubUtils/data";
|
||||
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../../../pubUtils/data";
|
||||
import { EQUIP } from "../../../pubUtils/dicParam";
|
||||
import { ITID, SPEICAL_ITEM } from "../../../consts/constModules/itemConst";
|
||||
|
||||
@@ -346,13 +346,21 @@ export class EquipHandler {
|
||||
let obj = ITID.get(goodInfo.itid);
|
||||
let ePlaceId = obj.type;
|
||||
let curEquips:Array<{seqId: number, hid: number, ePlaceId: number }> = [];
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
if (type == 1) {
|
||||
let { jobid } = gameData.hero.get(hid);
|
||||
let { job_class } = getHeroJob(jobid);
|
||||
let { classId } = getHeroEquipByClassId(goodInfo.itid);
|
||||
// if (_.indexOf(classId, job_class) < 0)
|
||||
// return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
|
||||
if (!!equip.hid)
|
||||
return resResult(STATUS.EQUIP_IS_EQUIPED);
|
||||
let ePlace = await HeroModel.getHeroEquip(roleId, hid);
|
||||
if (!ePlace)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
let index = _.findIndex(ePlace, {id: ePlaceId});
|
||||
let index = _.findIndex(hero.ePlace, {id: ePlaceId});
|
||||
if (index < 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (!!ePlace[index].equip) {
|
||||
@@ -483,7 +491,7 @@ export class EquipHandler {
|
||||
if (index > 0)
|
||||
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
|
||||
if (!equip.holes[index].jewel)
|
||||
return resResult(STATUS.JEWEL_IS_NOT_FIND);
|
||||
return resResult(STATUS.EQUIP_NOT_FILL_HOLE);
|
||||
goods.push({id: equip.holes[index].jewel, count: 1});
|
||||
equip.holes[index].jewel = 0;
|
||||
await EquipModel.updateEquipInfo(eid, {holes: equip.holes});
|
||||
|
||||
@@ -4,4 +4,94 @@ module.exports = {
|
||||
'required string from': 2,
|
||||
'required string target': 3
|
||||
},
|
||||
'onItemUpdate': {
|
||||
"message Data": {
|
||||
'required uInt32 id': 1,
|
||||
'required uInt32 count': 2,
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
},
|
||||
'onPlayerCeUpdate': {
|
||||
"message Data": {
|
||||
"message Hero": {
|
||||
'required uInt32 hid': 1,
|
||||
'required uInt32 ce': 2,
|
||||
},
|
||||
'required uInt32 ce': 1,
|
||||
'repeated Hero heros': 2,
|
||||
'required uInt32 topFiveCe': 3
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
},
|
||||
'onPlayerDataChange': {
|
||||
"message Data": {
|
||||
'optional uInt32 coin': 1,
|
||||
'optional uInt32 giftGold': 2,
|
||||
'optional uInt32 gold': 3,
|
||||
'optional uInt32 ap': 4
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
},
|
||||
'onHeroSkinChange': {
|
||||
"message Data": {
|
||||
"message SkinInfo": {
|
||||
"message Skin": {
|
||||
'required uInt32 id': 1,
|
||||
'required bool enable': 2
|
||||
},
|
||||
'repeated Skin skins': 1,
|
||||
},
|
||||
'repeated SkinInfo skinInfos': 1
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
},
|
||||
'onEquipAdd': {
|
||||
"message Data": {
|
||||
"message EquipInfo": {
|
||||
"message RandSe": {
|
||||
'required uInt32 id': 1,
|
||||
'required uInt32 seid': 2,
|
||||
'required uInt32 rand': 3,
|
||||
'required uInt32 locked': 4
|
||||
},
|
||||
"message Hole": {
|
||||
'required uInt32 id': 1,
|
||||
'required bool enable': 2,
|
||||
'required bool jewel': 3
|
||||
},
|
||||
'repeated Hole holes': 1,
|
||||
'repeated RandSe randSe': 2,
|
||||
'required uInt32 seqId': 3,
|
||||
'required uInt32 id': 4,
|
||||
'required uInt32 name': 5,
|
||||
'required uInt32 hid': 6,
|
||||
'required uInt32 count': 7,
|
||||
'required uInt32 quality': 8,
|
||||
'required uInt32 type': 9,
|
||||
'required uInt32 wearLv': 10,
|
||||
'required uInt32 suitId': 11,
|
||||
'required uInt32 randRange': 12
|
||||
},
|
||||
'repeated EquipInfo equipInfos': 1
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
},
|
||||
'onEquipDel': {
|
||||
"message Data": {
|
||||
'repeated uInt32 equips': 1
|
||||
},
|
||||
'required string msg': 1,
|
||||
'required uInt32 code': 2,
|
||||
'required Data data': 3
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user