From a2924dee3b92ee8ad0e784f400b1fe12be6bbddb Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 26 Jul 2023 19:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=BB=E7=BA=BF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/mainline/api_challenge.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/mainline/api_challenge.go b/modules/mainline/api_challenge.go index 1dc938667..e742a41f3 100644 --- a/modules/mainline/api_challenge.go +++ b/modules/mainline/api_challenge.go @@ -20,16 +20,26 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MainlineC // /挑战主线关卡 func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChallengeReq) (errdata *pb.ErrorData) { var ( - info *pb.DBMainline // 当前章节信息 - ps int32 // 消耗的体力 - psAnt *cfg.Gameatn - stageConf *cfg.GameMainStageData // 当前章节数据 - err error + info *pb.DBMainline // 当前章节信息 + ps int32 // 消耗的体力 + psAnt *cfg.Gameatn + conf *cfg.GameMainStageData // 当前章节数据 + err error ) if errdata = this.ChallengeCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } + + if conf, err = this.module.configure.GetMainStageConf(req.Level); err != nil { // 配置文件校验 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_MainlineNotFindChapter, + Title: pb.ErrorCode_MainlineNotFindChapter.ToString(), + Message: err.Error(), + } + return + } + if info, err = this.module.modelMline.getMainlineData(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -39,12 +49,12 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle } if v1, ok := info.Ps[req.Level]; !ok || v1 == 0 { - for _, v := range stageConf.PsConsume { + for _, v := range conf.PsConsume { if v.A == "attr" && v.T == "ps" { ps += v.N } } - for _, v := range stageConf.PsMg { + for _, v := range conf.PsMg { if v.A == "attr" && v.T == "ps" { ps += v.N } @@ -72,7 +82,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle Ptype: pb.PlayType_mainline, Title: "", Format: req.Battle, - Mformat: stageConf.FormatList, + Mformat: conf.FormatList, }) if errdata != nil { return @@ -81,7 +91,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle Info: &pb.BattleInfo{ Id: record.Id, Title: record.Title, - Rulesid: stageConf.BattleReadyID, + Rulesid: conf.BattleReadyID, Btype: record.Btype, Ptype: record.Ptype, RedCompId: record.RedCompId,