装备:卸下镶嵌

This commit is contained in:
luying
2022-02-16 16:56:07 +08:00
parent 29e66fc844
commit e0bf64a35e
3 changed files with 25 additions and 1 deletions

View File

@@ -328,6 +328,30 @@ export class EquipHandler {
return resResult(STATUS.SUCCESS, { curHero, originHero: originHeroResult, curJewel });
}
// 卸下天晶石
public async putOffJewel(msg: { hid: number, eplaceId: number }, session: BackendSession) {
let { hid, eplaceId } = msg;
let roleId: string = session.get('roleId');
let sid: string = session.get('sid');
let hero = await HeroModel.findByHidAndRole(hid, roleId);
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
let curEquip = hero.ePlace?.find(cur => cur.id == eplaceId);
if(!curEquip) return resResult(STATUS.EQUIP_NOT_FIND);
if(curEquip.jewel == 0) return resResult(STATUS.JEWEL_NOT_SUIT);
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
let { newEplace, updatedEplace } = updateEplace(hero.ePlace, eplaceId, { jewel: 0 });
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_JEWEL, sid, roleId, hero, { ePlace: newEplace }, [eplaceId]);
let curHero = {
hid,
eplace: updatedEplace
}
return resResult(STATUS.SUCCESS, { curHero, curJewel });
}
// // 装备洗炼锁定
// public async lockRandSe(msg: { eid: number, id: number, lock: boolean }, session: BackendSession) {
// let roleId: string = session.get('roleId');