This commit is contained in:
meixiongfeng 2023-09-04 11:57:07 +08:00
parent 4ce720a7f2
commit e81cbc8096

View File

@ -186,20 +186,14 @@ func (this *MCompConfigure) LoadGroupData() {
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, lv int32) (items []*cfg.Gameatn) {
var (
lottery1 []int32
lottery2 []int32
ok1 bool
ok2 bool
)
this.hlock.RLock()
lottery1, ok1 = this._lotteryType1[lotteryId]
lottery2, ok2 = this._lotteryType2[lotteryId]
this.hlock.RUnlock()
if ok1 || ok2 {
if _, ok := this._lotteryType1[lotteryId]; !ok {
if _, ok := this._lotteryType2[lotteryId]; !ok {
this.module.Errorf("not found config lotterId:%d", lotteryId)
return
}
}
// 优先校验大组ID 的类型
var (
szW []int32 // 权重数组
szID []int32 // 小组ID 数组
@ -207,13 +201,14 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
)
// 随机小组id
for _, v := range lottery1 {
for _, v := range this._lotteryType1[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 {
szW = append(szW, _data.Groupwt)
szID = append(szID, _data.Groupid)
}
}
}
}
@ -260,10 +255,11 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
}
// 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, v := range lottery2 {
for _, v := range this._lotteryType2[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 {