装备:替换装备bug
This commit is contained in:
@@ -47,6 +47,7 @@ export function checkMaterialEnough(consumes:Array<{id: number, count: number}>,
|
||||
/**
|
||||
* 将装备卸载下来,并检查是否有替换装备的武将,若有则替换
|
||||
* 武将A(装备A)&武将B(装备B) ==> 武将A(装备B)&武将B(装备A)
|
||||
* 武将A(装备A)& 装备B ==> 武将A(装备B)& 装备A
|
||||
* @param roleId 玩家id
|
||||
* @param sid
|
||||
* @param equip 目标武将要卸下的装备,装备A
|
||||
@@ -75,9 +76,13 @@ export async function changeEquip(roleId: string, sid: string, equipA: EquipType
|
||||
}
|
||||
let res = await dressEquip(roleId, sid, heroB, equipA, funcs);//替换给武将,并计算战力
|
||||
return res;
|
||||
} else {
|
||||
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, null, equipA, id, funcs);//卸下装备并重算战力
|
||||
return res;
|
||||
}
|
||||
} else if (!!heroB) {//从穿戴装备的武将上卸下装备
|
||||
await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
|
||||
let res = await takeOffEquipAndCalPlayerCe(roleId, sid, heroB, equipB, id, funcs);//卸下装备并重算战力
|
||||
return res
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -89,16 +94,19 @@ export async function changeEquip(roleId: string, sid: string, equipA: EquipType
|
||||
* @param id
|
||||
*/
|
||||
export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, hero:HeroType, equip: EquipType, id: number, funcs: number[] ) {
|
||||
let args = calEquipSeids(hero);
|
||||
hero = await HeroModel.removeEquip(roleId, hero.hid, id, equip._id);
|
||||
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
||||
|
||||
console.log(roleId, sid, hero, equip, id)
|
||||
if(hero) {
|
||||
let args = calEquipSeids(hero);
|
||||
hero = await HeroModel.removeEquip(roleId, hero.hid, id, equip._id);
|
||||
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [-1]);
|
||||
} else {
|
||||
await EquipModel.putOnOrOff( equip._id, 0 );
|
||||
}
|
||||
// 任务
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.EQUIP_SUM, -1, true, {});
|
||||
await checkTaskWithHero(roleId, sid, funcs, TASK_TYPE.EQUIP_BY_HERO, hero, [-1]);
|
||||
await checkTaskWithEquip(roleId, sid, funcs, TASK_TYPE.EQUIP_QUALITY, equip, [-1]);
|
||||
|
||||
return { seqId: equip.seqId, hid: 0};
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user