上传武馆代码

This commit is contained in:
liwei1dao 2022-08-18 19:55:52 +08:00
parent 643808f353
commit 3ea3ca84e4
4 changed files with 40 additions and 5 deletions

View File

@ -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
}
]

View File

@ -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
}
]

View File

@ -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

View File

@ -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
}