diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/Makefile.am | 2 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 4 | ||||
-rw-r--r-- | src/bindings/scripts/VC71/71ScriptDev2.vcproj | 8 | ||||
-rw-r--r-- | src/bindings/scripts/VC80/80ScriptDev2.vcproj | 8 | ||||
-rw-r--r-- | src/bindings/scripts/VC90/90ScriptDev2.vcproj | 8 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/uldaman/boss_archaedas.cpp | 491 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp | 290 |
7 files changed, 811 insertions, 0 deletions
diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index b691b0cbdc2..f7636f49847 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -368,6 +368,8 @@ scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp \ scripts/zone/terokkar_forest/terokkar_forest.cpp \ scripts/zone/thunder_bluff/thunder_bluff.cpp \ scripts/zone/tirisfal_glades/tirisfal_glades.cpp \ +scripts/zone/uldaman/boss_archaedas.cpp \ +scripts/zone/uldaman/instance_uldaman.cpp \ scripts/zone/uldaman/boss_ironaya.cpp \ scripts/zone/uldaman/uldaman.cpp \ scripts/zone/undercity/undercity.cpp \ diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 344a865b7dd..f045a33970a 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -541,8 +541,10 @@ extern void AddSC_thunder_bluff(); extern void AddSC_tirisfal_glades(); //Uldaman +extern void AddSC_boss_archaedas(); extern void AddSC_boss_ironaya(); extern void AddSC_uldaman(); +extern void AddSC_instance_uldaman(); //Undercity extern void AddSC_undercity(); @@ -1731,8 +1733,10 @@ void ScriptsInit() AddSC_tirisfal_glades(); //Uldaman + AddSC_boss_archaedas(); AddSC_boss_ironaya(); AddSC_uldaman(); + AddSC_instance_uldaman(); //Undercity AddSC_undercity(); diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index 8cb81e141a3..06d70884e5a 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -1141,6 +1141,14 @@ <Filter Name="Uldaman" > + <File + RelativePath="..\scripts\zone\uldaman\boss_archaedas.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\uldaman\instance_uldaman.cpp" + > + </File> <File RelativePath="..\scripts\zone\uldaman\boss_ironaya.cpp" > diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index e41472e7a91..b578b23d880 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1386,6 +1386,14 @@ <Filter Name="Uldaman" > + <File + RelativePath="..\scripts\zone\uldaman\boss_archaedas.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\uldaman\instance_uldaman.cpp" + > + </File> <File RelativePath="..\scripts\zone\uldaman\boss_ironaya.cpp" > diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 530e99ea70c..ac26d53065b 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -1372,6 +1372,14 @@ <Filter Name="Uldaman" > + <File + RelativePath="..\scripts\zone\uldaman\boss_archaedas.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\uldaman\instance_uldaman.cpp" + > + </File> <File RelativePath="..\scripts\zone\uldaman\boss_ironaya.cpp" > diff --git a/src/bindings/scripts/scripts/zone/uldaman/boss_archaedas.cpp b/src/bindings/scripts/scripts/zone/uldaman/boss_archaedas.cpp new file mode 100644 index 00000000000..2559212debc --- /dev/null +++ b/src/bindings/scripts/scripts/zone/uldaman/boss_archaedas.cpp @@ -0,0 +1,491 @@ +/* Copyright (C) 2006,2007 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* ScriptData +SDName: boss_archaedas +SD%Complete: 100 +SDComment: Archaedas is activated when 3 prople click on his altar. +Every 10 seconds he will awaken one of his minions along the wall. +At 66%, he will awaken the 6 Guardians. +At 33%, he will awaken the Vault Walkers +On his death the vault door opens. +EndScriptData */ + +#include "precompiled.h" + + +#define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!" +#define SOUND_AGGRO 5855 + +#define SAY_SUMMON "Awake ye servants, defend the discs!" +#define SOUND_SUMMON 5856 + +#define SAY_SUMMON2 "To my side, brothers. For the makers!" +#define SOUND_SUMMON2 5857 + +#define SAY_KILL "Reckless mortal." +#define SOUND_KILL 5858 + +#define SPELL_GROUND_TREMOR 6524 +#define SPELL_ARCHAEDAS_AWAKEN 10347 +#define SPELL_BOSS_OBJECT_VISUAL 11206 +#define SPELL_BOSS_AGGRO 10340 +#define SPELL_SUB_BOSS_AGGRO 11568 +#define SPELL_AWAKEN_VAULT_WALKER 10258 +#define SPELL_AWAKEN_EARTHEN_GUARDIAN 10252 + +struct TRINITY_DLL_DECL boss_archaedasAI : public ScriptedAI +{ + boss_archaedasAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)m_creature->GetInstanceData()); + Reset(); + } + + uint32 Tremor_Timer; + int32 Awaken_Timer; + uint32 WallMinionTimer; + bool wakingUp; + + bool InCombat; + bool guardiansAwake; + bool vaultWalkersAwake; + ScriptedInstance* pInstance; + + void Reset() + { + Tremor_Timer = 60000; + Awaken_Timer = 0; + WallMinionTimer = 10000; + + InCombat = false; + wakingUp = false; + guardiansAwake = false; + vaultWalkersAwake = false; + + if (pInstance) pInstance->SetData (NULL, 5); // respawn any dead minions + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + + } + + void ActivateMinion (uint64 guid, bool flag) + { + Unit *minion = Unit::GetUnit(*m_creature, guid); + + if (minion && minion->isAlive()) + { + DoCast (minion, SPELL_AWAKEN_VAULT_WALKER, flag); + minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN,true); + } + } + + + void Aggro(Unit *who) + { + m_creature->setFaction (14); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); + } + + void SpellHit (Unit* caster, const SpellEntry *spell) + { + // Being woken up from the altar, start the awaken sequence + if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN)) { + DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(m_creature,SOUND_AGGRO); + Awaken_Timer = 4000; + wakingUp = true; + } + } + + void KilledUnit(Unit *victim) + { + DoYell(SAY_KILL,LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(m_creature, SOUND_KILL); + } + + void UpdateAI(const uint32 diff) + { + // we're still doing awaken animation + if (wakingUp && Awaken_Timer >= 0) { + Awaken_Timer -= diff; + return; // dont do anything until we are done + } else if (wakingUp && Awaken_Timer <= 0) { + wakingUp = false; + AttackStart(Unit::GetUnit(*m_creature, pInstance->GetData64(0))); + return; // dont want to continue until we finish the AttackStart method + } + + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + + // wake a wall minion + if (WallMinionTimer < diff) { + pInstance->SetData (NULL, 2); + + WallMinionTimer = 10000; + } else WallMinionTimer -= diff; + + //If we are <66 summon the guardians + if ( !guardiansAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 66) { + ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1 + ActivateMinion(pInstance->GetData64(6),true); // EarthenGuardian2 + ActivateMinion(pInstance->GetData64(7),true); // EarthenGuardian3 + ActivateMinion(pInstance->GetData64(8),true); // EarthenGuardian4 + ActivateMinion(pInstance->GetData64(9),true); // EarthenGuardian5 + ActivateMinion(pInstance->GetData64(10),false); // EarthenGuardian6 + DoYell(SAY_SUMMON,LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(m_creature, SOUND_SUMMON); + guardiansAwake = true; + } + + //If we are <33 summon the vault walkers + if ( !vaultWalkersAwake && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 33) { + ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1 + ActivateMinion(pInstance->GetData64(2),true); // VaultWalker2 + ActivateMinion(pInstance->GetData64(3),true); // VaultWalker3 + ActivateMinion(pInstance->GetData64(4),false); // VaultWalker4 + DoYell(SAY_SUMMON2, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(m_creature, SOUND_SUMMON2); + vaultWalkersAwake = true; + } + + + if (Tremor_Timer < diff) + { + //Cast + DoCast(m_creature->getVictim(),SPELL_GROUND_TREMOR); + + //45 seconds until we should cast this agian + Tremor_Timer = 45000; + }else Tremor_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied (Unit *killer) { + pInstance->SetData(NULL,3); // open the vault door + pInstance->SetData(NULL,4); // deactivate his minions + } + +}; + +CreatureAI* GetAI_boss_archaedas(Creature *_Creature) +{ + return new boss_archaedasAI (_Creature); +} + +/* ScriptData +SDName: mob_archaedas_minions +SD%Complete: 100 +SDComment: These mobs are initially frozen until Archaedas awakens them +one at a time. +EndScriptData */ + + +#define SPELL_ARCHAEDAS_AWAKEN 10347 + +struct TRINITY_DLL_DECL mob_archaedas_minionsAI : public ScriptedAI +{ + mob_archaedas_minionsAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)m_creature->GetInstanceData()); + Reset(); + } + + uint32 Arcing_Timer; + int32 Awaken_Timer; + bool wakingUp; + + bool InCombat; + bool amIAwake; + ScriptedInstance* pInstance; + + void Reset() + { + Arcing_Timer = 3000; + Awaken_Timer = 0; + + InCombat = false; + wakingUp = false; + amIAwake = false; + + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + m_creature->RemoveAllAuras(); + } + + void Aggro(Unit *who) + { + m_creature->setFaction (14); + m_creature->RemoveAllAuras(); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + amIAwake = true; + } + + void SpellHit (Unit* caster, const SpellEntry *spell) { + // time to wake up, start animation + if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN)){ + Awaken_Timer = 5000; + wakingUp = true; + } + } + + void MoveInLineOfSight(Unit *who) + { + if(amIAwake) + ScriptedAI::MoveInLineOfSight(who); + } + + void UpdateAI(const uint32 diff) + { + // we're still in the awaken animation + if (wakingUp && Awaken_Timer >= 0) { + Awaken_Timer -= diff; + return; // dont do anything until we are done + } else if (wakingUp && Awaken_Timer <= 0) { + wakingUp = false; + amIAwake = true; + AttackStart(Unit::GetUnit(*m_creature, pInstance->GetData64(0))); // whoWokeArchaedasGUID + return; // dont want to continue until we finish the AttackStart method + } + + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_archaedas_minions(Creature *_Creature) +{ + return new mob_archaedas_minionsAI (_Creature); +} + +/* ScriptData +SDName: go_altar_archaedas +SD%Complete: 100 +SDComment: Needs 3 people to activate the Archaedas script +SDCategory: Uldaman +EndScriptData */ + + +#define OBJECT_ALTAR_OF_ARCHAEDAS 133234 + +#define NUMBER_NEEDED_TO_ACTIVATE 3 + +#define SPELL_BOSS_OBJECT_VISUAL 11206 + +uint64 altarOfArchaedasCount[5]; +int32 altarOfArchaedasCounter=0; + + +bool GOHello_go_altar_of_archaedas(Player *player, GameObject* go) +{ + bool alreadyUsed; + go->AddUse (); + + alreadyUsed = false; + for (uint32 loop=0; loop<5; loop++) { + if (altarOfArchaedasCount[loop] == player->GetGUID()) alreadyUsed = true; + } + if (!alreadyUsed) + altarOfArchaedasCount[altarOfArchaedasCounter++] = player->GetGUID(); + + player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false); + + if (altarOfArchaedasCounter < NUMBER_NEEDED_TO_ACTIVATE) { + return false; // not enough people yet + } + + // Check to make sure at least three people are still casting + uint32 count=0; + Unit *pTarget; + for (uint32 x=0; x<=5; x++) { + pTarget = Unit::GetUnit(*player, altarOfArchaedasCount[x]); + if (!pTarget) continue; + if (pTarget->IsNonMeleeSpellCasted(true)) count++; + if (count >= NUMBER_NEEDED_TO_ACTIVATE) break; + } + + if (count < NUMBER_NEEDED_TO_ACTIVATE) { + return false; // not enough people + } + + ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData()); + if (!pInstance) return false; + pInstance->SetData(NULL,0); + pInstance->SetData64(0,player->GetGUID()); // activate archaedas + + return false; +} + +/* ScriptData +SDName: mob_stonekeepers +SD%Complete: 100 +SDComment: After activating the altar of the keepers, the stone keepers will +wake up one by one. +EndScriptData */ + +#include "precompiled.h" + +#define SPELL_SELF_DESTRUCT 9874 + +struct TRINITY_DLL_DECL mob_stonekeepersAI : public ScriptedAI +{ + mob_stonekeepersAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)m_creature->GetInstanceData()); + Reset(); + } + + bool InCombat; + ScriptedInstance* pInstance; + + void Reset() + { + InCombat = false; + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + m_creature->RemoveAllAuras(); + } + + void Aggro(Unit *who) + { + m_creature->setFaction (14); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + } + + void UpdateAI(const uint32 diff) + { + + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void DamageTaken (Unit *attacker, uint32 &damage) { + if (damage > m_creature->GetHealth()) { + DoCast (m_creature, SPELL_SELF_DESTRUCT,true); + pInstance->SetData(NULL, 1); // activate next stonekeeper + } + } + +}; + +CreatureAI* GetAI_mob_stonekeepers(Creature *_Creature) +{ + return new mob_stonekeepersAI (_Creature); +} + +/* ScriptData +SDName: go_altar_of_the_keepers +SD%Complete: 100 +SDComment: Need 3 people to activate to open the altar. One by one the StoneKeepers will activate. After all four are dead than the door will open. +SDCategory: Uldaman +EndScriptData */ + + +#define SPELL_BOSS_OBJECT_VISUAL 11206 + +#define NUMBER_NEEDED_TO_ACTIVATE 3 + +static uint64 altarOfTheKeeperCount[5]; +static uint32 altarOfTheKeeperCounter=0; + + +bool GOHello_go_altar_of_the_keepers(Player *player, GameObject* go) +{ + bool alreadyUsed; + + go->AddUse (); + + alreadyUsed = false; + for (uint32 loop=0; loop<5; loop++) { + if (altarOfTheKeeperCount[loop] == player->GetGUID()) alreadyUsed = true; + } + if (!alreadyUsed) + altarOfTheKeeperCount[altarOfTheKeeperCounter++] = player->GetGUID(); + player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false); + + if (altarOfTheKeeperCounter < NUMBER_NEEDED_TO_ACTIVATE) { + //error_log ("not enough people yet, altarOfTheKeeperCounter = %d", altarOfTheKeeperCounter); + return false; // not enough people yet + } + + // Check to make sure at least three people are still casting + uint32 count=0; + Unit *pTarget; + for (uint32 x=0; x<=5; x++) { + pTarget = Unit::GetUnit(*player, altarOfTheKeeperCount[x]); + //error_log ("number of people currently activating it: %d", x+1); + if (!pTarget) continue; + if (pTarget->IsNonMeleeSpellCasted(true)) count++; + if (count >= NUMBER_NEEDED_TO_ACTIVATE) break; + } + + if (count < NUMBER_NEEDED_TO_ACTIVATE) { + // error_log ("still not enough people"); + return false; // not enough people + } + + ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData()); + if (!pInstance) return false; + //error_log ("activating stone keepers"); + pInstance->SetData(NULL,1); // activate the Stone Keepers + return true; +} + +void AddSC_boss_archaedas() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_archaedas"; + newscript->GetAI = GetAI_boss_archaedas; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_altar_of_archaedas"; + newscript->pGOHello = &GOHello_go_altar_of_archaedas; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_archaedas_minions"; + newscript->GetAI = GetAI_mob_archaedas_minions; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_altar_of_the_keepers"; + newscript->pGOHello = &GOHello_go_altar_of_the_keepers; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_stonekeepers"; + newscript->GetAI = GetAI_mob_stonekeepers; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp b/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp new file mode 100644 index 00000000000..60776ec9c65 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp @@ -0,0 +1,290 @@ +/* Copyright (C) 2006,2007 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include "precompiled.h" + + +#define SPELL_ARCHAEDAS_AWAKEN 10347 +#define SPELL_AWAKEN_VAULT_WALKER 10258 + +#define ARCHAEDAS_TEMPLE_DOOR 141869 +#define ALTAR_OF_ARCHAEDAS 133234 + +#define ALTAR_OF_THE_KEEPER_TEMPLE_DOOR 124367 +#define ALTAR_OF_THE_KEEPER_TEMPLE 130511 + +#define ANCIENT_VAULT_DOOR 124369 + +struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance +{ + instance_uldaman(Map *Map) : ScriptedInstance(Map) { + Initialize(); + stoneKeepersCounter = 0; + altarOfTheKeeperCounter = 0; + vaultWalkerCounter = 0; + earthenGuardianCounter = 0; + archaedasWallMinionsCounter = 0; + whoWokeArchaedasGUID = 0; + }; + + + Creature* archaedas; + uint64 stoneKeeper[4]; + uint32 stoneKeepersCounter; + + uint64 altarOfTheKeeperCount[5]; + uint32 altarOfTheKeeperCounter; + + uint64 vaultWalker[4]; + uint32 vaultWalkerCounter; + + uint64 earthenGuardian[6]; + uint32 earthenGuardianCounter; + + uint64 archaedasWallMinions[100]; // minions lined up around the wall + uint32 archaedasWallMinionsCounter; + + GameObject *altarOfTheKeeperTempleDoor; + GameObject *archaedasTempleDoor; + GameObject *ancientVaultDoor; + + uint64 whoWokeArchaedasGUID; + + void OnObjectCreate (GameObject* go) { + switch (go->GetEntry()) { + case ALTAR_OF_THE_KEEPER_TEMPLE_DOOR: // lock the door + altarOfTheKeeperTempleDoor = go; + break; + + case ARCHAEDAS_TEMPLE_DOOR: + archaedasTempleDoor = go; + break; + + case ANCIENT_VAULT_DOOR: + go->SetUInt32Value(GAMEOBJECT_STATE,1); + go->SetUInt32Value(GAMEOBJECT_FLAGS, 33); + ancientVaultDoor = go; + break; + } + } + + void SetFrozenState(Creature *creature) { + creature->setFaction(35); + creature->RemoveAllAuras(); + //creature->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_ANIMATION_FROZEN); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + } + + void OpenDoor (GameObject *go) { + if (!go) return; + go->SetUInt32Value(GAMEOBJECT_FLAGS, 33); + go->SetUInt32Value(GAMEOBJECT_STATE, 0); + } + + + + void ActivateStoneKeepers() { + Creature *target; + uint32 counter = stoneKeepersCounter; + // error_log ("ActivateStoneKeepers"); + // error_log ("counter = %d", counter); + for (; counter>0; ) { + target = (Creature *) Unit::GetUnit(*archaedas,stoneKeeper[--counter]); + if (!target || !target->isAlive() || target->getFaction()==14) continue; + target->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); + target->setFaction(14); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return; // only want the first one we find + } + // error_log ("opening doors"); + // if we get this far than all four are dead so open the door + SetData (NULL, 0); + } + + void ActivateWallMinions() { + Creature *target; + uint32 counter = archaedasWallMinionsCounter; + for (; counter>0; ) { + target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]); + if (!target || !target->isAlive() || target->getFaction()==14) continue; + archaedas->CastSpell (target, SPELL_AWAKEN_VAULT_WALKER, true); + target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN,true); + return; // only want the first one we find + } + } + + // used when Archaedas dies. All active minions must be despawned. + void DeActivateMinions() { + Creature *target; + uint32 counter = archaedasWallMinionsCounter; + + // first despawn any aggroed wall minions + for (; counter>0; ) { + target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]); + if (!target || target->isDead() || target->getFaction()!=14) continue; + target->RemoveFromWorld(); + target->AI()->EnterEvadeMode(); // need this b/c it still attacks even when removed + } + + // Vault Walkers + for (counter=0; counter<4; counter++) { + target = (Creature *) Unit::GetUnit(*archaedas,vaultWalker[counter]); + if (!target || target->isDead() || target->getFaction() != 14) continue; + target->RemoveFromWorld(); + target->AI()->EnterEvadeMode(); // need this b/c it sill attacks even when removed + } + + // Earthen Guardians + for (counter=0; counter<6; counter++) { + target = (Creature *) Unit::GetUnit(*archaedas,earthenGuardian[counter]); + if (!target || target->isDead() || target->getFaction() != 14) continue; + target->RemoveFromWorld(); + target->AI()->EnterEvadeMode(); // need this b/c it sill attacks even when removed + } + } + + void ActivateArchaedas(uint64 target) { + + Unit *victim = Unit::GetUnit(*archaedas, target); + archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN,false); + whoWokeArchaedasGUID = target; + } + + void RespawnMinions() { + Creature *target; + uint32 counter = archaedasWallMinionsCounter; + + // first respawn any wall minions + for (; counter>0; ) { + target = (Creature *) Unit::GetUnit(*archaedas,archaedasWallMinions[--counter]); + if (target && target->isDead()) { + target->Respawn(); + target->GetMotionMaster()->MoveTargetedHome(); + //target->AI()->EnterEvadeMode(); + SetFrozenState(target); + } + } + + // Vault Walkers + for (counter=0; counter<4; counter++) { + target = (Creature *) Unit::GetUnit(*archaedas,vaultWalker[counter]); + if (target && target->isDead()) { + target->Respawn(); + target->GetMotionMaster()->MoveTargetedHome(); + // target->AI()->EnterEvadeMode(); + SetFrozenState(target); + } + } + + // Earthen Guardians + for (counter=0; counter<6; counter++) { + target = (Creature *) Unit::GetUnit(*archaedas,earthenGuardian[counter]); + if (target && target->isDead()) { + target->Respawn(); + target->GetMotionMaster()->MoveTargetedHome(); + //target->AI()->EnterEvadeMode(); + SetFrozenState(target); + } + } + + } + + void SetData (uint32 type, uint32 data) { + //error_log ("SetData: data = %d", data); + if (data==0) OpenDoor (altarOfTheKeeperTempleDoor); + if (data==0) OpenDoor (archaedasTempleDoor); + if (data==3) OpenDoor (ancientVaultDoor); + if (data==1) ActivateStoneKeepers(); + if (data==2) ActivateWallMinions(); + if (data==4) DeActivateMinions(); + if (data==5) RespawnMinions(); + } + + + void SetData64 (uint32 type, uint64 data) { + if (type==0 ) { // Archaedas + ActivateArchaedas (data); + } + } + + + void OnCreatureCreate (Creature *creature, uint32 creature_entry) + { + switch (creature_entry) { + case 4857: // Stone Keeper + SetFrozenState (creature); + stoneKeeper[stoneKeepersCounter++] = creature->GetGUID(); + break; + + case 7309: // Earthen Custodian + archaedasWallMinions[archaedasWallMinionsCounter++] = creature->GetGUID(); + break; + + case 7077: // Earthen Hallshaper + archaedasWallMinions[archaedasWallMinionsCounter++] = creature->GetGUID(); + break; + + case 7076: // Earthen Guardian + earthenGuardian[earthenGuardianCounter++] = creature->GetGUID(); + break; + + case 10120: // Vault Walker + vaultWalker[vaultWalkerCounter++] = creature->GetGUID(); + break; + + case 2748: // Archaedas + archaedas = creature; + break; + + } // end switch + } // end OnCreatureCreate + + uint64 GetData64 (uint32 identifier) { + if (identifier == 0) return whoWokeArchaedasGUID; + if (identifier == 1) return vaultWalker[0]; // VaultWalker1 + if (identifier == 2) return vaultWalker[1]; // VaultWalker2 + if (identifier == 3) return vaultWalker[2]; // VaultWalker3 + if (identifier == 4) return vaultWalker[3]; // VaultWalker4 + + if (identifier == 5) return earthenGuardian[0]; + if (identifier == 6) return earthenGuardian[1]; + if (identifier == 7) return earthenGuardian[2]; + if (identifier == 8) return earthenGuardian[3]; + if (identifier == 9) return earthenGuardian[4]; + if (identifier == 10) return earthenGuardian[5]; + + return 0; + } // end GetData64 + +}; + + + +InstanceData* GetInstanceData_instance_uldaman(Map* map) +{ + return new instance_uldaman(map); +} + +void AddSC_instance_uldaman() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_uldaman"; + newscript->GetInstanceData = GetInstanceData_instance_uldaman; + newscript->RegisterSelf(); +} |