diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index 459da3633..65af54ccb 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -81,7 +81,6 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com this.Stype = make(map[int64]int32, 0) this.SNum = make(map[int64]int32, 0) configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData) - return } @@ -168,7 +167,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, // 随机小组id 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.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 if _, ok := gourp[_data.Groupid]; !ok { gourp[_data.Groupid] = _data.Groupwt // 小组ID 权重赋值 szW = append(szW, _data.Groupwt) @@ -211,7 +210,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, for _, v := range this._groupType2[key] { if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v) - if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中 + if _data.Itemwt >= comm.GetRandNum(0, 1000) { // 命中 count := comm.GetRandNum(_data.Min, _data.Max) items = append(items, &cfg.Gameatn{ A: _data.Itemid.A, @@ -225,20 +224,19 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, } } else if this.Btype[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比) // 每个小组id 都随机取一次 - var szGroupID []int32 // 获得的权重数组 - gourp := make(map[int32]*cfg.GameLotteryData, 0) // key 小组ID value 权重 + var szGroupID []int32 // 获得的权重数组 + gourp := make([]*cfg.GameLotteryData, 0) // key 小组ID value 权重 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 _, ok := gourp[_data.Groupid]; !ok { - gourp[_data.Groupid] = _data // 小组ID 权重赋值 - } + if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 + gourp = append(gourp, _data) } } } // 类型为2 可能会同时获得多个组id - for k, v := range gourp { + for _, v := range gourp { + k := v.Groupid fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) if v.Itemwt >= comm.GetRandNum(0, 1000) { // 命中 szGroupID = append(szGroupID, k)