diff options
author | Kudlaty <none@none> | 2009-08-13 17:02:49 +0200 |
---|---|---|
committer | Kudlaty <none@none> | 2009-08-13 17:02:49 +0200 |
commit | 5ba4407d42462982c8fb8abc306376abcc0094bc (patch) | |
tree | 0af8aadfa477f1b4398aa6dd229921d5bc7ab3ea /src | |
parent | 5ab3117c0cebd1d1a457e1ae4656ba7c9cbaeec7 (diff) |
Merge [SD2]
r1231 Remove old hack code that never worked and move/comment a few remaining to a more suitable function.
r1232 Use more safe way to check local bool in AI, accessed from GossipSelect
r1233 Update instance type and data labels for ZG to sd2 style and remove not needed ones.
r1234 Add scriptname for Gong, prevent using it in ZG if event already in progress or done (script added in previous commit)
r1235 Restore compile, sorry for typos :)
Apply SD2 code style to arlokk script.
--HG--
branch : trunk
Diffstat (limited to 'src')
11 files changed, 446 insertions, 533 deletions
diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp index 5703158389e..7e03c2f57cd 100644 --- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp @@ -1094,8 +1094,11 @@ bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature { pPlayer->CLOSE_GOSSIP_MENU(); - if (CAST_AI(npc_death_knight_initiateAI, pCreature->AI())->m_bIsDuelInProgress) - return true; + if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) + { + if(pInitiateAI->m_bIsDuelInProgress) + return true; + } pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp index 8f2e6210110..9fdbd9617b3 100644 --- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp +++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp @@ -16,8 +16,8 @@ /* ScriptData SDName: Boss_Gruul -SD%Complete: 50 -SDComment: Ground Slam seriously messed up due to core problem +SD%Complete: 60 +SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to mangos) SDCategory: Gruul's Lair EndScriptData */ @@ -47,10 +47,9 @@ enum SPELL_SHATTER_EFFECT = 33671, SPELL_HURTFUL_STRIKE = 33813, SPELL_STONED = 33652, //Spell is self cast by target + SPELL_MAGNETIC_PULL = 28337, SPELL_KNOCK_BACK = 24199, //Knockback spell until correct implementation is made - - SPELL_GRONN_LORDS_GRASP = 33572 //Triggered by Ground Slam }; struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI @@ -62,25 +61,24 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI ScriptedInstance *pInstance; - uint32 Growth_Timer; - uint32 CaveIn_Timer; - uint32 CaveIn_StaticTimer; - uint32 GroundSlamTimer; - uint32 GroundSlamStage; - uint32 PerformingGroundSlam; - uint32 HurtfulStrike_Timer; - uint32 Reverberation_Timer; + uint32 m_uiGrowth_Timer; + uint32 m_uiCaveIn_Timer; + uint32 m_uiCaveIn_StaticTimer; + uint32 m_uiGroundSlamTimer; + uint32 m_uiHurtfulStrike_Timer; + uint32 m_uiReverberation_Timer; + + bool m_bPerformingGroundSlam; void Reset() { - Growth_Timer= 30000; - CaveIn_Timer= 27000; - CaveIn_StaticTimer = 30000; - GroundSlamTimer= 35000; - GroundSlamStage= 0; - PerformingGroundSlam= false; - HurtfulStrike_Timer= 8000; - Reverberation_Timer= 60000+45000; + m_uiGrowth_Timer= 30000; + m_uiCaveIn_Timer= 27000; + m_uiCaveIn_StaticTimer = 30000; + m_uiGroundSlamTimer= 35000; + m_bPerformingGroundSlam= false; + m_uiHurtfulStrike_Timer= 8000; + m_uiReverberation_Timer= 60000+45000; if (pInstance) pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); @@ -115,183 +113,131 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } } - void UpdateAI(const uint32 diff) + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) + { + //This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction + //It's initially wrong, since this will cause fall damage, which is by comments, not intended. + if (pSpell->Id == SPELL_GROUND_SLAM) + { + if (pTarget->GetTypeId() == TYPEID_PLAYER) + { + switch(rand()%2) + { + case 0: pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true, NULL, NULL, m_creature->GetGUID()); break; + case 1: pTarget->CastSpell(pTarget, SPELL_KNOCK_BACK, true, NULL, NULL, m_creature->GetGUID()); break; + } + } + } + + //this part should be in mangos + if (pSpell->Id == SPELL_SHATTER) + { + //this spell must have custom handling in mangos, dealing damage based on distance + pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true); + + if (pTarget->HasAura(SPELL_STONED)) + pTarget->RemoveAurasDueToSpell(SPELL_STONED); + + //clear this, if we are still performing + if (m_bPerformingGroundSlam) + { + m_bPerformingGroundSlam = false; + + //and correct movement, if not already + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (m_creature->getVictim()) + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + } + } + } + } + + void UpdateAI(const uint32 uiDiff) { //Return since we have no target - if (!UpdateVictim() ) + if (!UpdateVictim()) return; // Growth // Gruul can cast this spell up to 30 times - if (Growth_Timer < diff) + if (m_uiGrowth_Timer < uiDiff) { DoScriptText(EMOTE_GROW, m_creature); DoCast(m_creature,SPELL_GROWTH); - Growth_Timer = 30000; - }else Growth_Timer -= diff; + m_uiGrowth_Timer = 30000; + } + else + m_uiGrowth_Timer -= uiDiff; - if (PerformingGroundSlam) + if (m_bPerformingGroundSlam) { - if (GroundSlamTimer < diff) + if (m_uiGroundSlamTimer < uiDiff) { - switch(GroundSlamStage) - { - case 0: - { - //Begin the whole ordeal - std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - - std::vector<Unit*> knockback_targets; - - //First limit the list to only players - for(std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) - { - Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - - if (target && target->GetTypeId() == TYPEID_PLAYER) - knockback_targets.push_back(target); - } - - //Now to totally disoriend those players - for(std::vector<Unit*>::iterator itr = knockback_targets.begin(); itr!= knockback_targets.end(); ++itr) - { - Unit *target = *itr; - Unit *target2 = *(knockback_targets.begin() + rand()%knockback_targets.size()); - - if (target && target2) - { - switch(rand()%2) - { - case 0: target2->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, m_creature->GetGUID()); break; - case 1: target2->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, m_creature->GetGUID()); break; - } - } - } - - GroundSlamTimer = 7000; - break; - } - - case 1: - { - //Players are going to get stoned - std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - - for(std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) - { - Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - - if(target) - { - target->RemoveAurasDueToSpell(SPELL_GRONN_LORDS_GRASP); - target->CastSpell(target, SPELL_STONED, true, NULL, NULL, m_creature->GetGUID()); - } - } - - GroundSlamTimer = 5000; - break; - } - - case 2: - { - //The dummy shatter spell is cast - DoCast(m_creature, SPELL_SHATTER); - GroundSlamTimer = 1000; - break; - } - - case 3: - { - //Shatter takes effect - std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); - - for(std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) - { - Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - - if(target) - { - target->RemoveAurasDueToSpell(SPELL_STONED); - - if(target->GetTypeId() == TYPEID_PLAYER) - target->CastSpell(target, SPELL_SHATTER_EFFECT, false, NULL, NULL, m_creature->GetGUID()); - } - - } - - m_creature->GetMotionMaster()->Clear(); - - Unit *victim = m_creature->getVictim(); - if (victim) - { - m_creature->GetMotionMaster()->MoveChase(victim); - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); - } - - PerformingGroundSlam = false; - GroundSlamTimer =120000; - HurtfulStrike_Timer= 8000; - - if (Reverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter - Reverberation_Timer += 10000; - - break; - } - } + m_uiGroundSlamTimer =120000; + m_uiHurtfulStrike_Timer= 8000; - GroundSlamStage++; + if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter + m_uiReverberation_Timer += 10000; + + DoCast(m_creature, SPELL_SHATTER); } else - GroundSlamTimer-=diff; + m_uiGroundSlamTimer -= uiDiff; } else { // Hurtful Strike - if (HurtfulStrike_Timer < diff) + if (m_uiHurtfulStrike_Timer < uiDiff) { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_TOPAGGRO,1); + Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,1); if (target && m_creature->IsWithinMeleeRange(m_creature->getVictim())) DoCast(target,SPELL_HURTFUL_STRIKE); else DoCast(m_creature->getVictim(),SPELL_HURTFUL_STRIKE); - HurtfulStrike_Timer= 8000; - }else HurtfulStrike_Timer -= diff; + m_uiHurtfulStrike_Timer= 8000; + } + else + m_uiHurtfulStrike_Timer -= uiDiff; // Reverberation - if (Reverberation_Timer < diff) + if (m_uiReverberation_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_REVERBERATION, true); - Reverberation_Timer = 15000 + rand()%10000; - }else Reverberation_Timer -= diff; + m_uiReverberation_Timer = 15000 + rand()%10000; + } + else + m_uiReverberation_Timer -= uiDiff; // Cave In - if (CaveIn_Timer < diff) + if (m_uiCaveIn_Timer < uiDiff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_CAVE_IN); - if(CaveIn_StaticTimer >= 4000) - CaveIn_StaticTimer -= 2000; + if(m_uiCaveIn_StaticTimer >= 4000) + m_uiCaveIn_StaticTimer -= 2000; - CaveIn_Timer = CaveIn_StaticTimer; - - }else CaveIn_Timer -= diff; + m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; + } + else + m_uiCaveIn_Timer -= uiDiff; // Ground Slam, Gronn Lord's Grasp, Stoned, Shatter - if (GroundSlamTimer < diff) + if (m_uiGroundSlamTimer < uiDiff) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - PerformingGroundSlam= true; - GroundSlamTimer = 0; - GroundSlamStage = 0; - DoCast(m_creature->getVictim(), SPELL_GROUND_SLAM); - } else GroundSlamTimer -=diff; + m_bPerformingGroundSlam= true; + m_uiGroundSlamTimer = 10000; + + DoCast(m_creature, SPELL_GROUND_SLAM); + } + else + m_uiGroundSlamTimer -= uiDiff; DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp index 9789d362ab9..9e020ed495f 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp @@ -24,101 +24,126 @@ EndScriptData */ #include "precompiled.h" #include "def_zulgurub.h" -#define SAY_AGGRO -1309011 -#define SAY_FEAST_PANTHER -1309012 -#define SAY_DEATH -1309013 +bool GOHello_go_gong_of_bethekk(Player* pPlayer, GameObject* pGo) +{ + if (ScriptedInstance* m_pInstance = (ScriptedInstance*)pGo->GetInstanceData()) + { + if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) + return true; + + m_pInstance->SetData(TYPE_ARLOKK, IN_PROGRESS); + } + + return false; +} + +enum +{ + SAY_AGGRO = -1309011, + SAY_FEAST_PANTHER = -1309012, + SAY_DEATH = -1309013, -#define SPELL_SHADOWWORDPAIN 23952 -#define SPELL_GOUGE 24698 -#define SPELL_MARK 24210 -#define SPELL_CLEAVE 26350 //Perhaps not right. Not a red aura... -#define SPELL_PANTHER_TRANSFORM 24190 + SPELL_SHADOWWORDPAIN = 23952, + SPELL_GOUGE = 24698, + SPELL_MARK = 24210, + SPELL_CLEAVE = 26350, //Perhaps not right. Not a red aura... + SPELL_PANTHER_TRANSFORM = 24190, + + MODEL_ID_NORMAL = 15218, + MODEL_ID_PANTHER = 15215, + MODEL_ID_BLANK = 11686, + + NPC_ZULIAN_PROWLER = 15101 +}; struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI { boss_arlokkAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; - uint32 ShadowWordPain_Timer; - uint32 Gouge_Timer; - uint32 Mark_Timer; - uint32 Cleave_Timer; - uint32 Vanish_Timer; - uint32 Summon_Timer; - uint32 Visible_Timer; + uint32 m_uiShadowWordPain_Timer; + uint32 m_uiGouge_Timer; + uint32 m_uiMark_Timer; + uint32 m_uiCleave_Timer; + uint32 m_uiVanish_Timer; + uint32 m_uiSummon_Timer; + uint32 m_uiVisible_Timer; uint64 markedTargetGUID; uint32 Counter; - bool PhaseTwo; - bool VanishedOnce; + bool m_bPhaseTwo; + bool m_bVanishedOnce; void Reset() { - ShadowWordPain_Timer = 8000; - Gouge_Timer = 14000; - Mark_Timer = 35000; - Cleave_Timer = 4000; - Vanish_Timer = 60000; - Summon_Timer = 5000; - Visible_Timer = 6000; + m_uiShadowWordPain_Timer = 8000; + m_uiGouge_Timer = 14000; + m_uiMark_Timer = 35000; + m_uiCleave_Timer = 4000; + m_uiVanish_Timer = 60000; + m_uiSummon_Timer = 5000; + m_uiVisible_Timer = 6000; Counter = 0; markedTargetGUID = 0; - PhaseTwo = false; - VanishedOnce = false; + m_bPhaseTwo = false; + m_bVanishedOnce = false; - m_creature->SetDisplayId(15218); + m_creature->SetDisplayId(MODEL_ID_NORMAL); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit *who) + void EnterCombat(Unit* pWho) { DoScriptText(SAY_AGGRO, m_creature); } - void JustDied(Unit* Killer) + void JustDied(Unit* pKiller) { DoScriptText(SAY_DEATH, m_creature); - m_creature->SetDisplayId(15218); + m_creature->SetDisplayId(MODEL_ID_NORMAL); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if(pInstance) - pInstance->SetData(DATA_ARLOKK_DEATH, 0); + if(m_pInstance) + m_pInstance->SetData(TYPE_ARLOKK, DONE); } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if( m_creature->getVictim() && m_creature->isAlive()) { - if (!PhaseTwo && ShadowWordPain_Timer < diff) + if (!m_bPhaseTwo && m_uiShadowWordPain_Timer < uiDiff) { DoCast(m_creature->getVictim(),SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 15000; - }else ShadowWordPain_Timer -= diff; + m_uiShadowWordPain_Timer = 15000; + } + else + m_uiShadowWordPain_Timer -= uiDiff; - if (!PhaseTwo && Mark_Timer < diff) + if (!m_bPhaseTwo && m_uiMark_Timer < uiDiff) { if(Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { DoCast(target, SPELL_MARK); markedTargetGUID = target->GetGUID(); } - Mark_Timer = 15000; - }else Mark_Timer -= diff; + m_uiMark_Timer = 15000; + } + else + m_uiMark_Timer -= uiDiff; - if (Summon_Timer < diff && Counter < 31) + if (m_uiSummon_Timer < uiDiff && Counter < 31) { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Creature *Panther = m_creature->SummonCreature(15101,-11532.79980,-1649.6734,41.4800,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); Player *markedTarget = Unit::GetPlayer(markedTargetGUID); @@ -127,7 +152,9 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI { DoScriptText(SAY_FEAST_PANTHER, m_creature, markedTarget); Panther ->AI()->AttackStart(markedTarget); - }else if(Panther && target) Panther ->AI()->AttackStart(target); + } + else if(Panther && target) + Panther ->AI()->AttackStart(target); Panther = m_creature->SummonCreature(15101,-11532.9970,-1606.4840,41.2979,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); @@ -137,65 +164,74 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI Panther ->AI()->AttackStart(target); Counter++; - Summon_Timer = 5000; - }else Summon_Timer -= diff; + m_uiSummon_Timer = 5000; + } + else + m_uiSummon_Timer -= uiDiff; - if (Vanish_Timer < diff) + if (m_uiVanish_Timer < uiDiff) { //Invisble Model - m_creature->SetDisplayId(11686); + m_creature->SetDisplayId(MODEL_ID_BLANK); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //m_creature->CombatStop(); DoResetThreat(); - VanishedOnce = true; - Vanish_Timer = 45000; - Visible_Timer = 6000; - }else Vanish_Timer -= diff; + m_bVanishedOnce = true; + m_uiVanish_Timer = 45000; + m_uiVisible_Timer = 6000; + } + else + m_uiVanish_Timer -= uiDiff; - if (VanishedOnce) + if (m_bVanishedOnce) { - if(Visible_Timer < diff) + if(m_uiVisible_Timer < uiDiff) { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); //The Panther Model - m_creature->SetDisplayId(15215); + m_creature->SetDisplayId(MODEL_ID_PANTHER); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); m_creature->UpdateDamagePhysical(BASE_ATTACK); - if(target) - AttackStart(target); - //The Panther Model - m_creature->SetDisplayId(15215); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - PhaseTwo = true; - }else Visible_Timer -= diff; + + if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + AttackStart(pTarget); + + m_bPhaseTwo = true; + } + else + m_uiVisible_Timer -= uiDiff; } //Cleave_Timer - if(PhaseTwo && Cleave_Timer < diff) + if(m_bPhaseTwo && m_uiCleave_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 16000; - }Cleave_Timer -=diff; + m_uiCleave_Timer = 16000; + } + else + m_uiCleave_Timer -=uiDiff; //Gouge_Timer - if(PhaseTwo && Gouge_Timer < diff) + if(m_bPhaseTwo && m_uiGouge_Timer < uiDiff) { DoCast(m_creature->getVictim(), SPELL_GOUGE); + if(DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-80); - Gouge_Timer = 17000+rand()%10000; - }else Gouge_Timer -= diff; + m_uiGouge_Timer = 17000+rand()%10000; + } + else + m_uiGouge_Timer -= uiDiff; DoMeleeAttackIfReady(); } } }; + CreatureAI* GetAI_boss_arlokk(Creature *_Creature) { return new boss_arlokkAI (_Creature); @@ -204,6 +240,12 @@ CreatureAI* GetAI_boss_arlokk(Creature *_Creature) void AddSC_boss_arlokk() { Script *newscript; + + newscript = new Script; + newscript->Name = "go_gong_of_bethekk"; + newscript->pGOHello = &GOHello_go_gong_of_bethekk; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name="boss_arlokk"; newscript->GetAI = &GetAI_boss_arlokk; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp index 6879c04646f..0618fb9bf32 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp @@ -46,10 +46,10 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI { boss_hakkarAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; @@ -143,11 +143,11 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else Enrage_Timer -= diff; //Checking if Jeklik is dead. If not we cast her Aspect - if(CheckJeklik_Timer < diff) + if (CheckJeklik_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(!pInstance->GetData(DATA_JEKLIKISDEAD)) + if (m_pInstance->GetData(TYPE_JEKLIK) != DONE) { if (AspectOfJeklik_Timer < diff) { @@ -160,11 +160,11 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else CheckJeklik_Timer -= diff; //Checking if Venoxis is dead. If not we cast his Aspect - if(CheckVenoxis_Timer < diff) + if (CheckVenoxis_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(!pInstance->GetData(DATA_VENOXISISDEAD)) + if (m_pInstance->GetData(TYPE_VENOXIS) != DONE) { if (AspectOfVenoxis_Timer < diff) { @@ -177,11 +177,11 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else CheckVenoxis_Timer -= diff; //Checking if Marli is dead. If not we cast her Aspect - if(CheckMarli_Timer < diff) + if (CheckMarli_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(!pInstance->GetData(DATA_MARLIISDEAD)) + if (m_pInstance->GetData(TYPE_MARLI) != DONE) { if (AspectOfMarli_Timer < diff) { @@ -195,11 +195,11 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else CheckMarli_Timer -= diff; //Checking if Thekal is dead. If not we cast his Aspect - if(CheckThekal_Timer < diff) + if (CheckThekal_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(!pInstance->GetData(DATA_THEKALISDEAD)) + if (m_pInstance->GetData(TYPE_THEKAL) != DONE) { if (AspectOfThekal_Timer < diff) { @@ -212,11 +212,11 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else CheckThekal_Timer -= diff; //Checking if Arlokk is dead. If yes we cast her Aspect - if(CheckArlokk_Timer < diff) + if (CheckArlokk_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(!pInstance->GetData(DATA_ARLOKKISDEAD)) + if (m_pInstance->GetData(TYPE_ARLOKK) != DONE) { if (AspectOfArlokk_Timer < diff) { @@ -233,6 +233,7 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_hakkar(Creature *_Creature) { return new boss_hakkarAI (_Creature); diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp index d1ef25a03a8..da1cffea32d 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp @@ -45,10 +45,10 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI { boss_jeklikAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -87,8 +87,8 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI { DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_JEKLIK_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_JEKLIK, DONE); } void UpdateAI(const uint32 diff) @@ -96,7 +96,7 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI if (!UpdateVictim()) return; - if( m_creature->getVictim() && m_creature->isAlive()) + if (m_creature->getVictim() && m_creature->isAlive()) { if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 50)) { @@ -132,27 +132,27 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI if (target && Bat ) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(target && Bat ) Bat ->AI()->AttackStart(target); + if (target && Bat ) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(target && Bat ) Bat ->AI()->AttackStart(target); + if (target && Bat ) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(target && Bat ) Bat ->AI()->AttackStart(target); + if (target && Bat ) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(target && Bat ) Bat ->AI()->AttackStart(target); + if (target && Bat ) Bat ->AI()->AttackStart(target); Bat = m_creature->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(target && Bat ) Bat ->AI()->AttackStart(target); + if (target && Bat ) Bat ->AI()->AttackStart(target); SpawnBats_Timer = 60000; }else SpawnBats_Timer -= diff; } else { - if(PhaseTwo) + if (PhaseTwo) { - if(PhaseTwo && ShadowWordPain_Timer < diff) + if (PhaseTwo && ShadowWordPain_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { @@ -161,34 +161,34 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI } }ShadowWordPain_Timer -=diff; - if(MindFlay_Timer < diff) + if (MindFlay_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MIND_FLAY); MindFlay_Timer = 16000; }MindFlay_Timer -=diff; - if(ChainMindFlay_Timer < diff) + if (ChainMindFlay_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature->getVictim(), SPELL_CHAIN_MIND_FLAY); ChainMindFlay_Timer = 15000 + rand()%15000; }ChainMindFlay_Timer -=diff; - if(GreaterHeal_Timer < diff) + if (GreaterHeal_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature,SPELL_GREATERHEAL); GreaterHeal_Timer = 25000 + rand()%10000; }GreaterHeal_Timer -=diff; - if(SpawnFlyingBats_Timer < diff) + if (SpawnFlyingBats_Timer < diff) { Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(!target) + if (!target) return; Creature* FlyingBat = m_creature->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if(FlyingBat) + if (FlyingBat) FlyingBat->AI()->AttackStart(target); SpawnFlyingBats_Timer = 10000 + rand()%5000; @@ -212,10 +212,10 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI { mob_batriderAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; uint32 Bomb_Timer; uint32 Check_Timer; @@ -236,7 +236,7 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI return; //Bomb_Timer - if(Bomb_Timer < diff) + if (Bomb_Timer < diff) { if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { @@ -246,14 +246,15 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI }else Bomb_Timer -= diff; //Check_Timer - if(Check_Timer < diff) + if (Check_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(pInstance->GetData(DATA_JEKLIKISDEAD)) + if (m_pInstance->GetData(TYPE_JEKLIK) == DONE) { m_creature->setDeathState(JUST_DIED); m_creature->RemoveCorpse(); + return; } } diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp index e2c3f306e8b..f5bd8fa9958 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp @@ -46,7 +46,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI { boss_mandokirAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } uint32 KillCount; @@ -61,7 +61,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI float targetY; float targetZ; - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; bool endWatch; bool someWatched; @@ -97,7 +97,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI void KilledUnit(Unit* victim) { - if(victim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() == TYPEID_PLAYER) { ++KillCount; @@ -105,9 +105,9 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI { DoScriptText(SAY_DING_KILL, m_creature); - if (pInstance) + if (m_pInstance) { - uint64 JindoGUID = pInstance->GetData64(DATA_JINDO); + uint64 JindoGUID = m_pInstance->GetData64(DATA_JINDO); if (JindoGUID) { if (Unit* jTemp = Unit::GetUnit(*m_creature,JindoGUID)) @@ -130,12 +130,12 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if(!UpdateVictim()) + if (!UpdateVictim()) return; - if( m_creature->getVictim() && m_creature->isAlive()) + if ( m_creature->getVictim() && m_creature->isAlive()) { - if(!CombatStart) + if (!CombatStart) { //At combat Start Mandokir is mounted so we must unmount it first m_creature->Unmount(); @@ -147,17 +147,17 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI if (Watch_Timer < diff) //Every 20 Sec Mandokir will check this { - if(WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him + if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him { Unit* pUnit = Unit::GetUnit(*m_creature, WatchTarget); - if( pUnit && ( + if ( pUnit && ( targetX != pUnit->GetPositionX() || targetY != pUnit->GetPositionY() || targetZ != pUnit->GetPositionZ() || pUnit->isInCombat())) { - if(m_creature->IsWithinMeleeRange(pUnit)) + if (m_creature->IsWithinMeleeRange(pUnit)) { DoCast(pUnit,24316); } @@ -197,7 +197,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI endWatch = false; } - if(!someWatched) + if (!someWatched) { //Cleave if (Cleave_Timer < diff) @@ -222,11 +222,11 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI for(; i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid()); - if(pUnit && m_creature->IsWithinMeleeRange(pUnit)) + if (pUnit && m_creature->IsWithinMeleeRange(pUnit)) TargetInRange++; } - if(TargetInRange > 3) + if (TargetInRange > 3) DoCast(m_creature->getVictim(),SPELL_FEAR); Fear_Timer = 4000; @@ -243,11 +243,11 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI } } //Checking if Ohgan is dead. If yes Mandokir will enrage. - if(Check_Timer < diff) + if (Check_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(pInstance->GetData(DATA_OHGANISDEAD)) + if (m_pInstance->GetData(TYPE_OHGAN) == DONE) { if (!RaptorDead) { @@ -270,11 +270,11 @@ struct TRINITY_DLL_DECL mob_ohganAI : public ScriptedAI { mob_ohganAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } uint32 SunderArmor_Timer; - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; void Reset() { @@ -285,8 +285,8 @@ struct TRINITY_DLL_DECL mob_ohganAI : public ScriptedAI void JustDied(Unit* Killer) { - if(pInstance) - pInstance->SetData(DATA_OHGAN_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_OHGAN, DONE); } void UpdateAI (const uint32 diff) @@ -296,7 +296,7 @@ struct TRINITY_DLL_DECL mob_ohganAI : public ScriptedAI return; //SunderArmor_Timer - if(SunderArmor_Timer < diff) + if (SunderArmor_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_SUNDERARMOR); SunderArmor_Timer = 10000 + rand()%5000; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp index 78ddfcf1d9a..79fb6f9653d 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp @@ -42,10 +42,10 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI { boss_marliAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -81,8 +81,8 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_MARLI_DEATH, 0); + if(m_pInstance) + m_pInstance->SetData(TYPE_MARLI, DONE); } void UpdateAI(const uint32 diff) diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp index 5cd5fc61d8f..eb5d3d65114 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp @@ -54,7 +54,7 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI { boss_thekalAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } uint32 MortalCleave_Timer; @@ -67,7 +67,7 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI uint32 Check_Timer; uint32 Resurrect_Timer; - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; bool Enraged; bool PhaseTwo; bool WasDead; @@ -87,9 +87,6 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI Enraged = false; PhaseTwo = false; WasDead = false; - - if(pInstance) - pInstance->SetData(DATA_THEKAL_ALIVE, 0); } void EnterCombat(Unit *who) @@ -100,8 +97,14 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_THEKAL_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, DONE); + } + + void JustReachedHome() + { + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, NOT_STARTED); } void UpdateAI(const uint32 diff) @@ -110,32 +113,36 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI return; //Check_Timer for the death of LorKhan and Zath. - if(!WasDead && Check_Timer < diff) + if (!WasDead && Check_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(pInstance->GetData(DATA_LORKHANISDEAD)) + if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if(Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN))) + if (Unit *pLorKhan = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); + + m_pInstance->SetData(TYPE_LORKHAN, DONE); } } - if(pInstance->GetData(DATA_ZATHISDEAD)) + if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) { //Resurrect Zath - Unit *pZath = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ZATH)); - if(pZath) + Unit *pZath = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ZATH)); + if (pZath) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->setFaction(14); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + + m_pInstance->SetData(TYPE_ZATH, DONE); } } } @@ -161,14 +168,14 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI m_creature->SetStandState(UNIT_STAND_STATE_SLEEP); m_creature->AttackStop(); - if(pInstance) - pInstance->SetData(DATA_THEKALFAKE_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, SPECIAL); WasDead=true; } //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. - if(!PhaseTwo && WasDead) + if (!PhaseTwo && WasDead) { if (Resurrect_Timer < diff) { @@ -240,7 +247,7 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI { mob_zealot_lorkhanAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } uint32 Shield_Timer; @@ -251,7 +258,7 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI bool FakeDeath; - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; void Reset() { @@ -263,8 +270,8 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI FakeDeath = false; - if(pInstance) - pInstance->SetData(DATA_LORKHAN_ALIVE, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_LORKHAN, NOT_STARTED); m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -280,38 +287,38 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI return; //Shield_Timer - if(Shield_Timer < diff) + if (Shield_Timer < diff) { DoCast(m_creature,SPELL_SHIELD); Shield_Timer = 61000; }else Shield_Timer -= diff; //BloodLust_Timer - if(BloodLust_Timer < diff) + if (BloodLust_Timer < diff) { DoCast(m_creature,SPELL_BLOODLUST); BloodLust_Timer = 20000+rand()%8000; }else BloodLust_Timer -= diff; //Casting Greaterheal to Thekal or Zath if they are in meele range. - if(GreaterHeal_Timer < diff) + if (GreaterHeal_Timer < diff) { - if(pInstance) + if (m_pInstance) { - Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL)); - Unit *pZath = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ZATH)); + Unit *pThekal = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_THEKAL)); + Unit *pZath = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ZATH)); - if(!pThekal || !pZath) + if (!pThekal || !pZath) return; switch(rand()%2) { case 0: - if(m_creature->IsWithinMeleeRange(pThekal)) + if (m_creature->IsWithinMeleeRange(pThekal)) DoCast(pThekal, SPELL_GREATERHEAL); break; case 1: - if(m_creature->IsWithinMeleeRange(pZath)) + if (m_creature->IsWithinMeleeRange(pZath)) DoCast(pZath, SPELL_GREATERHEAL); break; } @@ -321,21 +328,21 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI }else GreaterHeal_Timer -= diff; //Disarm_Timer - if(Disarm_Timer < diff) + if (Disarm_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DISARM); Disarm_Timer = 15000+rand()%10000; }else Disarm_Timer -= diff; //Check_Timer for the death of LorKhan and Zath. - if(!FakeDeath && Check_Timer < diff) + if (!FakeDeath && Check_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(pInstance->GetData(DATA_THEKALISFAKEDEAD)) + if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) { //Resurrect Thekal - if(Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL))) + if (Unit *pThekal = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -344,10 +351,10 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI } } - if(pInstance->GetData(DATA_ZATHISDEAD)) + if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) { //Resurrect Zath - if(Unit *pZath = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ZATH))) + if (Unit *pZath = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -367,8 +374,8 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI m_creature->setFaction(35); m_creature->AttackStop(); - if(pInstance) - pInstance->SetData(DATA_LORKHAN_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_LORKHAN, SPECIAL); FakeDeath = true; } @@ -382,7 +389,7 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI { mob_zealot_zathAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } uint32 SweepingStrikes_Timer; @@ -394,7 +401,7 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI bool FakeDeath; - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; void Reset() { @@ -407,8 +414,8 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI FakeDeath = false; - if(pInstance) - pInstance->SetData(DATA_ZATH_ALIVE, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_ZATH, NOT_STARTED); m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -424,53 +431,53 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI return; //SweepingStrikes_Timer - if(SweepingStrikes_Timer < diff) + if (SweepingStrikes_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SWEEPINGSTRIKES); SweepingStrikes_Timer = 22000+rand()%4000; }else SweepingStrikes_Timer -= diff; //SinisterStrike_Timer - if(SinisterStrike_Timer < diff) + if (SinisterStrike_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE); SinisterStrike_Timer = 8000+rand()%8000; }else SinisterStrike_Timer -= diff; //Gouge_Timer - if(Gouge_Timer < diff) + if (Gouge_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_GOUGE); - if(DoGetThreat(m_creature->getVictim())) + if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-100); Gouge_Timer = 17000+rand()%10000; }else Gouge_Timer -= diff; //Kick_Timer - if(Kick_Timer < diff) + if (Kick_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_KICK); Kick_Timer = 15000+rand()%10000; }else Kick_Timer -= diff; //Blind_Timer - if(Blind_Timer < diff) + if (Blind_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_BLIND); Blind_Timer = 10000+rand()%10000; }else Blind_Timer -= diff; //Check_Timer for the death of LorKhan and Zath. - if(!FakeDeath && Check_Timer < diff) + if (!FakeDeath && Check_Timer < diff) { - if(pInstance) + if (m_pInstance) { - if(pInstance->GetData(DATA_LORKHANISDEAD)) + if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if(Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN))) + if (Unit *pLorKhan = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -479,10 +486,10 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI } } - if(pInstance->GetData(DATA_THEKALISFAKEDEAD)) + if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) { //Resurrect Thekal - if(Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL))) + if (Unit *pThekal = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -502,8 +509,8 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI m_creature->setFaction(35); m_creature->AttackStop(); - if(pInstance) - pInstance->SetData(DATA_ZATH_DEATH, 0); + if (m_pInstance) + m_pInstance->SetData(TYPE_ZATH, SPECIAL); FakeDeath = true; } diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp index cd073099df1..ded78244534 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp @@ -41,10 +41,10 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI { boss_venoxisAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceData(); } - ScriptedInstance *pInstance; + ScriptedInstance *m_pInstance; uint32 HolyFire_Timer; uint32 HolyWrath_Timer; @@ -80,8 +80,8 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI void JustDied(Unit* Killer) { DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_VENOXIS_DEATH, 0); + if(m_pInstance) + m_pInstance->SetData(TYPE_VENOXIS, DONE); } void UpdateAI(const uint32 diff) @@ -183,6 +183,7 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI } }; + CreatureAI* GetAI_boss_venoxis(Creature *_Creature) { return new boss_venoxisAI (_Creature); diff --git a/src/bindings/scripts/scripts/zone/zulgurub/def_zulgurub.h b/src/bindings/scripts/scripts/zone/zulgurub/def_zulgurub.h index f14bd8eca98..3aab5b24b56 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/def_zulgurub.h +++ b/src/bindings/scripts/scripts/zone/zulgurub/def_zulgurub.h @@ -5,33 +5,24 @@ #ifndef DEF_ZULGURUB_H #define DEF_ZULGURUB_H -#define DATA_ARLOKKISDEAD 1 -#define DATA_ARLOKK_DEATH 2 -#define DATA_JEKLIKISDEAD 3 -#define DATA_JEKLIK_DEATH 4 -#define DATA_JINDO 5 -#define DATA_LORKHAN 6 -#define DATA_LORKHANISALIVE 7 -#define DATA_LORKHANISDEAD 8 -#define DATA_LORKHAN_ALIVE 9 -#define DATA_LORKHAN_DEATH 10 -#define DATA_MARLIISDEAD 11 -#define DATA_MARLI_DEATH 12 -#define DATA_OHGANISDEAD 13 -#define DATA_OHGAN_DEATH 14 -#define DATA_THEKAL 15 -#define DATA_THEKALFAKE_DEATH 16 -#define DATA_THEKALISALIVE 17 -#define DATA_THEKALISDEAD 18 -#define DATA_THEKALISFAKEDEAD 19 -#define DATA_THEKAL_ALIVE 20 -#define DATA_THEKAL_DEATH 21 -#define DATA_VENOXISISDEAD 22 -#define DATA_VENOXIS_DEATH 23 -#define DATA_ZATH 24 -#define DATA_ZATHISALIVE 25 -#define DATA_ZATHISDEAD 26 -#define DATA_ZATH_ALIVE 27 -#define DATA_ZATH_DEATH 28 +enum +{ + MAX_ENCOUNTERS = 8, + + TYPE_ARLOKK = 1, + TYPE_JEKLIK = 2, + TYPE_VENOXIS = 3, + TYPE_MARLI = 4, + TYPE_OHGAN = 5, + TYPE_THEKAL = 6, + TYPE_ZATH = 7, + TYPE_LORKHAN = 8, + + DATA_JINDO = 10, + DATA_LORKHAN = 11, + DATA_THEKAL = 12, + DATA_ZATH = 13 +}; + #endif diff --git a/src/bindings/scripts/scripts/zone/zulgurub/instance_zulgurub.cpp b/src/bindings/scripts/scripts/zone/zulgurub/instance_zulgurub.cpp index e09335bba92..1cce42d2b4c 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/instance_zulgurub.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/instance_zulgurub.cpp @@ -26,51 +26,26 @@ EndScriptData */ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance { - instance_zulgurub(Map *map) : ScriptedInstance(map) {Initialize();}; + instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. - bool IsBossDied[9]; + uint32 m_auiEncounter[MAX_ENCOUNTERS]; //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. - uint64 LorKhanGUID; - uint64 ZathGUID; - uint64 ThekalGUID; - uint64 JindoGUID; - - void OnCreatureCreate(Creature *creature, bool add) - { - switch (creature->GetEntry()) - { - case 11347: - LorKhanGUID = creature->GetGUID(); - break; - - case 11348: - ZathGUID = creature->GetGUID(); - break; - - case 14509: - ThekalGUID = creature->GetGUID(); - break; - - case 11380: - JindoGUID = creature->GetGUID(); - break; - } - } + uint64 m_uiLorKhanGUID; + uint64 m_uiZathGUID; + uint64 m_uiThekalGUID; + uint64 m_uiJindoGUID; void Initialize() { - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; - IsBossDied[3] = false; - IsBossDied[4] = false; - IsBossDied[5] = false; - IsBossDied[6] = false; - - IsBossDied[7] = false; - IsBossDied[8] = false; + m_uiLorKhanGUID = 0; + m_uiZathGUID = 0; + m_uiThekalGUID = 0; + m_uiJindoGUID = 0; + + for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + m_auiEncounter[i] = NOT_STARTED; } bool IsEncounterInProgress() const @@ -79,153 +54,99 @@ struct TRINITY_DLL_DECL instance_zulgurub : public ScriptedInstance return false; } - uint32 GetData(uint32 type) + void OnCreatureCreate(Creature* pCreature) { - switch(type) + switch(pCreature->GetEntry()) { - case DATA_JEKLIKISDEAD: - if(IsBossDied[0]) - return 1; - break; - - case DATA_VENOXISISDEAD: - if(IsBossDied[1]) - return 1; - break; - - case DATA_MARLIISDEAD: - if(IsBossDied[2]) - return 1; - break; - - case DATA_THEKALISDEAD: - if(IsBossDied[3]) - return 1; - break; + case 11347: m_uiLorKhanGUID = pCreature->GetGUID(); break; + case 11348: m_uiZathGUID = pCreature->GetGUID(); break; + case 14509: m_uiThekalGUID = pCreature->GetGUID(); break; + case 11380: m_uiJindoGUID = pCreature->GetGUID(); break; + } + } - case DATA_ARLOKKISDEAD: - if(IsBossDied[4]) - return 1; + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_ARLOKK: + m_auiEncounter[0] = uiData; break; - case DATA_LORKHANISDEAD: - if(IsBossDied[5]) - return 1; + case TYPE_JEKLIK: + m_auiEncounter[1] = uiData; break; - case DATA_ZATHISDEAD: - if(IsBossDied[6]) - return 1; + case TYPE_VENOXIS: + m_auiEncounter[2] = uiData; break; - case DATA_THEKALISFAKEDEAD: - if(IsBossDied[7]) - return 1; + case TYPE_MARLI: + m_auiEncounter[3] = uiData; break; - case DATA_OHGANISDEAD: - if(IsBossDied[8]) - return 1; + case TYPE_THEKAL: + m_auiEncounter[4] = uiData; break; - //Boss is not dead. Resetting function for some bosses after killing them but whiping at the complete encounter. - - case DATA_THEKALISALIVE: - if(IsBossDied[3]) - return 0; + case TYPE_LORKHAN: + m_auiEncounter[5] = uiData; break; - case DATA_LORKHANISALIVE: - if(IsBossDied[5]) - return 0; + case TYPE_ZATH: + m_auiEncounter[6] = uiData; break; - case DATA_ZATHISALIVE: - if(IsBossDied[6]) - return 0; + case TYPE_OHGAN: + m_auiEncounter[7] = uiData; break; } + } + uint32 GetData(uint32 uiType) + { + switch(uiType) + { + case TYPE_ARLOKK: + return m_auiEncounter[0]; + case TYPE_JEKLIK: + return m_auiEncounter[1]; + case TYPE_VENOXIS: + return m_auiEncounter[2]; + case TYPE_MARLI: + return m_auiEncounter[3]; + case TYPE_THEKAL: + return m_auiEncounter[4]; + case TYPE_LORKHAN: + return m_auiEncounter[5]; + case TYPE_ZATH: + return m_auiEncounter[6]; + case TYPE_OHGAN: + return m_auiEncounter[7]; + } return 0; } - uint64 GetData64 (uint32 identifier) + uint64 GetData64(uint32 uiData) { - switch(identifier) + switch(uiData) { case DATA_LORKHAN: - return LorKhanGUID; - + return m_uiLorKhanGUID; case DATA_ZATH: - return ZathGUID; - + return m_uiZathGUID; case DATA_THEKAL: - return ThekalGUID; - + return m_uiThekalGUID; case DATA_JINDO: - return JindoGUID; + return m_uiJindoGUID; } return 0; - } // end GetData64 - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_JEKLIK_DEATH: - IsBossDied[0] = true; - break; - - case DATA_VENOXIS_DEATH: - IsBossDied[1] = true; - break; - - case DATA_MARLI_DEATH: - IsBossDied[2] = true; - break; - - case DATA_THEKAL_DEATH: - IsBossDied[3] = true; - break; - - case DATA_ARLOKK_DEATH: - IsBossDied[4] = true; - break; - - case DATA_LORKHAN_DEATH: - IsBossDied[5] = true; - break; - - case DATA_ZATH_DEATH: - IsBossDied[6] = true; - break; - - case DATA_THEKALFAKE_DEATH: - IsBossDied[7] = true; - break; - - case DATA_OHGAN_DEATH: - IsBossDied[8] = true; - break; - - case DATA_LORKHAN_ALIVE: - IsBossDied[5] = false; - break; - - case DATA_ZATH_ALIVE: - IsBossDied[6] = false; - break; - - case DATA_THEKAL_ALIVE: - IsBossDied[7] = false; - break; - } } }; -InstanceData* GetInstanceData_instance_zulgurub(Map* map) +InstanceData* GetInstanceData_instance_zulgurub(Map* pMap) { - return new instance_zulgurub(map); + return new instance_zulgurub(pMap); } void AddSC_instance_zulgurub() |