diff options
author | tartalo <none@none> | 2009-10-18 14:45:57 +0200 |
---|---|---|
committer | tartalo <none@none> | 2009-10-18 14:45:57 +0200 |
commit | 6debee395462e0682faa3e0ef2bf19bbb392d9e9 (patch) | |
tree | 10c5619729fef4dc723264b67d242dca46b7cdc0 /src | |
parent | 6a068b71518d961fb32d023797400d80b8b62a6d (diff) |
Culling of Stratholme: Initial instance script
Code cleansing
More complete boss script skels
--HG--
branch : trunk
Diffstat (limited to 'src')
6 files changed, 371 insertions, 166 deletions
diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp index 3d9c1c3fcbf..96a37c4ad79 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp @@ -10,35 +10,52 @@ Script Data End */ update creature_template set scriptname = '' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_culling_of_stratholme.h" -//Spells -#define SPELL_CURSE_OF_EXERTION 52772 -#define SPELL_TIME_WARP 52766 //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. -#define SPELL_TIME_STOP 58848 //Stops time in a 50 yard sphere for 2 sec. -#define SPELL_WOUNDING_STRIKE_N 52771 //Used only on the tank -#define SPELL_WOUNDING_STRIKE_H 58830 +enum Spells +{ + SPELL_CURSE_OF_EXERTION = 52772, + SPELL_TIME_WARP = 52766, //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. + SPELL_TIME_STOP = 58848, //Stops time in a 50 yard sphere for 2 sec. + SPELL_WOUNDING_STRIKE = 52771, //Used only on the tank + H_SPELL_WOUNDING_STRIKE = 58830 +}; //not in db -//Say -#define SAY_INTRO -1595000 //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own." -#define SAY_AGGRO -1595001 //"We'll see about that, young prince." -#define SAY_TIME_WARP_1 -1595002 //"Tick tock, tick tock..." -#define SAY_TIME_WARP_2 -1595003 //"Not quick enough!" -#define SAY_TIME_WARP_3 -1595004 //"Let's get this over with. " -#define SAY_SLAY_1 -1595005 //"There is no future for you." -#define SAY_SLAY_2 -1595006 //"This is the hour of our greatest triumph!" -#define SAY_SLAY_3 -1595007 //"You were destined to fail. " -#define SAY_DEATH -1595008 //"*gurgles*" +enum Yells +{ + SAY_INTRO = -1595000, //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own." + SAY_AGGRO = -1595001, //"We'll see about that, young prince." + SAY_TIME_WARP_1 = -1595002, //"Tick tock, tick tock..." + SAY_TIME_WARP_2 = -1595003, //"Not quick enough!" + SAY_TIME_WARP_3 = -1595004, //"Let's get this over with. " + SAY_SLAY_1 = -1595005, //"There is no future for you." + SAY_SLAY_2 = -1595006, //"This is the hour of our greatest triumph!" + SAY_SLAY_3 = -1595007, //"You were destined to fail. " + SAY_DEATH = -1595008 //"*gurgles*" +}; struct TRINITY_DLL_DECL boss_epochAI : public ScriptedAI { - boss_epochAI(Creature *c) : ScriptedAI(c) {} + boss_epochAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + ScriptedInstance* pInstance; - void Reset() {} + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); + } void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS); } void AttackStart(Unit* who) {} @@ -55,6 +72,9 @@ struct TRINITY_DLL_DECL boss_epochAI : public ScriptedAI void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, DONE); } void KilledUnit(Unit *victim) diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp index b94d01ce4de..e01c4302743 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp @@ -10,53 +10,69 @@ Script Data End */ update creature_template set scriptname = 'boss_mal_ganis' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_culling_of_stratholme.h" -//Spells -#define SPELL_CARRION_SWARM_N 52720 //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec. -#define SPELL_CARRION_SWARM_H 58852 -#define SPELL_MIND_BLAST_N 52722 //Inflicts 4163 to 4837 Shadow damage to an enemy. -#define SPELL_MIND_BLAST_H 58850 -#define SPELL_SLEEP 52721 //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. -#define SPELL_VAMPIRIC_TOUCH 52723 //Heals the caster for half the damage dealt by a melee attack. +enum Spells +{ + SPELL_CARRION_SWARM = 52720, //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec. + H_SPELL_CARRION_SWARM = 58852, + SPELL_MIND_BLAST = 52722, //Inflicts 4163 to 4837 Shadow damage to an enemy. + H_SPELL_MIND_BLAST = 58850, + SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. + SPELL_VAMPIRIC_TOUCH = 52723 //Heals the caster for half the damage dealt by a melee attack. +}; //not in db -//Yell Mal'ganis -#define SAY_INTRO_1 -1595009 -#define SAY_INTRO_2 -1595010 -#define SAY_OUTRO -1595011 -#define SAY_AGGRO -1595012 -#define SAY_KILL_1 -1595013 -#define SAY_KILL_2 -1595014 -#define SAY_KILL_3 -1595015 -#define SAY_SLAY_1 -1595016 -#define SAY_SLAY_2 -1595017 -#define SAY_SLAY_3 -1595018 -#define SAY_SLAY_4 -1595019 -#define SAY_SLEEP_1 -1595020 -#define SAY_SLEEP_2 -1595021 -#define SAY_30HEALTH -1595022 -#define SAY_15HEALTH -1595023 -#define SAY_ESCAPE_SPEECH_1 -1595024 -#define SAY_ESCAPE_SPEECH_2 -1595025 +enum Yells +{ + SAY_INTRO_1 = -1595009, + SAY_INTRO_2 = -1595010, + SAY_OUTRO = -1595011, + SAY_AGGRO = -1595012, + SAY_KILL_1 = -1595013, + SAY_KILL_2 = -1595014, + SAY_KILL_3 = -1595015, + SAY_SLAY_1 = -1595016, + SAY_SLAY_2 = -1595017, + SAY_SLAY_3 = -1595018, + SAY_SLAY_4 = -1595019, + SAY_SLEEP_1 = -1595020, + SAY_SLEEP_2 = -1595021, + SAY_30HEALTH = -1595022, + SAY_15HEALTH = -1595023, + SAY_ESCAPE_SPEECH_1 = -1595024, + SAY_ESCAPE_SPEECH_2 = -1595025 +}; struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI { - boss_mal_ganisAI(Creature *c) : ScriptedAI(c) {} + boss_mal_ganisAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } bool yelled, yelled2, yelled3; + + ScriptedInstance* pInstance; void Reset() { yelled = false; yelled2 = false; yelled3 = false; + + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); } void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); } void AttackStart(Unit* who) {} @@ -92,7 +108,11 @@ struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI DoMeleeAttackIfReady(); } - void JustDied(Unit* killer) {} + void JustDied(Unit* killer) + { + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); + } void KilledUnit(Unit *victim) { if (victim == m_creature) diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp index 53052f0f9e0..90902bf8c91 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp @@ -10,53 +10,61 @@ Script Data End */ update creature_template set scriptname = 'boss_meathook' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_culling_of_stratholme.h" -//Spell -#define SPELL_CONSTRICTING_CHAINS_N 52696 //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec. -#define SPELL_CONSTRICTING_CHAINS_H 58823 -#define SPELL_DISEASE_EXPULSION_N 52666 //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec. -#define SPELL_DISEASE_EXPULSION_H 58824 -#define SPELL_FRENZY 58841 //Increases the caster's Physical damage by 10% for 30 sec. - +enum Spells +{ + SPELL_CONSTRICTING_CHAINS = 52696, //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec. + H_SPELL_CONSTRICTING_CHAINS = 58823, + SPELL_DISEASE_EXPULSION = 52666, //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec. + H_SPELL_DISEASE_EXPULSION = 58824, + SPELL_FRENZY = 58841 //Increases the caster's Physical damage by 10% for 30 sec. +}; //not in db -//Yell -#define SAY_AGGRO -1595026 -#define SAY_SLAY_1 -1595027 -#define SAY_SLAY_2 -1595028 -#define SAY_SLAY_3 -1595029 -#define SAY_SPAWN -1595030 -#define SAY_DEATH -1595031 +enum Yells +{ + SAY_AGGRO = -1595026, + SAY_SLAY_1 = -1595027, + SAY_SLAY_2 = -1595028, + SAY_SLAY_3 = -1595029, + SAY_SPAWN = -1595030, + SAY_DEATH = -1595031 +}; struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI { - boss_meathookAI(Creature *c) : ScriptedAI(c) {} + boss_meathookAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } - uint32 Chain_Timer, - Disease_Timer, - Frenzy_Timer; + uint32 uiChainTimer; + uint32 uiDiseaseTimer; + uint32 uiFrenzyTimer; + + ScriptedInstance* pInstance; void Reset() { - Chain_Timer = 12000 + rand()%5000; //seen on video 13, 17, 15, 12, 16 - Disease_Timer = 2000 + rand()%1000; //approx 3s - Frenzy_Timer = 20000 + rand()%10000; //made it up + uiChainTimer = urand(12000,17000); //seen on video 13, 17, 15, 12, 16 + uiDiseaseTimer = urand(2000,3000); //approx 3s + uiFrenzyTimer = urand(20000,30000); //made it up + + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); } void EnterCombat(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS); } void AttackStart(Unit* who) {} - std::list <Unit*>pList; - void MoveInLineOfSight(Unit* who, const uint32 diff) - { - /*if (m_creature->isHostileTo(who)) - { - pList.append(who); - }*/ - } + void MoveInLineOfSight(Unit* who, const uint32 diff) {} void UpdateAI(const uint32 diff) { @@ -64,42 +72,23 @@ struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI if (!UpdateVictim()) return; - if (Disease_Timer < diff) + if (uiDiseaseTimer < diff) { - DoCast(m_creature->getVictim(), SPELL_DISEASE_EXPULSION_N); - Disease_Timer = 1500 + rand()%2500; - }else Disease_Timer -= diff; + DoCast(m_creature->getVictim(), HEROIC(SPELL_DISEASE_EXPULSION,H_SPELL_DISEASE_EXPULSION)); + uiDiseaseTimer = urand(1500,4000); + }else uiDiseaseTimer -= diff; - if (Frenzy_Timer < diff) + if (uiFrenzyTimer < diff) { DoCast(m_creature->getVictim(), SPELL_FRENZY); - Frenzy_Timer = 20000 + rand()%10000; - }else Frenzy_Timer -= diff; + uiFrenzyTimer = urand(20000,30000); + }else uiFrenzyTimer -= diff; - if (Chain_Timer < diff) + if (uiChainTimer < diff) { - - /* - std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list<HostilReference*>::iterator itr; - - int st=0; - for (itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) - { - //st++; - m_creature->getThreatManager(). - } - Unit* targets[st]; - int st2=0; - for (int i=1; i<=st; ++i){ - if (!IsWithinLOSInMap(targets[i]) - st2++; - } - Unit* targets_out_of_LOS[st2];*/ - - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CONSTRICTING_CHAINS_N); //anyone but the tank - Chain_Timer = 2000 + rand()%1000; - }else Chain_Timer -= diff; + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), HEROIC(SPELL_CONSTRICTING_CHAINS,H_SPELL_CONSTRICTING_CHAINS)); //anyone but the tank + uiChainTimer = urand(2000,3000); + }else uiChainTimer -= diff; DoMeleeAttackIfReady(); } @@ -107,6 +96,9 @@ struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI void JustDied(Unit* killer) { DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, DONE); } void KilledUnit(Unit *victim) diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp index 2982eb5a1b8..b5ae0ad0dd4 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp @@ -10,53 +10,71 @@ Script Data End */ update creature_template set scriptname = 'boss_salramm' where entry = ''; *** SQL END ***/ #include "precompiled.h" +#include "def_culling_of_stratholme.h" -//Spells -#define SPELL_CURSE_OF_TWISTED_FLESH 58845 -#define SPELL_EXPLODE_GHOUL_N 52480 -#define SPELL_EXPLODE_GHOUL_H 58825 -#define SPELL_SHADOW_BOLT_N 57725 -#define SPELL_SHADOW_BOLT_H 58828 -#define SPELL_STEAL_FLESH 52708 -#define SPELL_SUMMON_GHOULS 52451 +enum Spells +{ + SPELL_CURSE_OF_TWISTED_FLESH = 58845, + SPELL_EXPLODE_GHOUL = 52480, + H_SPELL_EXPLODE_GHOUL = 58825, + SPELL_SHADOW_BOLT = 57725, + H_SPELL_SHADOW_BOLT = 58828, + SPELL_STEAL_FLESH = 52708, + SPELL_SUMMON_GHOULS = 52451 +}; //not in db -//Yell -#define SAY_AGGRO -1595032 -#define SAY_SPAWN -1595033 -#define SAY_SLAY_1 -1595034 -#define SAY_SLAY_2 -1595035 -#define SAY_SLAY_3 -1595036 -#define SAY_DEATH -1595037 -#define SAY_EXPLODE_GHOUL_1 -1595038 -#define SAY_EXPLODE_GHOUL_2 -1595039 -#define SAY_STEAL_FLESH_1 -1595040 -#define SAY_STEAL_FLESH_2 -1595041 -#define SAY_STEAL_FLESH_3 -1595042 -#define SAY_SUMMON_GHOULS_1 -1595043 -#define SAY_SUMMON_GHOULS_2 -1595044 +enum Yells +{ + SAY_AGGRO = -1595032, + SAY_SPAWN = -1595033, + SAY_SLAY_1 = -1595034, + SAY_SLAY_2 = -1595035, + SAY_SLAY_3 = -1595036, + SAY_DEATH = -1595037, + SAY_EXPLODE_GHOUL_1 = -1595038, + SAY_EXPLODE_GHOUL_2 = -1595039, + SAY_STEAL_FLESH_1 = -1595040, + SAY_STEAL_FLESH_2 = -1595041, + SAY_STEAL_FLESH_3 = -1595042, + SAY_SUMMON_GHOULS_1 = -1595043, + SAY_SUMMON_GHOULS_2 = -1595044 +}; struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI { - boss_salrammAI(Creature *c) : ScriptedAI(c) {} + boss_salrammAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } - uint32 Curse_flesh_Timer, - Explode_ghoul_Timer, - Shadow_bolt_Timer, - Steal_flesh_Timer, - Summon_ghouls_Timer; + uint32 Curse_flesh_Timer; + uint32 Explode_ghoul_Timer; + uint32 Shadow_bolt_Timer; + uint32 Steal_flesh_Timer; + uint32 Summon_ghouls_Timer; + + ScriptedInstance* pInstance; void Reset() { - Curse_flesh_Timer = 30000; //30s DBM - Explode_ghoul_Timer = 25000 + rand()%3000; //approx 6 sec after summon ghouls - Shadow_bolt_Timer = 8000 + rand()%4000; // approx 10s - Steal_flesh_Timer = 12345; - Summon_ghouls_Timer = 19000 + rand()%5000; //on a video approx 24s after aggro + Curse_flesh_Timer = 30000; //30s DBM + Explode_ghoul_Timer = urand(25000,28000); //approx 6 sec after summon ghouls + Shadow_bolt_Timer = urand(8000,12000); // approx 10s + Steal_flesh_Timer = 12345; + Summon_ghouls_Timer = urand(19000,24000); //on a video approx 24s after aggro + + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); } void EnterCombat(Unit* who) - {DoScriptText(SAY_AGGRO, m_creature);} + { + DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); + } void AttackStart(Unit* who) {} void MoveInLineOfSight(Unit* who) {} @@ -66,8 +84,6 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI if (!UpdateVictim()) return; - Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0); - //Curse of twisted flesh timer if (Curse_flesh_Timer < diff) { @@ -78,27 +94,16 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI //Shadow bolt timer if (Shadow_bolt_Timer < diff) { - if (random_target) - DoCast(random_target,SPELL_SHADOW_BOLT_N); - Shadow_bolt_Timer = 8000 + rand()%4000; + if (Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(random_target, HEROIC(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); + Shadow_bolt_Timer = urand(8000,12000); }else Shadow_bolt_Timer -= diff; //Steal Flesh timer if (Steal_flesh_Timer < diff) { - switch(rand()%3) - { - case 0: - DoScriptText(SAY_STEAL_FLESH_1, m_creature); - break; - case 1: - DoScriptText(SAY_STEAL_FLESH_2, m_creature); - break; - case 2: - DoScriptText(SAY_STEAL_FLESH_3, m_creature); - break; - } - if (random_target) + DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), m_creature); + if (Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(random_target,SPELL_STEAL_FLESH); Steal_flesh_Timer = 10000; }else Steal_flesh_Timer -= diff; @@ -106,16 +111,9 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI //Summon ghouls timer if (Summon_ghouls_Timer < diff) { + DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), m_creature); switch(rand()%2) - { - case 0: - DoScriptText(SAY_SUMMON_GHOULS_1, m_creature); - break; - case 1: - DoScriptText(SAY_SUMMON_GHOULS_2, m_creature); - break; - } - if (random_target) + if (Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(random_target,SPELL_SUMMON_GHOULS); Summon_ghouls_Timer = 10000; }else Summon_ghouls_Timer -= diff; @@ -124,7 +122,12 @@ struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI } void JustDied(Unit* killer) - {DoScriptText(SAY_DEATH, m_creature);} + { + DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, DONE); + } void KilledUnit(Unit *victim) { diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h index 849549e8f99..d5c2acae277 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h @@ -1,4 +1,30 @@ #ifndef DEF_CULLING_OF_STRATHOLME_H #define DEF_CULLING_OF_STRATHOLME_H +enum Data +{ + DATA_MEATHOOK_EVENT, + DATA_SALRAMM_EVENT, + DATA_EPOCH_EVENT, + DATA_MAL_GANIS_EVENT, + DATA_INFINITE_EVENT +}; + +enum Data64 +{ + DATA_MEATHOOK, + DATA_SALRAMM, + DATA_EPOCH, + DATA_MAL_GANIS, + DATA_INFINITE +}; + +enum Bosses +{ + CREATURE_MEATHOOK = 26529, + CREATURE_SALRAMM = 26530, + CREATURE_EPOCH = 26532, + CREATURE_MAL_GANIS = 26533, + CREATURE_INFINITE = 32273 +}; #endif diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp index 35ee68ea991..4750c17588d 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp @@ -1,9 +1,153 @@ #include "precompiled.h" #include "def_culling_of_stratholme.h" +#define MAX_ENCOUNTER 5 +/* Culling of Stratholme encounters: +0 - Meathook +1 - Salramm the Fleshcrafter +2 - Chrono-Lord Epoch +3 - Mal'Ganis +4 - Infinite Corruptor (Heroic only) +*/ struct TRINITY_DLL_DECL instance_culling_of_stratholme : public ScriptedInstance { instance_culling_of_stratholme(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + + uint64 uiMeathook; + uint64 uiSalramm; + uint64 uiEpoch; + uint64 uiMalGanis; + uint64 uiInfinite; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + 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 CREATURE_MEATHOOK: + uiMeathook = pCreature->GetGUID(); + break; + case CREATURE_SALRAMM: + uiSalramm = pCreature->GetGUID(); + break; + case CREATURE_EPOCH: + uiEpoch = pCreature->GetGUID(); + break; + case CREATURE_MAL_GANIS: + uiMalGanis = pCreature->GetGUID(); + break; + case CREATURE_INFINITE: + uiInfinite = pCreature->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_MEATHOOK_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_SALRAMM_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_EPOCH_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_MAL_GANIS_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_INFINITE_EVENT: + m_auiEncounter[4] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_MEATHOOK_EVENT: return m_auiEncounter[0]; + case DATA_SALRAMM_EVENT: return m_auiEncounter[1]; + case DATA_EPOCH_EVENT: return m_auiEncounter[2]; + case DATA_MAL_GANIS_EVENT: return m_auiEncounter[3]; + case DATA_INFINITE_EVENT: return m_auiEncounter[4]; + } + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MEATHOOK: return uiMeathook; + case DATA_SALRAMM: return uiSalramm; + case DATA_EPOCH: return uiEpoch; + case DATA_INFINITE: return uiInfinite; + } + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "C S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + + 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 == 'C' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + }else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_culling_of_stratholme(Map* pMap) |