From 2c35ca73884702fc7d0333e5a4d0dafd405ff099 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 30 Mar 2023 16:26:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=93=81=E5=8C=A0=E9=93=BANPC=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E8=AF=BB=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_global.json | 1 + modules/dispatch/model_dispatch.go | 6 +++--- modules/dispatch/module.go | 2 +- modules/smithy/api_getCustomer.go | 4 +--- sys/configure/structs/game.globalData.go | 2 ++ 5 files changed, 8 insertions(+), 7 deletions(-) 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..3ea10f97b 100644 --- a/modules/smithy/api_getCustomer.go +++ b/modules/smithy/api_getCustomer.go @@ -9,14 +9,12 @@ 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 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 } } From d4c92efa5b4e23ee5661fa1438dbd30e54628830 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 30 Mar 2023 16:49:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=95=86=E6=88=B7NPC=E8=AF=BB=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/api_getCustomer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/smithy/api_getCustomer.go b/modules/smithy/api_getCustomer.go index 3ea10f97b..69c844f4e 100644 --- a/modules/smithy/api_getCustomer.go +++ b/modules/smithy/api_getCustomer.go @@ -15,6 +15,10 @@ func (this *apiComp) CustomerCheck(session comm.IUserSession, req *pb.SmithyCust 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 {