战力,出生皮肤
This commit is contained in:
@@ -44,7 +44,7 @@ export class EquipHandler {
|
||||
|
||||
|
||||
let targetGood = gameData.goods.get(gid);
|
||||
if (!targetGood) return resResult(STATUS.ROLE_INFO_NOT_FOUND);
|
||||
if (!targetGood) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
let cost = new Array<ItemInter>();
|
||||
if (targetGood.suitId > 0) { // 套装
|
||||
@@ -172,13 +172,13 @@ export class EquipHandler {
|
||||
// 是否成功精炼
|
||||
let dicRefine = gameData.refine.get(refineLv + 1);
|
||||
if (!dicRefine) {
|
||||
return resResult(STATUS.ROLE_INFO_NOT_FOUND)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND)
|
||||
}
|
||||
|
||||
let { successRate } = dicRefine;
|
||||
for (let { id, count } of material) {
|
||||
let dicGoods = gameData.goods.get(id);
|
||||
if (!dicGoods) return resResult(STATUS.ROLE_INFO_NOT_FOUND);
|
||||
if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
if (!SPEICAL_ITEM.REFINE_ADD_RATE.includes(id)) {
|
||||
return resResult(STATUS.ROLE_WRONG_ITEM)
|
||||
}
|
||||
@@ -264,7 +264,7 @@ export class EquipHandler {
|
||||
}
|
||||
|
||||
let dicGoods = gameData.goods.get(id);
|
||||
if (!dicGoods) return resResult(STATUS.ROLE_INFO_NOT_FOUND);
|
||||
if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
let { randomEffect } = dicGoods;
|
||||
let pool = randomEffect.map(cur => gameData.randomEffectPool.get(cur));
|
||||
@@ -354,12 +354,14 @@ export class EquipHandler {
|
||||
let equip = await EquipModel.getEquip(eid);
|
||||
let goodInfo = getGoodById(equip.id);
|
||||
let obj = ITID.get(goodInfo.itid);
|
||||
let ePlaceId = obj.type;
|
||||
let id = obj.type;
|
||||
let curEquips: Array<{ seqId: number, hid: number, ePlaceId: number }> = [];
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
if (type == 1) {
|
||||
if (!!equip.hid)
|
||||
return resResult(STATUS.EQUIP_IS_EQUIPED);
|
||||
if (goodInfo.lvLimited > hero.lv)
|
||||
return resResult(STATUS.EQUIP_LEVEL_LIMIT);
|
||||
let { jobid } = gameData.hero.get(hid);
|
||||
@@ -367,40 +369,26 @@ export class EquipHandler {
|
||||
let { classId } = getHeroEquipByClassId(goodInfo.itid);
|
||||
if (_.indexOf(classId, job_class) < 0)
|
||||
return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
|
||||
if (!!equip.hid)
|
||||
return resResult(STATUS.EQUIP_IS_EQUIPED);
|
||||
let index = _.findIndex(hero.ePlace, { id: ePlaceId });
|
||||
let index = _.findIndex(hero.ePlace, { id });
|
||||
if (index < 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,
|
||||
ePlaceId: lastEquip.ePlaceId
|
||||
});
|
||||
let {seqId, ePlaceId} = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0, ePlaceId: 0 });
|
||||
curEquips.push({ seqId, hid, ePlaceId });
|
||||
}
|
||||
await HeroModel.addEquip(roleId, hid, ePlaceId, equip._id);
|
||||
curEquips.push({
|
||||
seqId: eid,
|
||||
hid: hid,
|
||||
ePlaceId: ePlaceId
|
||||
});
|
||||
await HeroModel.addEquip(roleId, hid, id, equip._id);
|
||||
curEquips.push({ seqId: eid, hid, ePlaceId:id});
|
||||
} else if (type == 2) {
|
||||
if (!equip.hid)
|
||||
return resResult(STATUS.EQUIP_NOT_EQUIPED);
|
||||
let index = _.findIndex(hero.ePlace, { id: ePlaceId });
|
||||
let index = _.findIndex(hero.ePlace, { id });
|
||||
if (index < 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
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,
|
||||
hid: equip.hid,
|
||||
ePlaceId: equip.ePlaceId
|
||||
});
|
||||
let {seqId, ePlaceId} = await EquipModel.updateEquipInfo(eid, { hid: 0, ePlaceId: 0 });
|
||||
curEquips.push({ seqId, hid, ePlaceId });
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curEquips: curEquips });
|
||||
}
|
||||
@@ -438,18 +426,29 @@ export class EquipHandler {
|
||||
let roleId: string = session.get('roleId');
|
||||
let sid: string = session.get('sid');
|
||||
let consumes: Array<{ id: number, count: number }> = [];
|
||||
let goods: Array<{ id: number, count: number }> = [];
|
||||
let equip = await EquipModel.getEquip(eid);
|
||||
let { itid } = getGoodById(equip.id);
|
||||
let {equipJewel} = ITID.get(itid);
|
||||
let jewelInfo = getGoodById(jewel);
|
||||
if (jewelInfo.itid != equipJewel)
|
||||
return resResult(STATUS.EQUIP_NOT_MATCH_JEWEL);
|
||||
let index = _.findIndex(equip.holes, { id });
|
||||
if (index > 0)
|
||||
return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
|
||||
if (!equip.holes[index].isOpen)
|
||||
return resResult(STATUS.EQUIP_HOLE_IS_NOT_DUG);
|
||||
if (!!equip.holes[index].jewel)
|
||||
goods.push({id: equip.holes[index].jewel, count:1});
|
||||
consumes.push({ id: jewel, count: 1 });
|
||||
let result = await handleCost(roleId, sid, consumes);
|
||||
if (!result)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
equip.holes[index].jewel = jewel;
|
||||
await EquipModel.updateEquipInfo(eid, { holes: equip.holes });
|
||||
let roleName: string = session.get('roleName');
|
||||
if (goods.length)
|
||||
await addItems(roleId, roleName, sid, goods);
|
||||
return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user