feat(gm): 武将装备升级、升星、升品至最高级

This commit is contained in:
dcl
2023-02-23 12:19:14 +08:00
parent 46fb283d3c
commit f546f623b2
3 changed files with 124 additions and 0 deletions
@@ -113,6 +113,64 @@ export class GmRoleHandler {
return resResult(STATUS.SUCCESS);
}
/**
* 升级英雄装备至限制内的最高级
*
* @param {{ roleId: string, hid: number }} msg
* @param {BackendSession} session
* @return {*}
* @memberof GmRoleHandler
*/
async upgradeHeroEPlace(msg: { roleId: string, hid: number }, session: BackendSession) {
let { roleId, hid } = msg;
let hero = await HeroModel.findByHidAndRole(hid, roleId);
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
/*
* 通过
* dic_zyz_equipQuality.json
* dic_zyz_equipStar.json
* dic_zyz_equipStrength.json
* dic_zyz_artifactQuality.json
* 配置文件得出:
* maxLevel: 100
* maxQuality: 5 (金)
* maxStar: 12
*
* 限制:
* 装备等级不能超过hero等级
* maxQuality限制等级最大值: 金 最大lv 100
*/
const MAX_LV = 100;
const MAX_STAR = 12;
const MAX_QUALITY = 5;
// 装备升级、升星、升品(注意升级限制)
let ePlaceIds: number[] = [];
hero.ePlace.forEach((ePlaceItem) => {
// 升级 - 最大等级100
ePlaceItem.lv = hero.lv; // 英雄等级肯定小于MAX_LV
// 升品 - 金
ePlaceItem.quality = MAX_QUALITY;
ePlaceItem.qualityStage = 0;
// 生星 - 最高12
ePlaceItem.star = MAX_STAR;
ePlaceItem.starStage = 0;
ePlaceIds.push(ePlaceItem.id);
});
// 战力重算
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 });
// 返回强化,升星,升品后的hero数据
return resResult(STATUS.SUCCESS, { curHero });
}
async deleteHero(msg: { roleId: string, hid: number }, session: BackendSession) {
let { roleId, hid } = msg;