diff options
15 files changed, 1236 insertions, 146 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index f3571ca07f8..aecde61b73d 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -1198,6 +1198,19 @@ UPDATE `creature_template` SET `ScriptName`='boss_emalon' WHERE `entry`=33993; UPDATE `creature_template` SET `ScriptName`='mob_tempest_minion' WHERE `entry`=33998; UPDATE `instance_template` SET `script`='instance_archavon' WHERE `map`=624; +/* VIOLET HOLD */ +UPDATE `creature_template` SET `ScriptName`='npc_sinclari_vh' WHERE `entry`=30658; +UPDATE `creature_template` SET `ScriptName`='npc_teleportation_portal_vh' WHERE `entry`=31011; +UPDATE `creature_template` SET `ScriptName`='boss_lavanthor' WHERE `entry`=29312; +UPDATE `creature_template` SET `ScriptName`='boss_ichoron' WHERE `entry`=29313; +UPDATE `creature_template` SET `ScriptName`='boss_zuramat' WHERE `entry`=29314; +UPDATE `creature_template` SET `ScriptName`='boss_erekem' WHERE `entry`=29315; +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=32226; +UPDATE `creature_template` SET `ScriptName`='boss_moragg' WHERE `entry`=29316; +UPDATE `creature_template` SET `ScriptName`='boss_xevozz' WHERE `entry`=29266; +UPDATE `creature_template` SET `ScriptName`='boss_cyanigosa' WHERE `entry`=31134; +UPDATE `instance_template` SET `script`='instance_violet_hold' WHERE `map`=608; + /* WAILING CAVERNS */ UPDATE `creature_template` SET `ScriptName`='npc_disciple_of_naralex' WHERE entry=3678; UPDATE `instance_template` SET `script`='instance_wailing_caverns' WHERE map=43; diff --git a/sql/updates/5936_world_scripts.sql b/sql/updates/5936_world_scripts.sql new file mode 100644 index 00000000000..eb319458a30 --- /dev/null +++ b/sql/updates/5936_world_scripts.sql @@ -0,0 +1,12 @@ + +UPDATE `creature_template` SET `ScriptName`='npc_sinclari_vh' WHERE `entry`=30658; +UPDATE `creature_template` SET `ScriptName`='npc_teleportation_portal_vh' WHERE `entry`=31011; +UPDATE `creature_template` SET `ScriptName`='boss_lavanthor' WHERE `entry`=29312; +UPDATE `creature_template` SET `ScriptName`='boss_ichoron' WHERE `entry`=29313; +UPDATE `creature_template` SET `ScriptName`='boss_zuramat' WHERE `entry`=29314; +UPDATE `creature_template` SET `ScriptName`='boss_erekem' WHERE `entry`=29315; +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=32226; +UPDATE `creature_template` SET `ScriptName`='boss_moragg' WHERE `entry`=29316; +UPDATE `creature_template` SET `ScriptName`='boss_xevozz' WHERE `entry`=29266; +UPDATE `creature_template` SET `ScriptName`='boss_cyanigosa' WHERE `entry`=31134; +UPDATE `instance_template` SET `script`='instance_violet_hold' WHERE `map`=608; diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index fcd9e9719f3..ad161de89a0 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -408,6 +408,7 @@ SET(trinityscript_LIB_SRCS scripts/northrend/violet_hold/boss_xevozz.cpp scripts/northrend/violet_hold/boss_zuramat.cpp scripts/northrend/violet_hold/def_violet_hold.h + scripts/northrend/violet_hold/violet_hold.cpp scripts/northrend/borean_tundra.cpp scripts/northrend/dragonblight.cpp scripts/northrend/grizzly_hills.cpp diff --git a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp index ded3170e22c..334862d9d97 100644 --- a/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/bindings/scripts/scripts/northrend/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp @@ -293,7 +293,7 @@ struct TRINITY_DLL_DECL npc_anub_ar_shadowcasterAI : public ScriptedAI if(ShadowBoltTimer < diff) { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,100,true)) DoCast(target, HEROIC(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT), true); ShadowBoltTimer = 15000; } else ShadowBoltTimer -= diff; @@ -464,7 +464,7 @@ struct TRINITY_DLL_DECL npc_watcher_silthikAI : public ScriptedAI if(PosionSprayTimer < diff) { - DoCast(m_creature->getVictim(), HEROIC(SPELL_POSION_SPRAY , H_SPELL_POSION_SPRAY), true); + DoCast(m_creature->getVictim(), HEROIC(SPELL_POSION_SPRAY, H_SPELL_POSION_SPRAY), true); PosionSprayTimer = 17000; } else PosionSprayTimer -= diff; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp index 24f2f38c876..a55e68ebb91 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_cyanigosa.cpp @@ -10,60 +10,121 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_ARCANE_VACUM 58694 -#define SPELL_BLIZZARD 58693 -#define SPELL_MANA_DESTRUCTION 59374 -#define SPELL_TAIL_SWEEP 58690 -#define SPELL_UNCONTROLLABLE_ENERGY 58688 +enum Spells +{ + SPELL_ARCANE_VACUM = 58694, + SPELL_BLIZZARD = 58693, + H_SPELL_BLIZZARD = 59369, + SPELL_MANA_DESTRUCTION = 59374, + SPELL_TAIL_SWEEP = 58690, + H_SPELL_TAIL_SWEEP = 59283, + SPELL_UNCONTROLLABLE_ENERGY = 58688, + H_SPELL_UNCONTROLLABLE_ENERGY = 59281 +}; -//not in db -//Yells -#define SAY_AGGRO -1608000 -#define SAY_SLAY_1 -1608001 -#define SAY_SLAY_2 -1608002 -#define SAY_SLAY_3 -1608003 -#define SAY_DEATH -1608004 -#define SAY_SPAWN -1608005 -#define SAY_DISRUPTION -1608006 -#define SAY_BREATH_ATTACK -1608007 -#define SAY_SPECIAL_ATTACK_1 -1608008 -#define SAY_SPECIAL_ATTACK_2 -1608009 +enum Yells +{ + SAY_AGGRO = -1608000, + SAY_SLAY_1 = -1608001, + SAY_SLAY_2 = -1608002, + SAY_SLAY_3 = -1608003, + SAY_DEATH = -1608004, + SAY_SPAWN = -1608005, + SAY_DISRUPTION = -1608006, + SAY_BREATH_ATTACK = -1608007, + SAY_SPECIAL_ATTACK_1 = -1608008, + SAY_SPECIAL_ATTACK_2 = -1608009 +}; struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI { - boss_cyanigosaAI(Creature *c) : ScriptedAI(c) {} + boss_cyanigosaAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiArcaneVacumTimer; + uint32 uiBlizzardTimer; + uint32 uiManaDestructionTimer; + uint32 uiTailSweepTimer; + uint32 uiUncontrollableEnergyTimer; + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); + } + void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); } - void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; + + if (uiArcaneVacumTimer < diff) + { + DoCast(m_creature, SPELL_ARCANE_VACUM); + } else uiArcaneVacumTimer -= diff; + + if (uiBlizzardTimer < diff) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + while (pTarget && pTarget->GetTypeId() != TYPEID_PLAYER) + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, HeroicMode ? H_SPELL_BLIZZARD : SPELL_BLIZZARD); + } else uiBlizzardTimer -= diff; + + if (uiTailSweepTimer < diff) + { + DoCast(m_creature, HeroicMode ? H_SPELL_TAIL_SWEEP : SPELL_TAIL_SWEEP); + } else uiTailSweepTimer -= diff; + + if (uiUncontrollableEnergyTimer < diff) + { + DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_UNCONTROLLABLE_ENERGY : SPELL_UNCONTROLLABLE_ENERGY); + } else uiUncontrollableEnergyTimer -= diff; + + if (HeroicMode) + if (uiManaDestructionTimer < diff) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + while (pTarget && pTarget->GetTypeId() != TYPEID_PLAYER) + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_MANA_DESTRUCTION); + } else uiManaDestructionTimer -= diff; DoMeleeAttackIfReady(); } + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); } + void KilledUnit(Unit *victim) { if (victim == m_creature) return; - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature);break; - case 1: DoScriptText(SAY_SLAY_2, m_creature);break; - case 2: DoScriptText(SAY_SLAY_3, m_creature);break; - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; @@ -77,7 +138,7 @@ void AddSC_boss_cyanigosa() Script *newscript; newscript = new Script; - newscript->Name="boss_cyanigosa"; + newscript->Name = "boss_cyanigosa"; newscript->GetAI = &GetAI_boss_cyanigosa; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp index 89d00002378..4848813d727 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_erekem.cpp @@ -10,60 +10,171 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_BLOODLUST 54516 -#define SPELL_BREAK_BONDS 59463 -#define SPELL_CHAIN_HEAL 54481 -#define SPELL_EARTH_SHIELD 54479 -#define SPELL_EARTH_SHOCK 54511 -#define SPELL_LIGHTNING_BOLT 53044 -#define SPELL_STORMSTRIKE 51876 +enum Spells +{ + SPELL_BLOODLUST = 54516, + SPELL_BREAK_BONDS = 59463, + SPELL_CHAIN_HEAL = 54481, + H_SPELL_CHAIN_HEAL = 59473, + SPELL_EARTH_SHIELD = 54479, + H_SPELL_EARTH_SHIELD = 59471, + SPELL_EARTH_SHOCK = 54511, + SPELL_LIGHTNING_BOLT = 53044, + SPELL_STORMSTRIKE = 51876 +}; //not in db -//Yells -#define SAY_AGGRO -1608010 -#define SAY_SLAY_1 -1608011 -#define SAY_SLAY_2 -1608012 -#define SAY_SLAY_3 -1608013 -#define SAY_DEATH -1608014 -#define SAY_SPAWN -1608015 -#define SAY_ADD_KILED -1608016 -#define SAY_BOTH_ADDS_KILED -1608017 +enum Yells +{ + SAY_AGGRO = -1608010, + SAY_SLAY_1 = -1608011, + SAY_SLAY_2 = -1608012, + SAY_SLAY_3 = -1608013, + SAY_DEATH = -1608014, + SAY_SPAWN = -1608015, + SAY_ADD_KILLED = -1608016, + SAY_BOTH_ADDS_KILLED = -1608017 +}; struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI { - boss_erekemAI(Creature *c) : ScriptedAI(c) {} + boss_erekemAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiBloodlustTimer; + uint32 uiChainHealTimer; + uint32 uiEarthShockTimer; + uint32 uiLightningBoltTimer; + uint32 uiEarthShieldTimer; + + Creature* pGuard1; + Creature* pGuard2; + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + uiBloodlustTimer = 15000; + uiChainHealTimer = 0; + uiEarthShockTimer = urand(2000,8000); + uiLightningBoltTimer = urand(5000,10000); + uiEarthShieldTimer = 20000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + DoCast(m_creature, HEROIC(SPELL_EARTH_SHIELD, H_SPELL_EARTH_SHIELD)); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; + + //spam stormstrike in hc mode if spawns are dead + if (HeroicMode) + { + if (pGuard1 && !pGuard1->isAlive() && pGuard2 && !pGuard2->isAlive()) + { + DoCast(m_creature->getVictim(), SPELL_STORMSTRIKE); + } + } + + if (uiEarthShieldTimer < diff) + { + DoCast(m_creature, HEROIC(SPELL_EARTH_SHIELD, H_SPELL_EARTH_SHIELD)); + uiEarthShieldTimer = 20000; + } else uiEarthShieldTimer -= diff; + + if (uiChainHealTimer < diff) + { + if (Creature *pTarget = GetChainHealTarget()) + { + DoCast(pTarget,HeroicMode ? H_SPELL_CHAIN_HEAL : SPELL_CHAIN_HEAL); + //If one of the adds is dead spawn heals faster + uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; + } + } else uiChainHealTimer -= diff; + + if (uiBloodlustTimer < diff) + { + DoCast(m_creature,SPELL_BLOODLUST); + uiBloodlustTimer = urand(35000,45000); + } else uiBloodlustTimer -= diff; + + + if (uiEarthShockTimer < diff) + { + DoCast(m_creature->getVictim(), SPELL_EARTH_SHOCK); + uiEarthShockTimer = urand(8000,13000); + } else uiEarthShockTimer -= diff; + + if (uiLightningBoltTimer < diff) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + while (pTarget && pTarget->GetTypeId() != TYPEID_PLAYER) + SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_LIGHTNING_BOLT); + uiLightningBoltTimer = urand(18000,24000); + } else uiLightningBoltTimer -= diff; DoMeleeAttackIfReady(); } + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } } + void KilledUnit(Unit *victim) { if (victim == m_creature) return; - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature);break; - case 1: DoScriptText(SAY_SLAY_2, m_creature);break; - case 2: DoScriptText(SAY_SLAY_3, m_creature);break; - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); + } + + Creature* GetChainHealTarget() + { + Creature* pTarget = NULL; + return pTarget; } }; @@ -72,6 +183,62 @@ CreatureAI* GetAI_boss_erekem(Creature* pCreature) return new boss_erekemAI (pCreature); } +struct TRINITY_DLL_DECL mob_erekem_guardAI : public ScriptedAI +{ + mob_erekem_guardAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiEarthShieldTimer; + uint32 uiLightningBoltTimer; + uint32 uiBloodlustTimer; + + ScriptedInstance* pInstance; + + void Reset() + { + uiEarthShieldTimer = 20000; + uiLightningBoltTimer = urand(0,5000); + uiBloodlustTimer = urand(8000,18000); + } + + void EnterCombat(Unit* who) + { + DoCast(m_creature, H_SPELL_EARTH_SHIELD); + } + + void MoveInLineOfSight(Unit* who) {} + + void UpdateAI(const uint32 diff) + { + if (uiEarthShieldTimer < diff) + { + DoCast(m_creature, H_SPELL_EARTH_SHIELD); + uiEarthShieldTimer = 20000; + } else uiEarthShieldTimer -= diff; + + if (uiLightningBoltTimer < diff) + { + if (pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_LIGHTNING_BOLT); + uiLightningBoltTimer = urand(18000,24000); + } else uiLightningBoltTimer -= diff; + + if (uiBloodlustTimer < diff) + { + DoCast(m_creature,SPELL_BLOODLUST); + uiBloodlustTimer = urand(35000,45000); + } else uiBloodlustTimer -= diff; + } +}; + +CreatureAI* GetAI_mob_erekem_guard(Creature* pCreature) +{ + return new mob_erekem_guardAI (pCreature); +} + + void AddSC_boss_erekem() { Script *newscript; @@ -80,4 +247,8 @@ void AddSC_boss_erekem() newscript->Name="boss_erekem"; newscript->GetAI = &GetAI_boss_erekem; newscript->RegisterSelf(); + + newscript->Name="mob_erekem_guard"; + newscript->GetAI = &GetAI_mob_erekem_guard; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp index 5d41a9c64dc..476c84a8c3a 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_ichoron.cpp @@ -10,37 +10,79 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_DRAINED 59820 -#define SPELL_FRENZY 54312 -#define SPELL_PROTECTIVE_BUBBLE 54306 -#define SPELL_WATER_BLAST 54237 -#define SPELL_WATER_BOLT_VOLLEY 54241 +enum Spells +{ + SPELL_DRAINED = 59820, + SPELL_FRENZY = 54312, + H_SPELL_FRENZY = 59522, + SPELL_PROTECTIVE_BUBBLE = 54306, + SPELL_WATER_BLAST = 54237, + H_SPELL_WATER_BLAST = 59520, + SPELL_WATER_BOLT_VOLLEY = 54241, + H_SPELL_WATER_BOLT_VOLLEY = 59521 +}; //not in db -//Yells -#define SAY_AGGRO -1608018 -#define SAY_SLAY_1 -1608019 -#define SAY_SLAY_2 -1608020 -#define SAY_SLAY_3 -1608021 -#define SAY_DEATH -1608022 -#define SAY_SPAWN -1608023 -#define SAY_ENRAGE -1608024 -#define SAY_SHATTER -1608025 -#define SAY_BUBBLE -1608026 +enum Yells +{ + SAY_AGGRO = -1608018, + SAY_SLAY_1 = -1608019, + SAY_SLAY_2 = -1608020, + SAY_SLAY_3 = -1608021, + SAY_DEATH = -1608022, + SAY_SPAWN = -1608023, + SAY_ENRAGE = -1608024, + SAY_SHATTER = -1608025, + SAY_BUBBLE = -1608026 +}; + +enum CombatPhase +{ + BUBBLED, + SUMMONS, + DPS +}; struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI { - boss_ichoronAI(Creature *c) : ScriptedAI(c) {} + boss_ichoronAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + CombatPhase Phase; + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + Phase = BUBBLED; + + DoCast(m_creature, SPELL_PROTECTIVE_BUBBLE); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target @@ -49,20 +91,31 @@ struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI DoMeleeAttackIfReady(); } + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } } + void KilledUnit(Unit *victim) { if (victim == m_creature) return; - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature);break; - case 1: DoScriptText(SAY_SLAY_2, m_creature);break; - case 2: DoScriptText(SAY_SLAY_3, m_creature);break; - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp index 54fe4900ab6..30d8e5d7526 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_lavanthor.cpp @@ -10,30 +10,113 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_CAUTERIZING_FLAMES 59466 -#define SPELL_FIREBOLT 54235 -#define SPELL_FLAME_BREATH 54282 -#define SPELL_LAVA_BURN 54249 +enum Spells +{ + SPELL_CAUTERIZING_FLAMES = 59466, //Only in heroic + SPELL_FIREBOLT = 54235, + H_SPELL_FIREBOLT = 59468, + SPELL_FLAME_BREATH = 54282, + H_SPELL_FLAME_BREATH = 59469, + SPELL_LAVA_BURN = 54249, + H_SPELL_LAVA_BURN = 59594 +}; struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI { - boss_lavanthorAI(Creature *c) : ScriptedAI(c) {} + boss_lavanthorAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiFireboltTimer; + uint32 uiFlameBreathTimer; + uint32 uiLavaBurnTimer; + uint32 uiCauterizingFlamesTimer; + + ScriptedInstance* pInstance; - void Reset() {} - void EnterCombat(Unit* who) {} - void AttackStart(Unit* who) {} + void Reset() + { + uiFireboltTimer = 1000; + uiFlameBreathTimer = 5000; + uiLavaBurnTimer = 10000; + uiCauterizingFlamesTimer = 3000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + + void EnterCombat(Unit* who) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; + + if (uiFireboltTimer < diff) + { + DoCast(m_creature->getVictim(), HEROIC(SPELL_FIREBOLT, H_SPELL_FIREBOLT)); + uiFireboltTimer = urand(5000,13000); + } else uiFireboltTimer -= diff; + + if (uiFlameBreathTimer < diff) + { + DoCast(m_creature->getVictim(), HEROIC(SPELL_FLAME_BREATH, H_SPELL_FLAME_BREATH)); + uiFlameBreathTimer = urand(10000,15000); + } else uiFlameBreathTimer -= diff; + + if (uiLavaBurnTimer < diff) + { + DoCast(m_creature->getVictim(), HEROIC(SPELL_LAVA_BURN, H_SPELL_LAVA_BURN)); + uiLavaBurnTimer = urand(15000,23000); + } + + if (HeroicMode) + { + if (uiCauterizingFlamesTimer < diff) + { + DoCast(m_creature->getVictim(), SPELL_CAUTERIZING_FLAMES); + uiCauterizingFlamesTimer = urand(10000,16000); + } else uiCauterizingFlamesTimer -= diff; + } DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) {} + + void JustDied(Unit* killer) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } + } }; CreatureAI* GetAI_boss_lavanthor(Creature* pCreature) @@ -46,7 +129,7 @@ void AddSC_boss_lavanthor() Script *newscript; newscript = new Script; - newscript->Name="boss_lavanthor"; + newscript->Name = "boss_lavanthor"; newscript->GetAI = &GetAI_boss_lavanthor; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp index dd381cf166d..c952d2dc6a7 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_moragg.cpp @@ -10,28 +10,92 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" + //Spells -#define SPELL_CORROSICE_SALIVA 54527 -#define SPELL_OPTIC_LINK 54396 +enum Spells +{ + SPELL_CORROSIVE_SALIVA = 54527, + SPELL_OPTIC_LINK = 54396 +}; struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI { - boss_moraggAI(Creature *c) : ScriptedAI(c) {} + boss_moraggAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiOpticLinkTimer; + uint32 uiCorrosiveSalivaTimer; + + ScriptedInstance* pInstance; - void Reset() {} - void EnterCombat(Unit* who) {} - void AttackStart(Unit* who) {} + void Reset() + { + uiOpticLinkTimer = 10000; + uiCorrosiveSalivaTimer = 5000; + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + + void EnterCombat(Unit* who) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; + + if (uiOpticLinkTimer < diff) + { + if (pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget,SPELL_OPTIC_LINK); + uiOpticLinkTimer = 15000; + } else uiOpticLinkTimer -= diff; + + if (uiCorrosiveSalivaTimer < diff) + { + DoCast(m_creature->getVictim(), SPELL_CORROSIVE_SALIVA); + uiCorrosiveSalivaTimer = 10000; + } else uiCorrosiveSalivaTimer -= diff; DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) {} + void JustDied(Unit* killer) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT,13); + } + } + } }; CreatureAI* GetAI_boss_moragg(Creature* pCreature) @@ -44,7 +108,7 @@ void AddSC_boss_moragg() Script *newscript; newscript = new Script; - newscript->Name="boss_moragg"; + newscript->Name = "boss_moragg"; newscript->GetAI = &GetAI_boss_moragg; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp index def0cbf7316..6fe3587345e 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_xevozz.cpp @@ -10,38 +10,84 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_ARCANE_BARRAGE_VOLLEY 54202 -#define SPELL_ARCANE_BUFFET 54226 -#define SPELL_SUMMON_ETHEREAL_SPHERE_1 54102 -#define SPELL_SUMMON_ETHEREAL_SPHERE_2 54137 -#define SPELL_SUMMON_ETHEREAL_SPHERE_3 54138 +enum Spells +{ + SPELL_ARCANE_BARRAGE_VOLLEY = 54202, + H_SPELL_ARCANE_BARRAGE_VOLLEY = 59483, + SPELL_ARCANE_BUFFET = 54226, + H_SPELL_ARCANE_BUFFET = 59485, + SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102, + H_SPELL_SUMMON_ETHEREAL_SPHERE_1 = 61337, + SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137, + H_SPELL_SUMMON_ETHEREAL_SPHERE_2 = 61338, + SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, + H_SPELL_SUMMON_ETHEREAL_SPHERE_3 = 61339 +}; + +enum Creatures +{ + CREATURE_ETHEREAL_SPHERE = 29271, + H_CREATURE_ETHEREAL_SPHERE = 32582 +}; + +enum CreatureSpells +{ + SPELL_ARCANE_POWER = 54160, + H_SPELL_ARCANE_POWER = 59474, + SPELL_SUMMON_PLAYERS = 54164 +}; //not in db -//Yells -#define SAY_AGGRO -1608027 -#define SAY_SLAY_1 -1608028 -#define SAY_SLAY_2 -1608029 -#define SAY_SLAY_3 -1608030 -#define SAY_DEATH -1608031 -#define SAY_SPAWN -1608032 -#define SAY_CHARGED -1608033 -#define SAY_REPEAT_SUMMON_1 -1608034 -#define SAY_REPEAT_SUMMON_2 -1608035 -#define SAY_SUMMON_ENERGY -1608036 +enum Yells +{ + SAY_AGGRO = -1608027, + SAY_SLAY_1 = -1608028, + SAY_SLAY_2 = -1608029, + SAY_SLAY_3 = -1608030, + SAY_DEATH = -1608031, + SAY_SPAWN = -1608032, + SAY_CHARGED = -1608033, + SAY_REPEAT_SUMMON_1 = -1608034, + SAY_REPEAT_SUMMON_2 = -1608035, + SAY_SUMMON_ENERGY = -1608036 +}; struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI { - boss_xevozzAI(Creature *c) : ScriptedAI(c) {} + boss_xevozzAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target @@ -50,20 +96,29 @@ struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI DoMeleeAttackIfReady(); } + void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } } void KilledUnit(Unit *victim) { if (victim == m_creature) return; - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature);break; - case 1: DoScriptText(SAY_SLAY_2, m_creature);break; - case 2: DoScriptText(SAY_SLAY_3, m_creature);break; - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature); } }; @@ -77,7 +132,7 @@ void AddSC_boss_xevozz() Script *newscript; newscript = new Script; - newscript->Name="boss_xevozz"; + newscript->Name = "boss_xevozz"; newscript->GetAI = &GetAI_boss_xevozz; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp index 4815b63ba8c..98b4581af3d 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/boss_zuramat.cpp @@ -10,38 +10,71 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_violet_hold.h" -//Spells -#define SPELL_SHROUD_OF_DARKNESS 54524 -#define SPELL_SUMMON_VOID_SENTRY 54369 -#define SPELL_VOID_SHIFT 54361 +enum Spells +{ + SPELL_SHROUD_OF_DARKNESS = 54524, + H_SPELL_SHROUD_OF_DARKNESS = 59745, + SPELL_SUMMON_VOID_SENTRY = 54369, + SPELL_VOID_SHIFT = 54361, + H_SPELL_VOID_SHIFT = 59743 +}; -#define NPC_VOID_SENTRY 29364 +enum Creatures +{ + CREATURE_VOID_SENTRY = 29364 +}; //not in db -//Yells -#define SAY_AGGRO -1608037 -#define SAY_SLAY_1 -1608038 -#define SAY_SLAY_2 -1608039 -#define SAY_SLAY_3 -1608040 -#define SAY_DEATH -1608041 -#define SAY_SPAWN -1608042 -#define SAY_SHIELD -1608043 -#define SAY_WHISPER -1608044 +enum Yells +{ + SAY_AGGRO = -1608037, + SAY_SLAY_1 = -1608038, + SAY_SLAY_2 = -1608039, + SAY_SLAY_3 = -1608040, + SAY_DEATH = -1608041, + SAY_SPAWN = -1608042, + SAY_SHIELD = -1608043, + SAY_WHISPER = -1608044 +}; struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI { - boss_zuramatAI(Creature *c) : ScriptedAI(c) {} + boss_zuramatAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } uint32 void_shift; + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(const uint32 diff) { //Return since we have no target @@ -53,7 +86,22 @@ struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } } + void KilledUnit(Unit *victim) { if (victim == m_creature) @@ -73,7 +121,7 @@ void AddSC_boss_zuramat() Script *newscript; newscript = new Script; - newscript->Name="boss_zuramat"; + newscript->Name = "boss_zuramat"; newscript->GetAI = &GetAI_boss_zuramat; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h b/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h index 71bc0d18d2f..595cd24a7fb 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h +++ b/src/bindings/scripts/scripts/northrend/violet_hold/def_violet_hold.h @@ -1,4 +1,32 @@ #ifndef DEF_VIOLET_HOLD_H #define DEF_VIOLET_HOLD_H +enum Data +{ + DATA_1ST_BOSS_EVENT, + DATA_2ND_BOSS_EVENT, + DATA_CYANIGOSA_EVENT, + DATA_WAVE_COUNT +}; + +enum Data64 +{ + DATA_MORAGG, + DATA_EREKEM, + DATA_ICHORON, + DATA_LAVANTHOR, + DATA_XEVOZZ, + DATA_ZURAMAT, + DATA_CYANIGOSA, + DATA_MORAGG_CELL, + DATA_EREKEM_CELL, + DATA_EREKEM_RIGHT_GUARD_CELL, + DATA_EREKEM_LEFT_GUARD_CELL, + DATA_ICHORON_CELL, + DATA_LAVANTHOR_CELL, + DATA_XEVOZZ_CELL, + DATA_ZURAMAT_CELL, + DATA_MAIN_DOOR +}; + #endif diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp index 98962b919e0..74173655fa6 100644 --- a/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp +++ b/src/bindings/scripts/scripts/northrend/violet_hold/instance_violet_hold.cpp @@ -1,9 +1,392 @@ #include "precompiled.h" #include "def_violet_hold.h" +#define MAX_ENCOUNTER 3 + +/* Violet Hold encounters: +0 - First boss +1 - Second boss +2 - Cyanigosa*/ + +/* Violet hold bosses: +0 - Moragg +1 - Erekem +2 - Ichoron +3 - Lavanthor +4 - Xevozz +5 - Zuramat +6 - Cyanigosa */ +enum Creatures +{ + CREATURE_TELEPORTATION_PORTAL = 31011, + CREATURE_CYANIGOSA +}; +struct Location +{ + float x,y,z,orientation; +}; +const Location PortalLocation[] = +{ + {1936.07, 803.198, 53.3749, 3.12414}, + {1877.51, 850.104, 44.6599, 4.7822 }, + {1890.64, 753.471, 48.7224, 1.71042} +}; struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance { instance_violet_hold(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + + uint64 uiMoragg; + uint64 uiErekem; + uint64 uiIchoron; + uint64 uiLavanthor; + uint64 uiXevozz; + uint64 uiZuramat; + uint64 uiCyanigosa; + uint64 uiSinclari; + + uint64 uiMoraggCell; + uint64 uiErekemCell; + uint64 uiErekemRightGuardCell; + uint64 uiErekemLeftGuardCell; + uint64 uiIchoronCell; + uint64 uiLavanthorCell; + uint64 uiXevozzCell; + uint64 uiZuramatCell; + uint64 uiMainDoor; + + uint8 uiWaveCount; + uint8 uiLocation; + uint8 uiFirstBoss; + uint8 uiSecondBoss; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + + bool HeroicMode; + + std::string str_data; + + void Initialize() + { + uiMoragg = 0; + uiErekem = 0; + uiIchoron = 0; + uiLavanthor = 0; + uiXevozz = 0; + uiZuramat = 0; + uiCyanigosa = 0; + uiSinclari = 0; + + uiMoraggCell = 0; + uiErekemCell = 0; + uiErekemRightGuardCell = 0; + uiErekemLeftGuardCell = 0; + uiIchoronCell = 0; + uiLavanthorCell = 0; + uiXevozzCell = 0; + uiZuramatCell = 0; + uiMainDoor = 0; + + uiWaveCount = 0; + uiLocation = 0; + uiFirstBoss = 0; + uiSecondBoss = 0; + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } + + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool add) + { + switch(pCreature->GetEntry()) + { + case 29266: + uiXevozz = pCreature->GetGUID(); + break; + case 29312: + uiLavanthor = pCreature->GetGUID(); + break; + case 29313: + uiIchoron = pCreature->GetGUID(); + break; + case 29314: + uiZuramat = pCreature->GetGUID(); + break; + case 29315: + uiErekem = pCreature->GetGUID(); + break; + case 29316: + uiMoragg = pCreature->GetGUID(); + break; + case 31134: + uiCyanigosa = pCreature->GetGUID(); + break; + case 30658: + uiSinclari = pCreature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + switch(pGo->GetEntry()) + { + case 191562: + uiErekemLeftGuardCell = pGo->GetGUID(); + break; + case 191563: + uiErekemRightGuardCell = pGo->GetGUID(); + break; + case 191564: + uiErekemCell = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case 191565: + uiZuramatCell = pGo->GetGUID(); + if (m_auiEncounter[5] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case 191566: + uiLavanthorCell = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case 191606: + uiMoraggCell = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case 191722: + uiIchoronCell = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case 191723: + uiXevozzCell = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + HandleGameObject(NULL, true, pGo); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_1ST_BOSS_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_2ND_BOSS_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_CYANIGOSA_EVENT: + m_auiEncounter[6] = data; + if (data == DONE) + { + SaveToDB(); + GameObject* pMainDoor = instance->GetGameObject(uiMainDoor); + pMainDoor->SetGoState(GO_STATE_ACTIVE); + } + break; + case DATA_WAVE_COUNT: + uiWaveCount = data; + switch(data) + { + case 6: + uiFirstBoss = rand()%6; + StartBossEncounter(uiFirstBoss); + break; + case 12: + uiSecondBoss = rand()%6; + while (uiSecondBoss == uiFirstBoss) + uiSecondBoss = rand()%6; + StartBossEncounter(uiSecondBoss); + break; + case 18: + { + Creature *pSinclari = instance->GetCreature(uiSinclari); + if (pSinclari) + pSinclari->SummonCreature(CREATURE_CYANIGOSA,PortalLocation[0].x,PortalLocation[0].y, + PortalLocation[0].z,PortalLocation[0].orientation,TEMPSUMMON_CORPSE_DESPAWN,0); + break; + } + case 1: + { + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + pMainDoor->SetGoState(GO_STATE_READY); + } + default: + { + Creature *pSinclari = instance->GetCreature(uiSinclari); + if (pSinclari) + { + pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[uiLocation].x,PortalLocation[uiLocation].y, + PortalLocation[uiLocation].z,PortalLocation[uiLocation].orientation, + TEMPSUMMON_CORPSE_DESPAWN,0); + uiLocation = (++uiLocation)%3; + } + } + } + break; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_1ST_BOSS_EVENT: return m_auiEncounter[0]; + case DATA_2ND_BOSS_EVENT: return m_auiEncounter[1]; + case DATA_CYANIGOSA_EVENT: return m_auiEncounter[3]; + case DATA_WAVE_COUNT: return uiWaveCount; + } + + return 0; + } + + void StartBossEncounter(uint8 uiBoss) + { + Creature* pBoss = NULL; + switch(uiBoss) + { + case 0: //Moragg + HandleGameObject(uiMoraggCell,true); + if (pBoss = instance->GetCreature(uiMoragg)) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 1: //Erekem + HandleGameObject(uiErekemCell,true); + if (pBoss = instance->GetCreature(uiErekem)) + { + if (HeroicMode) + { + HandleGameObject(uiErekemRightGuardCell,true); + HandleGameObject(uiErekemLeftGuardCell,true); + } + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 2: //Ichoron + HandleGameObject(uiIchoronCell,true); + if (pBoss = instance->GetCreature(uiIchoron)) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 3: //Lavanthor + HandleGameObject(uiLavanthorCell,true); + if (pBoss = instance->GetCreature(uiLavanthor)) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 4: //Xevozz + HandleGameObject(uiXevozzCell,true); + if (pBoss = instance->GetCreature(uiXevozz)) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 5: //Zuramat + HandleGameObject(uiZuramatCell,true); + if (pBoss = instance->GetCreature(uiZuramat)) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MORAGG: return uiMoragg; + case DATA_EREKEM: return uiErekem; + case DATA_ICHORON: return uiIchoron; + case DATA_LAVANTHOR: return uiLavanthor; + case DATA_XEVOZZ: return uiXevozz; + case DATA_ZURAMAT: return uiZuramat; + case DATA_CYANIGOSA: return uiCyanigosa; + case DATA_MORAGG_CELL: return uiMoraggCell; + case DATA_EREKEM_CELL: return uiErekemCell; + case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell; + case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell; + case DATA_ICHORON_CELL: return uiIchoronCell; + case DATA_LAVANTHOR_CELL: return uiLavanthorCell; + case DATA_XEVOZZ_CELL: return uiXevozzCell; + case DATA_ZURAMAT_CELL: return uiZuramatCell; + case DATA_MAIN_DOOR: return uiMainDoor; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "V H " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << uiFirstBoss << " " << uiSecondBoss; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + + if (dataHead1 == 'V' && dataHead2 == 'H') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + + for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + uiFirstBoss = data3; + uiSecondBoss = data4; + }else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_violet_hold(Map* pMap) diff --git a/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp b/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp new file mode 100644 index 00000000000..0a6d5383479 --- /dev/null +++ b/src/bindings/scripts/scripts/northrend/violet_hold/violet_hold.cpp @@ -0,0 +1,100 @@ +#include "precompiled.h" +#include "def_violet_hold.h" + +#define GOSSIP_START_EVENT "[PH]: Start Event" +#define NEXT_WAVE_TIME 90000 +#define SPAWN_TIME 9000 + +enum Creatures +{ + CREATURE_AZURE_INVADER = 30661, + CREATURE_AZURE_SPELLBREAKER = 30662, + CREATURE_AZURE_BINDER = 30663, + CREATURE_AZURE_MAGE_SLAYER = 30664, + CREATURE_AZURE_CAPTAIN = 30666 +}; + +bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) +{ + ScriptedInstance* pInstance = pCreature->GetInstanceData(); + if (pInstance) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1, pCreature->GetGUID()); + return true; +} + +bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + pPlayer->CLOSE_GOSSIP_MENU(); + ScriptedInstance* pInstance = pCreature->GetInstanceData(); + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT,1); + return true; +} + +struct TRINITY_DLL_DECL npc_teleportation_portalAI : public ScriptedAI +{ + npc_teleportation_portalAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + uint32 uiDespawnTimer; + uint32 uiSpawnTimer; + + ScriptedInstance *pInstance; + + void reset() + { + uiDespawnTimer = NEXT_WAVE_TIME; + uiSpawnTimer = 500; + } + + void EnterCombat(Unit *who) {} + void MoveInLineOfSight(Unit *who) {} + + void Update(uint32 diff) + { + if (uiSpawnTimer < diff) + { + if (Creature* pSummon = m_creature->SummonCreature(CREATURE_AZURE_CAPTAIN, + m_creature->GetPositionX()+rand()%3, m_creature->GetPositionY()+rand()%3, + m_creature->GetPositionZ(),m_creature->GetOrientation(), + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + pSummon->SetInCombatWithZone(); + uiSpawnTimer = SPAWN_TIME; + } else uiSpawnTimer -= diff; + if (uiDespawnTimer < diff) + { + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + } else uiDespawnTimer -= diff; + } + + void JustDied(Unit* killer) + { + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); + } +}; + +CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) +{ + return new npc_teleportation_portalAI(pCreature); +} + +void AddSC_violet_hold() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_sinclari_vh"; + newscript->pGossipHello = &GossipHello_npc_sinclari; + newscript->pGossipSelect = &GossipSelect_npc_sinclari; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_teleportation_portal_vh"; + newscript->GetAI = &GetAI_npc_teleportation_portal; + newscript->RegisterSelf(); +}
\ No newline at end of file diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index b4906d4dc3d..b7e85a4d2dd 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -330,6 +330,15 @@ extern void AddSC_boss_emalon(); extern void AddSC_instance_archavon(); extern void AddSC_boss_novos(); //Drak'Tharon Keep extern void AddSC_instance_drak_tharon(); +extern void AddSC_boss_cyanigosa(); //Violet Hold +extern void AddSC_boss_erekem(); +extern void AddSC_boss_ichoron(); +extern void AddSC_boss_lavanthor(); +extern void AddSC_boss_moragg(); +extern void AddSC_boss_xevozz(); +extern void AddSC_boss_zuramat(); +extern void AddSC_instance_violet_hold(); +extern void AddSC_violet_hold(); extern void AddSC_borean_tundra(); extern void AddSC_dragonblight(); @@ -752,6 +761,15 @@ void AddScripts() AddSC_instance_archavon(); AddSC_boss_novos(); //Drak'Tharon Keep AddSC_instance_drak_tharon(); + AddSC_boss_cyanigosa(); //Violet Hold + AddSC_boss_erekem(); + AddSC_boss_ichoron(); + AddSC_boss_lavanthor(); + AddSC_boss_moragg(); + AddSC_boss_xevozz(); + AddSC_boss_zuramat(); + AddSC_instance_violet_hold(); + AddSC_violet_hold(); AddSC_borean_tundra(); AddSC_dragonblight(); |
