From e5f1104849a714a3afce43ff0900d976122a7c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Borz=C3=AC?= Date: Mon, 19 Jul 2021 11:23:27 +0200 Subject: [PATCH] refactor(Scripts/EasternKingdoms): code cleanup (part 5) - also fix potential crash (#6923) --- .../AlteracValley/boss_balinda.cpp | 2 +- .../instance_blackrock_depths.cpp | 1 - .../MoltenCore/instance_molten_core.cpp | 1 - .../Karazhan/boss_prince_malchezaar.cpp | 27 ++++++++++--------- .../Karazhan/boss_shade_of_aran.cpp | 13 +++------ .../Karazhan/boss_terestian_illhoof.cpp | 6 ++--- .../Karazhan/instance_karazhan.cpp | 3 +++ .../EasternKingdoms/Karazhan/karazhan.cpp | 4 +-- .../EasternKingdoms/Karazhan/karazhan.h | 20 +++----------- .../boss_felblood_kaelthas.cpp | 1 - .../boss_priestess_delrissa.cpp | 6 ++--- .../ScarletEnclave/chapter1.cpp | 19 +++++++------ .../ScarletEnclave/chapter5.cpp | 1 - .../zone_the_scarlet_enclave.cpp | 20 +++++++++++--- .../instance_scarlet_monastery.cpp | 2 -- .../Scholomance/instance_scholomance.cpp | 2 +- .../instance_shadowfang_keep.cpp | 14 +++++----- .../Stratholme/instance_stratholme.cpp | 2 +- .../SunwellPlateau/boss_felmyst.cpp | 1 - .../SunwellPlateau/boss_kalecgos.cpp | 9 +++++-- .../EasternKingdoms/ZulAman/boss_akilzon.cpp | 17 ++++++------ .../EasternKingdoms/ZulAman/boss_janalai.cpp | 24 ++++++++--------- .../EasternKingdoms/ZulAman/boss_nalorakk.cpp | 4 +-- .../EasternKingdoms/ZulAman/boss_zuljin.cpp | 3 +-- .../EasternKingdoms/ZulGurub/boss_marli.cpp | 3 +-- .../ZulGurub/boss_renataki.cpp | 10 ++++--- .../EasternKingdoms/ZulGurub/boss_venoxis.cpp | 1 - .../ZulGurub/instance_zulgurub.cpp | 6 ----- .../eastern_kingdoms_script_loader.cpp | 4 +-- .../zone_alterac_mountains.cpp | 2 -- .../EasternKingdoms/zone_blasted_lands.cpp | 1 - .../EasternKingdoms/zone_burning_steppes.cpp | 4 +-- .../EasternKingdoms/zone_eversong_woods.cpp | 4 +-- .../EasternKingdoms/zone_ghostlands.cpp | 1 - .../EasternKingdoms/zone_ironforge.cpp | 11 ++------ .../EasternKingdoms/zone_undercity.cpp | 12 ++++----- .../zone_western_plaguelands.cpp | 1 - 37 files changed, 118 insertions(+), 144 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index ce2a76236..6db934031 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -204,4 +204,4 @@ void AddSC_boss_balinda() { new boss_balinda; new npc_water_elemental; -}; +} diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 4dc8c6dd7..29793fc1d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -6,7 +6,6 @@ #include "blackrock_depths.h" #include "InstanceScript.h" -#include "ScriptedCreature.h" #include "ScriptMgr.h" #define TIMER_TOMBOFTHESEVEN 15000 diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp index 573af4972..be0c6f649 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/instance_molten_core.cpp @@ -11,7 +11,6 @@ SDComment: Place Holder SDCategory: Molten Core EndScriptData */ -#include "CreatureAI.h" #include "InstanceScript.h" #include "molten_core.h" #include "ObjectMgr.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 5a022b66d..172b388ef 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -2,7 +2,6 @@ * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS -* Rescripted By Lee (Talamortis) */ #include "karazhan.h" @@ -285,7 +284,6 @@ public: void SummonInfernal() { - InfernalPoint* point = 0; Position pos; if ((me->GetMapId() == 532)) @@ -294,7 +292,7 @@ public: } else { - point = Acore::Containers::SelectRandomContainerElement(positions); + InfernalPoint* point = Acore::Containers::SelectRandomContainerElement(positions); pos.Relocate(point->x, point->y, INFERNAL_Z, frand(0.0f, float(M_PI * 2))); } @@ -360,14 +358,16 @@ public: { if (SWPainTimer <= diff) { - Unit* target = nullptr; - if (phase == 1) - target = me->GetVictim(); // Target the Tank - else // anyone but the tank - target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + + // if phase == 1 target the tank, otherwise anyone but the tank + Unit* target = phase == 1 + ? me->GetVictim() + : SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (target) + { DoCast(target, SPELL_SW_PAIN); + } SWPainTimer = 20000; } @@ -411,8 +411,7 @@ public: { if (AmplifyDamageTimer <= diff) { - Unit* target = nullptr; - target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (target) { @@ -421,7 +420,9 @@ public: } } else + { AmplifyDamageTimer -= diff; + } } if (phase != 3) @@ -483,9 +484,11 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { if (me->GetVictim()) + { DoModifyThreatPercent(me->GetVictim(), -100); - if (target) - me->AddThreat(target, 1000000.0f); + } + + me->AddThreat(target, 1000000.0f); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index cf070a448..4979b61f7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -392,15 +392,10 @@ public: { ElementalsSpawned = true; - Creature* ElementalOne = nullptr; - Creature* ElementalTwo = nullptr; - Creature* ElementalThree = nullptr; - Creature* ElementalFour = nullptr; - - ElementalOne = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11168.1f, -1939.29f, 232.092f, 1.46f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); - ElementalTwo = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11138.2f, -1915.38f, 232.092f, 3.00f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); - ElementalThree = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11161.7f, -1885.36f, 232.092f, 4.59f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); - ElementalFour = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11192.4f, -1909.36f, 232.092f, 6.19f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); + Creature* ElementalOne = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11168.1f, -1939.29f, 232.092f, 1.46f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); + Creature* ElementalTwo = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11138.2f, -1915.38f, 232.092f, 3.00f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); + Creature* ElementalThree = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11161.7f, -1885.36f, 232.092f, 4.59f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); + Creature* ElementalFour = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11192.4f, -1909.36f, 232.092f, 6.19f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000); if (ElementalOne) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index d2a4ffcf3..0b7faa0c8 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -86,10 +86,10 @@ public: void JustDied(Unit* /*killer*/) override { - ObjectGuid TerestianGUID = instance->GetGuidData(DATA_TERESTIAN); - if (TerestianGUID) + ObjectGuid TerestianGuid = instance->GetGuidData(DATA_TERESTIAN); + if (TerestianGuid) { - Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGUID); + Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGuid); if (Terestian && Terestian->IsAlive()) DoCast(Terestian, SPELL_BROKEN_PACT, true); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 614e9e74d..752b34b55 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -1,3 +1,6 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ #include "Creature.h" #include "GameObject.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index bf9cfe986..aaf8d17f9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -474,9 +474,9 @@ public: void EnterCombat(Unit* /*who*/) override {} - uint32 NextStep(uint32 Step) + uint32 NextStep(uint32 nextStep) { - switch(Step) + switch(nextStep) { case 1: me->MonsterYell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL, 0); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index 0425ea350..838bce079 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -1,20 +1,8 @@ /* -* Copyright (C) 2008-2016 TrinityCore -* Copyright (C) 2006-2009 ScriptDev2 -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at your -* option) any later version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see . -*/ + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2016 TrinityCore + * Copyright (C) 2006-2009 ScriptDev2 + */ #ifndef DEF_KARAZHAN_H #define DEF_KARAZHAN_H diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 56a0172aa..30ff41337 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -6,7 +6,6 @@ #include "Opcodes.h" #include "ScriptedCreature.h" #include "ScriptMgr.h" -#include "WorldPacket.h" enum Says { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index b00416452..160e06b3a 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -956,12 +956,12 @@ public: { boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_MELEE) { } - uint32 Totem_Timer; +// uint32 Totem_Timer; uint8 Totem_Amount; uint32 War_Stomp_Timer; - uint32 Purge_Timer; +// uint32 Purge_Timer; uint32 Healing_Wave_Timer; - uint32 Frost_Shock_Timer; +// uint32 Frost_Shock_Timer; void EnterCombat(Unit* who) override { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 3f2f8f2af..9c6f6331d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -8,7 +8,6 @@ #include "CreatureTextMgr.h" #include "ObjectMgr.h" #include "PassiveAI.h" -#include "PetAI.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" @@ -672,14 +671,14 @@ uint32 acherus_soul_prison[12] = 191590 }; -uint32 acherus_unworthy_initiate[5] = -{ - 29519, - 29520, - 29565, - 29566, - 29567 -}; +//uint32 acherus_unworthy_initiate[5] = +//{ +// 29519, +// 29520, +// 29565, +// 29566, +// 29567 +//}; class npc_unworthy_initiate : public CreatureScript { @@ -782,7 +781,7 @@ public: { if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 100)) { - if (temp_prison && me->IsWithinDist(temp_prison, dist, false)) + if (me->IsWithinDist(temp_prison, dist, false)) { dist = me->GetDistance2d(temp_prison); prison = temp_prison; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 2aaf8f141..378423fdf 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -6,7 +6,6 @@ #include "Player.h" #include "ScriptedCreature.h" -#include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "ScriptMgr.h" #include "SpellScript.h" diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index a4c17a7e1..ee0efcd38 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -64,11 +64,17 @@ public: { Player* player = nullptr; if (me->IsSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + { + if (Unit * summoner = me->ToTempSummon()->GetSummoner()) + { player = summoner->ToPlayer(); + } + } if (!player) + { phase = 3; + } switch (phase) { @@ -78,17 +84,23 @@ public: FlyBackTimer = 500; break; case 1: - player->GetClosePoint(x, y, z, me->GetObjectSize()); + if (player) + { + player->GetClosePoint(x, y, z, me->GetObjectSize()); + } z += 2.5f; x -= 2.0f; y -= 1.5f; me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetTarget(player->GetGUID()); + if (player) + { + me->SetTarget(player->GetGUID()); + } me->SetVisible(true); FlyBackTimer = 4500; break; case 2: - if (!player->isResurrectRequested()) + if (player && !player->isResurrectRequested()) { me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01); DoCast(player, SPELL_REVIVE, true); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index d6f07cb59..d9c9a12c7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -1,7 +1,5 @@ /* * Originally written by Xinef - Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 - -REWRITTEN BY XINEF */ #include "scarletmonastery.h" diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 04b12a8ce..aa57cd176 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -577,7 +577,7 @@ public: events.Update(diff); - if (me->HealthBelowPct(30) && !(me->GetEntry() == DARK_SHADE_ENTRY)) + if (me->HealthBelowPct(30) && me->GetEntry() != DARK_SHADE_ENTRY) { events.Reset(); me->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 74ca9e0f4..4e077c7b6 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -7,13 +7,13 @@ #include "shadowfang_keep.h" #include "TemporarySummon.h" -enum Creatures -{ - NPC_ASH = 3850, - NPC_ADA = 3849, - NPC_ARCHMAGE_ARUGAL = 4275, - NPC_ARUGAL_VOIDWALKER = 4627 -}; +//enum Creatures +//{ +// NPC_ASH = 3850, +// NPC_ADA = 3849, +// NPC_ARCHMAGE_ARUGAL = 4275, +// NPC_ARUGAL_VOIDWALKER = 4627 +//}; class instance_shadowfang_keep : public InstanceMapScript { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 449dc4013..6c6e83561 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -375,7 +375,7 @@ public: if (Player* player = itr->GetSource()) { // should pet also trigger the trap? could not find any source for it - if (player && !player->IsGameMaster() && player->IsWithinDist2d(aGateTrap[i].m_positionX, aGateTrap[i].m_positionY, 5.5f)) + if (!player->IsGameMaster() && player->IsWithinDist2d(aGateTrap[i].m_positionX, aGateTrap[i].m_positionY, 5.5f)) { // Check if timer was not already set by another player/pet a few milliseconds before if (_gateTrapsCooldown[i]) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index a79ab5cfc..552bee502 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -5,7 +5,6 @@ #include "Cell.h" #include "CellImpl.h" #include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "ScriptedCreature.h" #include "ScriptMgr.h" #include "sunwell_plateau.h" diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 85aa33f1a..a29f10569 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -576,9 +576,14 @@ public: case EVENT_CHECK_HEALTH: if (me->HealthBelowPct(10)) { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_KALECGOS))) + if (InstanceScript* instanceScript = me->GetInstanceScript()) + { + if (Creature *kalecgos = ObjectAccessor::GetCreature(*me, instanceScript->GetGuidData( + NPC_KALECGOS))) + { kalecgos->AI()->DoAction(ACTION_ENRAGE_OTHER); + } + } DoAction(ACTION_ENRAGE); break; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index a1349a77f..98add5a2b 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -46,14 +46,15 @@ enum Says SAY_DEATH = 5 }; -enum Misc -{ - NPC_SOARING_EAGLE = 24858, - SE_LOC_X_MAX = 400, - SE_LOC_X_MIN = 335, - SE_LOC_Y_MAX = 1435, - SE_LOC_Y_MIN = 1370 -}; +constexpr auto NPC_SOARING_EAGLE = 24858; + +//enum Misc +//{ +// SE_LOC_X_MAX = 400, +// SE_LOC_X_MIN = 335, +// SE_LOC_Y_MAX = 1435, +// SE_LOC_Y_MIN = 1370 +//}; enum Events { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 2ea08e532..cc49b1782 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -182,22 +182,20 @@ public: void FireWall() { - uint8 WallNum; - Creature* wall = nullptr; for (uint8 i = 0; i < 4; ++i) { - if (i == 0 || i == 2) - WallNum = 3; - else - WallNum = 2; + uint8 WallNum = i == 0 || i == 2 ? 3 : 2; for (uint8 j = 0; j < WallNum; j++) { - if (WallNum == 3) - wall = me->SummonCreature(NPC_FIRE_BOMB, FireWallCoords[i][0], FireWallCoords[i][1] + 5 * (j - 1), FireWallCoords[i][2], FireWallCoords[i][3], TEMPSUMMON_TIMED_DESPAWN, 15000); - else - wall = me->SummonCreature(NPC_FIRE_BOMB, FireWallCoords[i][0] - 2 + 4 * j, FireWallCoords[i][1], FireWallCoords[i][2], FireWallCoords[i][3], TEMPSUMMON_TIMED_DESPAWN, 15000); - if (wall) wall->CastSpell(wall, SPELL_FIRE_WALL, true); + Creature* wall = WallNum == 3 + ? me->SummonCreature(NPC_FIRE_BOMB, FireWallCoords[i][0], FireWallCoords[i][1] + 5 * (j - 1), FireWallCoords[i][2], FireWallCoords[i][3], TEMPSUMMON_TIMED_DESPAWN, 15000) + : me->SummonCreature(NPC_FIRE_BOMB, FireWallCoords[i][0] - 2 + 4 * j, FireWallCoords[i][1], FireWallCoords[i][2], FireWallCoords[i][3], TEMPSUMMON_TIMED_DESPAWN, 15000); + + if (wall) + { + wall->CastSpell(wall, SPELL_FIRE_WALL, true); + } } } } @@ -534,7 +532,7 @@ public: void UpdateAI(uint32 diff) override { - if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) + if (!instance || instance->GetData(DATA_JANALAIEVENT) != IN_PROGRESS) { me->DisappearAndDie(); return; @@ -614,7 +612,7 @@ public: void UpdateAI(uint32 diff) override { - if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) + if (!instance || instance->GetData(DATA_JANALAIEVENT) != IN_PROGRESS) { me->DisappearAndDie(); return; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index db3314b37..e9403b554 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -62,8 +62,8 @@ enum Talks SAY_KILL_ONE, SAY_KILL_TWO, SAY_DEATH, - SAY_NALORAKK_EVENT1, // Unimplemented - SAY_NALORAKK_EVENT2 // Unimplemented + SAY_NALORAKK_EVENT1, // Not implemented + SAY_NALORAKK_EVENT2 // Not implemented }; class boss_nalorakk : public CreatureScript diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index e1da0046e..d316a1a21 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -252,10 +252,9 @@ public: void SpawnAdds() { - Creature* creature = nullptr; for (uint8 i = 0; i < 4; ++i) { - creature = me->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* creature = me->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); if (creature) { creature->CastSpell(creature, SPELL_SPIRIT_AURA, true); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index f0d89b12a..cecbb3fc8 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -100,8 +100,7 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { Talk(SAY_SPIDER_SPAWN); - Creature* Spider = nullptr; - Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 4af599021..4b862389b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -91,8 +91,7 @@ public: { if (Ambush_Timer <= diff) { - Unit* target = nullptr; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation()); @@ -127,14 +126,17 @@ public: { if (Aggro_Timer <= diff) { - Unit* target = nullptr; - target = SelectTarget(SELECT_TARGET_RANDOM, 1); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (DoGetThreat(me->GetVictim())) + { DoModifyThreatPercent(me->GetVictim(), -50); + } if (target) + { AttackStart(target); + } Aggro_Timer = urand(7000, 20000); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index 9af44f8b1..fdd304781 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -4,7 +4,6 @@ * Copyright (C) 2005-2009 MaNGOS */ -#include "ObjectMgr.h" #include "ScriptedCreature.h" #include "ScriptMgr.h" #include "Spell.h" diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 0fc45403c..d284ae9d7 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -102,22 +102,16 @@ public: { case DATA_LORKHAN: return _zealotLorkhanGUID; - break; case DATA_ZATH: return _zealotZathGUID; - break; case DATA_THEKAL: return _highPriestTekalGUID; - break; case DATA_JINDO: return _jindoTheHexxerGUID; - break; case NPC_ARLOKK: return _arlokkGUID; - break; case GO_GONG_OF_BETHEKK: return _goGongOfBethekkGUID; - break; } return ObjectGuid::Empty; diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp index bcb2461eb..00f437d05 100644 --- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp @@ -125,7 +125,7 @@ void AddSC_eastern_plaguelands(); void AddSC_eversong_woods(); void AddSC_ghostlands(); void AddSC_hinterlands(); -void AddSC_ironforge(); +//void AddSC_ironforge(); void AddSC_isle_of_queldanas(); void AddSC_redridge_mountains(); void AddSC_silverpine_forest(); @@ -262,7 +262,7 @@ void AddEasternKingdomsScripts() AddSC_eversong_woods(); AddSC_ghostlands(); AddSC_hinterlands(); - AddSC_ironforge(); +// AddSC_ironforge(); AddSC_isle_of_queldanas(); AddSC_redridge_mountains(); AddSC_silverpine_forest(); diff --git a/src/server/scripts/EasternKingdoms/zone_alterac_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_alterac_mountains.cpp index 9266e5d79..f8789a1d6 100644 --- a/src/server/scripts/EasternKingdoms/zone_alterac_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/zone_alterac_mountains.cpp @@ -1,7 +1,5 @@ /* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. - * Copyright (C) 2008-2016 TrinityCore - * Copyright (C) 2005-2009 MaNGOS */ /* ScriptData diff --git a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp index 52008d7d2..eafc47cde 100644 --- a/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_blasted_lands.cpp @@ -12,7 +12,6 @@ Quest support: 3628. Teleporter to Rise of the Defiler. #include "Group.h" #include "Player.h" #include "ScriptedCreature.h" -#include "ScriptedGossip.h" #include "ScriptMgr.h" #include "SpellScript.h" diff --git a/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp b/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp index b7b12fbf6..6884609a0 100644 --- a/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp @@ -1,5 +1,3 @@ /* - * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. - * Copyright (C) 2008-2016 TrinityCore - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 */ diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp index 6c2e9cfd1..a6cdd1723 100644 --- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp @@ -1,7 +1,5 @@ /* - * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. - * Copyright (C) 2008-2016 TrinityCore - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 */ /* ScriptData diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp index 887a45915..617d2ab62 100644 --- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp @@ -20,7 +20,6 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "ScriptMgr.h" -#include "WorldSession.h" /*###### ## npc_ranger_lilatha diff --git a/src/server/scripts/EasternKingdoms/zone_ironforge.cpp b/src/server/scripts/EasternKingdoms/zone_ironforge.cpp index 025a0486d..e418d1ba5 100644 --- a/src/server/scripts/EasternKingdoms/zone_ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/zone_ironforge.cpp @@ -1,12 +1,5 @@ /* - * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. - * Copyright (C) 2008-2016 TrinityCore - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 */ -#include "Player.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptMgr.h" - -void AddSC_ironforge() { } +//void AddSC_ironforge() { } diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 141770041..edbf6ab9f 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -1103,15 +1103,15 @@ public: } } - void JustSummoned(Creature* summoned) override + void JustSummoned(Creature* summonedCreature) override { - switch (summoned->GetEntry()) + switch (summonedCreature->GetEntry()) { case NPC_GENERATOR: - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_WRYNN_BUFF, true); - summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true); - summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true); + summonedCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_WRYNN_BUFF, true); + summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true); + summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true); break; default: break; diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index 407341063..e59aa6742 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -20,7 +20,6 @@ EndContentData */ #include "Player.h" #include "ScriptedCreature.h" -#include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "ScriptMgr.h" #include "WorldSession.h"