Core/Units: Added helper function to clear boss emote frame and enable SMSG_CLEAR_BOSS_EMOTES

This commit is contained in:
Shauren
2024-02-27 16:13:23 +01:00
parent 9463933eda
commit deb24f3f53
4 changed files with 32 additions and 1 deletions

View File

@@ -13581,6 +13581,22 @@ void Unit::Whisper(uint32 textId, Player* target, bool isBossWhisper /*= false*/
target->SendDirectMessage(packet.Write());
}
void Unit::ClearBossEmotes(Optional<uint32> zoneId, Player const* target) const
{
WorldPackets::Chat::ClearBossEmotes clearBossEmotes;
clearBossEmotes.Write();
if (target)
{
target->SendDirectMessage(clearBossEmotes.GetRawPacket());
return;
}
for (MapReference const& ref : GetMap()->GetPlayers())
if (!zoneId || DB2Manager::IsInArea(ref.GetSource()->GetAreaId(), *zoneId))
ref.GetSource()->SendDirectMessage(clearBossEmotes.GetRawPacket());
}
SpellInfo const* Unit::GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const
{
auto findMatchingAuraEffectIn = [this, spellInfo, &triggerFlag](AuraType type) -> SpellInfo const*

View File

@@ -1767,6 +1767,13 @@ class TC_GAME_API Unit : public WorldObject
virtual void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false);
virtual void Whisper(uint32 textId, Player* target, bool isBossWhisper = false);
/**
@brief Clears boss emotes frame
@param zoneId Only clears emotes for players in that zone id
@param target Only clears emotes for that player
*/
void ClearBossEmotes(Optional<uint32> zoneId = {}, Player const* target = nullptr) const;
float GetCollisionHeight() const override;
uint32 GetVirtualItemId(uint32 slot) const;
uint16 GetVirtualItemAppearanceMod(uint32 slot) const;

View File

@@ -223,6 +223,14 @@ namespace WorldPackets
int32 EmoteID = 0;
};
class ClearBossEmotes final : public ServerPacket
{
public:
ClearBossEmotes() : ServerPacket(SMSG_CLEAR_BOSS_EMOTES, 0) { }
WorldPacket const* Write() override { return &_worldPacket; }
};
class TC_GAME_API PrintNotification final : public ServerPacket
{
public:

View File

@@ -1219,7 +1219,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHROMIE_TIME_SELECT_EXPANSION_SUCCESS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLAIM_RAF_REWARD_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_ALL_SPELL_CHARGES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_BOSS_EMOTES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_BOSS_EMOTES, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWN, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWNS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_RESURRECT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);