上传主线代码

This commit is contained in:
liwei 2023-07-26 19:26:39 +08:00
parent 15ebfe8094
commit a2924dee3b

View File

@ -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) { func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChallengeReq) (errdata *pb.ErrorData) {
var ( var (
info *pb.DBMainline // 当前章节信息 info *pb.DBMainline // 当前章节信息
ps int32 // 消耗的体力 ps int32 // 消耗的体力
psAnt *cfg.Gameatn psAnt *cfg.Gameatn
stageConf *cfg.GameMainStageData // 当前章节数据 conf *cfg.GameMainStageData // 当前章节数据
err error err error
) )
if errdata = this.ChallengeCheck(session, req); errdata != nil { if errdata = this.ChallengeCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 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 { if info, err = this.module.modelMline.getMainlineData(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, 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 { 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" { if v.A == "attr" && v.T == "ps" {
ps += v.N ps += v.N
} }
} }
for _, v := range stageConf.PsMg { for _, v := range conf.PsMg {
if v.A == "attr" && v.T == "ps" { if v.A == "attr" && v.T == "ps" {
ps += v.N ps += v.N
} }
@ -72,7 +82,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
Ptype: pb.PlayType_mainline, Ptype: pb.PlayType_mainline,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,
Mformat: stageConf.FormatList, Mformat: conf.FormatList,
}) })
if errdata != nil { if errdata != nil {
return return
@ -81,7 +91,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
Info: &pb.BattleInfo{ Info: &pb.BattleInfo{
Id: record.Id, Id: record.Id,
Title: record.Title, Title: record.Title,
Rulesid: stageConf.BattleReadyID, Rulesid: conf.BattleReadyID,
Btype: record.Btype, Btype: record.Btype,
Ptype: record.Ptype, Ptype: record.Ptype,
RedCompId: record.RedCompId, RedCompId: record.RedCompId,