diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 130 |
1 files changed, 57 insertions, 73 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 2458f9f171d..37b7b382499 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -302,95 +302,79 @@ public: enum DancingFlames { - SPELL_BRAZIER = 45423, - SPELL_SEDUCTION = 47057, - SPELL_FIERY_AURA = 45427 + SPELL_SUMMON_BRAZIER = 45423, + SPELL_BRAZIER_DANCE = 45427, + SPELL_FIERY_SEDUCTION = 47057 }; -class npc_dancing_flames : public CreatureScript +struct npc_dancing_flames : public ScriptedAI { -public: - npc_dancing_flames() : CreatureScript("npc_dancing_flames") { } + npc_dancing_flames(Creature* creature) : ScriptedAI(creature) { } - struct npc_dancing_flamesAI : public ScriptedAI + void Reset() override { - npc_dancing_flamesAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - Active = true; - CanIteract = 3500; - } - - bool Active; - uint32 CanIteract; + DoCastSelf(SPELL_SUMMON_BRAZIER, true); + DoCastSelf(SPELL_BRAZIER_DANCE, false); + me->SetEmoteState(EMOTE_STATE_DANCE); + float x, y, z; + me->GetPosition(x, y, z); + me->Relocate(x, y, z + 1.05f); + } - void Reset() override - { - Initialize(); - DoCast(me, SPELL_BRAZIER, true); - DoCast(me, SPELL_FIERY_AURA, false); - float x, y, z; - me->GetPosition(x, y, z); - me->Relocate(x, y, z + 0.94f); - me->SetDisableGravity(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - } + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } - void UpdateAI(uint32 diff) override + void ReceiveEmote(Player* player, uint32 emote) override + { + if (me->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()) && me->IsWithinDistInMap(player, 30.0f)) { - if (!Active) - { - if (CanIteract <= diff) - { - Active = true; - CanIteract = 3500; - me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - } - else - CanIteract -= diff; - } - } + // She responds to emotes not instantly but ~1500ms later + // If you first /bow, then /wave before dancing flames bow back, it doesnt bow at all and only does wave + // If you're performing emotes too fast, she will not respond to them + // Means she just replaces currently scheduled event with new after receiving new emote + _scheduler.CancelAll(); - void JustEngagedWith(Unit* /*who*/) override { } - - void ReceiveEmote(Player* player, uint32 emote) override - { - if (me->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()) && me->IsWithinDistInMap(player, 30.0f)) + switch (emote) { - me->SetFacingToObject(player); - Active = false; - - switch (emote) - { - case TEXT_EMOTE_KISS: + case TEXT_EMOTE_KISS: + _scheduler.Schedule(1500ms, [this](TaskContext /*context*/) + { me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); - break; - case TEXT_EMOTE_WAVE: + }); + break; + case TEXT_EMOTE_WAVE: + _scheduler.Schedule(1500ms, [this](TaskContext /*context*/) + { me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - break; - case TEXT_EMOTE_BOW: + }); + break; + case TEXT_EMOTE_BOW: + _scheduler.Schedule(1500ms, [this](TaskContext /*context*/) + { me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); - break; - case TEXT_EMOTE_JOKE: + }); + break; + case TEXT_EMOTE_JOKE: + _scheduler.Schedule(1500ms, [this](TaskContext /*context*/) + { me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - break; - case TEXT_EMOTE_DANCE: - if (!player->HasAura(SPELL_SEDUCTION)) - DoCast(player, SPELL_SEDUCTION, true); - break; - } + }); + break; + case TEXT_EMOTE_DANCE: + if (!player->HasAura(SPELL_FIERY_SEDUCTION)) + { + DoCast(player, SPELL_FIERY_SEDUCTION, true); + me->SetFacingTo(me->GetAbsoluteAngle(player)); + } + break; } } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_dancing_flamesAI(creature); } + +private: + TaskScheduler _scheduler; }; /*###### @@ -2509,7 +2493,7 @@ void AddSC_npcs_special() { new npc_air_force_bots(); new npc_chicken_cluck(); - new npc_dancing_flames(); + RegisterCreatureAI(npc_dancing_flames); new npc_torch_tossing_target_bunny_controller(); new npc_midsummer_bunny_pole(); new npc_doctor(); |