diff --git a/game-server/app/services/playerCeService.ts b/game-server/app/services/playerCeService.ts index b825f7de5..06cb19428 100644 --- a/game-server/app/services/playerCeService.ts +++ b/game-server/app/services/playerCeService.ts @@ -2,11 +2,7 @@ * 体力系统 */ -import { pinus } from 'pinus'; -import { STATUS } from '../consts/statusCode'; - -import { resResult } from '../pubUtils/util'; -import { HeroModel, HeroType, HeroUpdate } from '../db/Hero'; +import { EPlace, HeroModel, HeroType, HeroUpdate } from '../db/Hero'; import { RoleUpdate, RoleType, RoleModel } from '../db/Role'; import { Rank } from './rankService'; @@ -270,17 +266,12 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve } case HERO_SYSTEM_TYPE.REBIRTH: // 29. 重生 { - for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins, ePlace, scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) { + for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins, scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) { calCe.setHeroBase(hid, skinId); calCe.setHeroLv(hid, lv); calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage); calCe.setJob(hid, job, jobStage); - - for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) { - calCe.setEquipQuality(hid, id, equipId, quality, qualityStage); - calCe.setEquipStrength(hid, id, equipId, lv); - calCe.setEquipStar(hid, id, equipId, star, starStage); - } + calCe.clearEquip(hid); calCe.setTalent(hid, skins); calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar); } diff --git a/game-server/app/services/role/calCe.ts b/game-server/app/services/role/calCe.ts index d76624e81..6dd05f9e1 100644 --- a/game-server/app/services/role/calCe.ts +++ b/game-server/app/services/role/calCe.ts @@ -289,11 +289,20 @@ export class CalCe { } } + + public clearEquip(hid: number) { + this.data.clearHeroAttrByHid(hid, 'equipQuality'); + this.data.clearEquipAttrByHid(hid, 'equipQuality'); + this.data.clearHeroAttrByHid(hid, 'equipStrength'); + this.data.clearEquipAttrByHid(hid, 'equipStrength'); + this.data.clearHeroAttrByHid(hid, 'equipStar'); + this.data.clearEquipAttrByHid(hid, 'equipStar'); + } // 装备强化 public setEquipStrength(hid: number, eplaceId: number, equipId: number, lv: number) { - this.data.clearHeroAttrByHid(hid, 'equipStrengthen'); - this.data.clearEquipAttrByHidAndEplace(hid, eplaceId, 'equipStrengthen'); + this.data.clearHeroAttrByHid(hid, 'equipStrength'); + this.data.clearEquipAttrByHidAndEplace(hid, eplaceId, 'equipStrength'); let dicEquipStrenth = getEquipStrenthenAttr(equipId, lv); let map = new Map(); // attrId => val for(let { id, num } of dicEquipStrenth.attr) { @@ -305,12 +314,12 @@ export class CalCe { } for(let [id, val] of map) { let equipAttr = this.data.getEquipAttrByHidAndId(hid, eplaceId, id); - equipAttr.equipStrengthen = val; + equipAttr.equipStrength = val; } let equips = this.data.getEquipAttrsByHid(hid); - for(let { hid, attrId, equipStrengthen } of equips) { + for(let { hid, attrId, equipStrength } of equips) { let heroAttr = this.data.getHeroAttrByHidAndId(hid, attrId); - heroAttr.equipStrength = equipStrengthen; + heroAttr.equipStrength = equipStrength; } } @@ -701,11 +710,13 @@ class CalCeData { public clearEquipAttrByHidAndEplace(hid: number, eplaceId: number, field: string) { let equipAttrs = this.getEquipAttrsByHidAndEplace(hid, eplaceId); for(let equipAttr of equipAttrs) { - let originNum = equipAttr[field]||0; - let heroAttr = this.getHeroAttrByHidAndId(hid, equipAttr.attrId); - if(heroAttr && heroAttr[field]) { - heroAttr[field] -= originNum; - } + equipAttr[field] = 0; + } + } + + public clearEquipAttrByHid(hid: number, field: string) { + let equipAttrs = this.getEquipAttrsByHid(hid); + for(let equipAttr of equipAttrs) { equipAttr[field] = 0; } } @@ -1127,7 +1138,7 @@ abstract class EquipAllAttr { eplaceId: number; attrId: number; equipQuality: number = 0; - equipStrengthen: number = 0; + equipStrength: number = 0; equipStar: number = 0; jewel: number = 0; stone: number = 0; @@ -1157,7 +1168,7 @@ class EquipMainAttr extends EquipAllAttr { case EQUIP_MAIN_ATTR_INDEX.EQUIP_QUALITY: this.equipQuality = value; break; case EQUIP_MAIN_ATTR_INDEX.EQUIP_STRENGTH: - this.equipStrengthen = value; break; + this.equipStrength = value; break; case EQUIP_MAIN_ATTR_INDEX.EQUIP_STAR: this.equipStar = value; break; case EQUIP_MAIN_ATTR_INDEX.JEWEL: @@ -1177,7 +1188,7 @@ class EquipMainAttr extends EquipAllAttr { values.push(this.equipQuality); break; case EQUIP_MAIN_ATTR_INDEX.EQUIP_STRENGTH: - values.push(this.equipStrengthen); + values.push(this.equipStrength); break; case EQUIP_MAIN_ATTR_INDEX.EQUIP_STAR: values.push(this.equipStar);