refactor(Scripts/EasternKingdoms): code cleanup (part 5) - also fix potential crash (#6923)

This commit is contained in:
Francesco Borzì
2021-07-19 11:23:27 +02:00
committed by GitHub
parent fab0fc421b
commit e5f1104849
37 changed files with 118 additions and 144 deletions
@@ -204,4 +204,4 @@ void AddSC_boss_balinda()
{ {
new boss_balinda; new boss_balinda;
new npc_water_elemental; new npc_water_elemental;
}; }
@@ -6,7 +6,6 @@
#include "blackrock_depths.h" #include "blackrock_depths.h"
#include "InstanceScript.h" #include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#define TIMER_TOMBOFTHESEVEN 15000 #define TIMER_TOMBOFTHESEVEN 15000
@@ -11,7 +11,6 @@ SDComment: Place Holder
SDCategory: Molten Core SDCategory: Molten Core
EndScriptData */ EndScriptData */
#include "CreatureAI.h"
#include "InstanceScript.h" #include "InstanceScript.h"
#include "molten_core.h" #include "molten_core.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
@@ -2,7 +2,6 @@
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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) 2016+ AzerothCore <www.azerothcore.org>, 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 <http://www.trinitycore.org/> * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
* Rescripted By Lee (Talamortis)
*/ */
#include "karazhan.h" #include "karazhan.h"
@@ -285,7 +284,6 @@ public:
void SummonInfernal() void SummonInfernal()
{ {
InfernalPoint* point = 0;
Position pos; Position pos;
if ((me->GetMapId() == 532)) if ((me->GetMapId() == 532))
@@ -294,7 +292,7 @@ public:
} }
else 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))); pos.Relocate(point->x, point->y, INFERNAL_Z, frand(0.0f, float(M_PI * 2)));
} }
@@ -360,14 +358,16 @@ public:
{ {
if (SWPainTimer <= diff) if (SWPainTimer <= diff)
{ {
Unit* target = nullptr;
if (phase == 1) // if phase == 1 target the tank, otherwise anyone but the tank
target = me->GetVictim(); // Target the Tank Unit* target = phase == 1
else // anyone but the tank ? me->GetVictim()
target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); : SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
if (target) if (target)
{
DoCast(target, SPELL_SW_PAIN); DoCast(target, SPELL_SW_PAIN);
}
SWPainTimer = 20000; SWPainTimer = 20000;
} }
@@ -411,8 +411,7 @@ public:
{ {
if (AmplifyDamageTimer <= diff) if (AmplifyDamageTimer <= diff)
{ {
Unit* target = nullptr; Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
if (target) if (target)
{ {
@@ -421,7 +420,9 @@ public:
} }
} }
else else
{
AmplifyDamageTimer -= diff; AmplifyDamageTimer -= diff;
}
} }
if (phase != 3) if (phase != 3)
@@ -483,9 +484,11 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{ {
if (me->GetVictim()) if (me->GetVictim())
{
DoModifyThreatPercent(me->GetVictim(), -100); DoModifyThreatPercent(me->GetVictim(), -100);
if (target) }
me->AddThreat(target, 1000000.0f);
me->AddThreat(target, 1000000.0f);
} }
} }
@@ -392,15 +392,10 @@ public:
{ {
ElementalsSpawned = true; ElementalsSpawned = true;
Creature* ElementalOne = nullptr; Creature* ElementalOne = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11168.1f, -1939.29f, 232.092f, 1.46f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
Creature* ElementalTwo = nullptr; Creature* ElementalTwo = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11138.2f, -1915.38f, 232.092f, 3.00f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
Creature* ElementalThree = nullptr; Creature* ElementalThree = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11161.7f, -1885.36f, 232.092f, 4.59f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
Creature* ElementalFour = nullptr; Creature* ElementalFour = me->SummonCreature(CREATURE_WATER_ELEMENTAL, -11192.4f, -1909.36f, 232.092f, 6.19f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
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);
if (ElementalOne) if (ElementalOne)
{ {
@@ -86,10 +86,10 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
ObjectGuid TerestianGUID = instance->GetGuidData(DATA_TERESTIAN); ObjectGuid TerestianGuid = instance->GetGuidData(DATA_TERESTIAN);
if (TerestianGUID) if (TerestianGuid)
{ {
Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGUID); Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGuid);
if (Terestian && Terestian->IsAlive()) if (Terestian && Terestian->IsAlive())
DoCast(Terestian, SPELL_BROKEN_PACT, true); DoCast(Terestian, SPELL_BROKEN_PACT, true);
} }
@@ -1,3 +1,6 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/
#include "Creature.h" #include "Creature.h"
#include "GameObject.h" #include "GameObject.h"
@@ -474,9 +474,9 @@ public:
void EnterCombat(Unit* /*who*/) override {} void EnterCombat(Unit* /*who*/) override {}
uint32 NextStep(uint32 Step) uint32 NextStep(uint32 nextStep)
{ {
switch(Step) switch(nextStep)
{ {
case 1: case 1:
me->MonsterYell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL, 0); me->MonsterYell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL, 0);
@@ -1,20 +1,8 @@
/* /*
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_KARAZHAN_H #ifndef DEF_KARAZHAN_H
#define DEF_KARAZHAN_H #define DEF_KARAZHAN_H
@@ -6,7 +6,6 @@
#include "Opcodes.h" #include "Opcodes.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "WorldPacket.h"
enum Says enum Says
{ {
@@ -956,12 +956,12 @@ public:
{ {
boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_MELEE) { } boss_apokoAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_MELEE) { }
uint32 Totem_Timer; // uint32 Totem_Timer;
uint8 Totem_Amount; uint8 Totem_Amount;
uint32 War_Stomp_Timer; uint32 War_Stomp_Timer;
uint32 Purge_Timer; // uint32 Purge_Timer;
uint32 Healing_Wave_Timer; uint32 Healing_Wave_Timer;
uint32 Frost_Shock_Timer; // uint32 Frost_Shock_Timer;
void EnterCombat(Unit* who) override void EnterCombat(Unit* who) override
{ {
@@ -8,7 +8,6 @@
#include "CreatureTextMgr.h" #include "CreatureTextMgr.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "PassiveAI.h" #include "PassiveAI.h"
#include "PetAI.h"
#include "Player.h" #include "Player.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedEscortAI.h" #include "ScriptedEscortAI.h"
@@ -672,14 +671,14 @@ uint32 acherus_soul_prison[12] =
191590 191590
}; };
uint32 acherus_unworthy_initiate[5] = //uint32 acherus_unworthy_initiate[5] =
{ //{
29519, // 29519,
29520, // 29520,
29565, // 29565,
29566, // 29566,
29567 // 29567
}; //};
class npc_unworthy_initiate : public CreatureScript class npc_unworthy_initiate : public CreatureScript
{ {
@@ -782,7 +781,7 @@ public:
{ {
if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 100)) 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); dist = me->GetDistance2d(temp_prison);
prison = temp_prison; prison = temp_prison;
@@ -6,7 +6,6 @@
#include "Player.h" #include "Player.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h" #include "ScriptedGossip.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "SpellScript.h" #include "SpellScript.h"
@@ -64,11 +64,17 @@ public:
{ {
Player* player = nullptr; Player* player = nullptr;
if (me->IsSummon()) if (me->IsSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner()) {
if (Unit * summoner = me->ToTempSummon()->GetSummoner())
{
player = summoner->ToPlayer(); player = summoner->ToPlayer();
}
}
if (!player) if (!player)
{
phase = 3; phase = 3;
}
switch (phase) switch (phase)
{ {
@@ -78,17 +84,23 @@ public:
FlyBackTimer = 500; FlyBackTimer = 500;
break; break;
case 1: case 1:
player->GetClosePoint(x, y, z, me->GetObjectSize()); if (player)
{
player->GetClosePoint(x, y, z, me->GetObjectSize());
}
z += 2.5f; z += 2.5f;
x -= 2.0f; x -= 2.0f;
y -= 1.5f; y -= 1.5f;
me->GetMotionMaster()->MovePoint(0, x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetTarget(player->GetGUID()); if (player)
{
me->SetTarget(player->GetGUID());
}
me->SetVisible(true); me->SetVisible(true);
FlyBackTimer = 4500; FlyBackTimer = 4500;
break; break;
case 2: case 2:
if (!player->isResurrectRequested()) if (player && !player->isResurrectRequested())
{ {
me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01); me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01);
DoCast(player, SPELL_REVIVE, true); DoCast(player, SPELL_REVIVE, true);
@@ -1,7 +1,5 @@
/* /*
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 * Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
REWRITTEN BY XINEF
*/ */
#include "scarletmonastery.h" #include "scarletmonastery.h"
@@ -577,7 +577,7 @@ public:
events.Update(diff); events.Update(diff);
if (me->HealthBelowPct(30) && !(me->GetEntry() == DARK_SHADE_ENTRY)) if (me->HealthBelowPct(30) && me->GetEntry() != DARK_SHADE_ENTRY)
{ {
events.Reset(); events.Reset();
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
@@ -7,13 +7,13 @@
#include "shadowfang_keep.h" #include "shadowfang_keep.h"
#include "TemporarySummon.h" #include "TemporarySummon.h"
enum Creatures //enum Creatures
{ //{
NPC_ASH = 3850, // NPC_ASH = 3850,
NPC_ADA = 3849, // NPC_ADA = 3849,
NPC_ARCHMAGE_ARUGAL = 4275, // NPC_ARCHMAGE_ARUGAL = 4275,
NPC_ARUGAL_VOIDWALKER = 4627 // NPC_ARUGAL_VOIDWALKER = 4627
}; //};
class instance_shadowfang_keep : public InstanceMapScript class instance_shadowfang_keep : public InstanceMapScript
{ {
@@ -375,7 +375,7 @@ public:
if (Player* player = itr->GetSource()) if (Player* player = itr->GetSource())
{ {
// should pet also trigger the trap? could not find any source for it // 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 // Check if timer was not already set by another player/pet a few milliseconds before
if (_gateTrapsCooldown[i]) if (_gateTrapsCooldown[i])
@@ -5,7 +5,6 @@
#include "Cell.h" #include "Cell.h"
#include "CellImpl.h" #include "CellImpl.h"
#include "GridNotifiers.h" #include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "sunwell_plateau.h" #include "sunwell_plateau.h"
@@ -576,9 +576,14 @@ public:
case EVENT_CHECK_HEALTH: case EVENT_CHECK_HEALTH:
if (me->HealthBelowPct(10)) if (me->HealthBelowPct(10))
{ {
if (InstanceScript* instance = me->GetInstanceScript()) if (InstanceScript* instanceScript = me->GetInstanceScript())
if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_KALECGOS))) {
if (Creature *kalecgos = ObjectAccessor::GetCreature(*me, instanceScript->GetGuidData(
NPC_KALECGOS)))
{
kalecgos->AI()->DoAction(ACTION_ENRAGE_OTHER); kalecgos->AI()->DoAction(ACTION_ENRAGE_OTHER);
}
}
DoAction(ACTION_ENRAGE); DoAction(ACTION_ENRAGE);
break; break;
} }
@@ -46,14 +46,15 @@ enum Says
SAY_DEATH = 5 SAY_DEATH = 5
}; };
enum Misc constexpr auto NPC_SOARING_EAGLE = 24858;
{
NPC_SOARING_EAGLE = 24858, //enum Misc
SE_LOC_X_MAX = 400, //{
SE_LOC_X_MIN = 335, // SE_LOC_X_MAX = 400,
SE_LOC_Y_MAX = 1435, // SE_LOC_X_MIN = 335,
SE_LOC_Y_MIN = 1370 // SE_LOC_Y_MAX = 1435,
}; // SE_LOC_Y_MIN = 1370
//};
enum Events enum Events
{ {
@@ -182,22 +182,20 @@ public:
void FireWall() void FireWall()
{ {
uint8 WallNum;
Creature* wall = nullptr;
for (uint8 i = 0; i < 4; ++i) for (uint8 i = 0; i < 4; ++i)
{ {
if (i == 0 || i == 2) uint8 WallNum = i == 0 || i == 2 ? 3 : 2;
WallNum = 3;
else
WallNum = 2;
for (uint8 j = 0; j < WallNum; j++) for (uint8 j = 0; j < WallNum; j++)
{ {
if (WallNum == 3) Creature* wall = 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); ? 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 : me->SummonCreature(NPC_FIRE_BOMB, FireWallCoords[i][0] - 2 + 4 * j, FireWallCoords[i][1], FireWallCoords[i][2], FireWallCoords[i][3], TEMPSUMMON_TIMED_DESPAWN, 15000);
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); if (wall)
{
wall->CastSpell(wall, SPELL_FIRE_WALL, true);
}
} }
} }
} }
@@ -534,7 +532,7 @@ public:
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) if (!instance || instance->GetData(DATA_JANALAIEVENT) != IN_PROGRESS)
{ {
me->DisappearAndDie(); me->DisappearAndDie();
return; return;
@@ -614,7 +612,7 @@ public:
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) if (!instance || instance->GetData(DATA_JANALAIEVENT) != IN_PROGRESS)
{ {
me->DisappearAndDie(); me->DisappearAndDie();
return; return;
@@ -62,8 +62,8 @@ enum Talks
SAY_KILL_ONE, SAY_KILL_ONE,
SAY_KILL_TWO, SAY_KILL_TWO,
SAY_DEATH, SAY_DEATH,
SAY_NALORAKK_EVENT1, // Unimplemented SAY_NALORAKK_EVENT1, // Not implemented
SAY_NALORAKK_EVENT2 // Unimplemented SAY_NALORAKK_EVENT2 // Not implemented
}; };
class boss_nalorakk : public CreatureScript class boss_nalorakk : public CreatureScript
@@ -252,10 +252,9 @@ public:
void SpawnAdds() void SpawnAdds()
{ {
Creature* creature = nullptr;
for (uint8 i = 0; i < 4; ++i) 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) if (creature)
{ {
creature->CastSpell(creature, SPELL_SPIRIT_AURA, true); creature->CastSpell(creature, SPELL_SPIRIT_AURA, true);
@@ -100,8 +100,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{ {
Talk(SAY_SPIDER_SPAWN); Talk(SAY_SPIDER_SPAWN);
Creature* Spider = nullptr; Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Spider) if (Spider)
Spider->AI()->AttackStart(target); Spider->AI()->AttackStart(target);
Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
@@ -91,8 +91,7 @@ public:
{ {
if (Ambush_Timer <= diff) if (Ambush_Timer <= diff)
{ {
Unit* target = nullptr; Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target) if (target)
{ {
me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation()); me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation());
@@ -127,14 +126,17 @@ public:
{ {
if (Aggro_Timer <= diff) if (Aggro_Timer <= diff)
{ {
Unit* target = nullptr; Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (DoGetThreat(me->GetVictim())) if (DoGetThreat(me->GetVictim()))
{
DoModifyThreatPercent(me->GetVictim(), -50); DoModifyThreatPercent(me->GetVictim(), -50);
}
if (target) if (target)
{
AttackStart(target); AttackStart(target);
}
Aggro_Timer = urand(7000, 20000); Aggro_Timer = urand(7000, 20000);
} }
@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/ */
#include "ObjectMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "Spell.h" #include "Spell.h"
@@ -102,22 +102,16 @@ public:
{ {
case DATA_LORKHAN: case DATA_LORKHAN:
return _zealotLorkhanGUID; return _zealotLorkhanGUID;
break;
case DATA_ZATH: case DATA_ZATH:
return _zealotZathGUID; return _zealotZathGUID;
break;
case DATA_THEKAL: case DATA_THEKAL:
return _highPriestTekalGUID; return _highPriestTekalGUID;
break;
case DATA_JINDO: case DATA_JINDO:
return _jindoTheHexxerGUID; return _jindoTheHexxerGUID;
break;
case NPC_ARLOKK: case NPC_ARLOKK:
return _arlokkGUID; return _arlokkGUID;
break;
case GO_GONG_OF_BETHEKK: case GO_GONG_OF_BETHEKK:
return _goGongOfBethekkGUID; return _goGongOfBethekkGUID;
break;
} }
return ObjectGuid::Empty; return ObjectGuid::Empty;
@@ -125,7 +125,7 @@ void AddSC_eastern_plaguelands();
void AddSC_eversong_woods(); void AddSC_eversong_woods();
void AddSC_ghostlands(); void AddSC_ghostlands();
void AddSC_hinterlands(); void AddSC_hinterlands();
void AddSC_ironforge(); //void AddSC_ironforge();
void AddSC_isle_of_queldanas(); void AddSC_isle_of_queldanas();
void AddSC_redridge_mountains(); void AddSC_redridge_mountains();
void AddSC_silverpine_forest(); void AddSC_silverpine_forest();
@@ -262,7 +262,7 @@ void AddEasternKingdomsScripts()
AddSC_eversong_woods(); AddSC_eversong_woods();
AddSC_ghostlands(); AddSC_ghostlands();
AddSC_hinterlands(); AddSC_hinterlands();
AddSC_ironforge(); // AddSC_ironforge();
AddSC_isle_of_queldanas(); AddSC_isle_of_queldanas();
AddSC_redridge_mountains(); AddSC_redridge_mountains();
AddSC_silverpine_forest(); AddSC_silverpine_forest();
@@ -1,7 +1,5 @@
/* /*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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) 2016+ AzerothCore <www.azerothcore.org>, 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 <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/ */
/* ScriptData /* ScriptData
@@ -12,7 +12,6 @@ Quest support: 3628. Teleporter to Rise of the Defiler.
#include "Group.h" #include "Group.h"
#include "Player.h" #include "Player.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "SpellScript.h" #include "SpellScript.h"
@@ -1,5 +1,3 @@
/* /*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/ */
@@ -1,7 +1,5 @@
/* /*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/ */
/* ScriptData /* ScriptData
@@ -20,7 +20,6 @@ EndContentData */
#include "ScriptedEscortAI.h" #include "ScriptedEscortAI.h"
#include "ScriptedGossip.h" #include "ScriptedGossip.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "WorldSession.h"
/*###### /*######
## npc_ranger_lilatha ## npc_ranger_lilatha
@@ -1,12 +1,5 @@
/* /*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/ */
#include "Player.h" //void AddSC_ironforge() { }
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
void AddSC_ironforge() { }
@@ -1103,15 +1103,15 @@ public:
} }
} }
void JustSummoned(Creature* summoned) override void JustSummoned(Creature* summonedCreature) override
{ {
switch (summoned->GetEntry()) switch (summonedCreature->GetEntry())
{ {
case NPC_GENERATOR: case NPC_GENERATOR:
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summonedCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_WRYNN_BUFF, true); summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_WRYNN_BUFF, true);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true); summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true); summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
break; break;
default: default:
break; break;
@@ -20,7 +20,6 @@ EndContentData */
#include "Player.h" #include "Player.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h" #include "ScriptedGossip.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "WorldSession.h" #include "WorldSession.h"