From 721ff30fb87dac3395b67a541611532388d941e2 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 25 Oct 2024 16:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=A5=96=E6=B4=BB=E5=8A=A8=E4=B8=AD?= =?UTF-8?q?=E5=A5=96=E5=B9=BF=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/lotterymgr.go | 69 ++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/worldsrv/lotterymgr.go b/worldsrv/lotterymgr.go index 3106040..ea7779c 100644 --- a/worldsrv/lotterymgr.go +++ b/worldsrv/lotterymgr.go @@ -148,53 +148,36 @@ func (l *LotteryData) sendAward() { return } l.IsSend = true + + var lotteryAward []*welfare.PropInfo + for _, v := range l.Reward { + lotteryAward = append(lotteryAward, &welfare.PropInfo{ + ItemId: v.ItemId, + ItemNum: v.ItemNum, + }) + } + + pack := &welfare.NotifyLotteryAward{ + Info: &welfare.LotteryInfo{ + Id: l.CId, + StartTs: l.StartTs, + Index: int32(l.Num), + Award: lotteryAward, + SnId: l.SnId, + Name: l.Name, + RoleId: l.RoleId, + Price: l.Price, + }, + } + + // 广播中奖结果 + PlayerMgrSington.BroadcastMessageToPlatform(l.Platform, int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack) + logger.Logger.Tracef("NotifyLotteryAward: %v", pack) + if l.IsRobot { return } AddMailLottery(l.Platform, l.SnId, l.Reward) - // 通知 - if p := PlayerMgrSington.GetPlayerBySnId(l.SnId); p != nil { - - var lotteryAward []*welfare.PropInfo - for _, v := range l.Reward { - lotteryAward = append(lotteryAward, &welfare.PropInfo{ - ItemId: v.ItemId, - ItemNum: v.ItemNum, - }) - } - - var codes []string - info := PlayerInfoMgrSingle.Players[p.SnId] - if info != nil { - if lt := info.Lottery[l.CId]; lt != nil && lt.StartTs == l.StartTs { - codes = lt.Code - } - } - - pack := &welfare.NotifyLotteryAward{ - Info: &welfare.LotteryInfo{ - Id: l.CId, - StartTs: l.StartTs, - EndTs: l.EndTs, - WinTs: l.WinTs, - RemainCode: int64(l.GetRemainCode()), - TotalCode: l.TotalCode, - Award: lotteryAward, - State: common.LotteryStateOver, - WinCode: l.WinCode, - SnId: l.SnId, - Name: l.Name, - Index: int32(l.Num), - Price: l.Price, - NeedRoomCard: LotteryRoomCard, - ImageURL: l.ImageURL, - CostRoomCard: l.WinCostCard, - Codes: codes, - }, - } - p.SendToClient(int(welfare.SPacketID_PACKET_NotifyLotteryAward), pack) - logger.Logger.Tracef("NotifyLotteryAward: %v", pack) - } } func (l *LotteryData) sendRobotCode(a, b int) {