diff --git a/modules/stonehenge/configure.go b/modules/stonehenge/configure.go index c10ea714b..5bb956fda 100644 --- a/modules/stonehenge/configure.go +++ b/modules/stonehenge/configure.go @@ -138,7 +138,7 @@ func (this *configureComp) LoadEventGroupData() { } if _, ok := this.StypeE[key]; !ok { - this.StypeE[key] = value.GroupType + this.StypeE[key] = value.SubGroupType } if _, ok := this.SNumE[key]; !ok { this.SNumE[key] = value.SubGroupNum //value.Groupnum @@ -200,7 +200,7 @@ func (this *configureComp) LoadRoomGroupData() { } if _, ok := this.StypeR[key]; !ok { - this.StypeR[key] = value.GroupType + this.StypeR[key] = value.SubGroupType } if _, ok := this.SNumR[key]; !ok { this.SNumR[key] = value.SubGroupNum //value.Groupnum @@ -278,20 +278,18 @@ func (this *configureComp) GetRoomGroupDataByLottery(lotteryId int32) (rooms []i } } } - + m := make(map[int64]int32, 0) // 每个小组id 都随机取一次 - szW = make([]int32, 0) - szID = make([]int32, 0) + for _, _data := range this._lotteryType2R[lotteryId] { - if _data.SubGroupId != 0 { - szW = append(szW, _data.SubGroupWt) - szID = append(szID, _data.SubGroupId) + key := int64(lotteryId)<<31 + int64(_data.SubGroupId) + if _, ok := m[key]; !ok { + m[key] = _data.SubGroupWt } } // 类型为2 可能会同时获得多个组id - for pos, v := range szW { - key := int64(lotteryId)<<31 + int64(szID[pos]) + for key, v := range m { //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) if v >= comm.GetRandNum(0, 1000) { // 命中 if this.StypeR[key] == 1 { // 随机一组数据 @@ -695,14 +693,6 @@ func (this *configureComp) getGameStonePrivilegeData(privilegeId int32) (conf *c this.module.Errorln(err) return } -func (this *configureComp) GetEventLotterConfById(id int32) (data *cfg.GameEventlotteryData) { - if v, err := this.GetConfigure(game_eventlottery); err == nil { - if configure, ok := v.(*cfg.GameEventlottery); ok { - return configure.Get(id) - } - } - return -} // 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具) func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event []int32) { @@ -759,19 +749,16 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event } // 每个小组id 都随机取一次 - szW = make([]int32, 0) - szID = make([]int32, 0) + m := make(map[int64]int32, 0) for _, _data := range this._lotteryType2E[lotteryId] { - if _data.SubGroupId != 0 { - szW = append(szW, _data.SubGroupWt) - szID = append(szID, _data.SubGroupId) + key := int64(lotteryId)<<31 + int64(_data.SubGroupId) + if _, ok := m[key]; !ok { + m[key] = _data.SubGroupWt } } // 类型为2 可能会同时获得多个组id - for pos, v := range szW { - key := int64(lotteryId)<<31 + int64(szID[pos]) - //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) + for key, v := range m { if v >= comm.GetRandNum(0, 1000) { // 命中 if this.StypeE[key] == 1 { // 随机一组数据 for i := 0; i < int(this.SNumE[key]); i++ { @@ -791,7 +778,6 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event for _, _data := range this._groupType2E[key] { if _data.EventWt >= comm.GetRandNum(1, 1000) { // 命中 event = append(event, _data.EventID) - } } } diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index 034d49bac..3d353890a 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -238,20 +238,18 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, } // 每个小组id 都随机取一次 - szW = make([]int32, 0) - szID = make([]int32, 0) + m := make(map[int64]int32, 0) for _, _data := range this._lotteryType2[lotteryId] { 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) + key := int64(lotteryId)<<31 + int64(_data.Groupid) + if _, ok := m[key]; !ok { + m[key] = _data.Groupwt } } } // 类型为2 可能会同时获得多个组id - for pos, v := range szW { - key := int64(lotteryId)<<31 + int64(szID[pos]) + for key, v := range m { //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) if v >= comm.GetRandNum(0, 1000) { // 命中 if this.Stype[key] == 1 { // 随机一组数据