From d4b5f128dd889893151c5050738a3c09ce227ba5 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 1 Feb 2024 13:44:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80?= =?UTF-8?q?=E5=9C=BA=E8=AF=B7=E6=B1=82=E6=88=98=E6=96=97=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/api_challenge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/arena/api_challenge.go b/modules/arena/api_challenge.go index cfdc6018a..b74063fbe 100644 --- a/modules/arena/api_challenge.go +++ b/modules/arena/api_challenge.go @@ -8,7 +8,7 @@ import ( // 参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.ArenaChallengeReq) (errdata *pb.ErrorData) { - if (!req.Isai && req.Playerid == "") || (req.Isai && req.MformatId == 0) || req.Battle.Format == nil || len(req.Battle.Format) != 5 { + if (!req.Isai && req.Playerid == "") || (req.Isai && req.MformatId == 0) || req.Battle == nil || req.Battle.Format == nil || len(req.Battle.Format) != 5 { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), From 6666868fca3a37b494c70c8f317544830d24a0b4 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 1 Feb 2024 14:25:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80?= =?UTF-8?q?=E5=9C=BA=E8=BF=9E=E8=83=9C=E7=A7=AF=E5=88=86=E5=8A=A0=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/api_challengereward.go | 12 ++++++++++++ modules/arena/configure.go | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/modules/arena/api_challengereward.go b/modules/arena/api_challengereward.go index 3b4064ff3..b877391c7 100644 --- a/modules/arena/api_challengereward.go +++ b/modules/arena/api_challengereward.go @@ -18,6 +18,7 @@ func (this *apiComp) ChallengeRewardCheck(session comm.IUserSession, req *pb.Are func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (errdata *pb.ErrorData) { var ( reward *cfg.GameArenaActiveRewardData + conf *cfg.GameArenaActiveWinData info *pb.DBArenaUser rival *pb.DBArenaUser red *pb.ArenaPlayer @@ -156,6 +157,17 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha } } this.module.modelArena.integralCompute(red, bule, req.Iswin) + if req.Iswin { + if conf, err = this.module.configure.getGameArenaActiveWinData(info.Streak); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + red.Integral += conf.Txt.N + red.Changeintegral += conf.Txt.N + } if !req.Isai { this.module.modelRank.updateArenaRank(red, bule) info.Integral = red.Integral diff --git a/modules/arena/configure.go b/modules/arena/configure.go index 2fad9308b..ac802a241 100644 --- a/modules/arena/configure.go +++ b/modules/arena/configure.go @@ -45,6 +45,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this.LoadConfigure(game_arenachallengenpc, cfg.NewGameArenaChallengeNpc) this.LoadConfigure(game_arenaactiveking, cfg.NewGameArenaActiveKing) this.LoadConfigure(game_arenaweeklytask, cfg.NewGameArenaWeeklyTask) + this.LoadConfigure(game_arenaactivewin, cfg.NewGameArenaActiveWin) configure.RegisterConfigure(game_monsterformat, cfg.NewGameMonsterFormat, func() { this.mformatlock.Lock() if v, err := this.GetConfigure(game_monsterformat); err != nil { @@ -240,3 +241,25 @@ func (this *configureComp) getGameActiveTaskData(id int32) (result *cfg.GameAren } return } + +//查询剧情npc系统 +func (this *configureComp) getGameArenaActiveWinData(num int32) (conf *cfg.GameArenaActiveWinData, err error) { + var ( + v interface{} + confs []*cfg.GameArenaActiveWinData + ) + if v, err = this.GetConfigure(game_arenaactivewin); err != nil { + this.module.Errorln(err) + } else { + confs = v.(*cfg.GameArenaActiveWin).GetDataList() + for i := len(confs) - 1; i >= 0; i-- { + if num >= confs[i].Winningstreak { + conf = confs[i] + return + } + } + err = comm.NewNotFoundConfErr(moduleName, game_arenaactivewin, num) + this.module.Errorln(err) + } + return +} From 7307ab888ff11188738c779d03a3cac5da40389b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 1 Feb 2024 14:35:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80?= =?UTF-8?q?=E5=9C=BA=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/api_challengereward.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/arena/api_challengereward.go b/modules/arena/api_challengereward.go index b877391c7..41b1b824c 100644 --- a/modules/arena/api_challengereward.go +++ b/modules/arena/api_challengereward.go @@ -158,15 +158,10 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha } this.module.modelArena.integralCompute(red, bule, req.Iswin) if req.Iswin { - if conf, err = this.module.configure.getGameArenaActiveWinData(info.Streak); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Message: err.Error(), - } - return + if conf, err = this.module.configure.getGameArenaActiveWinData(info.Streak); err == nil { + red.Integral += conf.Txt.N + red.Changeintegral += conf.Txt.N } - red.Integral += conf.Txt.N - red.Changeintegral += conf.Txt.N } if !req.Isai { this.module.modelRank.updateArenaRank(red, bule)