装备穿戴
This commit is contained in:
@@ -422,7 +422,7 @@ export class EquipHandler {
|
|||||||
let goodInfo = getGoodById(equip.id);
|
let goodInfo = getGoodById(equip.id);
|
||||||
let obj = ITID.get(goodInfo.itid);
|
let obj = ITID.get(goodInfo.itid);
|
||||||
let id = obj.type;
|
let id = obj.type;
|
||||||
let curEquips: Array<{ seqId: number, hid: number, ePlaceId: number }> = [];
|
let curEquips: Array<{ seqId: number, hid: number}> = [];
|
||||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||||
if (!hero)
|
if (!hero)
|
||||||
return resResult(STATUS.HERO_NOT_FIND);
|
return resResult(STATUS.HERO_NOT_FIND);
|
||||||
@@ -445,7 +445,7 @@ export class EquipHandler {
|
|||||||
curEquips.push(curEquip);
|
curEquips.push(curEquip);
|
||||||
hero = await HeroModel.addEquip(roleId, hid, id, equip._id);
|
hero = await HeroModel.addEquip(roleId, hid, id, equip._id);
|
||||||
await calPlayerCeAndSave(sid, roleId, [hero]);
|
await calPlayerCeAndSave(sid, roleId, [hero]);
|
||||||
curEquips.push({ seqId: eid, hid, ePlaceId:id});
|
curEquips.push({ seqId: eid, hid });
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
if (!equip.hid)
|
if (!equip.hid)
|
||||||
return resResult(STATUS.EQUIP_NOT_EQUIPED);
|
return resResult(STATUS.EQUIP_NOT_EQUIPED);
|
||||||
@@ -453,9 +453,9 @@ export class EquipHandler {
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
return resResult(STATUS.WRONG_PARMS);
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
hero.ePlace[index].equip = null;
|
hero.ePlace[index].equip = null;
|
||||||
let {seqId, ePlaceId} = await EquipModel.updateEquipInfo(eid, { hid: 0, ePlaceId: 0 });
|
let {seqId} = await EquipModel.updateEquipInfo(eid, { hid: 0 });
|
||||||
await calPlayerCeAndSave(sid, roleId, [hero]);
|
await calPlayerCeAndSave(sid, roleId, [hero]);
|
||||||
curEquips.push({ seqId, hid, ePlaceId });
|
curEquips.push({ seqId, hid });
|
||||||
}
|
}
|
||||||
return resResult(STATUS.SUCCESS, { curEquips: curEquips });
|
return resResult(STATUS.SUCCESS, { curEquips: curEquips });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export async function changeEquip(roleId: string, sid: string, objectId: string,
|
|||||||
await calPlayerCeAndSave(sid, roleId, [hero]);
|
await calPlayerCeAndSave(sid, roleId, [hero]);
|
||||||
let ePlaces = <EPlace>hero.ePlace;
|
let ePlaces = <EPlace>hero.ePlace;
|
||||||
let ePlace= _.findWhere(ePlaces,{ id: ePlaceId });
|
let ePlace= _.findWhere(ePlaces,{ id: ePlaceId });
|
||||||
return {seqId: ePlace.equip.seqId, hid, ePlaceId};
|
return { seqId: ePlace.equip.seqId, hid };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return takeOffEquip(objectId);
|
return takeOffEquip(objectId);
|
||||||
@@ -72,12 +72,12 @@ export async function changeEquip(roleId: string, sid: string, objectId: string,
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
hero.ePlace[index].equip = null;
|
hero.ePlace[index].equip = null;
|
||||||
await EquipModel.updateEquipInfo(seqId, { hid: 0, ePlaceId: 0 });
|
await EquipModel.updateEquipInfo(seqId, { hid: 0 });
|
||||||
await calPlayerCeAndSave(sid, roleId, [hero]);
|
await calPlayerCeAndSave(sid, roleId, [hero]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function takeOffEquip(objectId: string) {
|
async function takeOffEquip(objectId: string) {
|
||||||
let {seqId, ePlaceId} = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0, ePlaceId: 0 });
|
let { seqId } = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0 });
|
||||||
return { seqId, hid: 0, ePlaceId};
|
return { seqId, hid: 0};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user