配置修改

This commit is contained in:
meixiongfeng 2022-08-15 17:37:56 +08:00
parent bc9fdabfc3
commit afc2468ef6
5 changed files with 110 additions and 21 deletions

View File

@ -79,6 +79,31 @@
"t": "10005",
"n": 1
},
"base_pool_10cost": {
"a": "item",
"t": "10001",
"n": 10
},
"camp1_pool_10cost": {
"a": "item",
"t": "10002",
"n": 10
},
"camp2_pool_10cost": {
"a": "item",
"t": "10003",
"n": 10
},
"camp3_pool_10cost": {
"a": "item",
"t": "10004",
"n": 10
},
"camp4_pool_10cost": {
"a": "item",
"t": "10005",
"n": 10
},
"camp1_pool1": "camp1_pool",
"camp2_pool1": "camp2_pool",
"camp3_pool1": "camp3_pool",
@ -109,6 +134,8 @@
"camp_pool_star3": 9000,
"camp_pool_star4": 900,
"camp_pool_star5": 100,
"gourmet": 500
"gourmet": 500,
"smithy_maxplayer": 20,
"smithy_maxtime": 36000
}
]

View File

@ -9,7 +9,7 @@ import (
)
func (this *apiComp) DrawCardCheck(session comm.IUserSession, req *pb.HeroDrawCardReq) (code pb.ErrorCode) {
if req.DrawType < 0 { // 只能是单抽或10抽
if req.DrawType < 0 && (req.DrawCount == 1 || req.DrawCount == 10) { // 只能是单抽或10抽
code = pb.ErrorCode_ReqParameterError
}
return
@ -39,19 +39,24 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
szCards = make([]string, 0)
rsp := &pb.HeroDrawCardResp{}
cfg := cfgDraw
costAtn = cfgDraw.BasePoolCost
heroRecord, _ = this.module.modelRecord.GetHeroRecord(session.GetUserId())
drawCount = heroRecord.Drawcount
pool = this.module.modelHero.CheckPool(drawCount, cfg)
if req.DrawType == 0 { // 普通卡池抽卡
// 获取普通抽卡池
if req.DrawCount == 1 {
costAtn = cfgDraw.BasePoolCost
} else {
costAtn = cfgDraw.BasePool10cost
}
costRes = append(costRes, costAtn)
code = this.module.CheckRes(session, costRes)
if code != pb.ErrorCode_Success { // 消耗数量不足直接返回
return
}
for {
for i := 0; i < int(req.DrawCount); i++ {
sz := make([]int32, 0)
if cfgDraw.BasePoolStar3 != 0 {
sz = append(sz, cfgDraw.BasePoolStar3)
@ -64,10 +69,22 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
sz = append(sz, cfgDraw.BasePoolStar5)
}
starIndex := this.module.modelHero.GetRandW(sz)
if starIndex == 1 {
star4Max++
} else if starIndex == 2 {
star5Max++
}
if star4Max >= cfgDraw.Draw10Star4Max || star5Max >= cfgDraw.Draw10Star5Max {
starIndex = 0
}
szStar = append(szStar, starIndex+3)
if len(szStar) >= int(req.DrawCount) {
break
}
}
} else { // 所有阵营抽卡都走这里
if req.DrawCount == 1 {
switch req.DrawType {
case 1:
pool = cfg.Camp1Pool1
@ -83,6 +100,25 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
pool = cfg.Camp4Pool1
costAtn = cfgDraw.Camp4PoolCost
}
} else {
costAtn = cfgDraw.Camp1PoolCost
switch req.DrawType {
case 1:
pool = cfg.Camp1Pool1
costAtn = cfgDraw.Camp1Pool10cost
case 2:
pool = cfg.Camp2Pool1
costAtn = cfgDraw.Camp2Pool10cost
case 3:
pool = cfg.Camp3Pool1
costAtn = cfgDraw.Camp3Pool10cost
case 4:
pool = cfg.Camp4Pool1
costAtn = cfgDraw.Camp4Pool10cost
}
}
costAtn.N *= req.DrawCount
costRes = append(costRes, costAtn)
@ -94,11 +130,10 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
for {
sz := make([]int32, 0)
if cfgDraw.CampPoolStar3 != 0 {
sz = append(sz, cfgDraw.CampPoolStar3)
sz = append(sz, cfgDraw.CampPoolStar3) // 3 4 5 性权重
}
if cfgDraw.CampPoolStar4 != 0 {
sz = append(sz, cfgDraw.CampPoolStar4)
}
if cfgDraw.CampPoolStar5 != 0 {
sz = append(sz, cfgDraw.CampPoolStar5)
@ -118,7 +153,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
break
}
}
}
_data := this.module.configure.GetPollByType(pool)
if _data == nil {

View File

@ -61,7 +61,7 @@ func (this *Items) EventUserOffline(session comm.IUserSession) {
//IItems-------------------------------------------------------------------------------------------------------------------------------
///查询用户背包物品数量
func (this *Items) QueryItemAmount(source *comm.ModuleCallSource, uId string, itemid string) (amount uint32) {
defer this.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount)
defer this.Debugf("获取物品 uId:%s itemid:%s addnum:%d ", uId, itemid, amount)
amount = 0
if result := this.modelItems.QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 {
return result[itemid]

View File

@ -49,6 +49,11 @@ type GamecomData struct {
Camp2PoolCost *Gameatn
Camp3PoolCost *Gameatn
Camp4PoolCost *Gameatn
BasePool10cost *Gameatn
Camp1Pool10cost *Gameatn
Camp2Pool10cost *Gameatn
Camp3Pool10cost *Gameatn
Camp4Pool10cost *Gameatn
Camp1Pool1 string
Camp2Pool1 string
Camp3Pool1 string
@ -64,6 +69,8 @@ type GamecomData struct {
CampPoolStar4 int32
CampPoolStar5 int32
Gourmet int32
SmithyMaxplayer int32
SmithyMaxtime int32
}
const TypeId_GamecomData = -395344177
@ -176,6 +183,11 @@ func (_v *GamecomData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_cost error"); return }; if _v.Camp2PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_cost error"); return }; if _v.Camp3PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_cost error"); return }; if _v.Camp4PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool_10cost error"); return }; if _v.BasePool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp1_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp1_pool_10cost error"); return }; if _v.Camp1Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_10cost error"); return }; if _v.Camp2Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_10cost error"); return }; if _v.Camp3Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_10cost error"); return }; if _v.Camp4Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; if _v.Camp1Pool1, _ok_ = _buf["camp1_pool1"].(string); !_ok_ { err = errors.New("camp1_pool1 error"); return } }
{ var _ok_ bool; if _v.Camp2Pool1, _ok_ = _buf["camp2_pool1"].(string); !_ok_ { err = errors.New("camp2_pool1 error"); return } }
{ var _ok_ bool; if _v.Camp3Pool1, _ok_ = _buf["camp3_pool1"].(string); !_ok_ { err = errors.New("camp3_pool1 error"); return } }
@ -191,6 +203,8 @@ func (_v *GamecomData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star4"].(float64); !_ok_ { err = errors.New("camp_pool_star4 error"); return }; _v.CampPoolStar4 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star5"].(float64); !_ok_ { err = errors.New("camp_pool_star5 error"); return }; _v.CampPoolStar5 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["gourmet"].(float64); !_ok_ { err = errors.New("gourmet error"); return }; _v.Gourmet = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxplayer"].(float64); !_ok_ { err = errors.New("smithy_maxplayer error"); return }; _v.SmithyMaxplayer = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxtime"].(float64); !_ok_ { err = errors.New("smithy_maxtime error"); return }; _v.SmithyMaxtime = int32(_tempNum_) }
return
}

