diff --git a/bin/json/game_drawpool.json b/bin/json/game_drawpool.json index 84e034af3..bdb65e39f 100644 --- a/bin/json/game_drawpool.json +++ b/bin/json/game_drawpool.json @@ -329,5 +329,37 @@ "n": 100 } ] + }, + { + "key": 7, + "recruitment_type": [], + "star3w": 940, + "star4w": 52, + "star5w": 8, + "protect": 100, + "p3pool": "pro_pool70003", + "p4pool": "pro_pool70004", + "p5pool": "pro_pool70005", + "n3pool": "base_pool70003", + "n4pool": "base_pool70004", + "n5pool": "base_pool70005", + "baodi4": 10, + "baidi5": 100, + "etime": -1, + "permission": 1, + "consumeA": [ + { + "a": "item", + "t": "10000024", + "n": 1 + } + ], + "consumeB": [ + { + "a": "item", + "t": "10000024", + "n": 10 + } + ] } ] \ No newline at end of file diff --git a/bin/json/game_global.json b/bin/json/game_global.json index f3a10d1f9..ab7e59a1a 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -231,48 +231,7 @@ "t": "18000004", "n": 1 }, - "Arena_buy": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "attr", - "t": "diamond", - "n": 200 - }, - { - "a": "attr", - "t": "diamond", - "n": 400 - }, - { - "a": "attr", - "t": "diamond", - "n": 600 - }, - { - "a": "attr", - "t": "diamond", - "n": 800 - }, - { - "a": "attr", - "t": "diamond", - "n": 1000 - }, - { - "a": "attr", - "t": "diamond", - "n": 1200 - }, - { - "a": "attr", - "t": "diamond", - "n": 1400 - } - ], + "Arena_buy": 1001, "VikingExpedition_RecoveryTime": 144, "cops_RecoveryTime": 300, "cops_InitialNum": 60, diff --git a/bin/json/game_pricegroup.json b/bin/json/game_pricegroup.json index be421e355..74b29a9f4 100644 --- a/bin/json/game_pricegroup.json +++ b/bin/json/game_pricegroup.json @@ -89,5 +89,18 @@ "n": 250 } ] + }, + { + "id": 8, + "pricegroupId": 1001, + "purchasemin": 11, + "purchasemax": -1, + "cost": [ + { + "a": "attr", + "t": "diamond", + "n": 250 + } + ] } ] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index 0cda53b3b..17e6260ac 100644 --- a/comm/const.go +++ b/comm/const.go @@ -905,7 +905,3 @@ const ( SmithyToolsSkill4 = 4 // 每日顾客数量提升至{0}人 SmithyToolsSkill5 = 5 // 顾客购买装备数量上限提高至{0}件 ) - -const ( - ArenaBuyType = 1001 // 价格组ID -) diff --git a/modules/arena/api_buy.go b/modules/arena/api_buy.go index 231bf99ca..62dfb7f61 100644 --- a/modules/arena/api_buy.go +++ b/modules/arena/api_buy.go @@ -7,7 +7,7 @@ import ( cfg "go_dreamfactory/sys/configure/structs" ) -//参数校验 +// 参数校验 func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ArenaBuyReq) (errdata *pb.ErrorData) { if req.BuyNum == 0 { errdata = &pb.ErrorData{ @@ -18,7 +18,7 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ArenaBuyReq) (e return } -///获取自己的排行榜信息 +// /获取自己的排行榜信息 func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdata *pb.ErrorData) { var ( // global *cfg.GameGlobalData @@ -49,8 +49,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdat return } this.module.modelArena.recoverTicket(session, info) - - if maxbuy, err = this.module.ModuleTools.GetPriceGroupLen(comm.ArenaBuyType); err != nil { + pricekey := this.module.ModuleTools.GetGlobalConf().ArenaBuy + if maxbuy, err = this.module.ModuleTools.GetPriceGroupLen(pricekey); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Title: pb.ErrorCode_CacheReadError.ToString(), @@ -68,7 +68,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdat } return } - if res, err := this.module.ModuleTools.GetPriceGroupCost(comm.ArenaBuyType, info.Buynum+i+1); len(res) > 0 { + if res, err := this.module.ModuleTools.GetPriceGroupCost(pricekey, info.Buynum+i+1); len(res) > 0 { need = append(need, res...) } else { errdata = &pb.ErrorData{ diff --git a/modules/pay/api_info.go b/modules/pay/api_info.go index f7ca8f4bf..e1f1f20ba 100644 --- a/modules/pay/api_info.go +++ b/modules/pay/api_info.go @@ -33,7 +33,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PayInfoReq) (errdat } return } - if goods, err = this.module.configure.getPayPackageDatas(); err != nil { + if goods, err = this.module.configure.getPayPackageDatas(1); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Title: pb.ErrorCode_ConfigNoFound.ToString(), diff --git a/modules/pay/configure.go b/modules/pay/configure.go index 485f5b8d1..a7da0c8ef 100644 --- a/modules/pay/configure.go +++ b/modules/pay/configure.go @@ -12,13 +12,13 @@ const ( game_paypackage = "game_paypackage.json" ) -///背包配置管理组件 +// /背包配置管理组件 type configureComp struct { modules.MCompConfigure module *Pay } -//组件初始化接口 +// 组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*Pay) @@ -27,7 +27,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp return } -//获取手动加入频道 任务限制 +// 获取手动加入频道 任务限制 func (this *configureComp) getGameRecharge(id string) (result *cfg.GameRechargeData, err error) { var ( v interface{} @@ -46,8 +46,8 @@ func (this *configureComp) getGameRecharge(id string) (result *cfg.GameRechargeD return } -//获取手动加入频道 任务限制 -func (this *configureComp) getPayPackageDatas() (result []*cfg.GamePayPackageData, err error) { +// 获取手动加入频道 任务限制 +func (this *configureComp) getPayPackageDatas(ptype int32) (result []*cfg.GamePayPackageData, err error) { var ( v interface{} ) @@ -55,12 +55,17 @@ func (this *configureComp) getPayPackageDatas() (result []*cfg.GamePayPackageDat this.module.Errorf("err:%v", err) return } else { - result = v.(*cfg.GamePayPackage).GetDataList() + result = make([]*cfg.GamePayPackageData, 0) + for _, v := range v.(*cfg.GamePayPackage).GetDataList() { + if v.Type == ptype { + result = append(result, v) + } + } } return } -//获取手动加入频道 任务限制 +// 获取手动加入频道 任务限制 func (this *configureComp) getPayPackageData(id int32) (result *cfg.GamePayPackageData, err error) { var ( v interface{} @@ -79,7 +84,7 @@ func (this *configureComp) getPayPackageData(id int32) (result *cfg.GamePayPacka return } -//获取手动加入频道 任务限制 +// 获取手动加入频道 任务限制 func (this *configureComp) getPayPackageDataByPid(pid string) (result *cfg.GamePayPackageData, err error) { var ( v interface{} diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index 7d6b7e459..b1c8fc092 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -616,7 +616,7 @@ func (this *MCompConfigure) GetPriceGroupCost(pricegroupId int32, purchase int32 return } for _, v := range this._price[pricegroupId] { - if v.Purchasemin <= purchase && purchase <= v.Purchasemax { + if v.Purchasemin <= purchase && (purchase <= v.Purchasemax || v.Purchasemax == -1) { res = v.Cost return } @@ -628,8 +628,12 @@ func (this *MCompConfigure) GetPriceGroupLen(pricegroupId int32) (count int32, e if _, ok := this._price[pricegroupId]; !ok { err = comm.NewNotFoundConfErr("tools", game_price, pricegroupId) } - count = int32(len(this._price[pricegroupId])) - + count = 0 + for _, v := range this._price[pricegroupId] { + if count < v.Purchasemax { + count = v.Purchasemax + } + } return } diff --git a/modules/warorder/configure.go b/modules/warorder/configure.go index 659c2a78e..9003e64bd 100644 --- a/modules/warorder/configure.go +++ b/modules/warorder/configure.go @@ -15,9 +15,10 @@ const ( type configureComp struct { modules.MCompConfigure - module *Warorder - lock sync.RWMutex - order map[int32][]*cfg.GamePassCheckData //战令 + module *Warorder + lock sync.RWMutex + product map[string]int32 //商品id + order map[int32][]*cfg.GamePassCheckData //战令 } func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { @@ -27,6 +28,12 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp return } +func (this *configureComp) getproduct() map[string]int32 { + this.lock.RLock() + defer this.lock.RUnlock() + return this.product +} + // 读取任务配置表 func (this *configureComp) getPassCheckCfg() (data *cfg.GamePassCheck, err error) { var ( @@ -51,8 +58,12 @@ func (this *configureComp) updateconfigure() { this.module.Error("世界任务配置表异常!") return } + productConf := make(map[string]int32) orderConf := make(map[int32][]*cfg.GamePassCheckData) for _, v := range gwt.GetDataList() { + if _, ok := productConf[v.PayId]; !ok { + productConf[v.PayId] = v.PasscheckType + } if _, ok := orderConf[v.PasscheckType]; !ok { orderConf[v.PasscheckType] = make([]*cfg.GamePassCheckData, 0) } @@ -60,6 +71,7 @@ func (this *configureComp) updateconfigure() { } this.lock.Lock() + this.product = productConf this.order = orderConf this.lock.Unlock() } diff --git a/modules/warorder/module.go b/modules/warorder/module.go index a94a264e6..86fc7bef9 100644 --- a/modules/warorder/module.go +++ b/modules/warorder/module.go @@ -1,6 +1,7 @@ package warorder import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" @@ -46,6 +47,44 @@ func (this *Warorder) OnInstallComp() { // 发货 func (this *Warorder) Delivery(session comm.IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets) { + var ( + product map[string]int32 //商品id + warorders *pb.DBWarorders + info *pb.Warorder + wtype int32 + err error + ok bool + ) + product = this.configure.getproduct() + if _, ok = product[pid]; !ok { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.String(), + Message: fmt.Sprintf("no found pid:%s", pid), + } + return + } + wtype = product[pid] + if warorders, err = this.modelWarorder.getUserWarorders(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + + if info, ok = warorders.Items[wtype]; !ok { + info = &pb.Warorder{ + Vip: false, + Free: make([]int32, 0), + Pay: make([]int32, 0), + Progress: 0, + } + warorders.Items[wtype] = info + } + info.Vip = true + this.modelWarorder.updateUserWarorders(session.GetUserId(), warorders) return } diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index d2621ad2e..83dc3e1ee 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -117,7 +117,7 @@ type GameGlobalData struct { ArenaTicketMax int32 ArenaTicketRecoveryTime int32 ArenaTicketCos *Gameatn - ArenaBuy []*Gameatn + ArenaBuy int32 VikingExpeditionRecoveryTime int32 CopsRecoveryTime int32 CopsInitialNum int32 @@ -503,20 +503,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ArenaTicket_max"].(float64); !_ok_ { err = errors.New("ArenaTicket_max error"); return }; _v.ArenaTicketMax = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ArenaTicket_RecoveryTime"].(float64); !_ok_ { err = errors.New("ArenaTicket_RecoveryTime error"); return }; _v.ArenaTicketRecoveryTime = int32(_tempNum_) } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["ArenaTicket_cos"].(map[string]interface{}); !_ok_ { err = errors.New("ArenaTicket_cos error"); return }; if _v.ArenaTicketCos, err = DeserializeGameatn(_x_); err != nil { return } } - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["Arena_buy"].([]interface{}); !_ok_ { err = errors.New("Arena_buy error"); return } - - _v.ArenaBuy = make([]*Gameatn, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ *Gameatn - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } - _v.ArenaBuy = append(_v.ArenaBuy, _list_v_) - } - } - + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Arena_buy"].(float64); !_ok_ { err = errors.New("Arena_buy error"); return }; _v.ArenaBuy = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["VikingExpedition_RecoveryTime"].(float64); !_ok_ { err = errors.New("VikingExpedition_RecoveryTime error"); return }; _v.VikingExpeditionRecoveryTime = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cops_RecoveryTime"].(float64); !_ok_ { err = errors.New("cops_RecoveryTime error"); return }; _v.CopsRecoveryTime = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cops_InitialNum"].(float64); !_ok_ { err = errors.New("cops_InitialNum error"); return }; _v.CopsInitialNum = int32(_tempNum_) }