From e81cbc80960f6320e80d0e1e3d85f5e40be32c84 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 4 Sep 2023 11:57:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=89=E8=90=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/tools/comp_configure.go | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index c0963cf91..bc8540f22 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -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 { - this.module.Errorf("not found config lotterId:%d", lotteryId) - return + + 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 {