装备:卸下镶嵌
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: '玩家已达到最高的爵位' },
|
||||
|
||||
Reference in New Issue
Block a user