diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-09-03 21:44:45 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-09-03 22:11:41 +0200 |
| commit | 53d3becf3c5bbefa0d078379decbbc76b2840996 (patch) | |
| tree | 83bfedf7f9fa34c6f5508bc5fd9cc2f21f7cbb20 /src/server/scripts/EasternKingdoms/ZulAman | |
| parent | beaf778a3024c6d13d7c1708ce27c6c48568c709 (diff) | |
Core/Misc: Refactor scripts to fix static analysis warnings
Diffstat (limited to 'src/server/scripts/EasternKingdoms/ZulAman')
7 files changed, 243 insertions, 126 deletions
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index b55a9cc74d6..b15fdd85a00 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -88,19 +88,24 @@ class boss_akilzon : public CreatureScript { boss_akilzonAI(Creature* creature) : BossAI(creature, DATA_AKILZONEVENT) { - memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); + Initialize(); } - void Reset() override + void Initialize() { - _Reset(); - TargetGUID = 0; CloudGUID = 0; CycloneGUID = 0; memset(BirdGUIDs, 0, sizeof(BirdGUIDs)); StormCount = 0; isRaining = false; + } + + void Reset() override + { + _Reset(); + + Initialize(); SetWeather(WEATHER_STATE_FINE, 0.0f); } @@ -380,7 +385,17 @@ class npc_akilzon_eagle : public CreatureScript struct npc_akilzon_eagleAI : public ScriptedAI { - npc_akilzon_eagleAI(Creature* creature) : ScriptedAI(creature) { } + npc_akilzon_eagleAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + EagleSwoop_Timer = urand(5000, 10000); + arrived = true; + TargetGUID = 0; + } uint32 EagleSwoop_Timer; bool arrived; @@ -388,9 +403,7 @@ class npc_akilzon_eagle : public CreatureScript void Reset() override { - EagleSwoop_Timer = urand(5000, 10000); - arrived = true; - TargetGUID = 0; + Initialize(); me->SetDisableGravity(true); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 74ce267441f..0cf1f932f10 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -74,7 +74,21 @@ class boss_halazzi : public CreatureScript { boss_halazziAI(Creature* creature) : ScriptedAI(creature), summons(me) { + Initialize(); instance = creature->GetInstanceScript(); + Phase = PHASE_NONE; + FrenzyTimer = 0; + SaberlashTimer = 0; + ShockTimer = 0; + TotemTimer = 0; + } + + void Initialize() + { + LynxGUID = 0; + TransformCount = 0; + BerserkTimer = 600000; + CheckTimer = 1000; } InstanceScript* instance; @@ -96,10 +110,7 @@ class boss_halazzi : public CreatureScript instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); summons.DespawnAll(); - LynxGUID = 0; - TransformCount = 0; - BerserkTimer = 600000; - CheckTimer = 1000; + Initialize(); DoCast(me, SPELL_DUAL_WIELD, true); @@ -321,15 +332,23 @@ class npc_halazzi_lynx : public CreatureScript struct npc_halazzi_lynxAI : public ScriptedAI { - npc_halazzi_lynxAI(Creature* creature) : ScriptedAI(creature) { } + npc_halazzi_lynxAI(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds + shredder_timer = 4000; + } uint32 FrenzyTimer; uint32 shredder_timer; void Reset() override { - FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds - shredder_timer = 4000; + Initialize(); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 0fee04f0d20..3c9d4397d24 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -254,10 +254,23 @@ class boss_hexlord_malacrass : public CreatureScript { boss_hex_lord_malacrassAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; + PlayerGUID = 0; + PlayerClass = CLASS_NONE; + } + + void Initialize() + { + SpiritBolts_Timer = 20000; + DrainPower_Timer = 60000; + SiphonSoul_Timer = 100000; + PlayerAbility_Timer = 99999; + CheckAddState_Timer = 5000; + ResetTimer = 5000; } InstanceScript* instance; @@ -280,12 +293,7 @@ class boss_hexlord_malacrass : public CreatureScript { instance->SetData(DATA_HEXLORDEVENT, NOT_STARTED); - SpiritBolts_Timer = 20000; - DrainPower_Timer = 60000; - SiphonSoul_Timer = 100000; - PlayerAbility_Timer = 99999; - CheckAddState_Timer = 5000; - ResetTimer = 5000; + Initialize(); SpawnAdds(); @@ -523,15 +531,23 @@ class boss_thurg : public CreatureScript struct boss_thurgAI : public boss_hexlord_addAI { - boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + bloodlust_timer = 15000; + cleave_timer = 10000; + } uint32 bloodlust_timer; uint32 cleave_timer; void Reset() override { - bloodlust_timer = 15000; - cleave_timer = 10000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -580,15 +596,23 @@ class boss_alyson_antille : public CreatureScript struct boss_alyson_antilleAI : public boss_hexlord_addAI { //Holy Priest - boss_alyson_antilleAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_alyson_antilleAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + flashheal_timer = 2500; + dispelmagic_timer = 10000; + } uint32 flashheal_timer; uint32 dispelmagic_timer; void Reset() override { - flashheal_timer = 2500; - dispelmagic_timer = 10000; + Initialize(); //AcquireGUID(); @@ -667,13 +691,21 @@ class boss_alyson_antille : public CreatureScript struct boss_gazakrothAI : public boss_hexlord_addAI { - boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + firebolt_timer = 2000; + } uint32 firebolt_timer; void Reset() override { - firebolt_timer = 2000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -718,15 +750,23 @@ class boss_lord_raadan : public CreatureScript struct boss_lord_raadanAI : public boss_hexlord_addAI { - boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + flamebreath_timer = 8000; + thunderclap_timer = 13000; + } uint32 flamebreath_timer; uint32 thunderclap_timer; void Reset() override { - flamebreath_timer = 8000; - thunderclap_timer = 13000; + Initialize(); boss_hexlord_addAI::Reset(); @@ -769,13 +809,21 @@ class boss_darkheart : public CreatureScript struct boss_darkheartAI : public boss_hexlord_addAI { - boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + psychicwail_timer = 8000; + } uint32 psychicwail_timer; void Reset() override { - psychicwail_timer = 8000; + Initialize(); boss_hexlord_addAI::Reset(); } void UpdateAI(uint32 diff) override @@ -811,13 +859,21 @@ class boss_slither : public CreatureScript struct boss_slitherAI : public boss_hexlord_addAI { - boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + venomspit_timer = 5000; + } uint32 venomspit_timer; void Reset() override { - venomspit_timer = 5000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -869,13 +925,21 @@ class boss_fenstalker : public CreatureScript struct boss_fenstalkerAI : public boss_hexlord_addAI { - boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + volatileinf_timer = 15000; + } uint32 volatileinf_timer; void Reset() override { - volatileinf_timer = 15000; + Initialize(); boss_hexlord_addAI::Reset(); } @@ -913,15 +977,23 @@ class boss_koragg : public CreatureScript struct boss_koraggAI : public boss_hexlord_addAI { - boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) { } + boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) + { + Initialize(); + } + + void Initialize() + { + coldstare_timer = 15000; + mightyblow_timer = 10000; + } uint32 coldstare_timer; uint32 mightyblow_timer; void Reset() override { - coldstare_timer = 15000; - mightyblow_timer = 10000; + Initialize(); boss_hexlord_addAI::Reset(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index d5260c18add..2e434ed6ab5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -121,9 +121,29 @@ class boss_janalai : public CreatureScript { boss_janalaiAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + FireBreathTimer = 8000; + BombTimer = 30000; + BombSequenceTimer = 1000; + BombCount = 0; + HatcherTimer = 10000; + EnrageTimer = MINUTE * 5 * IN_MILLISECONDS; + + noeggs = false; + isBombing = false; + enraged = false; + + isFlameBreathing = false; + + for (uint8 i = 0; i < 40; ++i) + FireBombGUIDs[i] = 0; + } + InstanceScript* instance; uint32 FireBreathTimer; @@ -145,21 +165,7 @@ class boss_janalai : public CreatureScript { instance->SetData(DATA_JANALAIEVENT, NOT_STARTED); - FireBreathTimer = 8000; - BombTimer = 30000; - BombSequenceTimer = 1000; - BombCount = 0; - HatcherTimer = 10000; - EnrageTimer = MINUTE*5*IN_MILLISECONDS; - - noeggs = false; - isBombing =false; - enraged = false; - - isFlameBreathing = false; - - for (uint8 i = 0; i < 40; ++i) - FireBombGUIDs[i] = 0; + Initialize(); HatchAllEggs(1); } @@ -493,9 +499,20 @@ class npc_janalai_hatcher : public CreatureScript { npc_janalai_hatcherAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + waypoint = 0; + isHatching = false; + hasChangedSide = false; + WaitTimer = 1; + HatchNum = 0; + side = false; + } + InstanceScript* instance; uint32 waypoint; @@ -509,12 +526,8 @@ class npc_janalai_hatcher : public CreatureScript void Reset() override { me->SetWalk(true); + Initialize(); side =(me->GetPositionY() < 1150); - waypoint = 0; - isHatching = false; - hasChangedSide = false; - WaitTimer = 1; - HatchNum = 0; } bool HatchEggs(uint32 num) @@ -626,15 +639,21 @@ class npc_janalai_hatchling : public CreatureScript { npc_janalai_hatchlingAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + BuffetTimer = 7000; + } + InstanceScript* instance; uint32 BuffetTimer; void Reset() override { - BuffetTimer = 7000; + Initialize(); if (me->GetPositionY() > 1150) me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0] + rand32() % 4 - 2, 1150.0f + rand32() % 4 - 2, hatcherway[0][3][2]); else diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 4909074b059..c9c028021f1 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -109,11 +109,28 @@ class boss_nalorakk : public CreatureScript { boss_nalorakkAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); + inMove = false; MoveEvent = true; MovePhase = 0; + waitTimer = 0; + LaceratingSlash_Timer = 0; + RendFlesh_Timer = 0; + DeafeningRoar_Timer = 0; instance = creature->GetInstanceScript(); } + void Initialize() + { + Surge_Timer = urand(15000, 20000); + BrutalSwipe_Timer = urand(7000, 12000); + Mangle_Timer = urand(10000, 15000); + ShapeShift_Timer = urand(45000, 50000); + Berserk_Timer = 600000; + + inBearForm = false; + } + InstanceScript* instance; uint32 BrutalSwipe_Timer; @@ -150,13 +167,7 @@ class boss_nalorakk : public CreatureScript instance->SetData(DATA_NALORAKKEVENT, NOT_STARTED); - Surge_Timer = urand(15000, 20000); - BrutalSwipe_Timer = urand(7000, 12000); - Mangle_Timer = urand(10000, 15000); - ShapeShift_Timer = urand(45000, 50000); - Berserk_Timer = 600000; - - inBearForm = false; + Initialize(); // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); /// @todo find the correct equipment id } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 6b0fc05ba3d..5b9957cb94d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -136,8 +136,38 @@ class boss_zuljin : public CreatureScript { boss_zuljinAI(Creature* creature) : ScriptedAI(creature), Summons(me) { + Initialize(); instance = creature->GetInstanceScript(); + memset(SpiritGUID, 0, sizeof(SpiritGUID)); + health_20 = 0; } + + void Initialize() + { + Phase = 0; + + Intro_Timer = 37000; + Berserk_Timer = 600000; + + Whirlwind_Timer = 7000; + Grievous_Throw_Timer = 8000; + + Creeping_Paralysis_Timer = 7000; + Overpower_Timer = 0; + + Claw_Rage_Timer = 5000; + Lynx_Rush_Timer = 14000; + Claw_Loop_Timer = 0; + Claw_Counter = 0; + + Flame_Whirl_Timer = 5000; + Flame_Breath_Timer = 6000; + Pillar_Of_Fire_Timer = 7000; + + ClawTargetGUID = 0; + TankGUID = 0; + } + InstanceScript* instance; uint64 SpiritGUID[4]; @@ -171,30 +201,9 @@ class boss_zuljin : public CreatureScript { instance->SetData(DATA_ZULJINEVENT, NOT_STARTED); - Phase = 0; - health_20 = me->CountPctFromMaxHealth(20); - Intro_Timer = 37000; - Berserk_Timer = 600000; - - Whirlwind_Timer = 7000; - Grievous_Throw_Timer = 8000; - - Creeping_Paralysis_Timer = 7000; - Overpower_Timer = 0; - - Claw_Rage_Timer = 5000; - Lynx_Rush_Timer = 14000; - Claw_Loop_Timer = 0; - Claw_Counter = 0; - - Flame_Whirl_Timer = 5000; - Flame_Breath_Timer = 6000; - Pillar_Of_Fire_Timer = 7000; - - ClawTargetGUID = 0; - TankGUID = 0; + Initialize(); Summons.DespawnAll(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 5561ed3c2dd..6784ff086c7 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -131,38 +131,6 @@ class npc_zulaman_hostage : public CreatureScript public: npc_zulaman_hostage() : CreatureScript("npc_zulaman_hostage") { } - struct npc_zulaman_hostageAI : public ScriptedAI - { - npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature) - { - IsLoot = false; - } - - bool IsLoot; - uint64 PlayerGUID; - - void Reset() override { } - - void EnterCombat(Unit* /*who*/) override { } - - void JustDied(Unit* /*killer*/) override - { - if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - player->SendLoot(me->GetGUID(), LOOT_CORPSE); - } - - void UpdateAI(uint32 /*diff*/) override - { - if (IsLoot) - DoCast(me, 7, false); - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_zulaman_hostageAI(creature); - } - bool OnGossipHello(Player* player, Creature* creature) override { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -276,9 +244,17 @@ class npc_harrison_jones : public CreatureScript { npc_harrison_jonesAI(Creature* creature) : ScriptedAI(creature) { + Initialize(); instance = creature->GetInstanceScript(); } + void Initialize() + { + _gongEvent = 0; + _gongTimer = 0; + uiTargetGUID = 0; + } + InstanceScript* instance; uint8 _gongEvent; @@ -287,9 +263,7 @@ class npc_harrison_jones : public CreatureScript void Reset() override { - _gongEvent = 0; - _gongTimer = 0; - uiTargetGUID = 0; + Initialize(); } void EnterCombat(Unit* /*who*/) override { } |
