aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGacko <gacko28@gmx.de>2012-09-22 02:26:55 +0100
committerNay <dnpd.dd@gmail.com>2012-09-22 02:26:55 +0100
commite9a2b3f10e8f6108f1137be7357a44e9a1cff455 (patch)
tree914af9171162eb11901091be29f75dd99ec2c7af /src
parentce6785d9db569b31cb88e5d3e65077ffbced40e8 (diff)
Scripts/Sm: Fix quest I was a lot of things
(Modified - Nayd) Closes #6295 Closes #7577
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp2
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp91
2 files changed, 92 insertions, 1 deletions
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index e68e28be99b..76237fe1890 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -160,7 +160,7 @@ public:
_emeraldVoid = false;
if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true))
_amberVoid = false;
- }
+ }
uint32 GetData(uint32 type)
{
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 078f8f5a4f0..c84df2ee3d4 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -1899,6 +1899,96 @@ class spell_unlocking_zuluheds_chains : public SpellScriptLoader
}
};
+enum ShadowMoonTuberEnum
+{
+ SPELL_WHISTLE = 36652,
+ SPELL_SHADOWMOON_TUBER = 36462,
+
+ NPC_BOAR_ENTRY = 21195,
+ GO_SHADOWMOON_TUBER_MOUND = 184701,
+
+ POINT_TUBER = 1,
+ TYPE_BOAR = 1,
+ DATA_BOAR = 1
+};
+
+class npc_shadowmoon_tuber_node : public CreatureScript
+{
+public:
+ npc_shadowmoon_tuber_node() : CreatureScript("npc_shadowmoon_tuber_node") {}
+
+ struct npc_shadowmoon_tuber_nodeAI : public ScriptedAI
+ {
+ npc_shadowmoon_tuber_nodeAI(Creature* creature) : ScriptedAI(creature) {}
+
+ void Reset()
+ {
+ tapped = false;
+ tuberGUID = 0;
+ resetTimer = 60000;
+ }
+
+ void SetData(uint32 id, uint32 data)
+ {
+ if (id == TYPE_BOAR && data == DATA_BOAR)
+ {
+ // Spawn chest GO
+ DoCast(SPELL_SHADOWMOON_TUBER);
+
+ // Despawn the tuber
+ if (GameObject* tuber = me->FindNearestGameObject(GO_SHADOWMOON_TUBER_MOUND, 5.0f))
+ {
+ tuberGUID = tuber->GetGUID();
+ // @Workaround: find how to properly despawn the GO
+ tuber->SetPhaseMask(2, true);
+ }
+ }
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
+ {
+ if (!tapped && spell->Id == SPELL_WHISTLE)
+ {
+ if (Creature* boar = me->FindNearestCreature(NPC_BOAR_ENTRY, 30.0f))
+ {
+ // Disable trigger and force nearest boar to walk to him
+ tapped = true;
+ boar->SetWalk(false);
+ boar->GetMotionMaster()->MovePoint(POINT_TUBER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (tapped)
+ {
+ if (resetTimer <= diff)
+ {
+ // Respawn the tuber
+ if (tuberGUID)
+ if (GameObject* tuber = GameObject::GetGameObject(*me, tuberGUID))
+ // @Workaround: find how to properly respawn the GO
+ tuber->SetPhaseMask(1, true);
+
+ Reset();
+ }
+ else
+ resetTimer -= diff;
+ }
+ }
+ private:
+ bool tapped;
+ uint64 tuberGUID;
+ uint32 resetTimer;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_shadowmoon_tuber_nodeAI(creature);
+ }
+};
+
void AddSC_shadowmoon_valley()
{
new mob_mature_netherwing_drake();
@@ -1917,4 +2007,5 @@ void AddSC_shadowmoon_valley()
new mob_torloth_the_magnificent();
new npc_enraged_spirit();
new spell_unlocking_zuluheds_chains();
+ new npc_shadowmoon_tuber_node();
}