diff options
| author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-08-15 15:29:43 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-01-26 21:46:51 +0100 |
| commit | 2e3c612c808bca7601b32ce5dca28b204e652773 (patch) | |
| tree | 61f88efa0f2bc5781183ad5c8989b508f46b634c /src/server/scripts/Events | |
| parent | 595e89e02bec7300b3dd42afc5899a64f79aecba (diff) | |
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 6c7837f947ff4eb5110a116a371daa6f9e2b3bbe)
Diffstat (limited to 'src/server/scripts/Events')
| -rw-r--r-- | src/server/scripts/Events/childrens_week.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index d5f0f10383d..ab619a98e1a 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -1046,26 +1046,15 @@ class npc_cw_area_trigger : public CreatureScript if (player->GetQuestStatus(QUEST_NOW_WHEN_I_GROW_UP) == QUEST_STATUS_COMPLETE) if (Creature* samuro = me->FindNearestCreature(25151, 20.0f)) { - uint32 emote = 0; - switch (urand(1, 5)) - { - case 1: - emote = EMOTE_ONESHOT_WAVE; - break; - case 2: - emote = EMOTE_ONESHOT_ROAR; - break; - case 3: - emote = EMOTE_ONESHOT_FLEX; - break; - case 4: - emote = EMOTE_ONESHOT_SALUTE; - break; - case 5: - emote = EMOTE_ONESHOT_DANCE; - break; - } - samuro->HandleEmoteCommand(emote); + Emote const emotes[] = + { + EMOTE_ONESHOT_WAVE, + EMOTE_ONESHOT_ROAR, + EMOTE_ONESHOT_FLEX, + EMOTE_ONESHOT_SALUTE, + EMOTE_ONESHOT_DANCE + }; + samuro->HandleEmoteCommand(Trinity::Containers::SelectRandomContainerElement(emotes)); } } break; |
