From 03b15d968b56b7855693e47e79a320cf9990d73c Mon Sep 17 00:00:00 2001 From: SnapperRy Date: Tue, 5 Jul 2016 15:19:30 +0200 Subject: Event/Midsummer: improve pole ribbon functionality (#17464) Event/Midsummer: improve pole ribbon functionality: - Bunny creature should hover, which puts it in the intended position. - Use correct visual and internal spells to handle cosmetics and timers. --- src/server/game/Spells/SpellMgr.cpp | 7 ++ src/server/scripts/Spells/spell_holiday.cpp | 4 +- src/server/scripts/World/go_scripts.cpp | 24 ++++++ src/server/scripts/World/npcs_special.cpp | 110 ++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3526e7f1467..6eb75773770 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3349,6 +3349,13 @@ void SpellMgr::LoadSpellInfoCorrections() case 42492: // Cast Energized spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; break; + case 46842: // Flame Ring + case 46836: // Flame Patch + spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(); + break; + case 29726: // Test Ribbon Pole Channel + spellInfo->InterruptFlags &= ~AURA_INTERRUPT_FLAG_CAST; + break; // VIOLET HOLD SPELLS // case 54258: // Water Globule (Ichoron) diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 73347ff1163..52491bdf2f5 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -1187,6 +1187,7 @@ enum RibbonPoleData { SPELL_HAS_FULL_MIDSUMMER_SET = 58933, SPELL_BURNING_HOT_POLE_DANCE = 58934, + SPELL_RIBBON_DANCE_COSMETIC = 29726, SPELL_RIBBON_DANCE = 29175, GO_RIBBON_POLE = 181605, }; @@ -1214,10 +1215,11 @@ class spell_gen_ribbon_pole_dancer_check : public SpellScriptLoader Unit* target = GetTarget(); // check if aura needs to be removed - if (!target->FindNearestGameObject(GO_RIBBON_POLE, 20.0f) || !target->HasUnitState(UNIT_STATE_CASTING)) + if (!target->FindNearestGameObject(GO_RIBBON_POLE, 8.0f) || !target->HasUnitState(UNIT_STATE_CASTING)) { target->InterruptNonMeleeSpells(false); target->RemoveAurasDueToSpell(GetId()); + target->RemoveAura(SPELL_RIBBON_DANCE_COSMETIC); return; } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 8f2ea5887d2..3db4f41706d 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1197,6 +1197,29 @@ public: } }; +enum MidsummerPoleRibbon +{ + SPELL_POLE_DANCE = 29726, + SPELL_BLUE_FIRE_RING = 46842, + NPC_POLE_RIBBON_BUNNY = 17066, + ACTION_COSMETIC_FIRES = 0 +}; + +class go_midsummer_ribbon_pole : public GameObjectScript +{ +public: + go_midsummer_ribbon_pole() : GameObjectScript("go_midsummer_ribbon_pole") { } + + bool OnGossipHello(Player* player, GameObject* go) override + { + if (Creature* creature = go->FindNearestCreature(NPC_POLE_RIBBON_BUNNY, 10.0f)) + { + creature->GetAI()->DoAction(ACTION_COSMETIC_FIRES); + player->CastSpell(creature, SPELL_POLE_DANCE, true); + } + return true; + } +}; enum ToyTrainSpells { @@ -1274,5 +1297,6 @@ void AddSC_go_scripts() new go_veil_skith_cage(); new go_frostblade_shrine(); new go_midsummer_bonfire(); + new go_midsummer_ribbon_pole(); new go_toy_train_set(); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index da753568ee0..fc29c36c030 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -579,6 +579,115 @@ public: } }; +/*###### +## npc_midsummer_bunny_pole +######*/ + +enum RibbonPoleData +{ + GO_RIBBON_POLE = 181605, + SPELL_RIBBON_DANCE_COSMETIC = 29726, + SPELL_RED_FIRE_RING = 46836, + SPELL_BLUE_FIRE_RING = 46842, + EVENT_CAST_RED_FIRE_RING = 1, + EVENT_CAST_BLUE_FIRE_RING = 2 +}; + +class npc_midsummer_bunny_pole : public CreatureScript +{ +public: + npc_midsummer_bunny_pole() : CreatureScript("npc_midsummer_bunny_pole") { } + + struct npc_midsummer_bunny_poleAI : public ScriptedAI + { + npc_midsummer_bunny_poleAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + events.Reset(); + running = false; + } + + void Reset() override + { + Initialize(); + } + + void DoAction(int32 /*action*/) override + { + // Don't start event if it's already running. + if (running) + return; + + running = true; + events.ScheduleEvent(EVENT_CAST_RED_FIRE_RING, 1); + } + + bool checkNearbyPlayers() + { + // Returns true if no nearby player has aura "Test Ribbon Pole Channel". + std::list players; + Trinity::UnitAuraCheck check(true, SPELL_RIBBON_DANCE_COSMETIC); + Trinity::PlayerListSearcher searcher(me, players, check); + me->VisitNearbyWorldObject(10.0f, searcher); + + return players.empty(); + } + + void UpdateAI(uint32 diff) override + { + if (!running) + return; + + events.Update(diff); + + switch (events.ExecuteEvent()) + { + case EVENT_CAST_RED_FIRE_RING: + { + if (checkNearbyPlayers()) + { + Reset(); + return; + } + + if (GameObject* go = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f)) + me->CastSpell(go, SPELL_RED_FIRE_RING, true); + + events.ScheduleEvent(EVENT_CAST_BLUE_FIRE_RING, Seconds(5)); + } + break; + case EVENT_CAST_BLUE_FIRE_RING: + { + if (checkNearbyPlayers()) + { + Reset(); + return; + } + + if (GameObject* go = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f)) + me->CastSpell(go, SPELL_BLUE_FIRE_RING, true); + + events.ScheduleEvent(EVENT_CAST_RED_FIRE_RING, Seconds(5)); + } + break; + } + } + + private: + EventMap events; + bool running; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_midsummer_bunny_poleAI(creature); + } +}; + /*###### ## Triage quest ######*/ @@ -2447,6 +2556,7 @@ void AddSC_npcs_special() new npc_chicken_cluck(); new npc_dancing_flames(); new npc_torch_tossing_target_bunny_controller(); + new npc_midsummer_bunny_pole(); new npc_doctor(); new npc_injured_patient(); new npc_garments_of_quests(); -- cgit v1.2.3