🐞 fix(gm): 修复战力错误问题

This commit is contained in:
dingchaolin
2023-02-24 12:08:11 +08:00
parent 1c0661ed24
commit 2433f7367b

View File

@@ -193,19 +193,23 @@ export class GmRoleHandler {
})
}
})
// 更新装备信息
await HeroModel.updateHeroInfo(roleId, hid, { ePlace: hero.ePlace });
// 获取战力重算需要的数据
let role = await RoleModel.findByRoleId(roleId);
let schools = await SchoolModel.findByRoleId(roleId);
let jewels = await JewelModel.findbyRole(roleId);
let heroes = await HeroModel.findByRole(roleId);
let skins = await SkinModel.findbyRole(roleId);
let artifacts = await ArtifactModel.findbyRole(roleId);
// 所有战力重算
await calculateCeWithRole(HERO_SYSTEM_TYPE.RE_CAL, roleId, role.serverId, null, {}, { role, schools, jewels, heroes, skins, artifacts });
// 获取更新装备的英雄
hero = await HeroModel.findByHidAndRole(hid, roleId);
// 战力重算
let { sid } = await getRoleOnlineInfo(roleId);
hero.ePlace.forEach(async (ePlaceItem) => {
// 装备升品
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_QUALITY, roleId, hero.serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId: ePlaceItem.id });
// 装备升星
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STAR, roleId, hero.serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId: ePlaceItem.id, skinId: hero.skinId });
});
// 装备强化
const { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, hero.serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceIds: EPLACE_IDS });
// 返回强化升星升品后的hero数据
return resResult(STATUS.SUCCESS, { curHero });
return resResult(STATUS.SUCCESS, { curHero: hero });
}
async deleteHero(msg: { roleId: string, hid: number }, session: BackendSession) {