From b9207793d86eab4a23f6093f2e5d5f825aaf7414 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 12 Jan 2024 10:27:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8B=B1=E9=9B=84=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/model_hero.go | 67 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 1a8079eed..ca92c26d5 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -412,13 +412,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, curAddExp = make(map[string]int32, len(heros)) for _, hero := range heros { var ( - user *pb.DBUser - expConf *cfg.GamePlayerlvData - - preLv int32 //加经验之前的等级 - curExp int32 // 加经验之后的经验 - curLv int32 // 加经验之后的等级 - update map[string]interface{} // 属性变化 + user *pb.DBUser + expConf *cfg.GamePlayerlvData + heroconf *cfg.GameHeroData + preLv int32 //加经验之前的等级 + curExp int32 // 加经验之后的经验 + curLv int32 // 加经验之后的等级 + update map[string]interface{} // 属性变化 ) if hero == nil { errdata = &pb.ErrorData{ @@ -459,7 +459,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, } return } - + if heroconf, err = this.module.configure.GetHeroConfig(hero.HeroID); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } var maxExp int32 maxExp = _data.Heroexp if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 @@ -489,6 +495,9 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, } else { // 升级操作 curExp -= maxExp curLv += 1 // 经验够了 那么等级+1 + if upwardconf, err = this.module.configure.GetHeroLvUpWardData(heroconf.Star, curLv); err == nil { + upwardconfs = append(upwardconfs, upwardconf) + } _data = this.module.configure.GetHeroLv(curLv) if _data == nil { // 等级加失败了 回到原来的等级 fullexp = (curExp - maxExp) @@ -530,34 +539,30 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) - if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { - if upwardconf, err = this.module.configure.GetHeroLvUpWardData(cfg.Star, curLv); err != nil { - upwardconfs = append(upwardconfs, upwardconf) - } - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) - //xx英雄满级、共鸣、觉醒至最高状态 - nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) - if nextAwaken == nil { // 达到满级觉醒 - if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { - var _l int32 - talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) - if err == nil { - for _, v := range talent { - if v.HeroId == hero.HeroID { - _l = int32(len(v.Talent)) - break - } + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, heroconf.Color, hero.Lv)) + //xx英雄满级、共鸣、觉醒至最高状态 + nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) + if nextAwaken == nil { // 达到满级觉醒 + if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { + var _l int32 + talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) + if err == nil { + for _, v := range talent { + if v.HeroId == hero.HeroID { + _l = int32(len(v.Talent)) + break } } - if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) - iHeroId, _ := strconv.Atoi(hero.HeroID) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId))) - } + } + if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, heroconf.Color)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) + iHeroId, _ := strconv.Atoi(hero.HeroID) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId))) } } } + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv))