修改数据库,姑且跑起来
This commit is contained in:
@@ -569,7 +569,6 @@ export class HeroHandler {
|
||||
if (!dicSkin) return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
let hero = await HeroModel.findByHidAndRoleWithEquip(dicSkin.actorId, roleId);
|
||||
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
let oldCount = hero.ePlace.filter(cur => cur.equip).length;
|
||||
|
||||
let newHeroSkins: HeroSkin[] = [];
|
||||
let result = false;
|
||||
@@ -591,34 +590,34 @@ export class HeroHandler {
|
||||
if (!result) {
|
||||
return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
}
|
||||
let oldEquipSeids = calEquipSeids(hero);
|
||||
|
||||
let dicHero = gameData.hero.get(dicSkin.heroId);
|
||||
let dicMyJob = gameData.job.get(hero.job);
|
||||
let dicNewJob = getJobByGradeAndClass(dicHero.jobClass, dicMyJob.grade);
|
||||
|
||||
let newEplace: EPlace[] = [], heroPutNum = 0, curEquips: {seqId: number, id: number, hid: number, ePlaceId: number}[] = [];
|
||||
for(let { id, equip, lv, refineLv } of hero.ePlace) {
|
||||
let e = <EquipType>equip;
|
||||
if(equip && !checkEquipCanPut({...hero, skinId: dicSkin.heroId}, e.id)) {
|
||||
await EquipModel.putOnOrOff(e._id, 0);
|
||||
heroPutNum -= 1;
|
||||
newEplace.push({ id, equip: null, lv, refineLv});
|
||||
curEquips.push({ seqId: e.seqId, id: e.id, hid: 0, ePlaceId: id });
|
||||
} else {
|
||||
newEplace.push({ id, equip: e?e._id: null, lv, refineLv});
|
||||
}
|
||||
}
|
||||
// let newEplace: EPlace[] = [], heroPutNum = 0, curEquips: {seqId: number, id: number, hid: number, ePlaceId: number}[] = [];
|
||||
// for(let { id, equip, lv, refineLv } of hero.ePlace) {
|
||||
// let e = <EquipType>equip;
|
||||
// if(equip && !checkEquipCanPut({...hero, skinId: dicSkin.heroId}, e.id)) {
|
||||
// await EquipModel.putOnOrOff(e._id, 0);
|
||||
// heroPutNum -= 1;
|
||||
// newEplace.push({ id, equip: null, lv, refineLv});
|
||||
// curEquips.push({ seqId: e.seqId, id: e.id, hid: 0, ePlaceId: id });
|
||||
// } else {
|
||||
// newEplace.push({ id, equip: e?e._id: null, lv, refineLv});
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if(heroPutNum < 0) {
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, oldEquipSeids);
|
||||
await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroPutNum, true, {});
|
||||
await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, heroPutNum);
|
||||
await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [heroPutNum, oldCount]);
|
||||
}
|
||||
// if(heroPutNum < 0) {
|
||||
// hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, oldEquipSeids);
|
||||
// await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroPutNum, true, {});
|
||||
// await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, 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 });
|
||||
return resResult(STATUS.SUCCESS, { curHero: pick(hero, ['hid', 'skins', 'skinId', 'job']), curEquips });
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SKIN, sid, roleId, hero, { skins: newHeroSkins, skinId: dicSkin.heroId, job: dicNewJob.jobid });
|
||||
return resResult(STATUS.SUCCESS, { curHero: pick(hero, ['hid', 'skins', 'skinId', 'job']) });
|
||||
}
|
||||
|
||||
// ! debug接口 一键全武将
|
||||
|
||||
Reference in New Issue
Block a user