Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
7880b80fdd
@ -11,7 +11,9 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) PracticeCheck(session comm.IUserSession, req *pb.MartialhallPracticeReq) (code pb.ErrorCode) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +25,14 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.MartialhallPrac
|
|||||||
pillar *pb.DBPillar
|
pillar *pb.DBPillar
|
||||||
mdata *cfg.GameKungfuMasterworkerData
|
mdata *cfg.GameKungfuMasterworkerData
|
||||||
filed string
|
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 {
|
if mart, err = this.module.modelMartialhall.queryUserMartialhall(session.GetUserId()); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
@ -66,13 +75,21 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.MartialhallPrac
|
|||||||
//...
|
//...
|
||||||
|
|
||||||
//...
|
//...
|
||||||
|
var sale = make([]*cfg.Gameatn, 0)
|
||||||
if code = this.module.ConsumeRes(session, mdata.Deplete, true); code != pb.ErrorCode_Success {
|
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
|
return
|
||||||
}
|
}
|
||||||
pillar.State = pb.PillarState_Useing
|
pillar.State = pb.PillarState_Useing
|
||||||
pillar.Hero = req.Hero
|
pillar.Hero = req.Hero
|
||||||
pillar.Start = time.Now().Unix()
|
pillar.Start = time.Now().Unix()
|
||||||
|
pillar.End = time.Now().Add(time.Minute * time.Duration(req.Time)).Unix()
|
||||||
pillar.Lastbill = time.Now().Unix()
|
pillar.Lastbill = time.Now().Unix()
|
||||||
pillar.Reward = 0
|
pillar.Reward = 0
|
||||||
this.module.modelMartialhall.Change(session.GetUserId(), map[string]interface{}{
|
this.module.modelMartialhall.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
@ -71,6 +71,8 @@ type GameGlobalData struct {
|
|||||||
Gourmet int32
|
Gourmet int32
|
||||||
SmithyMaxplayer int32
|
SmithyMaxplayer int32
|
||||||
SmithyMaxtime int32
|
SmithyMaxtime int32
|
||||||
|
ChatExpressionSmall []string
|
||||||
|
KungfuTime int32
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeId_GameGlobalData = 477542761
|
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["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_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 _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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user