Core/Unit: Make HandleEmoteCommand typesafe (#25249)

* Scripts/ScarletMonastery: Fix wrong emote during Headless Horseman encounter

* Scripts/HoR: Fix wrong emote during escape event

* Core/Unit: Make improve type safety of HandleEmoteCommand

Change argument type to the expected enum type Emote

* Scripts/CoS: Use SetUInt32Value to set UNIT_NPC_EMOTESTATE

UNIT_NPC_EMOTESTATE is no flag field

(cherry picked from commit 6c7837f947)
This commit is contained in:
Peter Keresztes Schmidt
2020-08-15 15:29:43 +02:00
committed by Shauren
parent 595e89e02b
commit 2e3c612c80
19 changed files with 48 additions and 72 deletions

View File

@@ -663,9 +663,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPackets::Chat::CTextEmote& packet)
if (!em)
return;
uint32 emoteAnim = em->EmoteID;
Emote emote = static_cast<Emote>(em->EmoteID);
switch (emoteAnim)
switch (emote)
{
case EMOTE_STATE_SLEEP:
case EMOTE_STATE_SIT:
@@ -674,13 +674,13 @@ void WorldSession::HandleTextEmoteOpcode(WorldPackets::Chat::CTextEmote& packet)
break;
case EMOTE_STATE_DANCE:
case EMOTE_STATE_READ:
_player->SetEmoteState(Emote(emoteAnim));
_player->SetEmoteState(emote);
break;
default:
// Only allow text-emotes for "dead" entities (feign death included)
if (_player->HasUnitState(UNIT_STATE_DIED))
break;
_player->HandleEmoteCommand(emoteAnim, nullptr, { packet.SpellVisualKitIDs.data(), packet.SpellVisualKitIDs.data() + packet.SpellVisualKitIDs.size() });
_player->HandleEmoteCommand(emote, nullptr, { packet.SpellVisualKitIDs.data(), packet.SpellVisualKitIDs.data() + packet.SpellVisualKitIDs.size() });
break;
}
@@ -701,7 +701,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPackets::Chat::CTextEmote& packet)
if (Creature* creature = unit->ToCreature())
creature->AI()->ReceiveEmote(_player, packet.EmoteID);
if (emoteAnim != EMOTE_ONESHOT_NONE)
if (emote != EMOTE_ONESHOT_NONE)
_player->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Anim);
}