上传主线代码

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

View File

@ -23,13 +23,23 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
info *pb.DBMainline // 当前章节信息
ps int32 // 消耗的体力
psAnt *cfg.Gameatn
stageConf *cfg.GameMainStageData // 当前章节数据
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,