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
@@ -321,7 +321,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsUnit(target))
{
target->ToUnit()->HandleEmoteCommand(e.action.emote.emote);
target->ToUnit()->HandleEmoteCommand(static_cast<Emote>(e.action.emote.emote));
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s %s, emote: %u",
target->GetName().c_str(), target->GetGUID().ToString().c_str(), e.action.emote.emote);
}
@@ -475,7 +475,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsUnit(target))
{
uint32 emote = Trinity::Containers::SelectRandomContainerElement(emotes);
Emote emote = static_cast<Emote>(Trinity::Containers::SelectRandomContainerElement(emotes));
target->ToUnit()->HandleEmoteCommand(emote);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature %s handle random emote %u",
target->GetGUID().ToString().c_str(), emote);