🐞 fix(武将攻略): 武将对比时将我方全局值也下发
This commit is contained in:
@@ -726,7 +726,7 @@ export class FriendHandler {
|
||||
|
||||
// 查看对象武将详细
|
||||
public async getHeroDetail(msg: { roleId: string, hids: number[] }, session: BackendSession) {
|
||||
// let roleId: string = session.get('roleId');
|
||||
let roleId: string = session.get('roleId');
|
||||
// let sid: string = session.get('sid');
|
||||
|
||||
let { roleId: hisRoleId, hids } = msg;
|
||||
@@ -744,6 +744,11 @@ export class FriendHandler {
|
||||
|
||||
let school = await getSchoolPoint(hisRoleId);
|
||||
|
||||
let myRoleCe = await RoleCeModel.findByRoleId(roleId);
|
||||
if (!myRoleCe) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||
let mycalCe = new CalCe(roleId);
|
||||
mycalCe.setRoleCe(myRoleCe);
|
||||
|
||||
let calCe = new CalCe(hisRoleId);
|
||||
calCe.setRoleCe(roleCe);
|
||||
let attrByHid = await getHeroesAttributes(hisRoleId);
|
||||
@@ -766,6 +771,10 @@ export class FriendHandler {
|
||||
calCe.calSingleGlobalPartCe(hero.hid, 'teraph'),
|
||||
school
|
||||
);
|
||||
heroParam.setMyRole(
|
||||
mycalCe.calSingleGlobalPartCe(hero.hid, 'scroll'),
|
||||
mycalCe.calSingleGlobalPartCe(hero.hid, 'teraph')
|
||||
)
|
||||
|
||||
list.push(heroParam);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ export class HeroHandler {
|
||||
update['consumes'] = addConsumeToHero(hero.consumes, material)
|
||||
}
|
||||
|
||||
await SchoolModel.updateByHid(roleId, hid, { hid, star: update.quality });
|
||||
await SchoolModel.updateByHid(roleId, hid, { hid, quality: update.quality });
|
||||
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.QUALITY, roleId, serverId, sid, hid, update, { hero });
|
||||
await checkTaskInHeroQUalityUp(serverId, roleId, sid, curHero);
|
||||
// pushHeroQualityUpMsg(roleId, roleName, serverId, curHero);
|
||||
@@ -330,7 +330,7 @@ export class HeroHandler {
|
||||
|
||||
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.COLORSTAR, roleId, serverId, sid, hid, update, { hero, isUpStar });
|
||||
if (isUpStar) {
|
||||
await SchoolModel.updateByHid(roleId, hid, { hid, star: update.colorStar });
|
||||
await SchoolModel.updateByHid(roleId, hid, { hid, quality: update.quality, colorStar: update.colorStar });
|
||||
await checkTaskInHeroWakeUp(serverId, roleId, sid, curHero, oldColorStar); // 任务
|
||||
}
|
||||
if (isWakeUp) pushHeroWakeUp(roleId, roleName, serverId, curHero); // 第一次觉醒
|
||||
|
||||
@@ -288,11 +288,10 @@ function calSchoolPoint(quality: number, star: number, colorStar: number) {
|
||||
|
||||
export async function getSchoolPoint(roleId: string) {
|
||||
let schools = await SchoolModel.findByRoleId(roleId);
|
||||
return schools.reduce((pre, cur) => {
|
||||
if(cur.isOpen && cur.hid > 0) {
|
||||
return pre + calSchoolPoint(cur.quality, cur.star, cur.colorStar);
|
||||
}
|
||||
return pre;
|
||||
let hids = schools.filter(cur => cur.isOpen && cur.hid > 0).map(school => school.hid);
|
||||
let heroes = await HeroModel.findByHidRange(hids, roleId);
|
||||
return heroes.reduce((pre, cur) => {
|
||||
return pre + calSchoolPoint(cur.quality, cur.star, cur.colorStar);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,11 @@ export class HeroDetailParam {
|
||||
};
|
||||
subHid: number = 0;
|
||||
subActorId: number = 0;
|
||||
artifacts: {artifactId: number, lv: number }[] = []
|
||||
artifacts: {artifactId: number, lv: number }[] = [];
|
||||
myInfo: {
|
||||
scroll: number;
|
||||
teraph: number;
|
||||
}
|
||||
|
||||
constructor(hero: HeroType) {
|
||||
this.roleId = hero.roleId;
|
||||
@@ -248,6 +252,10 @@ export class HeroDetailParam {
|
||||
this.role = { title, scroll, teraph, school };
|
||||
}
|
||||
|
||||
setMyRole(scroll: number, teraph: number) {
|
||||
this.myInfo = { scroll, teraph };
|
||||
}
|
||||
|
||||
setArtifact(artifact: ArtifactModelType) {
|
||||
this.artifacts.push({ artifactId: artifact.artifactId, lv: artifact.lv });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user