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