代码整理
This commit is contained in:
parent
e6a56d5563
commit
f578c50043
@ -804,11 +804,11 @@ func (this *modelBattleComp) createMasterRoles(comp, wheel int, fid int32) (capt
|
||||
captain = int32(i)
|
||||
}
|
||||
// if monst, err := this.module.configure.GetMonster(v.Monster); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ConfigNoFound,
|
||||
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// } else {
|
||||
hero := &pb.DBHero{}
|
||||
if hero = this.module.ModuleHero.CreateMonster(fmt.Sprintf("%d", v.Heroid), v.Star, v.Lv); hero == nil {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -26,17 +25,19 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
curChapter *pb.DBMline // 当前章节信息
|
||||
ps int32 // 消耗的体力
|
||||
psAnt *cfg.Gameatn
|
||||
stageConf *cfg.GameMainStageData
|
||||
stageConf *cfg.GameMainStageData // 当前章节数据
|
||||
preStageConf *cfg.GameMainStageData // 上一章节数据
|
||||
err error
|
||||
)
|
||||
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
|
||||
if stageConf, err = this.module.configure.GetMainStageConf(req.StageId); err != nil { // 配置文件校验
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
Message: fmt.Sprintf("GetMainStageConf 配置没有找到:%d", req.StageId),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -50,13 +51,13 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
}
|
||||
if curChapter == nil { // 校验是不是新的数据
|
||||
//preStage := this.module.configure.GetMainStageConf(stageConf.Previoustage) // 新章节数据校验
|
||||
preStageConf := this.module.configure.GetMainStageConf(stageConf.Previoustage)
|
||||
if preStageConf == nil { // 配置文件校验
|
||||
preStageConf, err = this.module.configure.GetMainStageConf(stageConf.Previoustage)
|
||||
if err != nil { // 配置文件校验
|
||||
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
Message: fmt.Sprintf("GetMainStageConf 配置没有找到:%d", stageConf.Previoustage),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -32,16 +32,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
rsp *pb.MlineChallengeOverResp
|
||||
star int32 // 评星
|
||||
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
||||
err error
|
||||
)
|
||||
rsp = &pb.MlineChallengeOverResp{}
|
||||
update = make(map[string]interface{})
|
||||
if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
|
||||
if stageConf, err = this.module.configure.GetMainStageConf(req.StageId); err != nil { // 配置文件校验
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -23,15 +23,17 @@ func (this *apiComp) CleanStage(session comm.IUserSession, req *pb.MlineCleanSta
|
||||
curChapter *pb.DBMline // 当前章节信息
|
||||
stageConf *cfg.GameMainStageData
|
||||
rsp *pb.MlineCleanStageResp
|
||||
err error
|
||||
)
|
||||
rsp = &pb.MlineCleanStageResp{}
|
||||
if errdata = this.CleanStageCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
|
||||
if stageConf, err = this.module.configure.GetMainStageConf(req.StageId); err != nil { // 配置文件校验
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
const moduleName = "mline"
|
||||
const (
|
||||
game_mainchapter = "game_mainchapter.json"
|
||||
game_mainstage = "game_mainstage.json"
|
||||
@ -62,13 +63,19 @@ func (this *configureComp) GetMainStarRewardConf(boxId int32) (data []*cfg.GameM
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetMainStageConf(id int32) (data *cfg.GameMainStageData) {
|
||||
if v, err := this.GetConfigure(game_mainstage); err == nil {
|
||||
func (this *configureComp) GetMainStageConf(id int32) (data *cfg.GameMainStageData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_mainstage); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMainStage); ok {
|
||||
return configure.Get(id)
|
||||
data = configure.Get(id)
|
||||
if data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.module.Errorf("GameMainStageData conf not found key :%d", id)
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_mainstage, id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -86,6 +93,7 @@ func (this *configureComp) GetPreMainChapter(stageId int32) (preStageID int32) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetFirstChapterIDByType(iType int32) (conf *cfg.GameMainChapterData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
@ -99,7 +107,7 @@ func (this *configureComp) GetFirstChapterIDByType(iType int32) (conf *cfg.GameM
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr("mline", game_mainchapter, iType)
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_mainchapter, iType)
|
||||
return
|
||||
}
|
||||
|
||||
@ -136,7 +144,6 @@ func (this *configureComp) GetAllStageByChapterID(chapterID int32) (stage []int3
|
||||
if v1.Episodetype == 1 {
|
||||
stage = append(stage, v1.Id)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,8 +90,13 @@ func (this *Mline) CheckPoint(uid string) bool {
|
||||
// 参数 难度 + 章节id
|
||||
func (this *Mline) ModifyMlineDataByNanduID(session comm.IUserSession, id int32) (errdata *pb.ErrorData) {
|
||||
var del []string
|
||||
connf := this.configure.GetMainStageConf(id)
|
||||
if connf == nil {
|
||||
connf, err := this.configure.GetMainStageConf(id)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
list, err := this.modelMline.getMainlineList(session.GetUserId())
|
||||
@ -170,8 +175,8 @@ func (this *Mline) GetUserMlineData(uid string, chapterType int32) (chapterId in
|
||||
|
||||
func (this *Mline) CheckCommpleteStage(uid string, stageId int32) (b bool) {
|
||||
|
||||
conf := this.configure.GetMainStageConf(stageId)
|
||||
if conf == nil {
|
||||
conf, err := this.configure.GetMainStageConf(stageId)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
_szData, err := this.modelMline.getMainlineList(uid)
|
||||
|
@ -11,7 +11,7 @@ func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.PagodaActi
|
||||
return
|
||||
}
|
||||
|
||||
///获取主线关卡信息
|
||||
///激活赛季塔
|
||||
func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
list *pb.DBPagoda
|
||||
@ -25,8 +25,8 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateR
|
||||
}
|
||||
return
|
||||
}
|
||||
Nomalcfg := this.module.configure.GetPagodaConfigData(list.PagodaId + 1)
|
||||
if Nomalcfg == nil && !list.Complete {
|
||||
_, err = this.module.configure.GetPagodaConfigData(list.PagodaId + 1)
|
||||
if err == nil && !list.Complete {
|
||||
list.Complete = true
|
||||
this.module.ModifyPagodaData(session.GetUserId(), map[string]interface{}{
|
||||
"complete": true,
|
||||
|
@ -27,11 +27,12 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
conf := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf == nil {
|
||||
conf, err := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -36,11 +36,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
conf := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf == nil {
|
||||
conf, err := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
|
||||
}
|
||||
|
||||
if pagoda, err := this.module.modelPagoda.getPagodaList(session.GetUserId()); err != nil {
|
||||
_cfg := this.module.configure.GetPagodaRewardconfig(req.Id)
|
||||
if _cfg == nil {
|
||||
_cfg, err := this.module.configure.GetPagodaRewardconfig(req.Id)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package pagoda
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
@ -9,6 +10,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
const moduleName = "pagoda"
|
||||
const (
|
||||
game_pagoda = "game_pagoda.json"
|
||||
game_pagodaseasonreward = "game_pagodaseasonreward.json"
|
||||
@ -30,13 +32,10 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.module = module.(*Pagoda)
|
||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||
//game_pagoda: cfg.NewGame_pagoda,
|
||||
//game_pagodaseasonreward: cfg.NewGamePagodaSeasonReward,
|
||||
game_pagodataskreward: cfg.NewGamePagodaTaskReward,
|
||||
game_pagoda: cfg.NewGamePagoda,
|
||||
})
|
||||
|
||||
//configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, this.LoadPagodaData)
|
||||
this._checkType = make(map[int32][]*cfg.GamePassCheckData, 0)
|
||||
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.LoadPassCheck)
|
||||
|
||||
@ -61,15 +60,19 @@ func (this *configureComp) GetConfigure(name string) (v interface{}, err error)
|
||||
}
|
||||
|
||||
// 爬塔奖励
|
||||
func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamePagodaTaskRewardData) {
|
||||
if v, err := this.GetConfigure(game_pagodataskreward); err == nil {
|
||||
func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamePagodaTaskRewardData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_pagodataskreward); err == nil {
|
||||
if configure, ok := v.(*cfg.GamePagodaTaskReward); ok {
|
||||
return configure.Get(id)
|
||||
data = configure.Get(id)
|
||||
if data != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_pagodataskreward conf err:%v", err)
|
||||
}
|
||||
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_pagodataskreward, id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -143,14 +146,18 @@ func (this *configureComp) LoadPassCheck() {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetPagodaConfigData(id int32) (data *cfg.GamePagodaData) {
|
||||
var err error
|
||||
if v, err := this.GetConfigure(game_pagoda); err == nil {
|
||||
func (this *configureComp) GetPagodaConfigData(id int32) (data *cfg.GamePagodaData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_pagoda); err == nil {
|
||||
if configure, ok := v.(*cfg.GamePagoda); ok {
|
||||
|
||||
return configure.Get(id)
|
||||
}
|
||||
}
|
||||
log.Errorf("get game_pagoda conf err:%v", err)
|
||||
data = configure.Get(id)
|
||||
if data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_pagoda, id)
|
||||
return
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func (this *ModelRank) getPagodaRankListByFloorid(uid string, cid int32) *pb.DBP
|
||||
}
|
||||
}
|
||||
for _, v := range pagodaRank {
|
||||
if conf := this.modulePagoda.configure.GetPagodaConfigData(cid); conf == nil {
|
||||
if conf, err := this.modulePagoda.configure.GetPagodaConfigData(cid); err == nil {
|
||||
if v.PagodaId == conf.LayerNum && v.Tab == conf.Tab {
|
||||
return v
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (e
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["pagodaId"] = level
|
||||
// 通关校验
|
||||
Nomalcfg := this.configure.GetPagodaConfigData(level + 1)
|
||||
if Nomalcfg == nil {
|
||||
_, err := this.configure.GetPagodaConfigData(level + 1)
|
||||
if err == nil {
|
||||
list.Complete = true
|
||||
mapData["complete"] = true
|
||||
}
|
||||
|
@ -117,13 +117,19 @@ func (this *configureComp) CheckSmithyFirstReelConfigData(etype int32, id int32)
|
||||
}
|
||||
|
||||
// 获取铁匠铺熟练度数据
|
||||
func (this *configureComp) GetSmithProficiencyConf(id int32) (data *cfg.GameSmithyProficiencyData) {
|
||||
if v, err := this.GetConfigure(game_smproficiency); err == nil {
|
||||
func (this *configureComp) GetSmithProficiencyConf(id int32) (data *cfg.GameSmithyProficiencyData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smproficiency); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyProficiency); ok {
|
||||
data = configure.Get(int(id))
|
||||
if data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
comm.NewNotFoundConfErr(moduleName, game_smproficiency, id)
|
||||
return
|
||||
}
|
||||
|
||||
@ -187,12 +193,11 @@ func (this *configureComp) GetSmithyCustomerConf(id int32) (data *cfg.GameSmithy
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smithycustomer); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyCustomer); ok {
|
||||
if data = configure.Get(id); data == nil {
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithycustomer, id)
|
||||
}
|
||||
if data = configure.Get(id); data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithycustomer, id)
|
||||
return
|
||||
}
|
||||
@ -204,12 +209,11 @@ func (this *configureComp) GetSmithyToolsData(id int32) (data *cfg.GameSmithyToo
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smithytools); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyTool); ok {
|
||||
if data = configure.Get(int(id)); data == nil {
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithytools, id)
|
||||
}
|
||||
if data = configure.Get(int(id)); data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithytools, id)
|
||||
return
|
||||
}
|
||||
@ -220,12 +224,11 @@ func (this *configureComp) GetSmithyStoveConf(level int32) (data *cfg.GameSmithy
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smithystove); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyStoveV1); ok {
|
||||
if data = configure.Get(int32(level)); data == nil {
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithystove, level)
|
||||
}
|
||||
if data = configure.Get(int32(level)); data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithystove, level)
|
||||
return
|
||||
}
|
||||
@ -237,12 +240,11 @@ func (this *configureComp) GetSmithyAtlasConf(id string) (data *cfg.GameSmithyAt
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smithyatlas); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyAtlas); ok {
|
||||
if data = configure.Get(id); data == nil {
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithyatlas, id)
|
||||
}
|
||||
if data = configure.Get(id); data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithyatlas, id)
|
||||
|
||||
return
|
||||
@ -292,12 +294,11 @@ func (this *configureComp) GetSmithyTask(taskId int32) (data *cfg.GameSmithyTask
|
||||
)
|
||||
if v, err = this.GetConfigure(game_smithytask); err == nil {
|
||||
if configure, ok := v.(*cfg.GameSmithyTask); ok {
|
||||
if data = configure.Get(taskId); data == nil {
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithytask, taskId)
|
||||
}
|
||||
if data = configure.Get(taskId); data != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_smithytask, taskId)
|
||||
return
|
||||
}
|
||||
|
@ -47,10 +47,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
log.Errorf("get game_viking conf err:%v", err)
|
||||
return
|
||||
})
|
||||
// err = this.LoadConfigure(game_challenge, cfg.NewGameVikingChallenge)
|
||||
|
||||
// _data := this.GetVikingBossTypeConfigData()
|
||||
// log.Debugf("%v", _data)
|
||||
return
|
||||
}
|
||||
|
||||
@ -105,17 +101,3 @@ func (this *configureComp) GetMaxDifficultyByBossID(bossId int32) int32 {
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 获取最后一条数据
|
||||
// func (this *configureComp) GetLastBuyChallenge() (data *cfg.GameVikingChallengeData) {
|
||||
// if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
// if configure, ok := v.(*cfg.GameVikingChallenge); ok && len(configure.GetDataList()) > 0 {
|
||||
// data = configure.GetDataList()[len(configure.GetDataList())-1]
|
||||
// return
|
||||
// }
|
||||
// } else {
|
||||
// log.Errorf("get game_challenge conf err:%v", err)
|
||||
// }
|
||||
|
||||
// return
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user