aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/CMakeLists.txt6
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp10
-rw-r--r--src/bindings/scripts/VC71/71ScriptDev2.vcproj25
-rw-r--r--src/bindings/scripts/VC80/80ScriptDev2.vcproj25
-rw-r--r--src/bindings/scripts/VC90/90ScriptDev2.vcproj25
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp295
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp270
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp196
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp191
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h2
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp23
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp767
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h103
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp1507
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h37
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp102
17 files changed, 3483 insertions, 104 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt
index 39d7a556fa7..efee966da48 100644
--- a/src/bindings/scripts/CMakeLists.txt
+++ b/src/bindings/scripts/CMakeLists.txt
@@ -113,9 +113,15 @@ SET(trinityscript_LIB_SRCS
scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp
scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp
scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
scripts/zone/caverns_of_time/hyjal/def_hyjal.h
scripts/zone/caverns_of_time/hyjal/hyjal.cpp
+ scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
+ scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
scripts/zone/caverns_of_time/hyjal/hyjalAI.h
scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index 156358eddd9..b176c763f1f 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -219,6 +219,11 @@ extern void AddSC_burning_steppes();
extern void AddSC_hyjal();
extern void AddSC_boss_archimonde();
extern void AddSC_instance_mount_hyjal();
+extern void AddSC_hyjal_trash();
+extern void AddSC_boss_rage_winterchill();
+extern void AddSC_boss_anetheron();
+extern void AddSC_boss_kazrogal();
+extern void AddSC_boss_azgalor();
//--Old Hillsbrad
extern void AddSC_boss_captain_skarloc();
@@ -1533,6 +1538,11 @@ void ScriptsInit()
AddSC_hyjal();
AddSC_boss_archimonde();
AddSC_instance_mount_hyjal();
+ AddSC_hyjal_trash();
+ AddSC_boss_rage_winterchill();
+ AddSC_boss_anetheron();
+ AddSC_boss_kazrogal();
+ AddSC_boss_azgalor();
//--Old Hillsbrad
AddSC_boss_captain_skarloc();
diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj
index a309f585589..57ee9dad9f3 100644
--- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj
@@ -1884,10 +1884,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -1896,6 +1912,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -1908,6 +1932,7 @@
>
</File>
</Filter>
+
<Filter
Name="Old Hillsbrad"
>
diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
index e4e20bbb129..a2fcfb26af0 100644
--- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
@@ -2061,10 +2061,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -2073,6 +2089,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -2085,6 +2109,7 @@
>
</File>
</Filter>
+
<Filter
Name="Old Hillsbrad"
>
diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
index e6d36179274..8e8c9b58ca4 100644
--- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
@@ -2054,10 +2054,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -2066,6 +2082,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -2078,6 +2102,7 @@
>
</File>
</Filter>
+
<Filter
Name="Old Hillsbrad"
>
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
new file mode 100644
index 00000000000..5fb5577960b
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
@@ -0,0 +1,295 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_CARRION_SWARM 31306
+#define SPELL_SLEEP 31298
+#define SPELL_VAMPIRIC_AURA 38196
+#define SPELL_INFERNO 31299
+
+#define SAY_ONDEATH "The clock... is still... ticking."
+#define SOUND_ONDEATH 10982
+
+#define SAY_ONSLAY1 "Your hopes are lost!"
+#define SAY_ONSLAY2 "Scream for me!"
+#define SAY_ONSLAY3 "Pity, no time for a slow death!"
+#define SOUND_ONSLAY1 10981
+#define SOUND_ONSLAY2 11038
+#define SOUND_ONSLAY3 11039
+
+#define SAY_SWARM1 "The swarm is eager to feed!"
+#define SAY_SWARM2 "Pestilence upon you!"
+#define SOUND_SWARM1 10979
+#define SOUND_SWARM2 11037
+
+#define SAY_SLEEP1 "You look tired..."
+#define SAY_SLEEP2 "Sweet dreams..."
+#define SOUND_SLEEP1 10978
+#define SOUND_SLEEP2 11545
+
+#define SAY_INFERNO1 "Let fire rain from above!"
+#define SAY_INFERNO2 "Earth and sky shall burn!"
+#define SOUND_INFERNO1 10980
+#define SOUND_INFERNO2 11036
+
+#define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!"
+#define SOUND_ONAGGRO 10977
+
+struct TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI
+{
+ boss_anetheronAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SLEEP);
+ if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
+ {
+ TempSpell->EffectImplicitTargetA[0] = 1;
+ TempSpell->EffectImplicitTargetB[0] = 0;
+ }
+ }
+
+ uint32 SwarmTimer;
+ uint32 SleepTimer;
+ uint32 AuraTimer;
+ uint32 InfernoTimer;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ SwarmTimer = 45000;
+ SleepTimer = 60000;
+ AuraTimer = 5000;
+ InfernoTimer = 45000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ DoYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 4896.08, -1576.35, 1333.65);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 4898.68, -1615.02, 1329.48);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 4907.12, -1667.08, 1321.00);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 4963.18, -1699.35, 1340.51);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 4989.16, -1716.67, 1335.74);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5026.27, -1736.89, 1323.02);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5037.77, -1770.56, 1324.36);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5067.23, -1789.95, 1321.17);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(SwarmTimer < diff)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,100,true);
+ if(target)
+ DoCast(target,SPELL_CARRION_SWARM);
+
+ SwarmTimer = 45000+rand()%15000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_SWARM1);
+ DoYell(SAY_SWARM1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_SWARM2);
+ DoYell(SAY_SWARM2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else SwarmTimer -= diff;
+
+ if(SleepTimer < diff)
+ {
+ for(uint8 i=0;i<3;++i)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,100,true);
+ if(target)
+ target->CastSpell(target,SPELL_SLEEP,true);
+ }
+ SleepTimer = 60000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_SLEEP1);
+ DoYell(SAY_SLEEP1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_SLEEP2);
+ DoYell(SAY_SLEEP2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else SleepTimer -= diff;
+ if(AuraTimer < diff)
+ {
+ DoCast(m_creature, SPELL_VAMPIRIC_AURA,true);
+ AuraTimer = 10000+rand()%10000;
+ }else AuraTimer -= diff;
+ if(InfernoTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,100,true), SPELL_INFERNO);
+ InfernoTimer = 45000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_INFERNO1);
+ DoYell(SAY_INFERNO1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_INFERNO2);
+ DoYell(SAY_INFERNO2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else InfernoTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_anetheron(Creature *_Creature)
+{
+ return new boss_anetheronAI (_Creature);
+}
+
+#define SPELL_IMMOLATION 31303
+#define SPELL_INFERNO_EFFECT 31302
+
+struct TRINITY_DLL_DECL mob_towering_infernalAI : public ScriptedAI
+{
+ mob_towering_infernalAI(Creature *c) : ScriptedAI(c)
+ {
+ Reset();
+ }
+
+ uint32 ImmolationTimer;
+
+ void Reset()
+ {
+ DoCast(m_creature, SPELL_INFERNO_EFFECT);
+ ImmolationTimer = 5000;
+ }
+
+ void Aggro(Unit *who)
+ {
+
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+
+ }
+
+ void JustDied(Unit *victim)
+ {
+
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (m_creature->GetDistance(who) <= 50 && !InCombat && m_creature->IsHostileTo(who))
+ {
+ m_creature->AddThreat(who,0.0);
+ m_creature->Attack(who,false);
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if (!UpdateVictim())
+ return;
+
+ if(ImmolationTimer < diff)
+ {
+ DoCast(m_creature, SPELL_IMMOLATION);
+ ImmolationTimer = 5000;
+ }else ImmolationTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_towering_infernal(Creature *_Creature)
+{
+ return new mob_towering_infernalAI (_Creature);
+}
+
+void AddSC_boss_anetheron()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_anetheron";
+ newscript->GetAI = &GetAI_boss_anetheron;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_towering_infernal";
+ newscript->GetAI = &GetAI_mob_towering_infernal;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
index c5378068e63..4095ef9ca23 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
@@ -368,6 +368,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
WispCount = 0; // When ~30 wisps are summoned, Archimonde dies
EnrageTimer = 600000; // 10 minutes
CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage
+ SummonWispTimer = 0;
Enraged = false;
BelowTenPercent = false;
@@ -663,7 +664,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
DoScriptText(SAY_AIR_BURST2, m_creature);
- DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AIR_BURST);
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank
AirBurstTimer = 25000 + rand()%15000;
}else AirBurstTimer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
new file mode 100644
index 00000000000..3228566c6e8
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
@@ -0,0 +1,270 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_RAIN_OF_FIRE 31340
+#define SPELL_DOOM 31347
+#define SPELL_HOWL_OF_AZGALOR 31344
+#define SPELL_CLEAVE 31345
+#define SPELL_BERSERK 26662
+
+#define SAY_ONDEATH "Your time is almost... up"
+#define SOUND_ONDEATH 11002
+
+#define SAY_ONSLAY1 "Reesh, hokta!"
+#define SAY_ONSLAY2 "Don't fight it"
+#define SAY_ONSLAY3 "No one is going to save you"
+#define SOUND_ONSLAY1 11001
+#define SOUND_ONSLAY2 11048
+#define SOUND_ONSLAY3 11047
+
+#define SAY_DOOM1 "Just a taste... of what awaits you"
+#define SAY_DOOM2 "Suffer you despicable insect!"
+#define SOUND_DOOM1 11046
+#define SOUND_DOOM2 11000
+
+#define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!"
+#define SOUND_ONAGGRO 10999
+
+struct TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI
+{
+ boss_azgalorAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_HOWL_OF_AZGALOR);
+ if(TempSpell)
+ TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?!
+ }
+
+ uint32 RainTimer;
+ uint32 DoomTimer;
+ uint32 HowlTimer;
+ uint32 CleaveTimer;
+ uint32 EnrageTimer;
+ bool enraged;
+
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ RainTimer = 20000;
+ DoomTimer = 50000;
+ HowlTimer = 30000;
+ CleaveTimer = 10000;
+ EnrageTimer = 600000;
+ enraged = false;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91, -2404.61, 1462.63);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76, -2460.87, 1469.55);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58, -2514.66, 1476.12);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16, -2567.23, 1479.90);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67, -2625.99, 1480.89);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16, -2659.2, 1480.15);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62, -2704.05, 1482.18);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04, -2726.26, 1485.10);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(RainTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE);
+ RainTimer = 20000+rand()%15000;
+ }else RainTimer -= diff;
+
+ if(DoomTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank
+ DoomTimer = 45000+rand()%5000;
+ }else DoomTimer -= diff;
+
+ if(HowlTimer < diff)
+ {
+ DoCast(m_creature, SPELL_HOWL_OF_AZGALOR);
+ HowlTimer = 30000;
+ }else HowlTimer -= diff;
+
+ if(CleaveTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_CLEAVE);
+ CleaveTimer = 10000+rand()%5000;
+ }else CleaveTimer -= diff;
+
+ if(EnrageTimer < diff && !enraged)
+ {
+ m_creature->InterruptNonMeleeSpells(false);
+ DoCast(m_creature, SPELL_BERSERK, true);
+ enraged = true;
+ EnrageTimer = 600000;
+ }else EnrageTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_azgalor(Creature *_Creature)
+{
+ return new boss_azgalorAI (_Creature);
+}
+
+#define SPELL_THRASH 12787
+#define SPELL_CRIPPLE 31406
+#define SPELL_WARSTOMP 31408
+
+struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI
+{
+ mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ Reset();
+ }
+
+ uint32 CrippleTimer;
+ uint32 WarstompTimer;
+
+ void Reset()
+ {
+ CrippleTimer = 50000;
+ WarstompTimer = 10000;
+ DoCast(m_creature, SPELL_THRASH);
+ }
+
+ void Aggro(Unit *who)
+ {
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+
+ }
+
+ void WaypointReached(uint32 i)
+ {
+
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (m_creature->GetDistance(who) <= 50 && !InCombat && m_creature->IsHostileTo(who))
+ {
+ m_creature->AddThreat(who,0.0);
+ m_creature->Attack(who,false);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(WarstompTimer < diff)
+ {
+ DoCast(m_creature, SPELL_WARSTOMP);
+ WarstompTimer = 10000+rand()%5000;
+ }else WarstompTimer -= diff;
+
+ if(CrippleTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,100,true), SPELL_CRIPPLE);
+ CrippleTimer = 25000+rand()%5000;
+ }else CrippleTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_lesser_doomguard(Creature *_Creature)
+{
+ return new mob_lesser_doomguardAI (_Creature);
+}
+
+void AddSC_boss_azgalor()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_azgalor";
+ newscript->GetAI = &GetAI_boss_azgalor;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_lesser_doomguard";
+ newscript->GetAI = &GetAI_mob_lesser_doomguard;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
new file mode 100644
index 00000000000..29674dac0ff
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
@@ -0,0 +1,196 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_CLEAVE 31436
+#define SPELL_WARSTOMP 31480
+#define SPELL_MARK 31447
+
+#define SOUND_ONDEATH 11018
+
+#define SAY_ONSLAY1 "Shaza-Kiel!"
+#define SAY_ONSLAY2 "You... are nothing!"
+#define SAY_ONSLAY3 "Miserable nuisance!"
+#define SOUND_ONSLAY1 11017
+#define SOUND_ONSLAY2 11053
+#define SOUND_ONSLAY3 11054
+
+#define SAY_MARK1 "Your death will be a painful one."
+#define SAY_MARK2 "You... are marked."
+#define SOUND_MARK1 11016
+#define SOUND_MARK2 11052
+
+#define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit."
+#define SOUND_ONAGGRO 11015
+
+struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI
+{
+ boss_kazrogalAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_MARK);
+ if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
+ {
+ TempSpell->EffectImplicitTargetA[0] = 1;
+ TempSpell->EffectImplicitTargetB[0] = 0;
+ }
+ }
+
+ uint32 CleaveTimer;
+ uint32 WarStompTimer;
+ uint32 MarkTimer;
+ uint32 MarkTimerBase;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ CleaveTimer = 5000;
+ WarStompTimer = 15000;
+ MarkTimer = 45000;
+ MarkTimerBase = 45000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91, -2404.61, 1462.63);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76, -2460.87, 1469.55);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58, -2514.66, 1476.12);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16, -2567.23, 1479.90);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67, -2625.99, 1480.89);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16, -2659.2, 1480.15);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62, -2704.05, 1482.18);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04, -2726.26, 1485.10);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(CleaveTimer < diff)
+ {
+ DoCast(m_creature, SPELL_CLEAVE);
+ CleaveTimer = 6000+rand()%15000;
+ }else CleaveTimer -= diff;
+
+ if(WarStompTimer < diff)
+ {
+ DoCast(m_creature, SPELL_WARSTOMP);
+ WarStompTimer = 60000;
+ }else WarStompTimer -= diff;
+
+ if(m_creature->HasAura(SPELL_MARK,0))
+ m_creature->RemoveAurasDueToSpell(SPELL_MARK);
+ if(MarkTimer < diff)
+ {
+ //cast dummy, useful for bos addons
+ m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID());
+
+ std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
+ for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ {
+ Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
+ if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA)
+ {
+ target->CastSpell(target, SPELL_MARK,true);//only cast on mana users
+ }
+ }
+ MarkTimerBase -= 5000;
+ if(MarkTimerBase < 5500)
+ MarkTimerBase = 5500;
+ MarkTimer = MarkTimerBase;
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_MARK1);
+ DoYell(SAY_MARK1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_MARK2);
+ DoYell(SAY_MARK2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else MarkTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_kazrogal(Creature *_Creature)
+{
+ return new boss_kazrogalAI (_Creature);
+}
+
+void AddSC_boss_kazrogal()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_kazrogal";
+ newscript->GetAI = &GetAI_boss_kazrogal;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
new file mode 100644
index 00000000000..1bc8823d3e6
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
@@ -0,0 +1,191 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_FROST_ARMOR 31256
+#define SPELL_DEATH_AND_DECAY 31258
+
+#define SPELL_FROST_NOVA 31250
+#define SPELL_ICEBOLT 31249
+
+#define SAY_ONDEATH "You have won this battle, but not... the... war"
+#define SOUND_ONDEATH 11026
+
+#define SAY_ONSLAY1 "All life must perish!"
+#define SAY_ONSLAY2 "Victory to the Legion!"
+#define SOUND_ONSLAY1 11025
+#define SOUND_ONSLAY2 11057
+
+#define SAY_DECAY1 "Crumble and rot!"
+#define SAY_DECAY2 "Ashes to ashes, dust to dust"
+#define SOUND_DECAY1 11023
+#define SOUND_DECAY2 11055
+
+#define SAY_NOVA1 "Succumb to the icy chill... of death!"
+#define SAY_NOVA2 "It will be much colder in your grave"
+#define SOUND_NOVA1 11024
+#define SOUND_NOVA2 11058
+
+#define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!"
+#define SOUND_ONAGGRO 11022
+
+struct TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI
+{
+ boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ uint32 FrostArmorTimer;
+ uint32 DecayTimer;
+ uint32 NovaTimer;
+ uint32 IceboltTimer;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ FrostArmorTimer = 37000;
+ DecayTimer = 45000;
+ NovaTimer = 15000;
+ IceboltTimer = 10000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ DoYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 4896.08, -1576.35, 1333.65);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 4898.68, -1615.02, 1329.48);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 4907.12, -1667.08, 1321.00);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 4963.18, -1699.35, 1340.51);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 4989.16, -1716.67, 1335.74);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5026.27, -1736.89, 1323.02);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5037.77, -1770.56, 1324.36);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5067.23, -1789.95, 1321.17);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(FrostArmorTimer < diff)
+ {
+ DoCast(m_creature, SPELL_FROST_ARMOR);
+ FrostArmorTimer = 40000+rand()%20000;
+ }else FrostArmorTimer -= diff;
+ if(DecayTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_DEATH_AND_DECAY);
+ DecayTimer = 60000+rand()%20000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_DECAY1);
+ DoYell(SAY_DECAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_DECAY2);
+ DoYell(SAY_DECAY2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else DecayTimer -= diff;
+ if(NovaTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_FROST_NOVA);
+ NovaTimer = 30000+rand()%15000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_NOVA1);
+ DoYell(SAY_NOVA1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_NOVA2);
+ DoYell(SAY_NOVA2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else NovaTimer -= diff;
+ if(IceboltTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT);
+ IceboltTimer = 11000+rand()%20000;
+ }else IceboltTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_rage_winterchill(Creature *_Creature)
+{
+ return new boss_rage_winterchillAI (_Creature);
+}
+
+void AddSC_boss_rage_winterchill()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_rage_winterchill";
+ newscript->GetAI = &GetAI_boss_rage_winterchill;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
index 757ce2ce2cb..f6a77174e5d 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
@@ -24,6 +24,8 @@
#define DATA_TYRANDEWHISPERWIND 13
#define DATA_TRASH 14
#define DATA_RESET_TRASH_COUNT 15
+#define DATA_ALLIANCE_RETREAT 16
+#define DATA_HORDE_RETREAT 17
#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy"
#endif
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
index 16628cce685..9664fe6bf5f 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
@@ -89,6 +89,11 @@ bool GossipHello_npc_jaina_proudmoore(Player *player, Creature *_Creature)
bool GossipSelect_npc_jaina_proudmoore(Player *player, Creature *_Creature, uint32 sender, uint32 action)
{
+ if(_Creature->GetMap()->GetPlayersCountExceptGMs() < MINPLAYERS && !player->isGameMaster())
+ {
+ _Creature->Say("Did you come to die with me?",0,0);
+ return true;
+ }
hyjalAI* ai = ((hyjalAI*)_Creature->AI());
switch(action)
{
@@ -120,7 +125,7 @@ CreatureAI* GetAI_npc_thrall(Creature *_Creature)
ai->EnterEvadeMode();
ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING;
- ai->Spell[0].Cooldown = 2000 + rand()%5000;
+ ai->Spell[0].Cooldown = 3000 + rand()%5000;
ai->Spell[0].TargetType = TARGETTYPE_VICTIM;
ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
@@ -140,7 +145,7 @@ bool GossipHello_npc_thrall(Player *player, Creature *_Creature)
uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT);
// Only let them start the Horde phases if Anetheron is dead.
- if (AnetheronEvent == DONE)
+ if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT))
{
uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT);
uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
@@ -162,7 +167,13 @@ bool GossipHello_npc_thrall(Player *player, Creature *_Creature)
bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, uint32 action)
{
+ if(_Creature->GetMap()->GetPlayersCountExceptGMs() < MINPLAYERS && !player->isGameMaster())//to stop idiot farmers
+ {
+ _Creature->Say("Did you come to die with me?",0,0);
+ return true;
+ }
hyjalAI* ai = ((hyjalAI*)_Creature->AI());
+ ai->DeSpawnVeins();//despawn the alliance veins
switch(action)
{
case GOSSIP_ACTION_INFO_DEF + 1:
@@ -197,6 +208,7 @@ CreatureAI* GetAI_npc_tyrande_whisperwind(Creature *_Creature)
bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature)
{
hyjalAI* ai = ((hyjalAI*)_Creature->AI());
+ //ai->DeSpawnVeins();//dont despawn the horde veins if someone takes the item from Tyrande
uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
// Only let them get item if Azgalor is dead.
@@ -208,15 +220,18 @@ bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature)
bool GossipSelect_npc_tyrande_whisperwind(Player *player, Creature *_Creature, uint32 sender, uint32 action)
{
- if (action == GOSSIP_ACTION_INFO_DEF)
+ if (action == GOSSIP_ACTION_INFO_DEF)
{
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
{
- player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
+ Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
+ if(item && player)
+ player->SendNewItem(item,1,true,false,true);
}
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
+ hyjalAI* ai = ((hyjalAI*)_Creature->AI());
}
return true;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
index 111167b6e56..c3b23b69080 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
@@ -23,39 +23,298 @@ EndScriptData */
#include "precompiled.h"
#include "hyjalAI.h"
+#include "hyjal_trash.h"
+#include "MapManager.h"
+#include "Language.h"
+#include "Chat.h"
+#include "Object.h"
+
+#define SPAWN_GARG_GATE 0
+#define SPAWN_WYRM_GATE 1
+#define SPAWN_NEAR_TOWER 2
+// Locations for summoning gargoyls and frost wyrms in special cases
+float SpawnPointSpecial[3][3]=
+{
+ {5497.08, -2493.23, 1535.72}, //spawn point for the gargoyles near the horde gate
+ {5624.53, -2548.12, 1551.54}, //spawn point for the frost wyrm near the horde gate
+ {5604.41, -2811.98, 1547.77} //spawn point for the gargoyles and wyrms near the horde tower
+};
// Locations for summoning waves in Alliance base
float AllianceBase[4][3]=
{
- {4979.010, -1709.134, 1339.674},
- {4969.123, -1705.904, 1341.363},
- {4970.260, -1698.546, 1341.200},
- {4975.262, -1698.239, 1341.427}
+ {4928.48, -1526.38, 1326.83},
+ {4923.54, -1514.29, 1327.98},
+ {4928.41, -1510.35, 1327.99},
+ {4938.35, -1521.00, 1326.69}
+};
+
+float JainaDummySpawn[2][4]=
+{
+ {5497.01, -2719.03, 1483.08, 2.90426},
+ {5484.98, -2721.69, 1483.39, 6.00656}
};
+
// Locations for summoning waves in Horde base
-float HordeBase[4][3]=
+float HordeBase[4][3]=
+{
+ {5458.01, -2340.27, 1459.60},
+ {5466.01, -2334.69, 1460.06},
+ {5468.45, -2355.13, 1459.99},
+ {5479.06, -2344.16, 1461.74}
+};
+
+// Lady Jaina's waypoints when retreathing
+float JainaWPs[2][3]=
+{
+ {5078.56, -1789.79, 1320.73},//next to the small stairs
+ {5037.38, -1778.39, 1322.61},//center of alliance base
+};
+
+float InfernalPos[8][3]=//spawn points for the infernals in the horde base
{
- {5554.399, -2581.419, 1480.820},
- {5538.996, -2577.742, 1479.790},
- {5565.642, -2565.666, 1481.635},
- {5547.218, -2574.589, 1479.194}
+ {5453.59, -2764.52, 1493.50},
+ {5478.4, -2781.77, 1497.52},
+ {5506.09, -2780.53, 1496.32},
+ {5532.1, -2763.42, 1492.37},
+ {5544.16, -2733.99, 1487.14},
+ {5536.19, -2708.18, 1480.01},
+ {5510.16, -2691.75, 1479.66},
+ {5482.39, -2689.19, 1481.09}
};
-// used to inform the wave where to move and attack to
-float AttackArea[2][3]=
+float InfernalSPWP[10][3]=//spawn points for the infernals in the horde base used in the cleaning wave
{
- {5042.9189, -1776.2562, 1323.0621}, // Alliance
- {5510.4815, -2676.7112, 1480.4314} // Horde
+ {5528.5, -2771.23, 1494.08},
+ {5471.41, -2711.17, 1483.97},
+ {5464.08, -2653.9, 1482.67},
+ {5550.84, -2633.8, 1484.08},
+ {5579.86, -2704.86, 1489.33},
+ {5589.67, -2655.5, 1490.15},
+ {5432.36, -2744.81, 1486.25},
+ {5463.14, -2857.41, 1512.45},
+ {5534.31, -2774.58, 1494.89},
+ {5524.36, -2735.52, 1484.16}
};
-hyjalAI::hyjalAI(Creature *c) : ScriptedAI(c)
+float VeinPos[14][8]=//spawn points of the ancient gem veins
+{
+ {5184.84, -1982.59, 1382.66, 2.58079, 0, 0, 0.960944, 0.276742}, //alliance
+ {5107.66, -2071.16, 1368.37, 2.65148, 0, 0, 0.970124, 0.242611}, //alliance
+ {5040.53, -2227.65, 1403.17, 3.35049, 0, 0, 0.99455, -0.104257}, //alliance
+ {5187.59, -2453.12, 1455.51, 5.87943, 0, 0, 0.20051, -0.979692}, //alliance
+ {5429.43, -2340.65, 1465.38, 4.7681, 0, 0, 0.687138, -0.726527}, //alliance
+ {5463.99, -2315.95, 1470.29, 1.52045, 0, 0, 0.689084, 0.724682}, //alliance
+ {5624.65, -2495.09, 1510.11, 0.0124869, 0, 0, 0.00624342, 0.999981}, //alliance
+ {5285.41, -3348.32, 1663.01, 1.57152, 0, 0, 0.707362, 0.706852}, //horde
+ {5417.69, -3372.52, 1656.31, 0.361993, 0, 0, 0.18001, 0.983665}, //horde
+ {5315.34, -3238.32, 1622.88, 3.03627, 0, 0, 0.998614, 0.0526347}, //horde
+ {5303.4, -3096.44, 1596.41, 1.72073, 0, 0, 0.758081, 0.65216}, //horde
+ {5265.13, -3177.27, 1616.22, 0.813604, 0, 0, 0.395674, 0.918391}, //horde
+ {5374.3, -3420.59, 1653.43, 1.45762, 0, 0, 0.665981, 0.745969}, //horde
+ {5441.54, -3321.59, 1651.55, 0.258306, 0, 0, 0.128794, 0.991671} //horde
+};
+
+float AllianceFirePos[92][8]=//spawn points for the fire visuals (GO) in the alliance base
+{
+ {5039.9, -1796.84, 1323.88, 2.59222, 0, 0, 0.962511, 0.271243},
+ {5087.2, -1795.2, 1320.68, 1.03946, 0, 0, 0.496644, 0.867954},
+ {5112.68, -1806.66, 1359.93, 1.37799, 0, 0, 0.63576, 0.771887},
+ {5095.61, -1793.27, 1359.78, 0.580806, 0, 0, 0.286338, 0.958129},
+ {5090.43, -1784.45, 1360.44, 0.796784, 0, 0, 0.387937, 0.921686},
+ {5139.25, -1783.11, 1359.39, 3.30849, 0, 0, 0.99652, -0.0833509},
+ {5112.16, -1763.72, 1361.35, 5.10312, 0, 0, 0.556388, -0.830922},
+ {4981.18, -1793.98, 1335.7, 3.23072, 0, 0, 0.999007, -0.0445498},
+ {4996.57, -1766.75, 1341.62, 3.5331, 0, 0, 0.980902, -0.194505},
+ {4983.74, -1769.25, 1345.75, 3.79228, 0, 0, 0.947541, -0.319635},
+ {4996.01, -1774.43, 1330.71, 3.07364, 0, 0, 0.999423, 0.0339693},
+ {5094.2, -1726.13, 1330.55, 1.56175, 0, 0, 0.703901, 0.710298},
+ {5079.82, -1721.24, 1336.26, 1.18868, 0, 0, 0.559964, 0.828517},
+ {5077.68, -1717.15, 1327.78, 0.0145145, 0, 0, 0.00725717, 0.999974},
+ {5122.27, -1738.22, 1341.67, 0.835256, 0, 0, 0.405593, 0.914054},
+ {5131.88, -1741.15, 1335.25, 2.15472, 0, 0, 0.880712, 0.473653},
+ {5196.93, -1772.99, 1345.2, 0.128397, 0, 0, 0.0641544, 0.99794},
+ {5225.33, -1756.06, 1344.17, 3.04223, 0, 0, 0.998766, 0.0496599},
+ {5224.84, -1767.05, 1360.06, 3.19538, 0, 0, 0.999638, -0.0268922},
+ {5202.05, -1763.47, 1361.68, 2.59455, 0, 0, 0.962826, 0.270122},
+ {5194.74, -1766.66, 1356.94, 0.0734191, 0, 0, 0.0367013, 0.999326},
+ {5159.67, -1832.97, 1344.5, 5.17457, 0, 0, 0.526356, -0.850264},
+ {5096.17, -1858.73, 1332.46, 5.30021, 0, 0, 0.471939, -0.881631},
+ {5110.7, -1856.59, 1342.84, 5.97564, 0, 0, 0.153167, -0.9882},
+ {5109.76, -1855.3, 1332.38, 4.89572, 0, 0, 0.639411, -0.768865},
+ {5068.95, -1837.37, 1328.81, 2.61569, 0, 0, 0.965628, 0.25993},
+ {5064.4, -1824.77, 1329.02, 2.16409, 0, 0, 0.88292, 0.469524},
+ {5059.89, -1848.79, 1329.59, 0.0709955, 0, 0, 0.0354903, 0.99937},
+ {5014.37, -1851.39, 1322.56, 4.66949, 0, 0, 0.722111, -0.691777},
+ {5025.1, -1848.27, 1323.39, 4.44565, 0, 0, 0.794854, -0.606801},
+ {4942.63, -1890.13, 1326.59, 3.28719, 0, 0, 0.997351, -0.0727343},
+ {4937.95, -1888.71, 1352.41, 3.41678, 0, 0, 0.990549, -0.13716},
+ {4922.48, -1881.92, 1352.41, 5.03077, 0, 0, 0.586075, -0.810257},
+ {4915.35, -1894.32, 1351.24, 6.22457, 0, 0, 0.0293048, -0.999571},
+ {4922.71, -1904.84, 1352.56, 1.37866, 0, 0, 0.63602, 0.771672},
+ {4932.89, -1905.49, 1352.56, 1.89702, 0, 0, 0.812549, 0.582893},
+ {5011.83, -1861.05, 1345.86, 4.43777, 0, 0, 0.797239, -0.603664},
+ {5011.83, -1861.05, 1363.26, 4.748, 0, 0, 0.694406, -0.719583},
+ {5021.46, -1858.35, 1342.17, 4.86188, 0, 0, 0.652329, -0.757936},
+ {4995.02, -1698.3, 1370.38, 6.15779, 0, 0, 0.0626579, -0.998035},
+ {5119.85, -1728.9, 1336.04, 5.87112, 0, 0, 0.204579, -0.97885},
+ {5214.75, -1751.02, 1342.5, 5.08965, 0, 0, 0.561972, -0.827156},
+ {5075.04, -1822.43, 1328.87, 3.99951, 0, 0, 0.9094, -0.415924},
+ {5057.09, -1823.32, 1350.35, 3.88169, 0, 0, 0.93231, -0.361659},
+ {4984.6, -1816.99, 1329.21, 3.05308, 0, 0, 0.999021, 0.0442417},
+ {4983.35, -1811.55, 1356.82, 3.33975, 0, 0, 0.995096, -0.098917},
+ {4984.11, -1825.73, 1350.76, 2.26375, 0, 0, 0.905211, 0.424962},
+ {4968.47, -1786.46, 1354.09, 3.07663, 0, 0, 0.999473, 0.0324733},
+ {5061.82, -1751.16, 1339.07, 5.94727, 0, 0, 0.167171, -0.985928},
+ {5063.75, -1763, 1351.91, 0.759707, 0, 0, 0.370784, 0.928719},
+ {5078.65, -1708.26, 1353.9, 1.27022, 0, 0, 0.593264, 0.805008},
+ {4983.19, -1755.96, 1331.13, 4.28221, 0, 0, 0.841733, -0.539894},
+ {4972.76, -1755.3, 1332.5, 4.21938, 0, 0, 0.858276, -0.513188},
+ {4961.65, -1760.82, 1351.69, 3.56515, 0, 0, 0.977659, -0.210198},
+ {5086.45, -1779.83, 1321.62, 6.23157, 0, 0, 0.0258051, -0.999667},
+ {5063.15, -1756.74, 1328.56, 0.886926, 0, 0, 0.42907, 0.903271},
+ {5042.45, -1800.61, 1323.88, 2.50093, 0, 0, 0.949131, 0.31488},
+ {5084.74, -1725.35, 1327.89, 1.65034, 0, 0, 0.734663, 0.678432},
+ {4993.25, -1758.1, 1331.07, 3.49995, 0, 0, 0.98399, -0.178223},
+ {5078.53, -1867.85, 1348.91, 5.85612, 0, 0, 0.211913, -0.977288},
+ {5080.74, -1869.73, 1333.18, 6.18206, 0, 0, 0.0505424, -0.998722},
+ {5089.55, -1894.13, 1356.08, 1.52072, 0, 0, 0.689181, 0.724589},
+ {5113.24, -1899.49, 1363.77, 1.50108, 0, 0, 0.682034, 0.731321},
+ {4984.18, -1907.69, 1325.62, 3.82193, 0, 0, 0.942698, -0.333646},
+ {5094.14, -2432.08, 1429.38, 4.70083, 0, 0, 0.711182, -0.703007},
+ {5329.89, -2113.30, 1281.06, 5.60560, 0, 0, 0.332347, -0.943157},
+ {5170.87, -2148.13, 1278.32, 1.63540, 0, 0, 0.729573, 0.683903 },
+ {5132.94, -1960.25, 1367.8, 3.69787, 0, 0, 0.961568, -0.274566},
+ {5280.82, -2351.55, 1431.57, 4.46913, 0, 0, 0.787677, -0.616088},
+ {5176.78, -2121.43, 1295.27, 3.24153, 0, 0, 0.998752, -0.04995},
+ {5332.75, -2101.41, 1296.37, 5.50350, 0, 0, 0.380043, -0.924969},
+ {5265.70, -2050.27, 1287.57, 0.50051, 0, 0, 0.247655, 0.968848 },
+ {5194.21, -2129.89, 1274.04, 3.08053, 0, 0, 0.999534, 0.0305272},
+ {5225.81, -1985.50, 1364.15, 0.37247, 0, 0, 0.185163, 0.982708 },
+ {5339.46, -2204.47, 1280.45, 0.99921, 0, 0, 0.479081, 0.877771 },
+ {5269.63, -2020.57, 1299.62, 3.00201, 0, 0, 0.997566, 0.0697332},
+ {5111.54, -2445.70, 1435.31, 2.70983, 0, 0, 0.976788, 0.214207 },
+ {5111.24, -1901.14, 1355.33, 1.61028, 0, 0, 0.720929, 0.693009 },
+ {5310.42, -2207.82, 1277.46, 0.50441, 0, 0, 0.249544, 0.968363 },
+ {5150.81, -2042.13, 1394.3, 2.21031, 0, 0, 0.893534, 0.448995 },
+ {5224.84, -2376.61, 1366.33, 5.0621, 0, 0, 0.573311, -0.819338},
+ {5105.41, -2454.86, 1446.16, 4.64584, 0, 0, 0.730239, -0.683191},
+ {5309.65, -2188.28, 1266.84, 5.56631, 0, 0, 0.350811, -0.936446},
+ {5281.46, -2047.82, 1287.67, 2.44909, 0, 0, 0.940652, 0.339373 },
+ {5325.45, -2189.41, 1309.6, 6.23783, 0, 0, 0.0226771, -0.999743},
+ {5190.96, -2142.54, 1293.03, 6.25668, 0, 0, 0.0132544, -0.999912},
+ {5089.99, -2467.49, 1441.8, 0.77381, 0, 0, 0.377326, 0.92608 },
+ {5195.08, -2129.01, 1285.36, 3.55727, 0, 0, 0.978480, -0.206344},
+ {5353.76, -2116.28, 1299.27, 6.17894, 0, 0, 0.0521006, -0.998642},
+ {5271.14, -2037.38, 1299.24, 4.07879, 0, 0, 0.892201, -0.451638},
+ {5332.5 , -2181.28, 1279.95, 4.6906, 0, 0, 0.714768, -0.699362},
+ {5108.2 , -2429.84, 1427.73, 4.5194, 0, 0, 0.771943, -0.635691}
+};
+
+float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde base
+{
+ {5524.11, -2612.73, 1483.38, 1.96198, 0, 0, 0.831047, 0.556202},
+ {5514.42, -2617.19, 1505.77, 1.82453, 0, 0, 0.790892, 0.611956},
+ {5510.21, -2624.77, 1485.34, 1.71065, 0, 0, 0.754783, 0.655974},
+ {5570.72, -2619.04, 1487.62, 0.728898, 0, 0, 0.356435, 0.93432},
+ {5570.29, -2639.37, 1487.31, 1.49308, 0, 0, 0.679104, 0.734042},
+ {5583.56, -2637.2, 1503.78, 1.46559, 0, 0, 0.668951, 0.743307},
+ {5571.53, -2626.81, 1510.99, 0.362107, 0, 0, 0.180066, 0.983654},
+ {5545.97, -2659.62, 1489.64, 5.07055, 0, 0, 0.569845, -0.821752},
+ {5557.44, -2675.91, 1482.58, 1.70118, 0, 0, 0.751671, 0.659539},
+ {5594.98, -2742.31, 1495.51, 4.5993, 0, 0, 0.74594, -0.666013},
+ {5599.65, -2755.6, 1505.05, 1.66896, 0, 0, 0.740947, 0.671564},
+ {5565.95, -2774.75, 1499.48, 6.22425, 0, 0, 0.0294611, -0.999566},
+ {5567.1, -2769.7, 1511.17, 5.99257, 0, 0, 0.144799, -0.989461},
+ {5572.84, -2774.16, 1527.06, 0.836428, 0, 0, 0.406129, 0.913816},
+ {5538.32, -2805.94, 1498.87, 4.30082, 0, 0, 0.836674, -0.547701},
+ {5515.66, -2801.74, 1503.53, 5.57316, 0, 0, 0.347602, -0.937642},
+ {5516.76, -2827.14, 1501.15, 0.35026, 0, 0, 0.174236, 0.984704},
+ {5536.13, -2813.51, 1537.21, 4.51681, 0, 0, 0.772765, -0.634692},
+ {5525.05, -2825.16, 1538.53, 0.489275, 0, 0, 0.242205, 0.970225},
+ {5534.42, -2815.45, 1562.84, 4.62834, 0, 0, 0.736191, -0.676774},
+ {5519.64, -2831.12, 1526.46, 0.611008, 0, 0, 0.300774, 0.953696},
+ {5551.04, -2827.55, 1523.5, 3.35206, 0, 0, 0.994468, -0.10504},
+ {5469.22, -2802.87, 1503.5, 4.99509, 0, 0, 0.600436, -0.799673},
+ {5427.8, -2737.26, 1487.12, 1.78673, 0, 0, 0.779186, 0.626793},
+ {5454.1, -2709.1, 1485.92, 3.03552, 0, 0, 0.998594, 0.0530137},
+ {5436.3, -2718.2, 1506.02, 2.7567, 0, 0, 0.981539, 0.191261},
+ {5412.6, -2740.55, 1510.79, 2.98446, 0, 0, 0.996915, 0.0784832},
+ {5406.12, -2752.48, 1521.01, 2.05769, 0, 0, 0.856705, 0.515807},
+ {5445.24, -2676.35, 1521.89, 2.91378, 0, 0, 0.99352, 0.113661},
+ {5481.4, -2665.08, 1482.23, 4.30001, 0, 0, 0.836895, -0.547363},
+ {5443.51, -2675.44, 1487.12, 2.90986, 0, 0, 0.993295, 0.115606},
+ {5391.72, -2647.3, 1528.9, 3.76987, 0, 0, 0.951063, -0.308997},
+ {5421.09, -2734.12, 1521.01, 2.70567, 0, 0, 0.97634, 0.216242},
+ {5405.39, -2710.33, 1533.77, 2.51324, 0, 0, 0.951052, 0.309032},
+ {5423.96, -2703.76, 1516.34, 2.79206, 0, 0, 0.984767, 0.173879},
+ {5444.75, -2735.23, 1486.37, 2.22657, 0, 0, 0.897155, 0.441715},
+ {5570.98, -2747.91, 1495.7, 5.14433, 0, 0, 0.53915, -0.84221},
+ {5567.79, -2673.9, 1484.66, 2.72529, 0, 0, 0.978415, 0.20665},
+ {5600.71, -2696.8, 1500.42, 0.443704, 0, 0, 0.220036, 0.975492},
+ {5600.7, -2693.04, 1515.2, 5.16003, 0, 0, 0.532522, -0.846416},
+ {5627.56, -2839.66, 1510.53, 5.41527, 0, 0, 0.420463, -0.907309},
+ {5622.02, -2868.71, 1516.22, 2.25482, 0, 0, 0.903303, 0.429002},
+ {5586.61, -2878.97, 1510.34, 4.55604, 0, 0, 0.76017, -0.649724},
+ {5583.78, -2843.71, 1509.54, 5.35715, 0, 0, 0.44665, -0.894709},
+ {5580.95, -2811.3, 1513.3, 3.57587, 0, 0, 0.976518, -0.215434},
+ {5542.52, -2869.31, 1523.13, 5.23304, 0, 0, 0.501275, -0.865288},
+ {5557.35, -2866.36, 1518.76, 4.48299, 0, 0, 0.783388, -0.621533},
+ {5380.91, -2849.36, 1512.81, 3.90962, 0, 0, 0.927168, -0.374646},
+ {5395.76, -2881.41, 1521.11, 4.28426, 0, 0, 0.84118, -0.540755},
+ {5374.87, -2859.63, 1528.98, 3.30252, 0, 0, 0.996765, -0.0803745},
+ {5356.07, -2854.66, 1520.34, 5.83933, 0, 0, 0.220108, -0.975475},
+ {5363.01, -2975.72, 1539.02, 4.13738, 0, 0, 0.87859, -0.477576},
+ {5336.85, -2980.74, 1561.24, 5.11126, 0, 0, 0.553001, -0.83318},
+ {5335.23, -2974.62, 1540.05, 5.04451, 0, 0, 0.580496, -0.814263},
+ {5422.37, -2998.87, 1549.98, 4.51831, 0, 0, 0.772288, -0.635272},
+ {5405.54, -3014.6, 1562.16, 5.86761, 0, 0, 0.206298, -0.978489},
+ {5427.96, -3019.4, 1561.58, 3.53498, 0, 0, 0.980718, -0.19543},
+ {5348.12, -2977.84, 1582.47, 3.94025, 0, 0, 0.921323, -0.388799},
+ {5331.12, -2993.71, 1576.14, 0.0642734, 0, 0, 0.0321311, 0.999484},
+ {5321.63, -2986.55, 1552.2, 5.29503, 0, 0, 0.474219, -0.880407},
+ {5292.1, -2914.36, 1529.52, 2.9742, 0, 0, 0.996499, 0.083601},
+ {5281.77, -2926.5, 1530.62, 1.67829, 0, 0, 0.744071, 0.6681},
+ {5287.19, -2909.94, 1543.49, 3.31192, 0, 0, 0.996376, -0.0850591},
+ {5534.15, -2679.35, 1483.61, 0.428685, 0, 0, 0.212705, 0.977116},
+ {5545.43, -2647.82, 1483.05, 5.38848, 0, 0, 0.432578, -0.901596}
+};
+
+hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(m_creature)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ VeinsSpawned[0] = false;
+ VeinsSpawned[1] = false;
+ for(uint8 i=0;i<14;i++)
+ VeinGUID[i] = 0;
+ InfernalCount = 0;
+ TeleportTimer = 1000;
+ Overrun = false;
+ Teleported = false;
+ WaitForTeleport = false;
+ OverrunCounter = 0;
+ OverrunCounter2 = 0;
+ InfernalPoint = 0;
+ RespawnTimer = 10000;
+ DoRespawn = false;
+ DoHide = false;
+}
+
+void hyjalAI::JustSummoned(Creature *summoned)
+{
+ Summons.Summon(summoned);
+}
+
+void hyjalAI::SummonedCreatureDespawn(Creature* summoned)
+{
+ Summons.Despawn(summoned);
}
void hyjalAI::Reset()
{
+ IsDummy = false;
+ m_creature->setActive(true);
// GUIDs
PlayerGUID = 0;
BossGUID[0] = 0;
@@ -72,23 +331,28 @@ void hyjalAI::Reset()
// Set faction properly based on creature entry
switch(m_creature->GetEntry())
{
- case 17772:
+ case JAINA:
Faction = 0;
DoCast(m_creature, SPELL_BRILLIANCE_AURA, true);
break;
- case 17852:
+ case THRALL:
Faction = 1;
break;
+
+ case TYRANDE:
+ Faction = 2;
+ break;
}
- //Bools
+ //Bools
EventBegun = false;
FirstBossDead = false;
SecondBossDead = false;
Summon = false;
bRetreat = false;
Debug = false;
+
//Flags
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -107,27 +371,18 @@ void hyjalAI::Reset()
else error_log(ERROR_INST_DATA);
//Visibility
- switch(m_creature->GetEntry())
- {
- case 17772: if(pInstance->GetData(DATA_ANETHERONEVENT) == DONE)
- m_creature->SetVisibility(VISIBILITY_OFF);
- else m_creature->SetVisibility(VISIBILITY_ON);
- break;
- case 17852: if(pInstance->GetData(DATA_AZGALOREVENT) == DONE)
- m_creature->SetVisibility(VISIBILITY_OFF);
- else m_creature->SetVisibility(VISIBILITY_ON);
- break;
- }
-
+ DoHide = true;
+
+ //CreatureList.clear();
//If Jaina evades, reset the visibility of all other creatures in the grid.
- if(CreatureList.empty())
+ /*if(CreatureList.empty())
return;
for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr)
if(Creature* cr = ((Creature*)Unit::GetUnit(*m_creature, *itr)))
cr->SetVisibility(VISIBILITY_ON);
- CreatureList.clear();
+ CreatureList.clear();*/
}
void hyjalAI::EnterEvadeMode()
@@ -140,7 +395,7 @@ void hyjalAI::EnterEvadeMode()
if(m_creature->isAlive())
m_creature->GetMotionMaster()->MoveTargetedHome();
-
+
m_creature->SetLootRecipient(NULL);
InCombat = false;
@@ -159,25 +414,74 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
{
uint32 random = rand()%4;
float SpawnLoc[3];
- float AttackLoc[3];
for(uint8 i = 0; i < 3; ++i)
{
SpawnLoc[i] = Base[random][i];
- AttackLoc[i] = AttackArea[Faction][i];
}
-
- Creature* pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000);
+ Creature* pCreature = NULL;
+ switch(entry)
+ {
+ case 17906: //GARGOYLE
+
+ if(!FirstBossDead && (WaveCount == 1 || WaveCount == 3))
+ {//summon at tower
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ if(pCreature)
+ ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ }else{//summon at gate
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ }
+ break;
+ case 17907: //FROST_WYRM ,
+ if(FirstBossDead && WaveCount == 1)
+ {//summon at gate
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_WYRM_GATE][0],SpawnPointSpecial[SPAWN_WYRM_GATE][1],SpawnPointSpecial[SPAWN_WYRM_GATE][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ }else{
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1],SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ if(pCreature)
+ ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ }
+ break;
+ case 17908: //GIANT_INFERNAL
+ InfernalCount++;
+ if(InfernalCount > 7)InfernalCount = 0;
+ pCreature = m_creature->SummonCreature(entry, InfernalPos[InfernalCount][0], InfernalPos[InfernalCount][1], InfernalPos[InfernalCount][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ break;
+ default:
+ pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ break;
+
+ }
+
if(pCreature)
{
// Increment Enemy Count to be used in World States and instance script
++EnemyCount;
pCreature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- pCreature->GetMotionMaster()->MovePoint(0, AttackLoc[0],AttackLoc[1],AttackLoc[2]);
- pCreature->AddThreat(m_creature, 0.0f);
+ //pCreature->GetMotionMaster()->MovePoint(0, AttackLoc[0],AttackLoc[1],AttackLoc[2]);
+ //pCreature->AddThreat(m_creature, 0.0f);
+ //DoZoneInCombat(pCreature);
pCreature->setActive(true);
- DoZoneInCombat(pCreature);
+ switch(entry)
+ {
+ case NECROMANCER:
+ case ABOMINATION:
+ case GHOUL:
+ case BANSHEE:
+ case CRYPT_FIEND:
+ case GARGOYLE:
+ case FROST_WYRM:
+ case GIANT_INFERNAL:
+ case FEL_STALKER:
+ case RAGE_WINTERCHILL:
+ case ANETHERON:
+ case KAZROGAL:
+ case AZGALOR:
+ ((hyjal_trashAI*)pCreature->AI())->IsEvent = true;
+ break;
+ }
// Check if creature is a boss.
if (pCreature->isWorldBoss())
@@ -200,6 +504,7 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
error_log(ERROR_INST_DATA);
return;
}
+ InfernalCount = 0;//reset infernal count every new wave
EnemyCount = pInstance->GetData(DATA_TRASH);
for(uint8 i = 0; i < 18; ++i)
@@ -238,7 +543,7 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
void hyjalAI::StartEvent(Player* player)
{
- if(!player)
+ if(!player || IsDummy)
return;
Talk(BEGIN);
@@ -255,6 +560,8 @@ void hyjalAI::StartEvent(Player* player)
UpdateWorldState(WORLD_STATE_WAVES, 0);
UpdateWorldState(WORLD_STATE_ENEMY, 0);
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
+
+ DeSpawnVeins();
}
uint32 hyjalAI::GetInstanceData(uint32 Event)
@@ -305,12 +612,12 @@ void hyjalAI::Talk(uint32 id)
void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
{
Map * map = m_creature->GetMap();
-
- if(!map->IsDungeon())
+
+ if(!map->IsDungeon())
return;
Map::PlayerList const& players = map->GetPlayers();
-
+
if (!players.isEmpty())
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -326,7 +633,7 @@ void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
void hyjalAI::Retreat()
{
- CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ /*CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
@@ -339,18 +646,9 @@ void hyjalAI::Retreat()
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
- // Then get all Ancient Gem Veins. NOTE: Grid Search will only be able to find those in the grid.
- std::list<GameObject*> goList;
- Trinity::AllGameObjectsWithEntryInGrid go_check(185557);
- Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid> go_search(goList, go_check);
- TypeContainerVisitor
- <Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid>, GridTypeMapContainer> go_visit(go_search);
-
CellLock<GridReadGuard> cell_lock(cell, pair);
// Get Creatures
cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
- // Get GOs
- cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap()));
CreatureList.clear();
if(!creatures.empty())
@@ -358,36 +656,188 @@ void hyjalAI::Retreat()
for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{
(*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
CreatureList.push_back((*itr)->GetGUID());
}
DoCast(m_creature, SPELL_TELEPORT_VISUAL);
bRetreat = true;
RetreatTimer = 1000;
+ }*/
+ if(pInstance)
+ {
+ if(Faction == 0)
+ {
+ pInstance->SetData(DATA_ALLIANCE_RETREAT, 1);
+ AddWaypoint(0,JainaWPs[0][0],JainaWPs[0][1],JainaWPs[0][2]);
+ AddWaypoint(1,JainaWPs[1][0],JainaWPs[1][1],JainaWPs[1][2]);
+ Start(false, false, false);
+ SetDespawnAtEnd(false);//move to center of alliance base
+ }
+ if(Faction == 1)
+ {
+ pInstance->SetData(DATA_HORDE_RETREAT, 1);
+ Creature* JainaDummy = m_creature->SummonCreature(JAINA,JainaDummySpawn[0][0],JainaDummySpawn[0][1],JainaDummySpawn[0][2],JainaDummySpawn[0][3],TEMPSUMMON_TIMED_DESPAWN,60000);
+ if(JainaDummy)
+ {
+ JainaDummy->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ ((hyjalAI*)JainaDummy->AI())->IsDummy = true;
+ JainaDummy->CastSpell(JainaDummy, SPELL_TELEPORT_VISUAL, true);
+ }
+ AddWaypoint(0,JainaDummySpawn[1][0],JainaDummySpawn[1][1],JainaDummySpawn[1][2]);
+ Start(false, false, false);
+ SetDespawnAtEnd(false);//move to center of alliance base
+ }
+ }
+ SpawnVeins();
+ Overrun = true;
+ m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started
+}
+
+void hyjalAI::SpawnVeins()
+{
+ if(Faction == 0)
+ {
+ if (VeinsSpawned[0])//prevent any buggers
+ return;
+ for (uint8 i = 0; i<7; i++)
+ {
+ GameObject* gem = m_creature->SummonGameObject(ANCIENT_VEIN,VeinPos[i][0],VeinPos[i][1],VeinPos[i][2],VeinPos[i][3],VeinPos[i][4],VeinPos[i][5],VeinPos[i][6],VeinPos[i][7],0);
+ if(gem)
+ VeinGUID[i]=gem->GetGUID();
+ }
+ VeinsSpawned[0] = true;
+ }else{
+ if (VeinsSpawned[1])
+ return;
+ for (uint8 i = 7; i<14; i++)
+ {
+ GameObject* gem = m_creature->SummonGameObject(ANCIENT_VEIN,VeinPos[i][0],VeinPos[i][1],VeinPos[i][2],VeinPos[i][3],VeinPos[i][4],VeinPos[i][5],VeinPos[i][6],VeinPos[i][7],0);
+ if(gem)
+ VeinGUID[i]=gem->GetGUID();
+ }
+ VeinsSpawned[1] = true;
}
+}
- if(!goList.empty())
+void hyjalAI::DeSpawnVeins()
+{
+ if(!pInstance)return;
+ if(Faction == 1)
+ {
+ Creature* pUnit=(Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (!pUnit)return;
+ hyjalAI* ai = ((hyjalAI*)pUnit->AI());
+ if(!ai)return;
+ for (uint8 i = 0; i<7; i++)
+ {
+ GameObject* gem = GameObject::GetGameObject((*m_creature), ai->VeinGUID[i]);
+ if(gem)
+ gem->RemoveFromWorld();
+ }
+ }else if (Faction)
{
- for(std::list<GameObject*>::iterator itr = goList.begin(); itr != goList.end(); ++itr)
- (*itr)->SetRespawnTime(5000);
+ Creature* pUnit=(Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_THRALL));
+ if (!pUnit)return;
+ hyjalAI* ai = ((hyjalAI*)pUnit->AI());
+ if(!ai)return;
+ for (uint8 i = 7; i<14; i++)
+ {
+ GameObject* gem = GameObject::GetGameObject((*m_creature), ai->VeinGUID[i]);
+ if(gem)
+ gem->RemoveFromWorld();
+ }
}
}
void hyjalAI::UpdateAI(const uint32 diff)
{
+ if(IsDummy)
+ {
+ return;
+ }
+ if(DoHide)
+ {
+ DoHide = false;
+ switch(m_creature->GetEntry())
+ {
+ case JAINA:
+ if(pInstance->GetData(DATA_ALLIANCE_RETREAT))
+ {
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ HideNearPos(5037.76, -1889.71);
+ for(uint8 i = 0; i < 92; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0);
+
+ }
+ else m_creature->SetVisibility(VISIBILITY_ON);
+ break;
+ case THRALL: //thrall
+ if(pInstance->GetData(DATA_HORDE_RETREAT))
+ {
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ HideNearPos(5563, -2763.19);
+ HideNearPos(5542.2, -2629.36);
+ }
+ else m_creature->SetVisibility(VISIBILITY_ON);
+ break;
+ }
+ }
+ if(DoRespawn)
+ {
+ if(RespawnTimer < diff)
+ {
+ DoRespawn = false;
+ RespawnNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ if(Faction == 0)
+ {
+ RespawnNearPos(5037.76, -1889.71);
+ }else if (Faction == 1)
+ {
+ RespawnNearPos(5563, -2763.19);
+ RespawnNearPos(5542.2, -2629.36);
+ }
+ m_creature->SetVisibility(VISIBILITY_ON);
+ }else{
+ RespawnTimer -= diff;
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ }
+ return;
+ }
+ if(Overrun)
+ DoOverrun(Faction, diff);
+ if(m_creature->GetEntry() == 17772)
+ {
+ if(!m_creature->HasAura(SPELL_BRILLIANCE_AURA,0))
+ DoCast(m_creature, SPELL_BRILLIANCE_AURA, true);
+ }
if(bRetreat)
{
if(RetreatTimer < diff)
{
bRetreat = false;
- if(CreatureList.empty())
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ switch(m_creature->GetEntry())
+ {
+ case JAINA://jaina
+ HideNearPos(5037.76, -1889.71);
+ break;
+ case THRALL://thrall
+ HideNearPos(5563, -2763.19);
+ HideNearPos(5542.2, -2629.36);
+ HideNearPos(5603.75, -2853.12);
+ break;
+ }
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ /*if(CreatureList.empty())
return;
for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr)
if(Unit* pUnit = Unit::GetUnit(*m_creature, *itr))
pUnit->SetVisibility(VISIBILITY_OFF);
-
- m_creature->SetVisibility(VISIBILITY_OFF);
+ CreatureList.clear();*/
}else RetreatTimer -= diff;
}
@@ -475,4 +925,203 @@ void hyjalAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
+void hyjalAI::JustDied(Unit* killer)
+{
+ if(IsDummy)return;
+ m_creature->Respawn();
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ DoRespawn = true;
+ RespawnTimer = 120000;
+ Talk(DEATH);
+ Summons.DespawnAll();//despawn all wave's summons
+ if(pInstance)
+ {//reset encounter if boss is despawned (ex: thrall is killed, boss despawns, event stucks at inprogress)
+ if(pInstance->GetData(DATA_RAGEWINTERCHILLEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_ANETHERONEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_KAZROGALEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED);
+ }
+}
+void hyjalAI::HideNearPos(float x, float y)
+{
+ CellPair pair(Trinity::ComputeCellPair(x, y));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+ // First get all creatures.
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ // Get Creatures
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ //CreatureList.clear();
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ (*itr)->SetVisibility(VISIBILITY_OFF);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
+ //CreatureList.push_back((*itr)->GetGUID());
+ }
+ }
+}
+void hyjalAI::RespawnNearPos(float x, float y)
+{
+ CellPair p(Trinity::ComputeCellPair(x, y));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(u_do);
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, obj_worker, *m_creature->GetMap());
+}
+void hyjalAI::WaypointReached(uint32 i)
+{
+ if(i == 1 || (i == 0 && m_creature->GetEntry() == THRALL))
+ {
+ m_creature->Yell("Hurry, we don't have much time",0,0);
+ WaitForTeleport = true;
+ TeleportTimer = 15000;
+ //do some talking
+ //all alive guards walk near here
+ CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ // First get all creatures.
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ if((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA)
+ {
+ if((*itr)->GetDistance(m_creature) >= 60)
+ (*itr)->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ float x, y, z;
+ (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
+ (*itr)->GetMotionMaster()->Initialize();
+ float range = 10;
+ if(m_creature->GetEntry() == THRALL)range = 20;
+ m_creature->GetNearPoint(m_creature, x, y, z, range, 0, m_creature->GetAngle((*itr)));
+ (*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5,5), y+irand(-5,5), m_creature->GetPositionZ());
+ }
+ }
+ }
+ }
+}
+void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
+{
+ npc_escortAI::UpdateAI(diff);
+ if(WaitForTeleport)
+ {
+ if(TeleportTimer < diff)
+ {
+ CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ if((*itr) && (*itr)->isAlive())
+ {
+ (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
+ }
+ }
+ DoCast(m_creature, SPELL_TELEPORT_VISUAL);
+ bRetreat = true;
+ RetreatTimer = 1000;
+ }
+
+ WaitForTeleport = false;
+ Teleported = true;
+ }TeleportTimer -= diff;
+ }
+ if(!Teleported)
+ return;
+ Overrun = false;//execute once
+ switch(faction)
+ {
+ case 0://alliance
+ for(uint8 i = 0; i < 92; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0);
+
+ for(uint8 i = 0; i < 25; i++)//summon 25 ghouls
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ for(uint8 i = 0; i < 5; i++)//summon 5 abominations
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ for(uint8 i = 0; i < 5; i++)//summon 5 gargoyles
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(GARGOYLE, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ break;
+ case 1://horde
+ break;
+ }
+} \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
index cb4e3f72ab3..d54fe2fb1a8 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
@@ -6,17 +6,29 @@
#define SC_HYJALAI_H
#include "def_hyjal.h"
+#include "../../../npc/npc_escortAI.h"
+
+
+#define MINPLAYERS 1//min players on the map (except gms) to start the events, to prevent one player farming
+
// Trash Mobs summoned in waves
-#define NECROMANCER 17899
-#define ABOMINATION 17898
-#define GHOUL 17895
-#define BANSHEE 17905
-#define CRYPT_FIEND 17897
-#define GARGOYLE 17906
-#define FROST_WYRM 17907
-#define GIANT_INFERNAL 17908
-#define FEL_STALKER 17916
+#define NECROMANCER 17899//done
+#define ABOMINATION 17898//done
+#define GHOUL 17895//done
+#define BANSHEE 17905//done
+#define CRYPT_FIEND 17897//done
+#define GARGOYLE 17906//done
+#define FROST_WYRM 17907//done
+#define GIANT_INFERNAL 17908//done
+#define FEL_STALKER 17916//done
+
+#define JAINA 17772
+#define THRALL 17852
+#define TYRANDE 17948
+
+#define ANCIENT_VEIN 185557
+#define FLAMEOBJECT 182592
// Bosses summoned after every 8 waves
#define RAGE_WINTERCHILL 17767
@@ -51,7 +63,7 @@ static Wave AllianceWaves[]= // Waves that will b
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 120000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
// All 8 Waves are summoned, summon Rage Winterchill, next few waves are for Anetheron
@@ -60,10 +72,10 @@ static Wave AllianceWaves[]= // Waves that will b
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
+ {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, GHOUL, GHOUL, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
// All 8 Waves are summoned, summon Anatheron
{ANETHERON, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}
@@ -71,25 +83,25 @@ static Wave AllianceWaves[]= // Waves that will b
static Wave HordeWaves[]= // Waves that are summoned in the Horde base
{ // Kaz'Rogal Wave 1-8
- {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, FROST_WYRM, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, FROST_WYRM, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, FROST_WYRM, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, FROST_WYRM, 0, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 240000, false},
// All 8 Waves are summoned, summon Kaz'Rogal, next few waves are for Azgalor
{KAZROGAL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true},
// Azgalor Wave 1-8
- {ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, FROST_WYRM, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 120000, false},
- {GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, 0, 0, 0, 0, 120000, false},
- {FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 180000, false},
+ {ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, FROST_WYRM, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 180000, false},
+ {GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, 0, 0, 0, 0, 180000, false},
+ {FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 180000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 240000, false},
// All 8 Waves are summoned, summon Azgalor
{AZGALOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}
};
@@ -144,7 +156,7 @@ static Yells ThrallQuotes[]=
{DEATH, -1534017},
};
-struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
+struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI
{
hyjalAI(Creature *c);
@@ -156,10 +168,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
void UpdateAI(const uint32 diff); // Called to summon waves, check for boss deaths and to cast our spells.
- void JustDied(Unit* killer) // Called on death, informs the raid that they have failed.
- {
- Talk(DEATH);
- }
+ void JustDied(Unit* killer); // Called on death, informs the raid that they have failed.
void SetFaction(uint32 _faction) // Set the faction to either Alliance or Horde in Hyjal
{
@@ -168,6 +177,15 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
void Retreat(); // "Teleport" (teleport visual + set invisible) all friendly creatures away from the base.
+ void SpawnVeins();
+ void DeSpawnVeins();
+ void JustSummoned(Creature *summoned);
+ void SummonedCreatureDespawn(Creature* summoned);
+ void HideNearPos(float x, float y);
+ void RespawnNearPos(float x, float y);
+ void WaypointReached(uint32 i);
+ void DoOverrun(uint32 faction, const uint32 diff);
+
void SummonCreature(uint32 entry, float Base[4][3]); // Summons a creature for that wave in that base
// Summons the next wave, calls SummonCreature
@@ -185,6 +203,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
uint64 PlayerGUID;
uint64 BossGUID[2];
+ uint64 VeinGUID[14];
uint32 NextWaveTimer;
uint32 WaveCount;
@@ -199,6 +218,20 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
bool Summon;
bool bRetreat;
bool Debug;
+ bool VeinsSpawned[2];
+ uint8 InfernalCount;
+ SummonList Summons;
+ bool Overrun;
+ bool Teleported;
+ bool WaitForTeleport;
+ uint32 TeleportTimer;
+ uint32 OverrunCounter;
+ uint32 OverrunCounter2;
+ uint32 InfernalPoint;
+ uint32 RespawnTimer;
+ bool DoRespawn;
+ bool DoHide;
+ bool IsDummy;
struct Spell
{
@@ -209,7 +242,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
private:
uint32 SpellTimer[3];
- std::list<uint64> CreatureList;
+ //std::list<uint64> CreatureList;
};
#endif
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
new file mode 100644
index 00000000000..f9f4f68fb42
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
@@ -0,0 +1,1507 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+#include "hyjalAI.h"
+
+#define SPELL_METEOR 33814 //infernal visual
+#define SPELL_IMMOLATION 37059
+#define SPELL_FLAME_BUFFET 31724
+#define NPC_TRIGGER 21987 //World Trigger (Tiny)
+#define MODEL_INVIS 11686 //invisible model
+
+float HordeWPs[8][3]=//basic waypoints from spawn to leader
+{
+ {5492.91, -2404.61, 1462.63},
+ {5531.76, -2460.87, 1469.55},
+ {5554.58, -2514.66, 1476.12},
+ {5554.16, -2567.23, 1479.90},
+ {5540.67, -2625.99, 1480.89},
+ {5508.16, -2659.2, 1480.15},
+ {5489.62, -2704.05, 1482.18},
+ {5457.04, -2726.26, 1485.10}
+};
+float AllianceWPs[8][3]=//basic waypoints from spawn to leader
+{
+ {4896.08, -1576.35, 1333.65},
+ {4898.68, -1615.02, 1329.48},
+ {4907.12, -1667.08, 1321.00},
+ {4963.18, -1699.35, 1340.51},
+ {4989.16, -1716.67, 1335.74},//first WP in the base, after the gate
+ {5026.27, -1736.89, 1323.02},
+ {5037.77, -1770.56, 1324.36},
+ {5067.23, -1789.95, 1321.17}
+};
+
+float FrostWyrmWPs[3][3]=//waypoints for the frost wyrms in horde base
+{
+ {5580.82, -2628.83, 1528.28},
+ {5550.9, -2667.16, 1505.45},
+ {5459.64, -2725.91, 1484.83}
+};
+
+float GargoyleWPs[3][3]=//waypoints for the gargoyles in horde base
+{
+ {5533.66, -2634.32, 1495.33},
+ {5517.88, -2712.05, 1490.54},
+ {5459.64, -2725.91, 1484.83}
+};
+
+float FlyPathWPs[3][3]=//waypoints for the gargoyls and frost wyrms in horde base in wave 1/3
+{
+ {5531.96, -2772.83, 1516.68},
+ {5498.32, -2734.84, 1497.01},
+ {5456.67, -2725.48, 1493.08}
+};
+
+float AllianceOverrunWP[36][3]=//waypoints in the alliance base used in the end in the cleaning wave
+{
+ {4976.37,-1708.02,1339.43},//0spawn
+ {4994.83,-1725.52,1333.25},//1 start
+ {4982.92,-1753.7,1330.69},//2 end
+ {4996.75,-1721.47,1332.95},//3 start
+ {5015.74,-1755.05,1322.49},//4
+ {4998.68,-1773.44,1329.59},//5
+ {4994.83,-1725.52,1333.25},//6 start
+ {5022.8,-1735.46,1323.53},//7
+ {5052.15,-1729.02,1320.88},//8
+ {5082.43,-1726.29,1327.87},//9
+ {4994.83,-1725.52,1333.25},//10 start
+ {5018.92,-1751.14,1322.19},//11
+ {5040.09,-1792.09,1322.1},//12
+ {4994.83,-1725.52,1333.25},//13 start
+ {5023.47,-1748.1,1322.51},//14
+ {5013.43,-1842.39,1322.07},//15
+ {4994.83,-1725.52,1333.25},//16 start
+ {5020.8,-1756.86,1322.2},//17
+ {5019.53,-1824.6,1321.96},//18
+ {5043.42,-1853.75,1324.52},//19
+ {5053.02,-1864.13,1330.36},//20
+ {5062.49,-1852.47,1330.49},//21
+ {5049.32, -1726.31, 1320.64},//22 start
+ {5065.81, -1729.43, 1325.66},//23
+ {5096.63, -1742.22, 1329.61},//24
+ {5138.97, -1755.88, 1334.57},//25
+ {5163.27, -1789.08, 1337.04},//26
+ {5127.90, -1825.14, 1335.58},//27
+ {5089.68, -1846.88, 1328.99},//28
+ {5049.32, -1886.54, 1331.69},//29
+ {5002.33, -1893.98, 1325.88},//30
+ {4981.51, -1883.7, 1322.34},//31
+ {4983.25, -1857.4, 1320.48},//32
+ {5015.94, -1821.24, 1321.86},//33
+ {5027.97, -1775.25, 1321.87},//34
+ {5015.27, -1738.77, 1324.83}//35
+
+};
+
+float HordeOverrunWP[33][3]=//waypoints in the horde base used in the end in the cleaning wave
+{
+ {5510.4815, -2676.7112, 1480.4314},// 0 spawn
+ {5528.5, -2771.23, 1494.08},// 1 infernal 1
+ {5471.41, -2711.17, 1483.97},// 2 infernal 2
+ {5464.08, -2653.9, 1482.67},// 3 infernal 3
+ {5550.84, -2633.8, 1484.08},// 4 infernal 4
+ {5579.86, -2704.86, 1489.33},// 5 infernal 5
+ {5531.17, -2634.41, 1481.11},// 6 start
+ {5484.56, -2662.32, 1481.11},// 7 end
+ {5528.79, -2636.19, 1481.33},// 8 start
+ {5511.87, -2626.16, 1484.76},// 9 end
+ {5537.93, -2637.54, 1480.69},// 10 start
+ {5504.26, -2710.44, 1482.14},// 11
+ {5449.92, -2724.51, 1485.69},// 12
+ {5431.08, -2713.96, 1493.37},// 13 end
+ {5546.89, -2620.74, 1481.06},// 14 start
+ {5579.75, -2658.66, 1488.61},// 15
+ {5598.45, -2692.56, 1493.59},// 16 end
+ {5550.96, -2624.63, 1482.94},// 17 start
+ {5578.7, -2656.13, 1488.69},// 18
+ {5574.56, -2722.74, 1488.5},// 19
+ {5590.46, -2746.81, 1495},// 20
+ {5571.33, -2761.14, 1494.93},// 21
+ {5546.45, -2770.83, 1495.33},// 22
+ {5532.51, -2804.72, 1498.49},// 23
+ {5492.97, -2760.9, 1489.16},// 24
+ {5451.35, -2724.44, 1485.58},// 25
+ {5430.23, -2714.38, 1493.51},// 26 end
+ {5535.67, -2627.69, 1480.87},// 27 start
+ {5485.75, -2667.97, 1480.64},// 28
+ {5510.78, -2740.5, 1486.27},// 29
+ {5559.93, -2710.97, 1483.59},// 30
+ {5561.09, -2688.13, 1484.65},// 31
+ {5556.73, -2676.17, 1482.58}// 32 end
+};
+
+void hyjal_trashAI::Reset(){}
+
+hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c)
+{
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ IsEvent = false;
+ Delay = 0;
+ LastOverronPos = 0;
+ IsOverrun = false;
+ OverrunType = 0;
+ SetupOverrun = false;
+ faction = 0;
+ useFlyPath = false;
+ Reset();
+}
+
+void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage)
+{
+ if(IsOverrun && done_by->GetTypeId() == TYPEID_UNIT && ((Creature*)done_by)->GetEntry() == 17931)//don't take dmg from the dummy target
+ damage = 0;
+}
+
+void hyjal_trashAI::Aggro(Unit *who){}
+
+void hyjal_trashAI::UpdateAI(const uint32 diff)
+{
+ if(IsOverrun && !SetupOverrun)
+ {
+ SetupOverrun = true;
+ if(faction == 0)
+ {
+ for(uint8 i = 0; i < 4; i++)
+ AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ if(m_creature->GetEntry() == GHOUL)
+ {
+ switch(OverrunType)//0-19 ghouls, 20-24 abominations, 25-29 gargoyles
+ {
+ case 0:
+ AddWaypoint(4, AllianceOverrunWP[1][0]+irand(-3,3), AllianceOverrunWP[1][1]+irand(-3,3), AllianceOverrunWP[1][2]);
+ AddWaypoint(5, AllianceOverrunWP[2][0]+irand(-3,3), AllianceOverrunWP[2][1]+irand(-3,3), AllianceOverrunWP[2][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[2][0]+irand(-3,3), AllianceOverrunWP[2][1]+irand(-3,3), AllianceOverrunWP[2][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 5;
+ Start(true, true, true);
+ break;
+ case 1:
+ AddWaypoint(4, AllianceOverrunWP[3][0]+irand(-3,3), AllianceOverrunWP[3][1]+irand(-3,3), AllianceOverrunWP[3][2]);
+ AddWaypoint(5, AllianceOverrunWP[4][0]+irand(-3,3), AllianceOverrunWP[4][1]+irand(-3,3), AllianceOverrunWP[4][2]);
+ AddWaypoint(6, AllianceOverrunWP[5][0]+irand(-3,3), AllianceOverrunWP[5][1]+irand(-3,3), AllianceOverrunWP[5][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[5][0]+irand(-3,3), AllianceOverrunWP[5][1]+irand(-3,3), AllianceOverrunWP[5][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 2:
+ AddWaypoint(4, AllianceOverrunWP[6][0]+irand(-3,3), AllianceOverrunWP[6][1]+irand(-3,3), AllianceOverrunWP[6][2]);
+ AddWaypoint(5, AllianceOverrunWP[7][0]+irand(-3,3), AllianceOverrunWP[7][1]+irand(-3,3), AllianceOverrunWP[7][2]);
+ AddWaypoint(6, AllianceOverrunWP[8][0]+irand(-3,3), AllianceOverrunWP[8][1]+irand(-3,3), AllianceOverrunWP[8][2]);
+ AddWaypoint(7, AllianceOverrunWP[9][0]+irand(-3,3), AllianceOverrunWP[9][1]+irand(-3,3), AllianceOverrunWP[9][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[9][0]+irand(-3,3), AllianceOverrunWP[9][1]+irand(-3,3), AllianceOverrunWP[9][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 7;
+ Start(true, true, true);
+ break;
+ case 3:
+ AddWaypoint(4, AllianceOverrunWP[10][0]+irand(-3,3), AllianceOverrunWP[10][1]+irand(-3,3), AllianceOverrunWP[10][2]);
+ AddWaypoint(5, AllianceOverrunWP[11][0]+irand(-3,3), AllianceOverrunWP[11][1]+irand(-3,3), AllianceOverrunWP[11][2]);
+ AddWaypoint(6, AllianceOverrunWP[12][0]+irand(-3,3), AllianceOverrunWP[12][1]+irand(-3,3), AllianceOverrunWP[12][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[12][0]+irand(-3,3), AllianceOverrunWP[12][1]+irand(-3,3), AllianceOverrunWP[12][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 4:
+ AddWaypoint(4, AllianceOverrunWP[13][0]+irand(-3,3), AllianceOverrunWP[13][1]+irand(-3,3), AllianceOverrunWP[13][2]);
+ AddWaypoint(5, AllianceOverrunWP[14][0]+irand(-3,3), AllianceOverrunWP[14][1]+irand(-3,3), AllianceOverrunWP[14][2]);
+ AddWaypoint(6, AllianceOverrunWP[15][0]+irand(-3,3), AllianceOverrunWP[15][1]+irand(-3,3), AllianceOverrunWP[15][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[15][0]+irand(-3,3), AllianceOverrunWP[15][1]+irand(-3,3), AllianceOverrunWP[15][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 5:
+ AddWaypoint(4, AllianceOverrunWP[16][0]+irand(-3,3), AllianceOverrunWP[16][1]+irand(-3,3), AllianceOverrunWP[16][2]);
+ AddWaypoint(5, AllianceOverrunWP[17][0]+irand(-3,3), AllianceOverrunWP[17][1]+irand(-3,3), AllianceOverrunWP[17][2]);
+ AddWaypoint(6, AllianceOverrunWP[18][0]+irand(-3,3), AllianceOverrunWP[18][1]+irand(-3,3), AllianceOverrunWP[18][2]);
+ AddWaypoint(7, AllianceOverrunWP[19][0]+irand(-3,3), AllianceOverrunWP[19][1]+irand(-3,3), AllianceOverrunWP[19][2]);
+ AddWaypoint(8, AllianceOverrunWP[20][0]+irand(-3,3), AllianceOverrunWP[20][1]+irand(-3,3), AllianceOverrunWP[20][2]);
+ AddWaypoint(9, AllianceOverrunWP[21][0]+irand(-3,3), AllianceOverrunWP[21][1]+irand(-3,3), AllianceOverrunWP[21][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[21][0]+irand(-3,3), AllianceOverrunWP[21][1]+irand(-3,3), AllianceOverrunWP[21][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 9;
+ Start(true, true, true);
+ break;
+ default:
+ AddWaypoint( 4, AllianceOverrunWP[35][0]+irand(-3,3), AllianceOverrunWP[35][1]+irand(-3,3), AllianceOverrunWP[35][2]);
+ AddWaypoint( 5, AllianceOverrunWP[34][0]+irand(-3,3), AllianceOverrunWP[34][1]+irand(-3,3), AllianceOverrunWP[34][2]);
+ AddWaypoint( 6, AllianceOverrunWP[33][0]+irand(-3,3), AllianceOverrunWP[33][1]+irand(-3,3), AllianceOverrunWP[33][2]);
+ AddWaypoint( 7, AllianceOverrunWP[32][0]+irand(-3,3), AllianceOverrunWP[32][1]+irand(-3,3), AllianceOverrunWP[32][2]);
+ AddWaypoint( 8, AllianceOverrunWP[31][0]+irand(-3,3), AllianceOverrunWP[31][1]+irand(-3,3), AllianceOverrunWP[31][2]);
+ AddWaypoint( 9, AllianceOverrunWP[30][0]+irand(-3,3), AllianceOverrunWP[30][1]+irand(-3,3), AllianceOverrunWP[30][2]);
+ AddWaypoint(10, AllianceOverrunWP[29][0]+irand(-3,3), AllianceOverrunWP[29][1]+irand(-3,3), AllianceOverrunWP[29][2]);
+ AddWaypoint(11, AllianceOverrunWP[28][0]+irand(-3,3), AllianceOverrunWP[28][1]+irand(-3,3), AllianceOverrunWP[28][2]);
+ AddWaypoint(12, AllianceOverrunWP[27][0]+irand(-3,3), AllianceOverrunWP[27][1]+irand(-3,3), AllianceOverrunWP[27][2]);
+ AddWaypoint(13, AllianceOverrunWP[26][0]+irand(-3,3), AllianceOverrunWP[26][1]+irand(-3,3), AllianceOverrunWP[26][2]);
+ AddWaypoint(14, AllianceOverrunWP[25][0]+irand(-3,3), AllianceOverrunWP[25][1]+irand(-3,3), AllianceOverrunWP[25][2]);
+ AddWaypoint(15, AllianceOverrunWP[24][0]+irand(-3,3), AllianceOverrunWP[24][1]+irand(-3,3), AllianceOverrunWP[24][2]);
+ AddWaypoint(16, AllianceOverrunWP[23][0]+irand(-3,3), AllianceOverrunWP[23][1]+irand(-3,3), AllianceOverrunWP[23][2]);
+ AddWaypoint(17, AllianceOverrunWP[22][0]+irand(-3,3), AllianceOverrunWP[22][1]+irand(-3,3), AllianceOverrunWP[22][2]);
+ //m_creature->SetHomePosition(AllianceOverrunWP[0][0]+irand(-3,3), AllianceOverrunWP[0][1]+irand(-3,3), AllianceOverrunWP[0][2],0);
+ SetDespawnAtEnd(true);
+ LastOverronPos = 17;
+ Start(true, true, true);
+ break;
+ }
+ }
+ //}else if(faction == 1 && m_creature->GetEntry() != GARGOYLE){
+ // switch(OverrunType)
+ // {
+ // case 0:break;//infernal
+ // case 1:
+ // AddWaypoint(0, HordeOverrunWP[6][0], HordeOverrunWP[6][1], HordeOverrunWP[6][2]);
+ // AddWaypoint(1, HordeOverrunWP[7][0]+irand(-3,3), HordeOverrunWP[7][1]+irand(-3,3), HordeOverrunWP[7][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 2:
+ // AddWaypoint(0, HordeOverrunWP[6][0], HordeOverrunWP[6][1], HordeOverrunWP[6][2]);
+ // AddWaypoint(1, HordeOverrunWP[7][0]+irand(-3,3), HordeOverrunWP[7][1]+irand(-3,3), HordeOverrunWP[7][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 3:
+ // AddWaypoint(0, HordeOverrunWP[8][0], HordeOverrunWP[8][1], HordeOverrunWP[8][2]);
+ // AddWaypoint(1, HordeOverrunWP[9][0]+irand(-3,3), HordeOverrunWP[9][1]+irand(-3,3), HordeOverrunWP[9][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 4:
+ // AddWaypoint(0, HordeOverrunWP[10][0], HordeOverrunWP[10][1], HordeOverrunWP[10][2]);
+ // AddWaypoint(1, HordeOverrunWP[11][0], HordeOverrunWP[11][1], HordeOverrunWP[11][2]);
+ // AddWaypoint(2, HordeOverrunWP[12][0], HordeOverrunWP[12][1], HordeOverrunWP[12][2]);
+ // AddWaypoint(3, HordeOverrunWP[13][0]+irand(-3,3), HordeOverrunWP[13][1]+irand(-3,3), HordeOverrunWP[13][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 3;
+ // Start(true, true, true);
+ // break;
+ // case 5:
+ // AddWaypoint(0, HordeOverrunWP[14][0], HordeOverrunWP[14][1], HordeOverrunWP[14][2]);
+ // AddWaypoint(1, HordeOverrunWP[15][0], HordeOverrunWP[15][1], HordeOverrunWP[15][2]);
+ // AddWaypoint(2, HordeOverrunWP[16][0]+irand(-3,3), HordeOverrunWP[16][1]+irand(-3,3), HordeOverrunWP[16][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 2;
+ // Start(true, true, true);
+ // break;
+ // case 6:
+ // AddWaypoint(0, HordeOverrunWP[17][0], HordeOverrunWP[17][1], HordeOverrunWP[17][2]);
+ // AddWaypoint(1, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2]);
+ // AddWaypoint(2, HordeOverrunWP[19][0], HordeOverrunWP[19][1], HordeOverrunWP[19][2]);
+ // AddWaypoint(3, HordeOverrunWP[20][0], HordeOverrunWP[20][1], HordeOverrunWP[20][2]);
+ // AddWaypoint(4, HordeOverrunWP[21][0], HordeOverrunWP[21][1], HordeOverrunWP[21][2]);
+ // AddWaypoint(5, HordeOverrunWP[22][0], HordeOverrunWP[22][1], HordeOverrunWP[22][2]);
+ // AddWaypoint(6, HordeOverrunWP[23][0], HordeOverrunWP[23][1], HordeOverrunWP[23][2]);
+ // AddWaypoint(7, HordeOverrunWP[24][0], HordeOverrunWP[24][1], HordeOverrunWP[24][2]);
+ // AddWaypoint(8, HordeOverrunWP[25][0], HordeOverrunWP[25][1], HordeOverrunWP[25][2]);
+ // AddWaypoint(9, HordeOverrunWP[26][0]+irand(-3,3), HordeOverrunWP[26][1]+irand(-3,3), HordeOverrunWP[26][2]);
+ // SetDespawnAtEnd(true);
+ // LastOverronPos = 9;
+ // Start(true, true, true);
+ // break;
+ // case 7:
+ // AddWaypoint(0, HordeOverrunWP[27][0], HordeOverrunWP[27][1], HordeOverrunWP[27][2]);
+ // AddWaypoint(1, HordeOverrunWP[28][0], HordeOverrunWP[28][1], HordeOverrunWP[28][2]);
+ // AddWaypoint(2, HordeOverrunWP[29][0], HordeOverrunWP[29][1], HordeOverrunWP[29][2]);
+ // AddWaypoint(3, HordeOverrunWP[30][0], HordeOverrunWP[30][1], HordeOverrunWP[30][2]);
+ // AddWaypoint(4, HordeOverrunWP[31][0], HordeOverrunWP[31][1], HordeOverrunWP[31][2]);
+ // AddWaypoint(5, HordeOverrunWP[32][0]+irand(-3,3), HordeOverrunWP[32][1]+irand(-3,3), HordeOverrunWP[32][2]);
+ // SetDespawnAtEnd(true);
+ // LastOverronPos = 5;
+ // Start(true, true, true);
+ // break;
+ // }
+ //}else if(faction == 1 && m_creature->GetEntry() == GARGOYLE){
+ // AddWaypoint(0, 5536.65+irand(-80,+80), -2710.66+irand(-80,+80), 1504.45+irand(-5,+5));
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 0;
+ // Start(false, true, true);
+ }
+ }
+}
+
+void hyjal_trashAI::JustDied(Unit *victim)
+{
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ if(IsOverrun)
+ {
+ float x,y,z,o;
+ m_creature->GetHomePosition(x,y,z,o);
+ Creature* pUnit = m_creature->SummonCreature(m_creature->GetEntry(),x,y,z,o, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = OverrunType;
+ ((hyjal_trashAI*)pUnit->AI())->SetupOverrun = true;
+ pUnit->setActive(true);
+ pUnit->AI()->EnterEvadeMode();
+ }
+ }
+}
+
+struct mob_giant_infernalAI : public hyjal_trashAI
+{
+ mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ meteor = false;//call once!
+ CanMove = false;
+ Delay = rand()%10000;
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_INVIS);
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool meteor;
+ bool CanMove;
+ bool WpEnabled;
+ bool go;
+ uint32 pos;
+ uint32 spawnTimer;
+ uint32 FlameBuffetTimer;
+ bool imol;
+
+ void Reset()
+ {
+ spawnTimer = 2000;
+ FlameBuffetTimer= 2000;
+ imol = false;
+ }
+
+ void Aggro(Unit* who) {}
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 0 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(Delay<diff)
+ {
+ Delay=0;
+ }else{
+ Delay-=diff;
+ return;
+ }
+ if (!meteor)
+ {
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ Creature* trigger = m_creature->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000);
+ if(trigger)
+ {
+ trigger->SetVisibility(VISIBILITY_OFF);
+ trigger->setFaction(m_creature->getFaction());
+ trigger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ trigger->CastSpell(m_creature,SPELL_METEOR,true);
+ }
+ m_creature->GetMotionMaster()->Clear();
+ meteor = true;
+ }else if (!CanMove){
+ if(spawnTimer<diff)
+ {
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, m_creature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
+ CanMove = true;
+ /*if (m_creature->getVictim())
+ m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());*/
+ if (pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT))
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){
+ //do overrun
+ }
+ }
+ }else spawnTimer -= diff;
+ }
+ if(!CanMove)return;
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ if (!UpdateVictim())
+ return;
+ if(!imol)
+ {
+ DoCast(m_creature,SPELL_IMMOLATION);
+ imol=true;
+ }
+ if(FlameBuffetTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_FLAME_BUFFET,true);
+ FlameBuffetTimer = 7000;
+ }else FlameBuffetTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_giant_infernal(Creature* _Creature)
+{
+ return new mob_giant_infernalAI(_Creature);
+}
+
+#define SPELL_DISEASE_CLOUD 31607
+#define SPELL_KNOCKDOWN 31610
+
+struct mob_abominationAI : public hyjal_trashAI
+{
+ mob_abominationAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 KnockDownTimer;
+ uint32 pos;
+ void Reset()
+ {
+ KnockDownTimer = 10000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if(!m_creature->HasAura(SPELL_DISEASE_CLOUD,0))
+ DoCast(m_creature,SPELL_DISEASE_CLOUD);
+ if (!UpdateVictim())
+ return;
+ if(KnockDownTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN);
+ KnockDownTimer = 30000+rand()%25000;
+ }else KnockDownTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_abomination(Creature* _Creature)
+{
+ return new mob_abominationAI(_Creature);
+}
+
+#define SPELL_FRENZY 31540
+
+struct mob_ghoulAI : public hyjal_trashAI
+{
+ mob_ghoulAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 FrenzyTimer;
+ uint32 pos;
+ void Reset()
+ {
+ FrenzyTimer = 5000+rand()%5000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if(faction == 0)//alliance round
+ {
+
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED);
+ //m_creature->SetHomePosition(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation());
+ if(faction == 0 && LastOverronPos == 17)//alliance round
+ {
+ Creature* pUnit = m_creature->SummonCreature(m_creature->GetEntry(),4928.48+irand(-10,10), -1526.38+irand(-10,10), 1326.83+irand(-10,10),0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = 6;//default
+ ((hyjal_trashAI*)pUnit->AI())->SetupOverrun = false;
+ pUnit->setActive(true);
+ }
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if(FrenzyTimer<diff)
+ {
+ DoCast(m_creature,SPELL_FRENZY);
+ FrenzyTimer = 15000+rand()%15000;
+ }else FrenzyTimer -= diff;
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_ghoul(Creature* _Creature)
+{
+ return new mob_ghoulAI(_Creature);
+}
+
+#define SPELL_RAISE_DEAD_1 31617
+#define SPELL_RAISE_DEAD_2 31624
+#define SPELL_RAISE_DEAD_3 31625
+#define SPELL_SHADOW_BOLT 31627
+
+struct mob_necromancerAI : public hyjal_trashAI
+{
+ mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(m_creature)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+ SummonList summons;
+ bool go;
+ uint32 ShadowBoltTimer;
+ uint32 pos;
+ void Reset()
+ {
+ ShadowBoltTimer = 1000+rand()%5000;
+ summons.DespawnAll();
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,30,true);
+ if(target && summon)
+ summon->Attack(target,false);
+ summons.Summon(summon);
+ }
+ void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);}
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void KilledUnit(Unit* victim)
+ {
+ switch (rand()%3)
+ {
+ case 0:
+ DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ DoSpawnCreature(17902,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ break;
+ case 1:
+ DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ DoSpawnCreature(17903,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ break;
+ case 2:
+ if(rand()%2)
+ DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ else
+ DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ break;
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(ShadowBoltTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_SHADOW_BOLT);
+ ShadowBoltTimer = 20000+rand()%10000;
+ }else ShadowBoltTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_necromancer(Creature* _Creature)
+{
+ return new mob_necromancerAI(_Creature);
+}
+
+#define SPELL_BANSHEE_CURSE 31651
+#define SPELL_BANSHEE_WAIL 38183
+#define SPELL_ANTI_MAGIC_SHELL 31662
+
+struct mob_bansheeAI : public hyjal_trashAI
+{
+ mob_bansheeAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 CourseTimer;
+ uint32 WailTimer;
+ uint32 ShellTimer;
+ uint32 pos;
+ void Reset()
+ {
+ CourseTimer = 20000+rand()%5000;
+ WailTimer = 15000+rand()%5000;
+ ShellTimer = 50000+rand()%10000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(CourseTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_BANSHEE_CURSE);
+ CourseTimer = 20000+rand()%5000;
+ }else CourseTimer -= diff;
+ if(WailTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_BANSHEE_WAIL);
+ WailTimer = 15000+rand()%5000;
+ }else WailTimer -= diff;
+ if(ShellTimer<diff)
+ {
+ DoCast(m_creature,SPELL_ANTI_MAGIC_SHELL);
+ ShellTimer = 50000+rand()%10000;
+ }else ShellTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_banshee(Creature* _Creature)
+{
+ return new mob_bansheeAI(_Creature);
+}
+
+#define SPELL_WEB 28991
+
+struct mob_crypt_fiendAI : public hyjal_trashAI
+{
+ mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 WebTimer;
+ uint32 pos;
+ void Reset()
+ {
+ WebTimer = 20000+rand()%5000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(WebTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_WEB);
+ WebTimer = 20000+rand()%5000;
+ }else WebTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_crypt_fiend(Creature* _Creature)
+{
+ return new mob_crypt_fiendAI(_Creature);
+}
+
+#define SPELL_MANA_BURN 31729
+
+struct mob_fel_stalkerAI : public hyjal_trashAI
+{
+ mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 ManaBurnTimer;
+ uint32 pos;
+ void Reset()
+ {
+ ManaBurnTimer = 9000+rand()%5000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(ManaBurnTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_MANA_BURN);
+ ManaBurnTimer = 9000+rand()%5000;
+ }else ManaBurnTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_fel_stalker(Creature* _Creature)
+{
+ return new mob_fel_stalkerAI(_Creature);
+}
+
+#define SPELL_FROST_BREATH 31688
+
+struct mob_frost_wyrmAI : public hyjal_trashAI
+{
+ mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 FrostBreathTimer;
+ uint32 pos;
+ uint32 MoveTimer;
+
+ void Reset()
+ {
+ FrostBreathTimer = 5000;
+ MoveTimer = 0;
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 2 && pInstance && !IsOverrun)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ {
+ m_creature->AddThreat(target,0.0);
+ DoCast(target,SPELL_FROST_BREATH,true);
+ }
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ z = m_creature->GetMap()->GetVmapHeight(x, y, z, true);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z);
+ m_creature->Relocate(x,y,z,0);
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ {
+ ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ npc_escortAI::UpdateAI(diff);
+ }
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if(!useFlyPath)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else{//fly path FlyPathWPs
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(m_creature->GetDistance(m_creature->getVictim()) >= 25){
+ if(MoveTimer<diff)
+ {
+ m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
+ MoveTimer = 2000;
+ }else MoveTimer-=diff;
+ }
+
+ if(FrostBreathTimer<diff)
+ {
+ if(m_creature->GetDistance(m_creature->getVictim()) < 25)
+ {
+ DoCast(m_creature->getVictim(),SPELL_FROST_BREATH);
+ m_creature->StopMoving();
+ m_creature->GetMotionMaster()->Clear();
+ FrostBreathTimer = 4000;
+ }
+ }else FrostBreathTimer -= diff;
+ }
+};
+
+
+CreatureAI* GetAI_mob_frost_wyrm(Creature* _Creature)
+{
+ return new mob_frost_wyrmAI(_Creature);
+}
+
+#define SPELL_GARGOYLE_STRIKE 31664
+
+struct mob_gargoyleAI : public hyjal_trashAI
+{
+ mob_gargoyleAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 StrikeTimer;
+ uint32 pos;
+ uint32 MoveTimer;
+ float Zpos;
+ bool forcemove;
+
+ void Reset()
+ {
+ forcemove = true;
+ Zpos = 10.0;
+ StrikeTimer = 2000+rand()%5000;
+ MoveTimer = 0;
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 2 && pInstance && !IsOverrun)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ {
+ m_creature->AddThreat(target,0.0);
+ DoCast(target,SPELL_GARGOYLE_STRIKE,true);
+ }
+ }
+ if (IsOverrun && i == LastOverronPos)
+ {
+ AddWaypoint(0, 5536.65+irand(-80,80), -2710.66+irand(-80,80), 1504.45+irand(-10,10));
+ AddWaypoint(1, 5536.65+irand(-80,80), -2710.66+irand(-80,80), 1504.45+irand(-10,10));
+ SetDespawnAtEnd(false);
+ LastOverronPos = 1;
+ Start(false, true, true);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ z = m_creature->GetMap()->GetVmapHeight(x, y, z, true);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z);
+ m_creature->Relocate(x,y,z,0);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ {
+ ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ npc_escortAI::UpdateAI(diff);
+ }
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if(!useFlyPath)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else{//fly path FlyPathWPs
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(m_creature->GetDistance(m_creature->getVictim()) >= 20 || forcemove)
+ {
+ forcemove = false;
+ if(forcemove)
+ {
+ Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
+ if(target)
+ m_creature->Attack(target,false);
+ }
+ if(MoveTimer<diff)
+ {
+ float x,y,z;
+ m_creature->getVictim()->GetPosition(x,y,z);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z+Zpos);
+ Zpos-=1.0;
+ if(Zpos<=0)Zpos=0;
+ MoveTimer = 2000;
+ }else MoveTimer-=diff;
+ }
+ if(StrikeTimer<diff)
+ {
+ if(m_creature->GetDistance(m_creature->getVictim()) < 20)
+ {
+ DoCast(m_creature->getVictim(),SPELL_GARGOYLE_STRIKE);
+ m_creature->StopMoving();
+ m_creature->GetMotionMaster()->Clear();
+ StrikeTimer = 2000+rand()%1000;
+ }else StrikeTimer=0;
+ }else StrikeTimer -= diff;
+ }
+};
+
+
+CreatureAI* GetAI_mob_gargoyle(Creature* _Creature)
+{
+ return new mob_gargoyleAI(_Creature);
+}
+
+#define SPELL_EXPLODING_SHOT 7896
+
+struct TRINITY_DLL_DECL alliance_riflemanAI : public Scripted_NoMovementAI
+{
+ alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c)
+ {
+ Reset();
+ }
+
+ uint32 ExplodeTimer;
+
+ void JustDied(Unit*)
+ {
+ }
+
+ void Reset()
+ {
+ ExplodeTimer = 5000+rand()%5000;
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (!who || m_creature->getVictim())
+ return;
+
+ if (who->isTargetableForAttack() && m_creature->IsHostileTo(who))
+ {
+ float attackRadius = m_creature->GetAttackDistance(who);
+ if (m_creature->IsWithinDistInMap(who, 30))
+ {
+ AttackStart(who);
+ }
+ }
+ }
+
+ void Aggro(Unit *who)
+ {
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Check if we have a target
+ if (!UpdateVictim())
+ return;
+ if(ExplodeTimer < diff)
+ {
+ if (!m_creature->IsWithinDistInMap(m_creature->getVictim(), 30))
+ {
+ EnterEvadeMode();
+ return;
+ }
+ int dmg = 500+rand()%700;
+ m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false);
+ ExplodeTimer = 5000+rand()%5000;
+ }else ExplodeTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_alliance_rifleman(Creature* _Creature)
+{
+ return new alliance_riflemanAI(_Creature);
+}
+
+void AddSC_hyjal_trash()
+{
+ Script *newscript = new Script;
+ newscript->Name = "mob_giant_infernal";
+ newscript->GetAI = &GetAI_mob_giant_infernal;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_abomination";
+ newscript->GetAI = &GetAI_mob_abomination;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_ghoul";
+ newscript->GetAI = &GetAI_mob_ghoul;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_necromancer";
+ newscript->GetAI = &GetAI_mob_necromancer;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_banshee";
+ newscript->GetAI = &GetAI_mob_banshee;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_crypt_fiend";
+ newscript->GetAI = &GetAI_mob_crypt_fiend;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_fel_stalker";
+ newscript->GetAI = &GetAI_mob_fel_stalker;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_frost_wyrm";
+ newscript->GetAI = &GetAI_mob_frost_wyrm;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "mob_gargoyle";
+ newscript->GetAI = &GetAI_mob_gargoyle;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "alliance_rifleman";
+ newscript->GetAI = &GetAI_alliance_rifleman;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
new file mode 100644
index 00000000000..2473184dc87
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
@@ -0,0 +1,37 @@
+
+#ifndef SC_HYJAL_TRASH_AI_H
+#define SC_HYJAL_TRASH_AI_H
+
+#include "def_hyjal.h"
+#include "../../../npc/npc_escortAI.h"
+
+struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI
+{
+ hyjal_trashAI(Creature *c);
+
+ void Reset();
+
+ //void EnterEvadeMode();
+
+ void Aggro(Unit *who);
+
+ void UpdateAI(const uint32 diff);
+
+ void JustDied(Unit* killer);
+
+ void DamageTaken(Unit *done_by, uint32 &damage);
+
+ public:
+ ScriptedInstance* pInstance;
+ bool IsEvent;
+ uint32 Delay;
+ uint32 LastOverronPos;
+ bool IsOverrun;
+ bool SetupOverrun;
+ uint32 OverrunType;
+ uint8 faction;
+ bool useFlyPath;
+
+ //private:
+};
+#endif \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
index 44419b37575..1a0aaafb35b 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
@@ -46,10 +46,16 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
uint64 JainaProudmoore;
uint64 Thrall;
uint64 TyrandeWhisperwind;
+ uint64 HordeGate;
+ uint64 ElfGate;
uint32 Trash;
uint32 Encounters[ENCOUNTERS];
+ uint32 hordeRetreat;
+ uint32 allianceRetreat;
+ bool ArchiYell;
+
void Initialize()
{
RageWinterchill = 0;
@@ -60,10 +66,17 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
JainaProudmoore = 0;
Thrall = 0;
TyrandeWhisperwind = 0;
+ HordeGate = 0;
+ ElfGate = 0;
+ ArchiYell = false;
Trash = 0;
for(uint8 i = 0; i < ENCOUNTERS; ++i)
Encounters[i] = NOT_STARTED;
+
+ hordeRetreat = 0;
+ allianceRetreat = 0;
+
}
bool IsEncounterInProgress() const
@@ -74,6 +87,33 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
return false;
}
+ void OnObjectCreate(GameObject *go)
+ {
+ switch(go->GetEntry())
+ {
+ case 182060:
+ HordeGate = go->GetGUID();
+ if(allianceRetreat)
+ go->SetGoState(0);
+ else
+ go->SetGoState(1);
+ break;
+ case 182061:
+ ElfGate = go->GetGUID();
+ if(hordeRetreat)
+ go->SetGoState(0);
+ else
+ go->SetGoState(1);
+ break;
+ }
+ }
+
+ void OpenDoor(uint64 DoorGUID, bool open)
+ {
+ if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID))
+ Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1);
+ }
+
void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{
switch(creature_entry)
@@ -111,9 +151,49 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
switch(type)
{
case DATA_RAGEWINTERCHILLEVENT: Encounters[0] = data; break;
- case DATA_ANETHERONEVENT: Encounters[1] = data; break;
+ case DATA_ANETHERONEVENT:
+ Encounters[1] = data;
+ break;
case DATA_KAZROGALEVENT: Encounters[2] = data; break;
- case DATA_AZGALOREVENT: Encounters[3] = data; break;
+ case DATA_AZGALOREVENT:
+ {
+ Encounters[3] = data;
+ if(data==DONE)
+ {
+ if(ArchiYell)break;
+ ArchiYell = true;
+
+ Creature* pCreature = instance->GetCreatureInMap(Azgalor);
+ if(pCreature)
+ {
+ Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);
+
+ Map *map = pCreature->GetMap();
+ if (map->IsDungeon() && pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ Map::PlayerList const &PlayerList = map->GetPlayers();
+ if (PlayerList.isEmpty())
+ return;
+
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ {
+ if (i->getSource())
+ {
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+ pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,"All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more.",0,"Archimonde",i->getSource()->GetGUID());
+ i->getSource()->GetSession()->SendPacket(&data);
+
+ WorldPacket data2(SMSG_PLAY_SOUND, 4);
+ data2 << 10986;
+ i->getSource()->GetSession()->SendPacket(&data2);
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
case DATA_ARCHIMONDEEVENT: Encounters[4] = data; break;
case DATA_RESET_TRASH_COUNT: Trash = 0; break;
@@ -122,6 +202,16 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
else Trash--;
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
break;
+ case DATA_ALLIANCE_RETREAT:
+ allianceRetreat = data;
+ OpenDoor(HordeGate,true);
+ SaveToDB();
+ break;
+ case DATA_HORDE_RETREAT:
+ hordeRetreat = data;
+ OpenDoor(ElfGate,true);
+ SaveToDB();
+ break;
}
debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data);
@@ -140,6 +230,8 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
case DATA_AZGALOREVENT: return Encounters[3];
case DATA_ARCHIMONDEEVENT: return Encounters[4];
case DATA_TRASH: return Trash;
+ case DATA_ALLIANCE_RETREAT: return allianceRetreat;
+ case DATA_HORDE_RETREAT: return hordeRetreat;
}
return 0;
}
@@ -147,7 +239,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
void UpdateWorldState(uint32 id, uint32 state)
{
Map::PlayerList const& players = instance->GetPlayers();
-
+
if (!players.isEmpty())
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -163,7 +255,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " "
- << Encounters[3] << " " << Encounters[4];
+ << Encounters[3] << " " << Encounters[4] << " " << allianceRetreat << " " << hordeRetreat;
char* out = new char[stream.str().length() + 1];
strcpy(out, stream.str().c_str());
if(out)
@@ -186,7 +278,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
std::istringstream loadStream;
loadStream.str(in);
- loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4];
+ loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> allianceRetreat >> hordeRetreat;
for(uint8 i = 0; i < ENCOUNTERS; ++i)
if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead.
Encounters[i] = NOT_STARTED;