修改数据库,姑且跑起来
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -731,22 +731,22 @@ export class FriendHandler {
|
||||
if (heroList.length <= 0) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let list = new Array();
|
||||
for (let { roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skinId, attr: heroAttrs, ePlace } of heroList) {
|
||||
// for (let { roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skinId, attr: heroAttrs, ePlace } of heroList) {
|
||||
|
||||
let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
|
||||
// let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
|
||||
|
||||
let attributes = getPlayerMainAttribute(heroAttrs, role.attr);
|
||||
// let attributes = getPlayerMainAttribute(heroAttrs, role.attr);
|
||||
|
||||
list.push({
|
||||
roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skinId,
|
||||
equips: equips.map(cur => {
|
||||
let curEplace = ePlace.find(ccur => cur.ePlaceId == ccur.id) || new EPlace();
|
||||
let { lv = 0, refineLv = 0 } = curEplace;
|
||||
return { ...cur, lv, refineLv }
|
||||
}), attributes
|
||||
});
|
||||
// list.push({
|
||||
// roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skinId,
|
||||
// equips: equips.map(cur => {
|
||||
// let curEplace = ePlace.find(ccur => cur.ePlaceId == ccur.id) || new EPlace();
|
||||
// let { lv = 0, refineLv = 0 } = curEplace;
|
||||
// return { ...cur, lv, refineLv }
|
||||
// }), attributes
|
||||
// });
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
return resResult(STATUS.SUCCESS, { list });
|
||||
|
||||
@@ -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