装备bug修复

This commit is contained in:
mamengke01
2020-12-21 14:36:49 +08:00
parent dc527cae2e
commit 1edb717b99
3 changed files with 16 additions and 16 deletions
@@ -357,15 +357,13 @@ export class EquipHandler {
// 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);
return resResult(STATUS.EQUIP_IS_EQUIPED);
let index = _.findIndex(hero.ePlace, {id: ePlaceId});
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
if (!!ePlace[index].equip) {
let lastEquip = await EquipModel.updateEquipInfo(ePlace[index].equip.seqId, {hid:0, ePlaceId: 0});
return resResult(STATUS.WRONG_PARMS);
let objectId = <string>hero.ePlace[index].equip;
if (!!objectId) {
let lastEquip = await EquipModel.updateEquipInfobyObjectId(objectId, {hid:0, ePlaceId: 0});
curEquips.push({
seqId: lastEquip.seqId,
hid: lastEquip.hid,
@@ -381,15 +379,11 @@ export class EquipHandler {
} else if (type == 2) {
if (!equip.hid)
return resResult(STATUS.EQUIP_NOT_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||ePlace[index].equip.seqId != eid)
return resResult(STATUS.WRONG_PARMS);
await HeroModel.unloadHeroAndEquip(roleId, hid, eid);
hero.ePlace[index].equip = null;
await HeroModel.updateHeroInfo(roleId, hid, {ePlace:hero.ePlace});
equip = await EquipModel.updateEquipInfo(eid, {hid:0, ePlaceId: 0});
curEquips.push({
seqId: equip.seqId,