装备:卸下镶嵌

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');

View File

@@ -236,7 +236,6 @@ export function updateEplaces(eplace: EPlace[], update: Map<number, Partial<EPla
export function checkJewelCanPutOnEquip(equip: EPlace, jewel: JewelType) {
// 位置是否满足
let dicJewel = gameData.jewel.get(jewel.id);
console.log('####', dicJewel, dicJewel.eplaceId, equip.id)
if(!dicJewel || dicJewel.eplaceId != equip.id) return false;
// 品质是否满足
let dicEquipQualityExtra = gameData.equipQualityExtra.get(equip.quality);

View File

@@ -317,6 +317,7 @@ export const STATUS = {
EQUIP_QUALITYSTAGE_IS_MAX: { code: 30521, simStr: '该装备已到该品质下最高,请升品' },
EQUIP_STARSTAGE_IS_MAX: { code: 30522, simStr: '该装备已到该星级下最高,请升星' },
JEWEL_HAS_SUIT: { code: 30523, simStr: '该装备已镶嵌该天晶石了' },
JEWEL_NOT_SUIT: { code: 30524, simStr: '该装备未镶嵌天晶石' },
//全局养成30600-30699
ROLE_REACH_MAX_TITLE_LEVEL: { code: 30600, simStr: '玩家已达到最高的爵位' },