From d6a821ad550e412897a71333cca6a38f6bd180ad Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 7 Jul 2023 09:45:21 +0800 Subject: [PATCH] =?UTF-8?q?gm=20=E8=8E=B7=E5=8F=96=E6=BB=A1=E5=A4=A9?= =?UTF-8?q?=E8=B5=8B=20=E8=A7=A3=E9=94=81=E9=9A=BE=E5=BA=A61=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/gm/module.go | 21 ++++++++++++++++++++- modules/hero/configure_comp.go | 5 ++++- modules/hero/module.go | 25 +++++++++++++++---------- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index cd375bd0a..0a60a3bbc 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -120,7 +120,7 @@ type ( CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 // 获取所有满星满级满觉醒的英雄 - GetAllMaxHero(session IUserSession) (errdata *pb.ErrorData) + GetAllMaxHero(session IUserSession, bTalent bool) (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 4f74d30da..72d74fa09 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -198,7 +198,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er return } - errdata = module1.(comm.IHero).GetAllMaxHero(session) + errdata = module1.(comm.IHero).GetAllMaxHero(session, false) this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, @@ -528,6 +528,25 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er log.Field{Key: "param", Value: datas[0]}, log.Field{Key: "res", Value: res}, ) + } else if len(datas) == 1 && (datas[0] == "godlike") { // 一键超神 + module1, err := this.service.GetModule(comm.ModuleHero) + if err != nil { + return + } + + errdata = module1.(comm.IHero).GetAllMaxHero(session, true) + + module1, err = this.service.GetModule(comm.ModuleMline) + if err != nil { + return + } + + errdata = module1.(comm.IMline).ModifyMlineDataByNanduID(session, 1101208) + + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) } } } diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index 0ad802d11..8db0b97f1 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -491,6 +491,9 @@ func (this *configureComp) GMGetTalentByHeroId(hid string) (data []*cfg.GameHero } } } - err = comm.NewNotFoundConfErr(moduleName, hero_talent, hid) + if len(data) == 0 { + err = comm.NewNotFoundConfErr(moduleName, hero_talent, hid) + } + return } diff --git a/modules/hero/module.go b/modules/hero/module.go index d56130d81..3cfcb89ea 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -644,7 +644,10 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i } // 获取所有满星满级满觉醒的英雄 -func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorData) { +func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdata *pb.ErrorData) { + if bTalent { + this.modelTalent.CleanAllHeroTalent(session.GetUserId()) + } data := this.modelHero.module.configure.GetHeroConfigData() var ( changeHero []*pb.DBHero @@ -703,20 +706,22 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorDat "juexProperty": hero.JuexProperty, } - if true { // 满天赋 + if bTalent { // 满天赋 //var talent *pb.DBHeroTalent - talnet, _ := this.modelTalent.GetHerotalent(session.GetUserId()) - this.modelTalent.CleanAllHeroTalent(session.GetUserId()) + //talent, _ := this.modelTalent.GetHerotalent(session.GetUserId()) + + talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID) data, err := this.configure.GMGetTalentByHeroId(hero.HeroID) if err == nil { - for _, v := range talnet { - if v.HeroId == hero.HeroID { - for _, v2 := range data { - v.Talent[v2.Skillid] = 1 - } - } + 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