From a3f60b27cac6ba973040a5661a02b32a2c486eb0 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 09:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E7=BD=B2=E5=90=8C=E6=AD=A5=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0gm=20=E6=BB=A1=E5=A5=BD=E6=84=9F=E5=8A=A8?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 1 + modules/gm/module.go | 16 ++++++++++++++++ modules/library/module.go | 21 +++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/comm/imodule.go b/comm/imodule.go index 863f6bebc..8f4f6a919 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -428,6 +428,7 @@ type ( // 任务完成通知 TaskFinishNotify(uid string, taskId, fetterId int32) error IGetReddot + GMCreateFavorability(uid string) } // 个人成长任务 IGrowtask interface { diff --git a/modules/gm/module.go b/modules/gm/module.go index 1dc184278..936ede75f 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -578,6 +578,22 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er module1.(comm.IGourmet).GMCreateAltas(session.GetUserId()) + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) + } else if len(datas) == 1 && (datas[0] == "library") { + var ( + err error + ) + + module1, err := this.service.GetModule(comm.ModuleLibrary) + if err != nil { + return + } + + module1.(comm.ILibrary).GMCreateFavorability(session.GetUserId()) + this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, diff --git a/modules/library/module.go b/modules/library/module.go index e5a8e5214..aed353258 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -326,3 +326,24 @@ func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( } return } + +func (this *Library) GMCreateFavorability(uid string) { + fetter := this.GetHeroFetterList(uid) + update := map[string]interface{}{} + for _, v := range fetter { + + if conf, er := this.configure.GetFavorabilityExp(v.Heroid); er == nil { + // 达到最大等级不让继续升级 + v.Favorlv = int32(len(conf)) + v.Favorexp = 0 + update["favorlv"] = v.Favorlv + update["favorexp"] = v.Favorexp + + if err := this.modelFetter.ChangeList(uid, v.Id, update); err != nil { + this.Errorf("modelFetter ChangeList error: %v", err) + } + } + } + + return +}