From 91f08811039ec515828a9916e93840070bffa1b6 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 26 Jul 2023 10:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E6=9C=89buff=20=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/stonehenge/configure.go | 56 +++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/modules/stonehenge/configure.go b/modules/stonehenge/configure.go index b9e4b3195..ca821859e 100644 --- a/modules/stonehenge/configure.go +++ b/modules/stonehenge/configure.go @@ -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] }