View File

@ -49,6 +49,11 @@ type GameglobalData struct {
Camp2PoolCost *Gameatn
Camp3PoolCost *Gameatn
Camp4PoolCost *Gameatn
BasePool10cost *Gameatn
Camp1Pool10cost *Gameatn
Camp2Pool10cost *Gameatn
Camp3Pool10cost *Gameatn
Camp4Pool10cost *Gameatn
Camp1Pool1 string
Camp2Pool1 string
Camp3Pool1 string
@ -64,6 +69,8 @@ type GameglobalData struct {
CampPoolStar4 int32
CampPoolStar5 int32
Gourmet int32
SmithyMaxplayer int32
SmithyMaxtime int32
}
const TypeId_GameglobalData = -518904471
@ -176,6 +183,11 @@ func (_v *GameglobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_cost error"); return }; if _v.Camp2PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_cost error"); return }; if _v.Camp3PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_cost error"); return }; if _v.Camp4PoolCost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool_10cost error"); return }; if _v.BasePool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp1_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp1_pool_10cost error"); return }; if _v.Camp1Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_10cost error"); return }; if _v.Camp2Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_10cost error"); return }; if _v.Camp3Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_10cost error"); return }; if _v.Camp4Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; if _v.Camp1Pool1, _ok_ = _buf["camp1_pool1"].(string); !_ok_ { err = errors.New("camp1_pool1 error"); return } }
{ var _ok_ bool; if _v.Camp2Pool1, _ok_ = _buf["camp2_pool1"].(string); !_ok_ { err = errors.New("camp2_pool1 error"); return } }
{ var _ok_ bool; if _v.Camp3Pool1, _ok_ = _buf["camp3_pool1"].(string); !_ok_ { err = errors.New("camp3_pool1 error"); return } }
@ -191,6 +203,8 @@ func (_v *GameglobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star4"].(float64); !_ok_ { err = errors.New("camp_pool_star4 error"); return }; _v.CampPoolStar4 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star5"].(float64); !_ok_ { err = errors.New("camp_pool_star5 error"); return }; _v.CampPoolStar5 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["gourmet"].(float64); !_ok_ { err = errors.New("gourmet error"); return }; _v.Gourmet = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxplayer"].(float64); !_ok_ { err = errors.New("smithy_maxplayer error"); return }; _v.SmithyMaxplayer = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxtime"].(float64); !_ok_ { err = errors.New("smithy_maxtime error"); return }; _v.SmithyMaxtime = int32(_tempNum_) }
return
}