任务:修复装备穿戴bug
This commit is contained in:
@@ -619,6 +619,8 @@ export class EquipHandler {
|
|||||||
// 原武将:heroA,原武将穿戴着的装备a,将要穿戴的装备b,装备b被装备着的武将B
|
// 原武将:heroA,原武将穿戴着的装备a,将要穿戴的装备b,装备b被装备着的武将B
|
||||||
let heroA = await HeroModel.findByHidAndRoleWithEquip(hid, roleId);
|
let heroA = await HeroModel.findByHidAndRoleWithEquip(hid, roleId);
|
||||||
if (!heroA) return resResult(STATUS.HERO_NOT_FIND);
|
if (!heroA) return resResult(STATUS.HERO_NOT_FIND);
|
||||||
|
let oldCountA = heroA.ePlace.filter(cur => cur.equip).length;
|
||||||
|
let oldCountB = 0;
|
||||||
|
|
||||||
let equip = await EquipModel.getEquip(eid); // 装备:1-equipB 2-equipA
|
let equip = await EquipModel.getEquip(eid); // 装备:1-equipB 2-equipA
|
||||||
if(!equip) return resResult(STATUS.EQUIP_NOT_FIND);
|
if(!equip) return resResult(STATUS.EQUIP_NOT_FIND);
|
||||||
@@ -643,6 +645,7 @@ export class EquipHandler {
|
|||||||
if(equipB.hid > 0) {
|
if(equipB.hid > 0) {
|
||||||
heroB = await HeroModel.findByHidAndRoleWithEquip(equipB.hid, roleId);
|
heroB = await HeroModel.findByHidAndRoleWithEquip(equipB.hid, roleId);
|
||||||
argsB = calEquipSeids(heroB);
|
argsB = calEquipSeids(heroB);
|
||||||
|
oldCountB = heroB.ePlace.filter(cur => cur.equip).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(equipA) {
|
if(equipA) {
|
||||||
@@ -680,12 +683,12 @@ export class EquipHandler {
|
|||||||
if(heroA) {
|
if(heroA) {
|
||||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroA, {}, argsA);
|
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroA, {}, argsA);
|
||||||
if(heroAPutNum != 0) {
|
if(heroAPutNum != 0) {
|
||||||
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroAPutNum]);
|
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroAPutNum, oldCountA]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(heroB) {
|
if(heroB) {
|
||||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroB, {}, argsB);
|
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroB, {}, argsB);
|
||||||
if(heroBPutTNum != 0) await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroBPutTNum]);
|
if(heroBPutTNum != 0) await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroBPutTNum, oldCountB]);
|
||||||
}
|
}
|
||||||
if(heroAPutNum + heroBPutTNum != 0) {
|
if(heroAPutNum + heroBPutTNum != 0) {
|
||||||
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroAPutNum + heroBPutTNum, true, {});
|
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroAPutNum + heroBPutTNum, true, {});
|
||||||
@@ -742,6 +745,7 @@ export class EquipHandler {
|
|||||||
return { id, quality, ce, equip, goodsAbility, lvLimited, ePlaceId }
|
return { id, quality, ce, equip, goodsAbility, lvLimited, ePlaceId }
|
||||||
});
|
});
|
||||||
let { ePlace, lv } = hero;
|
let { ePlace, lv } = hero;
|
||||||
|
let oldCount = ePlace.filter(cur => cur.equip).length;
|
||||||
|
|
||||||
let curEquips: Array<{ seqId: number, hid: number }> = [];
|
let curEquips: Array<{ seqId: number, hid: number }> = [];
|
||||||
let equips: EquipType[] = [];
|
let equips: EquipType[] = [];
|
||||||
@@ -775,7 +779,7 @@ export class EquipHandler {
|
|||||||
}
|
}
|
||||||
if (curEquips.length > 0) {
|
if (curEquips.length > 0) {
|
||||||
//任务
|
//任务
|
||||||
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [1]);
|
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [1, oldCount]);
|
||||||
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, curEquips.length, true, {});
|
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, curEquips.length, true, {});
|
||||||
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, curEquips.length);
|
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, curEquips.length);
|
||||||
for(let equip of equips) {
|
for(let equip of equips) {
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ export class HeroHandler {
|
|||||||
if (!dicSkin) return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
if (!dicSkin) return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||||
let hero = await HeroModel.findByHidAndRoleWithEquip(dicSkin.actorId, roleId);
|
let hero = await HeroModel.findByHidAndRoleWithEquip(dicSkin.actorId, roleId);
|
||||||
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||||
|
let oldCount = hero.ePlace.filter(cur => cur.equip).length;
|
||||||
|
|
||||||
let newHeroSkins: HeroSkin[] = [];
|
let newHeroSkins: HeroSkin[] = [];
|
||||||
let result = false;
|
let result = false;
|
||||||
@@ -613,7 +614,7 @@ export class HeroHandler {
|
|||||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, oldEquipSeids);
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, oldEquipSeids);
|
||||||
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroPutNum, true, {});
|
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroPutNum, true, {});
|
||||||
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, heroPutNum);
|
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, heroPutNum);
|
||||||
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [heroPutNum]);
|
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [heroPutNum, oldCount]);
|
||||||
}
|
}
|
||||||
|
|
||||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SKIN, sid, roleId, hero, { skins: newHeroSkins, skinId: dicSkin.heroId, job: dicNewJob.jobid, ePlace: newEplace });
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SKIN, sid, roleId, hero, { skins: newHeroSkins, skinId: dicSkin.heroId, job: dicNewJob.jobid, ePlace: newEplace });
|
||||||
|
|||||||
@@ -137,13 +137,14 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(let [_hid, {hero, equips} ] of heroMap) {
|
for(let [_hid, {hero, equips} ] of heroMap) {
|
||||||
|
let oldCount = hero.ePlace.filter(cur => cur.equip).length;
|
||||||
let args = calEquipSeids(hero);
|
let args = calEquipSeids(hero);
|
||||||
for(let equip of equips) {
|
for(let equip of equips) {
|
||||||
hero = await HeroModel.removeEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
|
hero = await HeroModel.removeEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
||||||
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [-1]);
|
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [-1, oldCount]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ export async function checkTaskWithHero(roleId: string, taskType: number, hero:
|
|||||||
// arg[0] 1:穿上 -1:脱下
|
// arg[0] 1:穿上 -1:脱下
|
||||||
let { ePlace } = hero;
|
let { ePlace } = hero;
|
||||||
let count = ePlace.filter(cur => cur.equip).length;
|
let count = ePlace.filter(cur => cur.equip).length;
|
||||||
pushMessage = await checkTask(roleId, taskType, args[0], true, { count, isPutOn: args[0] });
|
pushMessage = await checkTask(roleId, taskType, args[0], true, { count, isPutOn: args[0], oldCount: args[1] });
|
||||||
}
|
}
|
||||||
else if (taskType == TASK_TYPE.EQUIP_STRENGTHEN) {
|
else if (taskType == TASK_TYPE.EQUIP_STRENGTHEN) {
|
||||||
// args: 依次为原先的装备的强化等级
|
// args: 依次为原先的装备的强化等级
|
||||||
@@ -372,9 +372,9 @@ export async function checkTaskRec(roleId: string, type: number, group: string,
|
|||||||
break;
|
break;
|
||||||
case TASK_TYPE.EQUIP_BY_HERO:
|
case TASK_TYPE.EQUIP_BY_HERO:
|
||||||
isMatch = false;
|
isMatch = false;
|
||||||
if (param.isPutOn == 1 && param.count == taskParam[1]) { // 装上之后达到 +1
|
if (param.isPutOn == 1 && param.count >= taskParam[1] && param.oldCount < taskParam[1] ) { // 装上之后达到 +1
|
||||||
isMatch = true;
|
isMatch = true;
|
||||||
} else if (param.isPutOn == -1 && param.count < taskParam[1]) { // 脱下后不能达到 -1
|
} else if (param.isPutOn == -1 && param.count < taskParam[1] && param.oldCount >= taskParam[1]) { // 脱下后不能达到 -1
|
||||||
isMatch = true;
|
isMatch = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user