diff --git a/bin/json/game_global.json b/bin/json/game_global.json index e50cd7adb..2603442a8 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -560,6 +560,7 @@ "n": 1 }, "exemption_TemperatureCosNum": 50, + "smithy_MaxNpc": 2, "dispatch_freecheck": 1, "dispatch_checktime": 12, "dispatch_checkmoney": { diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index 4302cc861..cb9abd112 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -122,7 +122,7 @@ func (this *modelDispatch) taskRandom(uid string, dispatch *pb.DBDispatch) (task if n == 0 { //随机任务 - tasks = this.randomTask(dispatch, NOTICE_NUM) + tasks = this.randomTask(dispatch, noticeNum) } else { var randCount int for i := 0; i < len(dispatch.Nb.Tasks); i++ { @@ -399,8 +399,8 @@ func (this *modelDispatch) updateNotice(uid string, dispatch *pb.DBDispatch) err //刷新任务 count := len(dispatch.Nb.Tasks) - if count < NOTICE_NUM { - randCount = NOTICE_NUM - count + if count < noticeNum { + randCount = noticeNum - count dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, this.addRandomTask(dispatch, randCount)...) } diff --git a/modules/dispatch/module.go b/modules/dispatch/module.go index 6469e9aac..c3bbbe703 100644 --- a/modules/dispatch/module.go +++ b/modules/dispatch/module.go @@ -7,7 +7,7 @@ import ( ) // 默认6条公告数量 -const NOTICE_NUM int = 6 +const noticeNum int = 6 // 派遣 type Dispatch struct { diff --git a/modules/smithy/api_getCustomer.go b/modules/smithy/api_getCustomer.go index 85ac7508e..69c844f4e 100644 --- a/modules/smithy/api_getCustomer.go +++ b/modules/smithy/api_getCustomer.go @@ -9,14 +9,16 @@ import ( "google.golang.org/protobuf/proto" ) -// 3个顾客 -var customerCount int32 = 3 - func (this *apiComp) CustomerCheck(session comm.IUserSession, req *pb.SmithyCustomerReq) (code pb.ErrorCode) { return } func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerReq) (code pb.ErrorCode, data proto.Message) { + customerCount := this.module.configure.GetGlobalConf().SmithyMaxNpc + if customerCount <= 0 { + code = pb.ErrorCode_ConfigNoFound + return + } cus, err := this.module.modelTrade.getDBCustomer(session.GetUserId()) if err != nil { if err == mongo.ErrNoDocuments { diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index 0774b639b..ba43fd963 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -180,6 +180,7 @@ type GameGlobalData struct { RaiseTemperatureNum int32 ExemptionTemperatureCos *Gameatn ExemptionTemperatureCosNum int32 + SmithyMaxNpc int32 DispatchFreecheck int32 DispatchChecktime int32 DispatchCheckmoney *Gameatn @@ -779,6 +780,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["raise_temperatureNum"].(float64); !_ok_ { err = errors.New("raise_temperatureNum error"); return }; _v.RaiseTemperatureNum = int32(_tempNum_) } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["exemption_TemperatureCos"].(map[string]interface{}); !_ok_ { err = errors.New("exemption_TemperatureCos error"); return }; if _v.ExemptionTemperatureCos, err = DeserializeGameatn(_x_); err != nil { return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exemption_TemperatureCosNum"].(float64); !_ok_ { err = errors.New("exemption_TemperatureCosNum error"); return }; _v.ExemptionTemperatureCosNum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_MaxNpc"].(float64); !_ok_ { err = errors.New("smithy_MaxNpc error"); return }; _v.SmithyMaxNpc = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_freecheck"].(float64); !_ok_ { err = errors.New("dispatch_freecheck error"); return }; _v.DispatchFreecheck = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_checktime"].(float64); !_ok_ { err = errors.New("dispatch_checktime error"); return }; _v.DispatchChecktime = int32(_tempNum_) } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_checkmoney"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_checkmoney error"); return }; if _v.DispatchCheckmoney, err = DeserializeGameatn(_x_); err != nil { return } }