From abf90a7592f4f2636e22e37931528ca82645797e Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 6 Nov 2023 14:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=94=A8=E6=88=B7=E6=AE=B5?= =?UTF-8?q?=E4=BD=8D=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/parkour/ai.go | 2 +- modules/parkour/configure.go | 19 +++++++++++++++++++ modules/parkour/module.go | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/parkour/ai.go b/modules/parkour/ai.go index 42e3fc4bd..1cf40436f 100644 --- a/modules/parkour/ai.go +++ b/modules/parkour/ai.go @@ -67,7 +67,7 @@ func (this *aiComp) createAi(battleid string, btype pb.RaceType, users []*pb.DBR } ais = make([]*AI, len(users)) for i, v := range users { - if conf, err = this.module.configure.getgameBukashiAiDataByDan(int32(btype)+1, v.Dan+1); err != nil { + if conf, err = this.module.configure.getgameBukashiAiDataByDan(int32(btype)+1, v.Dan); err != nil { return } ais[i] = NewAI(battleid, v.User.Uid, conf) diff --git a/modules/parkour/configure.go b/modules/parkour/configure.go index d08f2fee7..42a48dfcd 100644 --- a/modules/parkour/configure.go +++ b/modules/parkour/configure.go @@ -210,6 +210,25 @@ func (this *configureComp) getActiveRewardById(lv int32) (result *cfg.GameQualif return } +//查询积分段位信息 +func (this *configureComp) getActiveRewardByS(score int32) (conf *cfg.GameQualifyingData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_qualifying); err != nil { + this.module.Errorln(err) + } else { + for _, conf = range v.(*cfg.GameQualifying).GetDataList() { + if score > conf.ScoreLow && score <= conf.ScoreUp { + return + } + } + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_qualifying, score) + this.module.Errorln(err) + } + return +} + //查询积分段位信息 func (this *configureComp) getGameDragonWeeklyrewards() (confs []*cfg.GameDragonWeeklyrewardData, err error) { var ( diff --git a/modules/parkour/module.go b/modules/parkour/module.go index 6eb0bd738..f477e1e4e 100644 --- a/modules/parkour/module.go +++ b/modules/parkour/module.go @@ -420,6 +420,7 @@ func (this *Parkour) recoverhp(id string, uid string, hp int32) { v.Currhp = v.Property[comm.Dhp] } teamScores = battle.RedScore + ok = true break } } @@ -431,6 +432,7 @@ func (this *Parkour) recoverhp(id string, uid string, hp int32) { v.Currhp = v.Property[comm.Dhp] } teamScores = battle.BuleScore + ok = true break } } @@ -463,6 +465,7 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) { sessions []comm.IUserSession = make([]comm.IUserSession, 0) conf *cfg.GameQualifyingData lvconf *cfg.GameBuzkashiLvData + danconf *cfg.GameQualifyingData awards map[string][]*cfg.Gameatn = make(map[string][]*cfg.Gameatn) award map[string][]*pb.UserAtno = make(map[string][]*pb.UserAtno) errdata *pb.ErrorData @@ -582,9 +585,16 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) { for _, v := range battle.RedMember { if !v.Isai { + + if danconf, err = this.configure.getActiveRewardByS(v.Integral); err != nil { + this.Errorln(err) + continue + } + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "integral": v.Integral, "weekintegral": v.Weekintegral, + "dan": danconf.LvId, "state": 0, "roomid": "", "roompath": "", @@ -596,9 +606,15 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) { } for _, v := range battle.BuleMember { if !v.Isai { + if danconf, err = this.configure.getActiveRewardByS(v.Integral); err != nil { + this.Errorln(err) + continue + } + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "integral": v.Integral, "weekintegral": v.Weekintegral, + "dan": danconf.LvId, "state": 0, "roomid": "", "roompath": "",