This commit is contained in:
meixiongfeng 2023-07-12 11:41:02 +08:00
commit c78a491c56
11 changed files with 128 additions and 81 deletions

View File

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

View File

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

View File

@ -89,5 +89,18 @@
"n": 250
}
]
},
{
"id": 8,
"pricegroupId": 1001,
"purchasemin": 11,
"purchasemax": -1,
"cost": [
{
"a": "attr",
"t": "diamond",
"n": 250
}
]
}
]

View File

@ -905,7 +905,3 @@ const (
SmithyToolsSkill4 = 4 // 每日顾客数量提升至{0}人
SmithyToolsSkill5 = 5 // 顾客购买装备数量上限提高至{0}件
)
const (
ArenaBuyType = 1001 // 价格组ID
)

View File

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

View File

@ -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(),

View File

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

View File

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

View File

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

View File

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

View File

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