fix 训练
This commit is contained in:
@@ -280,14 +280,19 @@ export class HeroHandler {
|
||||
return resResult(STATUS.HERO_JOB_STAGE_REACH_MAX_STAGE);
|
||||
if (hero.job >= getMaxGradeByjobClass(heroJob.job_class))
|
||||
return resResult(STATUS.HERO_JOB_REACH_MAX_STAGE);
|
||||
let result = await handleCost(roleId, sid, heroJob.trainingConsume);
|
||||
|
||||
let consume = new Array<RewardInter>();
|
||||
if(heroJob.trainingConsume[hero.jobStage]) {
|
||||
consume.push(heroJob.trainingConsume[hero.jobStage]);
|
||||
}
|
||||
let result = await handleCost(roleId, sid, consume);
|
||||
if(!result) {
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
hero.jobStage = hero.jobStage ++;
|
||||
hero.jobStage = hero.jobStage +1;
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.TRAIN);
|
||||
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, job : heros[0].job, jobStage: heros[0].jobStage});
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage: heros[0].jobStage}});
|
||||
}
|
||||
|
||||
//进阶
|
||||
@@ -313,7 +318,7 @@ export class HeroHandler {
|
||||
hero.jobStage = 0;
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.STAGEUP, [curJob]);
|
||||
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, job : heros[0].job, jobStage : heros[0].jobStage});
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage : heros[0].jobStage}});
|
||||
}
|
||||
|
||||
//激活羁绊
|
||||
@@ -362,7 +367,7 @@ export class HeroHandler {
|
||||
}
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.CONNECT, [shipId, level]);
|
||||
return resResult(STATUS.SUCCESS, { hid : heros[0].hid, connections : heros[0].connections});
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, connections : heros[0].connections}});
|
||||
}
|
||||
|
||||
//赠送(包括一键赠送)
|
||||
@@ -407,7 +412,7 @@ export class HeroHandler {
|
||||
} else {
|
||||
await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { hid : hero.hid, favour : hero.favour, favourLv : hero.favourLv});
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, favour : hero.favour, favourLv : hero.favourLv}});
|
||||
}
|
||||
|
||||
//穿带时装
|
||||
@@ -441,7 +446,7 @@ export class HeroHandler {
|
||||
return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
}
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.SKIN, [id, lastSkinId]);
|
||||
return resResult(STATUS.SUCCESS, { hid : hero.hid, skins : hero.skins});
|
||||
return resResult(STATUS.SUCCESS, {curHero: {hid : hero.hid, skins : hero.skins} });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ export function getAllAttrStage () {
|
||||
export function calHeroTrainIncAttr(hero: any) {
|
||||
let res = {};
|
||||
let attrName: string = getAttrNameByJobStage(hero.jobStage);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
let currentJob = getJobInfoById(hero.job);
|
||||
if (currentJob.grade > 1) {
|
||||
let jobGradeAndClass = getJobByGradeAndClass(currentJob.job_class, currentJob.grade - 1);
|
||||
@@ -171,12 +171,12 @@ export function calWaerHeroSkinIncAttr(hero: any, args: Array<number>) {
|
||||
let attrName;
|
||||
for (let attr of delSkin.actorAttrs) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * HERO_CE_RATIO;
|
||||
}
|
||||
for (let attr of addSkin.actorAttrs) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp -= attr.number * HERO_CE_RATIO;
|
||||
}
|
||||
return res;
|
||||
@@ -192,14 +192,14 @@ export function calHeroConectIncAttr(hero: any, args: Array<number>) {
|
||||
let currentShip = getFriendShipById(shipId, level);
|
||||
for (let attr of currentShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
|
||||
}
|
||||
if (level > 1) {
|
||||
let lastShip = getFriendShipById(shipId, level - 1);
|
||||
for (let attr of lastShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp -= attr.number * (HERO_CE_RATIO + fiendShipLevel.add);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ export function calHeroFavourUpIncAttr(hero: any, args: Array<number>) {
|
||||
let heroShip = getFriendShipById(connect.shipId, connect.level);
|
||||
for (let attr of heroShip.attributes) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: hero.CeAttr[attrName].fixUp, base: hero.CeAttr[attrName].base, ratioUp: hero.CeAttr[attrName].ratioUp};
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * (HERO_CE_RATIO + difAdd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user