diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-08-31 20:12:47 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-08-31 20:42:02 +0200 |
| commit | dd4dbdcd16bb72b1b45c7971cb8b9e06030b6e16 (patch) | |
| tree | 8bd974d003322df828efdf56059695c79da285ef /src/server/scripts/EasternKingdoms/MagistersTerrace | |
| parent | 681cf8f27c341a8fadbadf1851b55b7b8a7e524a (diff) | |
Core/Misc: Refactor scripts to fix static analysis warnings
First batch of fixes targeting 100 issues reported by Coverity
Diffstat (limited to 'src/server/scripts/EasternKingdoms/MagistersTerrace')
3 files changed, 200 insertions, 92 deletions
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 7944011c7a0..1aafb32cef9 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -103,9 +103,29 @@ public: { boss_felblood_kaelthasAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + /// @todo Timers + FireballTimer = 0; + PhoenixTimer = 10000; + FlameStrikeTimer = 25000; + CombatPulseTimer = 0; + + PyroblastTimer = 60000; + + GravityLapseTimer = 0; + GravityLapsePhase = 0; + + FirstGravityLapse = true; + HasTaunted = false; + + Phase = 0; + } + InstanceScript* instance; uint32 FireballTimer; @@ -134,21 +154,7 @@ public: void Reset() override { - /// @todo Timers - FireballTimer = 0; - PhoenixTimer = 10000; - FlameStrikeTimer = 25000; - CombatPulseTimer = 0; - - PyroblastTimer = 60000; - - GravityLapseTimer = 0; - GravityLapsePhase = 0; - - FirstGravityLapse = true; - HasTaunted = false; - - Phase = 0; + Initialize(); instance->SetBossState(DATA_KAELTHAS, NOT_STARTED); } @@ -439,13 +445,19 @@ public: { npc_felkael_flamestrikeAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + } + + void Initialize() + { + FlameStrikeTimer = 5000; } uint32 FlameStrikeTimer; void Reset() override { - FlameStrikeTimer = 5000; + Initialize(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->setFaction(14); @@ -481,9 +493,18 @@ public: { npc_felkael_phoenixAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + BurnTimer = 2000; + Death_Timer = 3000; + Rebirth = false; + FakeDeath = false; + } + InstanceScript* instance; uint32 BurnTimer; uint32 Death_Timer; @@ -495,10 +516,7 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); me->SetDisableGravity(true); DoCast(me, SPELL_PHOENIX_BURN, true); - BurnTimer = 2000; - Death_Timer = 3000; - Rebirth = false; - FakeDeath = false; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } @@ -592,13 +610,21 @@ public: struct npc_felkael_phoenix_eggAI : public ScriptedAI { - npc_felkael_phoenix_eggAI(Creature* creature) : ScriptedAI(creature) { } + npc_felkael_phoenix_eggAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + HatchTimer = 10000; + } uint32 HatchTimer; void Reset() override { - HatchTimer = 10000; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 40dedcf6d93..cc2af3dcea5 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -117,11 +117,24 @@ public: { boss_priestess_delrissaAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); LackeyEntryList.clear(); } + void Initialize() + { + PlayersKilled = 0; + + HealTimer = 15000; + RenewTimer = 10000; + ShieldTimer = 2000; + SWPainTimer = 5000; + DispelTimer = 7500; + ResetTimer = 5000; + } + InstanceScript* instance; std::vector<uint32> LackeyEntryList; @@ -138,14 +151,7 @@ public: void Reset() override { - PlayersKilled = 0; - - HealTimer = 15000; - RenewTimer = 10000; - ShieldTimer = 2000; - SWPainTimer = 5000; - DispelTimer = 7500; - ResetTimer = 5000; + Initialize(); InitializeLackeys(); } @@ -353,11 +359,23 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI { boss_priestess_lackey_commonAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } + void Initialize() + { + UsedPotion = false; + + // These guys does not follow normal threat system rules + // For later development, some alternative threat system should be made + // We do not know what this system is based upon, but one theory is class (healers=high threat, dps=medium, etc) + // We reset their threat frequently as an alternative until such a system exist + ResetThreatTimer = urand(5000, 20000); + } + InstanceScript* instance; uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; @@ -367,13 +385,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void Reset() override { - UsedPotion = false; - - // These guys does not follow normal threat system rules - // For later development, some alternative threat system should be made - // We do not know what this system is based upon, but one theory is class (healers=high threat, dps=medium, etc) - // We reset their threat frequently as an alternative until such a system exist - ResetThreatTimer = urand(5000, 20000); + Initialize(); // in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her) if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) @@ -493,7 +505,20 @@ public: struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { //Rogue - boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Gouge_Timer = 5500; + Kick_Timer = 7000; + Vanish_Timer = 2000; + Eviscerate_Timer = 6000; + Wait_Timer = 5000; + InVanish = false; + } uint32 Gouge_Timer; uint32 Kick_Timer; @@ -504,12 +529,7 @@ public: void Reset() override { - Gouge_Timer = 5500; - Kick_Timer = 7000; - Vanish_Timer = 2000; - Eviscerate_Timer = 6000; - Wait_Timer = 5000; - InVanish = false; + Initialize(); me->SetVisible(true); boss_priestess_lackey_commonAI::Reset(); @@ -597,7 +617,19 @@ public: struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { //Warlock - boss_ellris_duskhallowAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_ellris_duskhallowAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Immolate_Timer = 6000; + Shadow_Bolt_Timer = 3000; + Seed_of_Corruption_Timer = 2000; + Curse_of_Agony_Timer = 1000; + Fear_Timer = 10000; + } uint32 Immolate_Timer; uint32 Shadow_Bolt_Timer; @@ -607,11 +639,7 @@ public: void Reset() override { - Immolate_Timer = 6000; - Shadow_Bolt_Timer = 3000; - Seed_of_Corruption_Timer = 2000; - Curse_of_Agony_Timer = 1000; - Fear_Timer = 10000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -688,15 +716,23 @@ public: struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { //Monk - boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Knockdown_Timer = 6000; + Snap_Kick_Timer = 4500; + } uint32 Knockdown_Timer; uint32 Snap_Kick_Timer; void Reset() override { - Knockdown_Timer = 6000; - Snap_Kick_Timer = 4500; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -749,7 +785,24 @@ public: struct boss_yazzaiAI : public boss_priestess_lackey_commonAI { //Mage - boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + HasIceBlocked = false; + + Polymorph_Timer = 1000; + Ice_Block_Timer = 20000; + Wait_Timer = 10000; + Blizzard_Timer = 8000; + Ice_Lance_Timer = 12000; + Cone_of_Cold_Timer = 10000; + Frostbolt_Timer = 3000; + Blink_Timer = 8000; + } bool HasIceBlocked; @@ -764,16 +817,7 @@ public: void Reset() override { - HasIceBlocked = false; - - Polymorph_Timer = 1000; - Ice_Block_Timer = 20000; - Wait_Timer = 10000; - Blizzard_Timer = 8000; - Ice_Lance_Timer = 12000; - Cone_of_Cold_Timer = 10000; - Frostbolt_Timer = 3000; - Blink_Timer = 8000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -879,7 +923,20 @@ public: struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { //Warrior - boss_warlord_salarisAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_warlord_salarisAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Intercept_Stun_Timer = 500; + Disarm_Timer = 6000; + Piercing_Howl_Timer = 10000; + Frightening_Shout_Timer = 18000; + Hamstring_Timer = 4500; + Mortal_Strike_Timer = 8000; + } uint32 Intercept_Stun_Timer; uint32 Disarm_Timer; @@ -890,12 +947,7 @@ public: void Reset() override { - Intercept_Stun_Timer = 500; - Disarm_Timer = 6000; - Piercing_Howl_Timer = 10000; - Frightening_Shout_Timer = 18000; - Hamstring_Timer = 4500; - Mortal_Strike_Timer = 8000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -1001,9 +1053,20 @@ public: //Hunter boss_garaxxasAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { + Initialize(); m_uiPetGUID = 0; } + void Initialize() + { + Aimed_Shot_Timer = 6000; + Shoot_Timer = 2500; + Concussive_Shot_Timer = 8000; + Multi_Shot_Timer = 10000; + Wing_Clip_Timer = 4000; + Freezing_Trap_Timer = 15000; + } + uint64 m_uiPetGUID; uint32 Aimed_Shot_Timer; @@ -1015,12 +1078,7 @@ public: void Reset() override { - Aimed_Shot_Timer = 6000; - Shoot_Timer = 2500; - Concussive_Shot_Timer = 8000; - Multi_Shot_Timer = 10000; - Wing_Clip_Timer = 4000; - Freezing_Trap_Timer = 15000; + Initialize(); Unit* pPet = ObjectAccessor::GetUnit(*me, m_uiPetGUID); if (!pPet) @@ -1110,7 +1168,20 @@ public: struct boss_apokoAI : public boss_priestess_lackey_commonAI { //Shaman - boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Totem_Timer = 2000; + Totem_Amount = 1; + War_Stomp_Timer = 10000; + Purge_Timer = 8000; + Healing_Wave_Timer = 5000; + Frost_Shock_Timer = 7000; + } uint32 Totem_Timer; uint8 Totem_Amount; @@ -1121,12 +1192,7 @@ public: void Reset() override { - Totem_Timer = 2000; - Totem_Amount = 1; - War_Stomp_Timer = 10000; - Purge_Timer = 8000; - Healing_Wave_Timer = 5000; - Frost_Shock_Timer = 7000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } @@ -1199,7 +1265,19 @@ public: struct boss_zelfanAI : public boss_priestess_lackey_commonAI { //Engineer - boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) { } + boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature) + { + Initialize(); + } + + void Initialize() + { + Goblin_Dragon_Gun_Timer = 20000; + Rocket_Launch_Timer = 7000; + Recombobulate_Timer = 4000; + High_Explosive_Sheep_Timer = 10000; + Fel_Iron_Bomb_Timer = 15000; + } uint32 Goblin_Dragon_Gun_Timer; uint32 Rocket_Launch_Timer; @@ -1209,11 +1287,7 @@ public: void Reset() override { - Goblin_Dragon_Gun_Timer = 20000; - Rocket_Launch_Timer = 7000; - Recombobulate_Timer = 4000; - High_Explosive_Sheep_Timer = 10000; - Fel_Iron_Bomb_Timer = 15000; + Initialize(); boss_priestess_lackey_commonAI::Reset(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 28f4800b6cf..a20f595183f 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -115,13 +115,21 @@ public: struct npc_kalecgosAI : public ScriptedAI { - npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) { } + npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + m_uiTransformTimer = 0; + } uint32 m_uiTransformTimer; void Reset() override { - m_uiTransformTimer = 0; + Initialize(); // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here if (me->GetEntry() != NPC_KAEL) |
