aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorSnapperRy <snapperryen@gmail.com>2016-07-05 15:19:30 +0200
committerGitHub <noreply@github.com>2016-07-05 15:19:30 +0200
commit03b15d968b56b7855693e47e79a320cf9990d73c (patch)
treeb4b7ed26c6b1a106b13e52550f4fef3e7fbfe7a6 /src/server/scripts
parent42028a18421f672a3292733cac73840c4e766089 (diff)
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.
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp4
-rw-r--r--src/server/scripts/World/go_scripts.cpp24
-rw-r--r--src/server/scripts/World/npcs_special.cpp110
3 files changed, 137 insertions, 1 deletions
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
@@ -580,6 +580,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<Player*> players;
+ Trinity::UnitAuraCheck check(true, SPELL_RIBBON_DANCE_COSMETIC);
+ Trinity::PlayerListSearcher<Trinity::UnitAuraCheck> 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();