From e783f1adeeeeddf2db355496e6109850de7460da Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 1 Nov 2022 19:09:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=98=9F=E5=BA=A7=E5=9B=BE?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/horoscope/configure.go | 19 +++++++++++++++++++ modules/horoscope/core.go | 7 ++++++- modules/horoscope/modelhoroscope.go | 25 +++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/modules/horoscope/configure.go b/modules/horoscope/configure.go index cdda46846..ddeb4dc04 100644 --- a/modules/horoscope/configure.go +++ b/modules/horoscope/configure.go @@ -42,3 +42,22 @@ func (this *configureComp) getHoroscope(id int32) (result *cfg.GameHoroscopeData } return } + +//查询阵容表 +func (this *configureComp) getHoroscopebylv(grow, lv int32) (result *cfg.GameHoroscopeData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_horoscope); err != nil { + this.module.Errorln(err) + } else { + for _, v := range v.(*cfg.GameHoroscope).GetDataMap() { + if v.GrowType == grow && v.Lv == lv { + result = v + return + } + } + } + err = fmt.Errorf("No found Horoscope grow:%d lv:%d", grow, lv) + return +} diff --git a/modules/horoscope/core.go b/modules/horoscope/core.go index 9afd643f7..20e223f83 100644 --- a/modules/horoscope/core.go +++ b/modules/horoscope/core.go @@ -1 +1,6 @@ -package horoscope \ No newline at end of file +package horoscope + +//加成类型 +const ( + full int32 = 1 //全员加成 +) diff --git a/modules/horoscope/modelhoroscope.go b/modules/horoscope/modelhoroscope.go index eef581066..aecb077d6 100644 --- a/modules/horoscope/modelhoroscope.go +++ b/modules/horoscope/modelhoroscope.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" ) ///星座图 数据组件 @@ -39,3 +40,27 @@ func (this *modelHoroscope) updateInfo(info *pb.DBHoroscope) (err error) { }) return } + +//计算英雄属性 +func (this *modelHoroscope) computeHeroNumeric(hero *pb.DBHero) (err error) { + var ( + info *pb.DBHoroscope + node *cfg.GameHoroscopeData + ) + if info, err = this.queryInfo(hero.Uid); err != nil { + return + } + for k, v := range info.Nodes { + if node, err = this.module.configure.getHoroscopebylv(k, v); err != nil { + return + } + switch node.AddGroup { + case full: //全员加成 + // for _, v := range node.Upgrade { + + // } + break + } + } + return +}