|
|
|
@@ -22,6 +22,7 @@ import { CalHeroCe } from '../../../domain/roleField/calCe';
|
|
|
|
|
import { HERO, REBORN } from '../../../pubUtils/dicParam';
|
|
|
|
|
import { createHero, createHeroes } from '../../../services/role/createHero';
|
|
|
|
|
import { CheckMeterial } from '../../../services/role/checkMaterial';
|
|
|
|
|
import { HeroParam } from '../../../domain/roleField/hero';
|
|
|
|
|
|
|
|
|
|
export default function (app: Application) {
|
|
|
|
|
new HandlerService(app, {});
|
|
|
|
@@ -57,7 +58,7 @@ export class HeroHandler {
|
|
|
|
|
let { heroes, resultHeroes } = await createHero(roleId, roleName, sid, serverId, { hid, count: 1 });
|
|
|
|
|
|
|
|
|
|
pushComposeOrangeHero(roleId, roleName, serverId, resultHeroes[0]);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: resultHeroes[0], addHeros: heroes });
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: new HeroParam(resultHeroes[0]), addHeros: heroes });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 武将升级
|
|
|
|
@@ -613,7 +614,8 @@ export class HeroHandler {
|
|
|
|
|
let { newEplace } = updateEplaces(oldEplace, eplaceIds);
|
|
|
|
|
|
|
|
|
|
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']), ePlace: newEplace }});
|
|
|
|
|
let resultHero = new HeroParam(hero);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(resultHero, ['hid', 'skins', 'skinId', 'job', 'talent', 'usedTalentPoint']), ePlace: newEplace }});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async previewRebirth(msg: { hid: number }, session: BackendSession) {
|
|
|
|
@@ -649,9 +651,10 @@ export class HeroHandler {
|
|
|
|
|
let dicHero = gameData.hero.get(skinId);
|
|
|
|
|
let dicJob = getJobByGradeAndClass(dicHero.jobClass, 0);
|
|
|
|
|
|
|
|
|
|
let newSkins = initSkinTalent(skins);
|
|
|
|
|
let dicHeroScroll = getScollByStar(dicHero.quality, dicHero.initialStars, dicHero.quality, 0);
|
|
|
|
|
let initInfo = HeroModel.getInitInfo({
|
|
|
|
|
job: dicJob.jobid, skins, skinId, ce,
|
|
|
|
|
job: dicJob.jobid, skins: newSkins, skinId, ce,
|
|
|
|
|
star: dicHero.initialStars, quality: dicHero.quality,
|
|
|
|
|
scrollActive: scrollActive,
|
|
|
|
|
scrollId: scrollActive? dicHeroScroll.id: 0,
|
|
|
|
@@ -682,7 +685,8 @@ export class HeroHandler {
|
|
|
|
|
|
|
|
|
|
let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH);
|
|
|
|
|
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: { ...curHero, ce: reduceCe(curHero.ce) }, curJewels, goods });
|
|
|
|
|
const heroResult = new HeroParam(curHero);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: heroResult, curJewels, goods });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 解锁天赋
|
|
|
|
@@ -715,10 +719,12 @@ export class HeroHandler {
|
|
|
|
|
return resResult(STATUS.TALENT_POINT_NOT_ENOUGH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { newSkins, newTalents } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint);
|
|
|
|
|
let { newSkins } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint);
|
|
|
|
|
|
|
|
|
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins });
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(hero, ['hid', 'skins', 'skinId']) }});
|
|
|
|
|
|
|
|
|
|
const heroResult = new HeroParam(hero);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint']) }});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -750,10 +756,12 @@ export class HeroHandler {
|
|
|
|
|
return resResult(STATUS.TALENT_POINT_NOT_ENOUGH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { newSkins, newTalents } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint);
|
|
|
|
|
let { newSkins } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint);
|
|
|
|
|
|
|
|
|
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins });
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(hero, ['hid', 'skins', 'skinId']) }});
|
|
|
|
|
|
|
|
|
|
const heroResult = new HeroParam(hero);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint']) }});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 洗点
|
|
|
|
@@ -776,7 +784,9 @@ export class HeroHandler {
|
|
|
|
|
|
|
|
|
|
let newSkins = initSkinTalent(skins);
|
|
|
|
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins });
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(hero, ['hid', 'skins', 'skinId']) }});
|
|
|
|
|
|
|
|
|
|
const heroResult = new HeroParam(hero);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint']) }});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ! debug接口 一键全武将
|
|
|
|
@@ -879,11 +889,11 @@ export class HeroHandler {
|
|
|
|
|
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
|
|
|
|
if(!hero) {
|
|
|
|
|
let { resultHeroes } = await createHero(roleId, roleName, sid, serverId, { hid, count: 1, ...params });
|
|
|
|
|
hero = resultHeroes[0];
|
|
|
|
|
return resResult(STATUS.SUCCESS, { hero: resultHeroes[0] });
|
|
|
|
|
} else {
|
|
|
|
|
hero = await HeroModel.updateHeroInfo(roleId, hid, params);
|
|
|
|
|
return resResult(STATUS.SUCCESS, { hero: new HeroParam(hero) });
|
|
|
|
|
}
|
|
|
|
|
hero = await HeroModel.updateHeroInfo(roleId, hid, params);
|
|
|
|
|
|
|
|
|
|
return resResult(STATUS.SUCCESS, { hero });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|