铁匠铺NPC数量读配置

This commit is contained in:
wh_zcy 2023-03-30 16:26:05 +08:00
parent 2ab7af6f76
commit 2c35ca7388
5 changed files with 8 additions and 7 deletions

View File

@ -560,6 +560,7 @@
"n": 1
},
"exemption_TemperatureCosNum": 50,
"smithy_MaxNpc": 2,
"dispatch_freecheck": 1,
"dispatch_checktime": 12,
"dispatch_checkmoney": {

View File

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

View File

@ -7,7 +7,7 @@ import (
)
// 默认6条公告数量
const NOTICE_NUM int = 6
const noticeNum int = 6
// 派遣
type Dispatch struct {

View File

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

View File

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