From 6a6d36a15163f975a2b03316e1dc9475147e97fd Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 27 Feb 2024 13:58:28 -0500 Subject: [PATCH] Core/Units: Added helper function to clear boss emote frame and enable SMSG_CLEAR_BOSS_EMOTES Port From (https://github.com/TrinityCore/TrinityCore/commit/deb24f3f53540733bef15f0a90a1b7e41e76d60e) --- Source/Game/Entities/Unit/Unit.cs | 20 +++++++++++++++++++ Source/Game/Networking/Packets/ChatPackets.cs | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index c9dcfbf63..481eddca4 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -437,6 +437,26 @@ namespace Game.Entities target.SendPacket(data); } + /// + /// Clears boss emotes frame + /// + /// Only clears emotes for players in that zone id + /// Only clears emotes for that player + public void ClearBossEmotes(uint? zoneId, Player target) + { + ClearBossEmotes clearBossEmotes = new(); + + if (target != null) + { + target.SendPacket(clearBossEmotes); + return; + } + + foreach (var player in GetMap().GetPlayers()) + if (!zoneId.HasValue || Global.DB2Mgr.IsInArea(player.GetAreaId(), zoneId.Value)) + player.SendPacket(clearBossEmotes); + } + public override void UpdateObjectVisibility(bool forced = true) { if (!forced) diff --git a/Source/Game/Networking/Packets/ChatPackets.cs b/Source/Game/Networking/Packets/ChatPackets.cs index c7337e3fe..8dc1bff05 100644 --- a/Source/Game/Networking/Packets/ChatPackets.cs +++ b/Source/Game/Networking/Packets/ChatPackets.cs @@ -334,6 +334,13 @@ namespace Game.Networking.Packets public int EmoteID; } + class ClearBossEmotes : ServerPacket + { + public ClearBossEmotes() : base(ServerOpcodes.ClearBossEmotes) { } + + public override void Write() { } + } + public class PrintNotification : ServerPacket { public PrintNotification(string notifyText) : base(ServerOpcodes.PrintNotification)