已有buff 过滤

This commit is contained in:
meixiongfeng 2023-07-26 10:34:45 +08:00
parent 301f4c6af1
commit 91f0881103

View File

@ -81,9 +81,18 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = this.LoadConfigure(game_eventconf, cfg.NewGameStoneEvent)
err = this.LoadConfigure(game_roomconf, cfg.NewGameStoneRoom)
configure.RegisterConfigure(game_stageconf, cfg.NewGameStoneStage, this.LoadGameStroneStage)
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStroneBuff)
configure.RegisterConfigure(game_stageconf, cfg.NewGameStoneStage, this.LoadGameStoneStage)
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff)
// sz := make(map[int32]struct{})
// sz[125004312] = struct{}{}
// sz[135006211] = struct{}{}
// sz[135006212] = struct{}{}
// sz[135006312] = struct{}{}
// sz[144004311] = struct{}{}
// sz[144004312] = struct{}{}
// sz[124006311] = struct{}{}
// this.GetBuffGroupDataByLottery(100001, 1, sz)
return
}
@ -474,7 +483,42 @@ func (this *configureComp) GetLotterConfById(id int32) (data *cfg.GameBufflotter
}
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *configureComp) GetBuffGroupDataByLottery(lotteryId int32, addType int32) (buff []int32) {
func (this *configureComp) GetBuffGroupDataByLottery(lotteryId int32, addType int32, ownerbuff map[int32]struct{}) (buff []int32) {
var (
num int32
szW []int32
curWt int32 // 是否增加权重
sz []*cfg.GameBufflotteryData
)
if v, ok := this.buffLottery[lotteryId]; ok {
for i := 1; ; i++ {
for k, v1 := range v { // k buffID v1 cfg.GameBufflotteryData
curWt = 0
if _, ok := ownerbuff[k]; !ok {
sz = append(sz, v1)
if v2, ok := this.buff[addType]; ok {
if _, ok := v2[k]; ok {
curWt += v1.TypeWt
}
}
curWt += v1.BuffWt
szW = append(szW, curWt)
}
if num == 0 {
num = v1.GroupNum
}
}
getbuffid := sz[comm.GetRandW(szW)].BuffID
ownerbuff[getbuffid] = struct{}{}
buff = append(buff, getbuffid)
if i >= int(num) {
break
}
}
}
return
}
@ -524,7 +568,7 @@ func (this *configureComp) GetStoneEventDataById(eventid int32) (conf *cfg.GameS
}
//
func (this *configureComp) LoadGameStroneStage() {
func (this *configureComp) LoadGameStoneStage() {
if v, err := this.GetConfigure(game_stageconf); err == nil {
if configure, ok := v.(*cfg.GameStoneStage); ok {
@ -547,7 +591,7 @@ func (this *configureComp) GetStageConfByStageid(stgeid int32, roomid int32) (co
return this.stage[key]
}
func (this *configureComp) LoadGameStroneBuff() {
func (this *configureComp) LoadGameStoneBuff() {
if v, err := this.GetConfigure(game_buffconf); err == nil {
if configure, ok := v.(*cfg.GameStoneBuff); ok {
@ -566,6 +610,6 @@ func (this *configureComp) LoadGameStroneBuff() {
return
}
func (this *configureComp) GetGameStroneBuff(addType int32) (m map[int32]struct{}) {
func (this *configureComp) GetGameStoneBuff(addType int32) (m map[int32]struct{}) {
return this.buff[addType]
}