diff --git a/comm/imodule.go b/comm/imodule.go index ab3fd5d7f..899b48b7f 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -135,7 +135,7 @@ type ( CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 // 获取所有满星满级满觉醒的英雄 - GetAllMaxHero(session IUserSession, bTalent bool) (errdata *pb.ErrorData) + GetAllMaxHero(session IUserSession) (errdata *pb.ErrorData) // 教习登记 RegisterInstructor(session IUserSession, heroOid []string, registerId int32) (errdata *pb.ErrorData) diff --git a/modules/gm/module.go b/modules/gm/module.go index f0c00a8f5..64a41f79f 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -193,7 +193,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er return } - errdata = module1.(comm.IHero).GetAllMaxHero(session, false) + errdata = module1.(comm.IHero).GetAllMaxHero(session) this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, @@ -650,7 +650,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er return } - errdata = module1.(comm.IHero).GetAllMaxHero(session, true) + errdata = module1.(comm.IHero).GetAllMaxHero(session) module1, err = this.service.GetModule(comm.ModuleMainline) if err != nil { diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 96883df78..69a04f764 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -728,7 +728,7 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { if hero == nil { return } - if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err != nil { + if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err == nil { for _, v := range rst { if v.HeroId == hero.HeroID { // 找到对应的英雄 for k := range v.Talent { diff --git a/modules/hero/module.go b/modules/hero/module.go index 3c37c52fe..5d676f01e 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -415,10 +415,10 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i } // 获取所有满星满级满觉醒的英雄 -func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdata *pb.ErrorData) { - if bTalent { - this.modelTalent.CleanAllHeroTalent(session.GetUserId()) - } +func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorData) { + + this.modelTalent.CleanAllHeroTalent(session.GetUserId()) + // 清除所有英雄 this.modelHero.RemoveUserHeroInfo(session.GetUserId()) data := this.modelHero.module.configure.GetHeroConfigData() @@ -478,7 +478,6 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat break } } - //this.modelHero.resetJuexingProperty(hero) // 获取满级技能 for _, skill := range hero.NormalSkill { skillMaxLv := this.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID)) @@ -489,7 +488,29 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat hero.Lv = maxLv hero.Star = maxStar hero.JuexingLv = int32(maxJux) + + if true { // 满天赋 + talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID) + data, err := this.configure.GMGetTalentByHeroId(hero.HeroID) + if err == nil { + for _, v := range data { + talent.Talent[v.Skillid] = 1 + if v.Skill != 0 { + hero.Talentskill = append(hero.Talentskill, &pb.SkillData{ + SkillID: v.Skill, + SkillLv: 1, + }) + } + } + } + update := make(map[string]interface{}, 0) + update["talent"] = talent.Talent + if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil { + this.Errorf("update failed :%v", err) + } + } this.modelHero.PropertyCompute(hero) // 重新计算属性 + _heroMap := map[string]interface{}{ "lv": hero.Lv, "star": hero.Star, @@ -501,29 +522,9 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat "horoscopeProperty": hero.HoroscopeProperty, "juexProperty": hero.JuexProperty, "awakenskill": hero.Awakenskill, + "talentskill": hero.Talentskill, } - if bTalent { // 满天赋 - talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID) - data, err := this.configure.GMGetTalentByHeroId(hero.HeroID) - if err == nil { - for _, v := range data { - talent.Talent[v.Skillid] = 1 - } - } - update := make(map[string]interface{}, 0) - update["talent"] = talent.Talent - if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil { - this.Errorf("update failed :%v", err) - } - // talent.Talent[req.TalentID] = 1 - // update := make(map[string]interface{}, 0) - // update["talent"] = talent.Talent - // if err = this.module.modelTalent.ChangeHeroTalent(talent, update); err != nil { - // this.module.Errorf("update failed :%v", err) - // } - // this.modelHero.setTalentProperty(hero) - } // 保存数据 err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) if err != nil {