配置解析

This commit is contained in:
meixiongfeng 2023-10-09 15:11:27 +08:00
parent 67bddca0d4
commit a69ecd0716
2 changed files with 18 additions and 34 deletions

View File

@ -138,7 +138,7 @@ func (this *configureComp) LoadEventGroupData() {
} }
if _, ok := this.StypeE[key]; !ok { if _, ok := this.StypeE[key]; !ok {
this.StypeE[key] = value.GroupType this.StypeE[key] = value.SubGroupType
} }
if _, ok := this.SNumE[key]; !ok { if _, ok := this.SNumE[key]; !ok {
this.SNumE[key] = value.SubGroupNum //value.Groupnum this.SNumE[key] = value.SubGroupNum //value.Groupnum
@ -200,7 +200,7 @@ func (this *configureComp) LoadRoomGroupData() {
} }
if _, ok := this.StypeR[key]; !ok { if _, ok := this.StypeR[key]; !ok {
this.StypeR[key] = value.GroupType this.StypeR[key] = value.SubGroupType
} }
if _, ok := this.SNumR[key]; !ok { if _, ok := this.SNumR[key]; !ok {
this.SNumR[key] = value.SubGroupNum //value.Groupnum 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 都随机取一次 // 每个小组id 都随机取一次
szW = make([]int32, 0)
szID = make([]int32, 0)
for _, _data := range this._lotteryType2R[lotteryId] { for _, _data := range this._lotteryType2R[lotteryId] {
if _data.SubGroupId != 0 { key := int64(lotteryId)<<31 + int64(_data.SubGroupId)
szW = append(szW, _data.SubGroupWt) if _, ok := m[key]; !ok {
szID = append(szID, _data.SubGroupId) m[key] = _data.SubGroupWt
} }
} }
// 类型为2 可能会同时获得多个组id // 类型为2 可能会同时获得多个组id
for pos, v := range szW { for key, v := range m {
key := int64(lotteryId)<<31 + int64(szID[pos])
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v >= comm.GetRandNum(0, 1000) { // 命中 if v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeR[key] == 1 { // 随机一组数据 if this.StypeR[key] == 1 { // 随机一组数据
@ -695,14 +693,6 @@ func (this *configureComp) getGameStonePrivilegeData(privilegeId int32) (conf *c
this.module.Errorln(err) this.module.Errorln(err)
return 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等级 玩家等级 返回获得的道具) // 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event []int32) { func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event []int32) {
@ -759,19 +749,16 @@ func (this *configureComp) GetEventGroupDataByLottery(lotterys ...int32) (event
} }
// 每个小组id 都随机取一次 // 每个小组id 都随机取一次
szW = make([]int32, 0) m := make(map[int64]int32, 0)
szID = make([]int32, 0)
for _, _data := range this._lotteryType2E[lotteryId] { for _, _data := range this._lotteryType2E[lotteryId] {
if _data.SubGroupId != 0 { key := int64(lotteryId)<<31 + int64(_data.SubGroupId)
szW = append(szW, _data.SubGroupWt) if _, ok := m[key]; !ok {
szID = append(szID, _data.SubGroupId) m[key] = _data.SubGroupWt
} }
} }
// 类型为2 可能会同时获得多个组id // 类型为2 可能会同时获得多个组id
for pos, v := range szW { for key, v := range m {
key := int64(lotteryId)<<31 + int64(szID[pos])
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v >= comm.GetRandNum(0, 1000) { // 命中 if v >= comm.GetRandNum(0, 1000) { // 命中
if this.StypeE[key] == 1 { // 随机一组数据 if this.StypeE[key] == 1 { // 随机一组数据
for i := 0; i < int(this.SNumE[key]); i++ { 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] { for _, _data := range this._groupType2E[key] {
if _data.EventWt >= comm.GetRandNum(1, 1000) { // 命中 if _data.EventWt >= comm.GetRandNum(1, 1000) { // 命中
event = append(event, _data.EventID) event = append(event, _data.EventID)
} }
} }
} }

View File

@ -238,20 +238,18 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
} }
// 每个小组id 都随机取一次 // 每个小组id 都随机取一次
szW = make([]int32, 0) m := make(map[int64]int32, 0)
szID = make([]int32, 0)
for _, _data := range this._lotteryType2[lotteryId] { 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.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件
if _data.Groupid != 0 { key := int64(lotteryId)<<31 + int64(_data.Groupid)
szW = append(szW, _data.Groupwt) if _, ok := m[key]; !ok {
szID = append(szID, _data.Groupid) m[key] = _data.Groupwt
} }
} }
} }
// 类型为2 可能会同时获得多个组id // 类型为2 可能会同时获得多个组id
for pos, v := range szW { for key, v := range m {
key := int64(lotteryId)<<31 + int64(szID[pos])
//fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v >= comm.GetRandNum(0, 1000) { // 命中 if v >= comm.GetRandNum(0, 1000) { // 命中
if this.Stype[key] == 1 { // 随机一组数据 if this.Stype[key] == 1 { // 随机一组数据