diff --git a/modules/comp_configure.go b/modules/comp_configure.go index 292d133ab..96ab82203 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -45,15 +45,13 @@ type MCompConfigure struct { _lotteryType1 map[int32][]int32 // key 大组ID value cid // 类型为2 的数据 有多个小组ID _lotteryType2 map[int32][]int32 // key 大组ID value 小组ID - // 小组类型为1 _groupType1 map[int64][]int32 //value cid // 小组类型为2 _groupType2 map[int64][]int32 //value cid - - Btype map[int32]int32 - Stype map[int64]int32 // subtype - SNum map[int64]int32 // 小组产出数量 + Btype map[int32]int32 + Stype map[int64]int32 // subtype + SNum map[int64]int32 // 小组产出数量 } //组件初始化接口 @@ -85,7 +83,8 @@ 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) - + _d := this.GetGroupData(40001001, 1, 1) + fmt.Printf("%v", _d) return } @@ -117,9 +116,9 @@ func (this *MCompConfigure) LoadGroupData() { this.SNum[key] = value.Groupnum } if this.Btype[value.Lotteryid] == 1 { - this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Groupid], value.Id) + this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Lotteryid], value.Id) } else if this.Btype[value.Lotteryid] == 2 { - this._lotteryType2[value.Groupid] = append(this._lotteryType2[value.Groupid], value.Id) + this._lotteryType2[value.Lotteryid] = append(this._lotteryType2[value.Lotteryid], value.Id) } if this.Stype[key] == 1 { // 小组ID为1 @@ -135,10 +134,6 @@ func (this *MCompConfigure) LoadGroupData() { } return } -func (this *MCompConfigure) GetGroupConf(lotterId int32, group int32) (conf *cfg.GameLotteryData) { - key := int64(lotterId)<<31 + int64(group) - return this.GetLotterConfById(this._group[key][0]) -} // 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具) func (this *MCompConfigure) GetGroupData(lotterId int32, vipLv int32, lv int32) (items []*cfg.Gameatn) { @@ -148,18 +143,18 @@ func (this *MCompConfigure) GetGroupData(lotterId int32, vipLv int32, lv int32) szW []int32 // 权重数组 szID []int32 // 小组ID 数组 groupID int32 + gourp map[int32]int32 // key 小组ID value 权重 ) - var gourp map[int32]int32 // key 小组ID value 权重 gourp = make(map[int32]int32, 0) // 随机小组id for _, v := range this._lotteryType1[lotterId] { if _data := this.GetLotterConfById(v); _data != nil { - if (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax) && (_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) - szID = append(szW, _data.Groupid) + szID = append(szID, _data.Groupid) } } } @@ -178,7 +173,7 @@ func (this *MCompConfigure) GetGroupData(lotterId int32, vipLv int32, lv int32) if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 if _, ok := gourp[_data.Groupid]; !ok { szW = append(szW, _data.Itemwt) - szID = append(szW, _data.Id) + szID = append(szID, _data.Id) } } } @@ -215,7 +210,7 @@ func (this *MCompConfigure) GetGroupData(lotterId int32, vipLv int32, lv int32) gourp := make(map[int32]*cfg.GameLotteryData, 0) // key 小组ID value 权重 for _, v := range this._lotteryType2[lotterId] { if _data := this.GetLotterConfById(v); _data != nil { - if (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax) && (_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 // 小组ID 权重赋值 } @@ -236,7 +231,7 @@ func (this *MCompConfigure) GetGroupData(lotterId int32, vipLv int32, lv int32) if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 if _, ok := gourp[_data.Groupid]; !ok { szW = append(szW, _data.Itemwt) - szID = append(szW, _data.Id) + szID = append(szID, _data.Id) } } }