From 3ea3ca84e47bd7839c92b1ad8a54edb5a7f7c364 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 18 Aug 2022 19:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=AD=A6=E9=A6=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_com.json | 3 ++- bin/json/game_global.json | 3 ++- modules/martialhall/api_practice.go | 22 +++++++++++++++++++--- sys/configure/structs/game.globalData.go | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/bin/json/game_com.json b/bin/json/game_com.json index 53a944206..045ab8264 100644 --- a/bin/json/game_com.json +++ b/bin/json/game_com.json @@ -139,6 +139,7 @@ "smithy_maxtime": 36000, "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" - ] + ], + "kungfu_time": 30 } ] \ No newline at end of file diff --git a/bin/json/game_global.json b/bin/json/game_global.json index 53a944206..045ab8264 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -139,6 +139,7 @@ "smithy_maxtime": 36000, "chat_expression_small": [ "lt_bq_icon001,lt_bq_icon002,lt_bq_icon003,lt_bq_icon004,lt_bq_icon005,lt_bq_icon006,lt_bq_icon007,lt_bq_icon008,lt_bq_icon009,lt_bq_icon010,lt_bq_icon011,lt_bq_icon012" - ] + ], + "kungfu_time": 30 } ] \ No newline at end of file diff --git a/modules/martialhall/api_practice.go b/modules/martialhall/api_practice.go index 6ce89ad22..a2bab5e62 100644 --- a/modules/martialhall/api_practice.go +++ b/modules/martialhall/api_practice.go @@ -11,7 +11,9 @@ import ( //参数校验 func (this *apiComp) PracticeCheck(session comm.IUserSession, req *pb.MartialhallPracticeReq) (code pb.ErrorCode) { - + if req.Pillar == 0 || req.Hero == "" || req.Time == 0 { + code = pb.ErrorCode_ReqParameterError + } return } @@ -23,7 +25,14 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.MartialhallPrac pillar *pb.DBPillar mdata *cfg.GameKungfuMasterworkerData filed string + ktime int32 + num int32 ) + if code = this.PracticeCheck(session, req); code != pb.ErrorCode_Success { + return + } + ktime = this.module.configure.GetGlobalConf().KungfuTime + num = req.Time / ktime if mart, err = this.module.modelMartialhall.queryUserMartialhall(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError } @@ -66,8 +75,15 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.MartialhallPrac //... //... - - if code = this.module.ConsumeRes(session, mdata.Deplete, true); code != pb.ErrorCode_Success { + var sale = make([]*cfg.Gameatn, 0) + for _, v := range mdata.Deplete { + sale = append(sale, &cfg.Gameatn{ + A: v.A, + T: v.T, + N: v.N * num, + }) + } + if code = this.module.ConsumeRes(session, sale, true); code != pb.ErrorCode_Success { return } pillar.State = pb.PillarState_Useing diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index 2a01f08a7..083b33bfb 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -71,6 +71,8 @@ type GameGlobalData struct { Gourmet int32 SmithyMaxplayer int32 SmithyMaxtime int32 + ChatExpressionSmall []string + KungfuTime int32 } const TypeId_GameGlobalData = 477542761 @@ -205,6 +207,21 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["gourmet"].(float64); !_ok_ { err = errors.New("gourmet error"); return }; _v.Gourmet = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxplayer"].(float64); !_ok_ { err = errors.New("smithy_maxplayer error"); return }; _v.SmithyMaxplayer = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxtime"].(float64); !_ok_ { err = errors.New("smithy_maxtime error"); return }; _v.SmithyMaxtime = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["chat_expression_small"].([]interface{}); !_ok_ { err = errors.New("chat_expression_small error"); return } + + _v.ChatExpressionSmall = make([]string, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ string + { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + _v.ChatExpressionSmall = append(_v.ChatExpressionSmall, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["kungfu_time"].(float64); !_ok_ { err = errors.New("kungfu_time error"); return }; _v.KungfuTime = int32(_tempNum_) } return }