This commit is contained in:
mamengke01
2020-12-25 14:15:03 +08:00
parent 0c5cb1daac
commit 04fa4e79cf
14 changed files with 304 additions and 27 deletions

View File

@@ -13,6 +13,7 @@ import { calPlayerCeAndSave } from "../../../services/playerCeService";
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../../../pubUtils/data";
import { EQUIP } from "../../../pubUtils/dicParam";
import { ITID, SPEICAL_ITEM, RANDOM_SE_COUNT } from "../../../consts/constModules/itemConst";
import { changeEquip } from "../../../services/equipService";
const _ = require('underscore');
@@ -426,8 +427,8 @@ export class EquipHandler {
if (!hero)
return resResult(STATUS.HERO_NOT_FIND);
if (type == 1) {
if (!!equip.hid)
return resResult(STATUS.EQUIP_IS_EQUIPED);
if (equip.hid == hid)
return resResult(STATUS.WRONG_PARMS);
if (goodInfo.lvLimited > hero.lv)
return resResult(STATUS.EQUIP_LEVEL_LIMIT);
let { jobid } = gameData.hero.get(hid);
@@ -439,12 +440,11 @@ export class EquipHandler {
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
let objectId = <string>hero.ePlace[index].equip;
if (!!objectId) {
let {seqId, ePlaceId} = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0, ePlaceId: 0 });
curEquips.push({ seqId, hid, ePlaceId });
}
await HeroModel.addEquip(roleId, hid, id, equip._id);
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, []);
let curEquip = await changeEquip(roleId, sid, objectId, equip.hid, id, eid);
if (!!curEquip)
curEquips.push(curEquip);
hero = await HeroModel.addEquip(roleId, hid, id, equip._id);
await calPlayerCeAndSave(sid, roleId, [hero]);
curEquips.push({ seqId: eid, hid, ePlaceId:id});
} else if (type == 2) {
if (!equip.hid)
@@ -453,9 +453,8 @@ export class EquipHandler {
if (index < 0)
return resResult(STATUS.WRONG_PARMS);
hero.ePlace[index].equip = null;
//await HeroModel.updateHeroInfo(roleId, hid, { ePlace: hero.ePlace });
let {seqId, ePlaceId} = await EquipModel.updateEquipInfo(eid, { hid: 0, ePlaceId: 0 });
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, []);
await calPlayerCeAndSave(sid, roleId, [hero]);
curEquips.push({ seqId, hid, ePlaceId });
}
return resResult(STATUS.SUCCESS, { curEquips: curEquips });