aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp29
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp41
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp38
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/zone_wetlands.cpp2
41 files changed, 125 insertions, 209 deletions
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
index 95910a81627..ffac75d2d14 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp
@@ -161,7 +161,7 @@ class boss_alizabal : public CreatureScript
case 0:
if (!_skewer)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT, 0))
{
DoCast(target, SPELL_SKEWER, true);
Talk(SAY_SKEWER);
@@ -203,7 +203,7 @@ class boss_alizabal : public CreatureScript
}
else if (!_skewer)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT, 0))
{
DoCast(target, SPELL_SKEWER, true);
Talk(SAY_SKEWER);
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
index a2f31ad476c..c96a1ba4367 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
@@ -212,7 +212,7 @@ class FocusedFireTargetSelector : public std::unary_function<Unit *, bool>
bool operator() (WorldObject* target)
{
- if (target == _victim && _me->getThreatManager().getThreatList().size() > 1)
+ if (target == _victim && _me->GetThreatManager().getThreatList().size() > 1)
return true;
if (target->GetTypeId() != TYPEID_PLAYER)
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
index 39cf1b6345a..abfbf5797a6 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp
@@ -321,7 +321,7 @@ public:
})
.Schedule(Seconds(2), [this](TaskContext mugChuck)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, false, -SPELL_HAS_DARK_BREWMAIDENS_BREW))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, false, true, -SPELL_HAS_DARK_BREWMAIDENS_BREW))
DoCast(target, SPELL_CHUCK_MUG);
mugChuck.Repeat(Seconds(4));
});
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 85a38917f2b..b4413fedbf4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp
@@ -374,7 +374,7 @@ public:
{//do not call EnterEvadeMode(), it will create infinit loops
boss->Respawn();
boss->RemoveAllAuras();
- boss->DeleteThreatList();
+ boss->GetThreatManager().ClearAllThreat();
boss->CombatStop(true);
boss->LoadCreaturesAddon();
boss->GetMotionMaster()->MoveTargetedHome();
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
index 970ce045b6e..9fb0e77caac 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -88,8 +88,8 @@ public:
break;
case EVENT_KNOCKBACK:
DoCastVictim(SPELL_KNOCKBACK);
- if (DoGetThreat(me->GetVictim()))
- DoModifyThreatPercent(me->GetVictim(), -50);
+ if (GetThreat(me->GetVictim()))
+ ModifyThreatByPercent(me->GetVictim(), -50);
events.ScheduleEvent(EVENT_KNOCKBACK, urand(15000, 30000));
break;
case EVENT_CHECK:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
index b6a5e9b8b2f..97c73b89973 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_firemaw.cpp
@@ -71,8 +71,8 @@ public:
break;
case EVENT_WINGBUFFET:
DoCastVictim(SPELL_WINGBUFFET);
- if (DoGetThreat(me->GetVictim()))
- DoModifyThreatPercent(me->GetVictim(), -75);
+ if (GetThreat(me->GetVictim()))
+ ModifyThreatByPercent(me->GetVictim(), -75);
events.ScheduleEvent(EVENT_WINGBUFFET, 30000);
break;
case EVENT_FLAMEBUFFET:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
index c45d625334f..a54285164d9 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_flamegor.cpp
@@ -76,8 +76,8 @@ public:
break;
case EVENT_WINGBUFFET:
DoCastVictim(SPELL_WINGBUFFET);
- if (DoGetThreat(me->GetVictim()))
- DoModifyThreatPercent(me->GetVictim(), -75);
+ if (GetThreat(me->GetVictim()))
+ ModifyThreatByPercent(me->GetVictim(), -75);
events.ScheduleEvent(EVENT_WINGBUFFET, 30000);
break;
case EVENT_FRENZY:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
index f9f81e46efe..f4757e21ea8 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
@@ -319,7 +319,7 @@ public:
DoCast(target, SPELL_SHADOWBOLT);
break;
}
- DoResetThreat();
+ ResetThreatList();
events.ScheduleEvent(EVENT_SHADOW_BOLT, urand(3000, 10000));
break;
case EVENT_FEAR:
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
index 611e4462a55..63d7a9206ac 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp
@@ -150,10 +150,6 @@ public:
break;
case EVENT_CONFLAGRATION:
DoCastVictim(SPELL_CONFLAGRATION);
- // @todo is this even necessary? pretty sure AI ignores targets with disorient by default
- if (me->GetVictim() && me->EnsureVictim()->HasAura(SPELL_CONFLAGRATION))
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
- me->TauntApply(target);
events.ScheduleEvent(EVENT_CONFLAGRATION, 30000);
break;
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
index 331b789aa9c..da82930c678 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_baron_geddon.cpp
@@ -97,7 +97,7 @@ class boss_baron_geddon : public CreatureScript
events.ScheduleEvent(EVENT_INFERNO, 45000);
break;
case EVENT_IGNITE_MANA:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_IGNITE_MANA))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_IGNITE_MANA))
DoCast(target, SPELL_IGNITE_MANA);
events.ScheduleEvent(EVENT_IGNITE_MANA, 30000);
break;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
index 5ac91557df6..62108a9d1cf 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp
@@ -95,7 +95,7 @@ class boss_magmadar : public CreatureScript
events.ScheduleEvent(EVENT_PANIC, 35000);
break;
case EVENT_LAVA_BOMB:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_LAVA_BOMB))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_LAVA_BOMB))
DoCast(target, SPELL_LAVA_BOMB);
events.ScheduleEvent(EVENT_LAVA_BOMB, 12000);
break;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
index 3e73c1e162e..4d113f8c757 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp
@@ -248,7 +248,7 @@ class boss_ragnaros : public CreatureScript
//is not very well supported in the core //no it really isnt
//so added normaly spawning and banish workaround and attack again after 90 secs.
me->AttackStop();
- DoResetThreat();
+ ResetThreatList();
me->SetReactState(REACT_PASSIVE);
me->InterruptNonMeleeSpells(false);
//Root self
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
index 8d40909ac9e..7d7a4e3ce0c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_shazzrah.cpp
@@ -82,7 +82,7 @@ class boss_shazzrah : public CreatureScript
DoCastVictim(SPELL_ARCANE_EXPLOSION);
break;
case EVENT_SHAZZRAH_CURSE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_SHAZZRAH_CURSE))
DoCast(target, SPELL_SHAZZRAH_CURSE);
events.ScheduleEvent(EVENT_SHAZZRAH_CURSE, urand(25000, 30000));
break;
@@ -95,7 +95,7 @@ class boss_shazzrah : public CreatureScript
events.ScheduleEvent(EVENT_COUNTERSPELL, urand(16000, 20000));
break;
case EVENT_SHAZZRAH_GATE:
- DoResetThreat();
+ ResetThreatList();
DoCastAOE(SPELL_SHAZZRAH_GATE_DUMMY);
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION_TRIGGERED, 2000);
events.RescheduleEvent(EVENT_ARCANE_EXPLOSION, urand(3000, 6000));
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
index d6198849107..386de5e94eb 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_sulfuron_harbinger.cpp
@@ -184,12 +184,12 @@ class npc_flamewaker_priest : public CreatureScript
events.ScheduleEvent(EVENT_HEAL, urand(15000, 20000));
break;
case EVENT_SHADOW_WORD_PAIN:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_SHADOWWORDPAIN))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_SHADOWWORDPAIN))
DoCast(target, SPELL_SHADOWWORDPAIN);
events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, urand(18000, 26000));
break;
case EVENT_IMMOLATE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_IMMOLATE))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_IMMOLATE))
DoCast(target, SPELL_IMMOLATE);
events.ScheduleEvent(EVENT_IMMOLATE, urand(15000, 25000));
break;
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index db48554625c..d4971961a79 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -213,11 +213,7 @@ public:
continue;
if (player->IsAlive())
- {
- temp->SetInCombatWith(player);
- player->SetInCombatWith(temp);
- temp->AddThreat(player, 0.0f);
- }
+ AddThreat(player, 0.0f, temp);
}
}
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index 21757877504..1b7ded81966 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -103,7 +103,7 @@ public:
switch (eventId)
{
case EVENT_HATEFUL_BOLT:
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT, 1))
DoCast(target, SPELL_HATEFUL_BOLT);
events.Repeat(Seconds(7), Seconds(15));
break;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 09edd14e94d..dcead9c2ecb 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -172,12 +172,11 @@ public:
scheduler.Schedule(Seconds(10), Seconds(25), [this](TaskContext task)
{
Unit* target = nullptr;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> target_list;
- for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
+ for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
{
- target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
+ target = ref->GetVictim();
if (target && !target->IsWithinDist(me, 8.00f, false) && target->IsWithinDist(me, 25.0f, false))
target_list.push_back(target);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 4fec3dc511c..f612dc03094 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -299,14 +299,8 @@ public:
if (Blind_Timer <= diff)
{
- std::list<Unit*> targets;
- SelectTargetList(targets, 5, SELECT_TARGET_RANDOM, me->GetCombatReach()*5, true);
- for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
- if (!me->IsWithinMeleeRange(*i))
- {
- DoCast(*i, SPELL_BLIND);
- break;
- }
+ if (Unit* target = SelectTarget(SELECT_TARGET_MINDISTANCE, 0, 0.0f, true, false))
+ DoCast(target, SPELL_BLIND);
Blind_Timer = 40000;
} else Blind_Timer -= diff;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index 2720a3afc8a..7b8b3505c52 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -226,7 +226,7 @@ public:
}
// aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
- me->getThreatManager().addThreat(target, 100000.0f+DoGetThreat(me->GetVictim()));
+ AddThreat(target, 100000.0f);
}
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index 3fd59724043..34911d7ef98 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -326,7 +326,7 @@ public:
me->GetMotionMaster()->MoveAlongSplineChain(POINT_INTRO_END, SPLINE_CHAIN_INTRO_END, false);
break;
case EVENT_RAIN_OF_BONES:
- DoResetThreat();
+ ResetThreatList();
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
me->SetFacingToObject(target);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index b1c88b9c6d2..2a86453f86a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -315,19 +315,18 @@ public:
if (!info)
return;
- ThreatContainer::StorageType const& t_list = me->getThreatManager().getThreatList();
+ Unit* tank = me->GetThreatManager().GetCurrentVictim();
std::vector<Unit*> targets;
- if (t_list.empty())
- return;
+ for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList())
+ {
+ Unit* target = ref->GetVictim();
+ if (target != tank && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
+ targets.push_back(target);
+ }
- //begin + 1, so we don't target the one with the highest threat
- ThreatContainer::StorageType::const_iterator itr = t_list.begin();
- std::advance(itr, 1);
- for (; itr != t_list.end(); ++itr) //store the threat list in a different container
- if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
- if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
- targets.push_back(target);
+ if (targets.empty())
+ return;
//cut down to size if we have more than 5 targets
while (targets.size() > 5)
@@ -454,9 +453,7 @@ public:
if (target)
{
axe->AI()->AttackStart(target);
- //axe->getThreatManager().tauntApply(target); //Taunt Apply and fade out does not work properly
- // So we'll use a hack to add a lot of threat to our target
- axe->AddThreat(target, 10000000.0f);
+ AddThreat(target, 10000000.0f, axe);
}
}
}
@@ -492,11 +489,9 @@ public:
if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]))
{
if (axe->GetVictim())
- DoModifyThreatPercent(axe->GetVictim(), -100);
+ ResetThreat(axe->GetVictim(), axe);
if (target)
- axe->AddThreat(target, 1000000.0f);
- //axe->getThreatManager().tauntFadeOut(axe->GetVictim());
- //axe->getThreatManager().tauntApply(target);
+ AddThreat(target, 1000000.0f, axe);
}
}
}
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 8172ec257d0..6e8e4d204a2 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -205,18 +205,12 @@ public:
void FlameWreathEffect()
{
std::vector<Unit*> targets;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
-
- if (t_list.empty())
- return;
-
//store the threat list in a different container
- for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
{
- Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
- //only on alive players
- if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
- targets.push_back(target);
+ Unit* target = ref->GetVictim();
+ if (ref->GetVictim()->GetTypeId() == TYPEID_PLAYER && ref->GetVictim()->IsAlive())
+ targets.push_back(target);
}
//cut down to size if we have more than 3 targets
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 45ac8291406..c639a384374 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -128,7 +128,7 @@ public:
events.Repeat(Seconds(42));
break;
case EVENT_SHADOWBOLT:
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT, 0))
DoCast(target, SPELL_SHADOW_BOLT);
events.Repeat(Seconds(4), Seconds(10));
break;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index c3a65c24fab..e656baf77d7 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -923,11 +923,11 @@ public:
{
Talk(SAY_WOLF_HOOD);
DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true);
- TempThreat = DoGetThreat(target);
+ TempThreat = GetThreat(target);
if (TempThreat)
- DoModifyThreatPercent(target, -100);
+ ModifyThreatByPercent(target, -100);
HoodGUID = target->GetGUID();
- me->AddThreat(target, 1000000.0f);
+ AddThreat(target, 1000000.0f);
ChaseTimer = 20000;
IsChasing = true;
}
@@ -939,9 +939,9 @@ public:
if (Unit* target = ObjectAccessor::GetUnit(*me, HoodGUID))
{
HoodGUID.Clear();
- if (DoGetThreat(target))
- DoModifyThreatPercent(target, -100);
- me->AddThreat(target, TempThreat);
+ if (GetThreat(target))
+ ModifyThreatByPercent(target, -100);
+ AddThreat(target, TempThreat);
TempThreat = 0;
}
@@ -1256,7 +1256,7 @@ public:
Julianne->GetMotionMaster()->Clear();
Julianne->setDeathState(JUST_DIED);
Julianne->CombatStop(true);
- Julianne->DeleteThreatList();
+ Julianne->GetThreatManager().ClearAllThreat();
Julianne->SetDynamicFlags(UNIT_DYNFLAG_LOOTABLE);
}
return;
@@ -1284,7 +1284,7 @@ public:
Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID));
if (Julianne && Julianne->GetVictim())
{
- me->AddThreat(Julianne->GetVictim(), 1.0f);
+ AddThreat(Julianne->GetVictim(), 1.0f);
AttackStart(Julianne->GetVictim());
}
}
@@ -1526,7 +1526,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
Romulo->GetMotionMaster()->Clear();
Romulo->setDeathState(JUST_DIED);
Romulo->CombatStop(true);
- Romulo->DeleteThreatList();
+ Romulo->GetThreatManager().ClearAllThreat();
Romulo->SetDynamicFlags(UNIT_DYNFLAG_LOOTABLE);
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 1a379d8676e..a21c0e1ed78 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -200,15 +200,15 @@ public:
if (!summonedUnit)
return;
- ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = me->GetThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && unit->IsAlive())
{
- float threat = me->getThreatManager().getThreat(unit);
- summonedUnit->AddThreat(unit, threat);
+ float threat = me->GetThreatManager().getThreat(unit);
+ AddThreat(unit, threat, summonedUnit);
}
}
}
@@ -218,7 +218,7 @@ public:
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
me->UpdatePosition(x, y, LOCATION_Z, 0.0f);
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
@@ -231,7 +231,7 @@ public:
void CastGravityLapseKnockUp()
{
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
@@ -244,7 +244,7 @@ public:
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
@@ -260,7 +260,7 @@ public:
void RemoveGravityLapse()
{
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
@@ -400,7 +400,7 @@ public:
if (Orb && target)
{
Orb->SetSpeedRate(MOVE_RUN, 0.5f);
- Orb->AddThreat(target, 1000000.0f);
+ AddThreat(target, 1000000.0f, Orb);
Orb->AI()->AttackStart(target);
}
}
@@ -680,7 +680,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
- me->AddThreat(target, 1.0f);
+ AddThreat(target, 1.0f);
me->TauntApply(target);
AttackStart(target);
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 97b410e07c9..1a30ef9dca1 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -168,16 +168,9 @@ public:
Talk(SAY_AGGRO);
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
- {
if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i]))
- {
- if (!pAdd->GetVictim())
- {
- who->SetInCombatWith(pAdd);
- pAdd->AddThreat(who, 0.0f);
- }
- }
- }
+ if (!pAdd->IsEngaged())
+ AddThreat(who, 0.0f, pAdd);
instance->SetBossState(DATA_DELRISSA, IN_PROGRESS);
}
@@ -398,25 +391,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
return;
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
- {
if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i]))
- {
- if (!pAdd->GetVictim() && pAdd != me)
- {
- who->SetInCombatWith(pAdd);
- pAdd->AddThreat(who, 0.0f);
- }
- }
- }
+ if (!pAdd->IsEngaged() && pAdd != me)
+ AddThreat(who, 0.0f, pAdd);
if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA)))
- {
- if (pDelrissa->IsAlive() && !pDelrissa->GetVictim())
- {
- who->SetInCombatWith(pDelrissa);
- pDelrissa->AddThreat(who, 0.0f);
- }
- }
+ if (pDelrissa->IsAlive() && !pDelrissa->IsEngaged())
+ AddThreat(who, 0.0f, pDelrissa);
}
void JustDied(Unit* /*killer*/) override
@@ -472,7 +453,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
if (ResetThreatTimer <= diff)
{
- DoResetThreat();
+ ResetThreatList();
ResetThreatTimer = urand(5000, 20000);
} else ResetThreatTimer -= diff;
}
@@ -544,10 +525,10 @@ public:
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0);
- DoResetThreat();
+ ResetThreatList();
if (unit)
- me->AddThreat(unit, 1000.0f);
+ AddThreat(unit, 1000.0f);
InVanish = true;
Vanish_Timer = 30000;
@@ -869,7 +850,7 @@ public:
if (Blink_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -963,7 +944,7 @@ public:
if (Intercept_Stun_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 461d326dd3e..7c908b850b2 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -430,7 +430,7 @@ public:
if (me->Attack(who, true))
{
- me->AddThreat(who, 0.0f);
+ AddThreat(who, 0.0f);
me->SetInCombatWith(who);
who->SetInCombatWith(me);
DoStartMovement(who);
@@ -1384,7 +1384,7 @@ public:
if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE))
me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE);
me->RemoveAllAuras();
- me->DeleteThreatList();
+ me->GetThreatManager().ClearAllThreat();
me->CombatStop(true);
me->InterruptNonMeleeSpells(false);
me->SetWalk(false);
@@ -1405,7 +1405,7 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID))
{
temp->RemoveAllAuras();
- temp->DeleteThreatList();
+ temp->GetThreatManager().ClearAllThreat();
temp->CombatStop(true);
temp->AttackStop();
temp->SetFaction(me->GetFaction());
@@ -1416,7 +1416,7 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID))
{
temp->RemoveAllAuras();
- temp->DeleteThreatList();
+ temp->GetThreatManager().ClearAllThreat();
temp->CombatStop(true);
temp->AttackStop();
temp->SetFaction(me->GetFaction());
@@ -1427,7 +1427,7 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID))
{
temp->RemoveAllAuras();
- temp->DeleteThreatList();
+ temp->GetThreatManager().ClearAllThreat();
temp->CombatStop(true);
temp->AttackStop();
temp->SetFaction(me->GetFaction());
@@ -1439,7 +1439,7 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID))
{
temp->RemoveAllAuras();
- temp->DeleteThreatList();
+ temp->GetThreatManager().ClearAllThreat();
temp->CombatStop(true);
temp->AttackStop();
temp->SetFaction(me->GetFaction());
@@ -1454,7 +1454,7 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID))
{
temp->RemoveAllAuras();
- temp->DeleteThreatList();
+ temp->GetThreatManager().ClearAllThreat();
temp->CombatStop(true);
temp->AttackStop();
temp->SetFaction(me->GetFaction());
@@ -1484,15 +1484,11 @@ public:
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, ui_GUID))
if (temp->IsAlive())
- if (Unit* pTarger = SelectTarget(SELECT_TARGET_RANDOM, 0))
- if (pTarger->IsAlive())
+ if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ if (pTarget->IsAlive())
{
- // temp->DeleteThreatList();
- temp->AddThreat(pTarger, 0.0f);
- temp->AI()->AttackStart(pTarger);
- temp->SetInCombatWith(pTarger);
- pTarger->SetInCombatWith(temp);
- // temp->GetMotionMaster()->MoveChase(pTarger, 20.0f);
+ AddThreat(pTarget, 0.0f, temp);
+ temp->AI()->AttackStart(pTarget);
}
}
@@ -1550,7 +1546,7 @@ public:
{
temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiDefenderGUID[i] = temp->GetGUID();
}
}
@@ -1561,7 +1557,7 @@ public:
{
temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiEarthshatterGUID[i] = temp->GetGUID();
}
}
@@ -1570,7 +1566,7 @@ public:
{
temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiKorfaxGUID = temp->GetGUID();
}
temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID);
@@ -1578,7 +1574,7 @@ public:
{
temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiMaxwellGUID = temp->GetGUID();
}
temp = ObjectAccessor::GetCreature(*me, uiEligorGUID);
@@ -1586,7 +1582,7 @@ public:
{
temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiEligorGUID = temp->GetGUID();
}
temp = ObjectAccessor::GetCreature(*me, uiRayneGUID);
@@ -1594,7 +1590,7 @@ public:
{
temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000);
temp->SetFaction(FACTION_SCARLET_CRUSADE);
- me->AddThreat(temp, 0.0f);
+ AddThreat(temp, 0.0f);
uiRayneGUID = temp->GetGUID();
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 0fcb1d9be1d..3e5fb9884a5 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -604,14 +604,6 @@ public:
DoCast(me, SPELL_HEAD);
caster->GetMotionMaster()->Clear(false);
caster->GetMotionMaster()->MoveFollow(me, 6, float(urand(0, 5)));
- //DoResetThreat();//not sure if need
- ThreatContainer::StorageType threatlist = caster->getThreatManager().getThreatList();
- for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
- {
- Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
- if (unit && unit->IsAlive() && unit != caster)
- me->AddThreat(unit, caster->getThreatManager().getThreat(unit));
- }
}
}
@@ -861,7 +853,7 @@ public:
if (!who || !me->IsValidAttackTarget(who) || me->GetVictim())
return;
- me->AddThreat(who, 0.0f);
+ AddThreat(who, 0.0f);
if (sprouted)
DoStartMovement(who);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
index 6d17e3742ff..fd0a8ec795f 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -119,7 +119,7 @@ public:
//Sleep_Timer
if (Sleep_Timer <= diff)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT, 0))
DoCast(target, SPELL_SLEEP);
Sleep_Timer = 30000;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
index 20ccf961c16..a50e2a19bb2 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
@@ -91,7 +91,7 @@ public:
DoCast(SPELL_ILLUSION);
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(11686); // Invisible Model
- DoModifyThreatPercent(me->GetVictim(), -99);
+ ModifyThreatByPercent(me->GetVictim(), -99);
events.ScheduleEvent(EVENT_SET_VISIBILITY, 3000);
events.ScheduleEvent(EVENT_ILLUSION, 25000);
break;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 6c168b4c20e..751ff1d16c1 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -321,14 +321,8 @@ public:
if (BurnTimer <= diff)
{
- std::list<Unit*> targets;
- SelectTargetList(targets, 10, SELECT_TARGET_RANDOM, 100, true);
- for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
- if (!(*i)->HasAura(SPELL_BURN))
- {
- (*i)->CastSpell((*i), SPELL_BURN, true);
- break;
- }
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, true, -SPELL_BURN))
+ target->CastSpell(target, SPELL_BURN, true);
BurnTimer = urand(60000, 180000);
} else BurnTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index b3aeb81f3ef..082cfc98f27 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -121,7 +121,7 @@ public:
if (temp->isDead())
temp->Respawn();
else if (temp->GetVictim())
- me->getThreatManager().addThreat(temp->GetVictim(), 0.0f);
+ AddThreat(temp->GetVictim(), 0.0f);
}
if (!me->IsInCombat())
@@ -276,7 +276,7 @@ public:
temp = DoSpawnCreature(NPC_SHADOW_IMAGE, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 10000);
if (temp && target)
{
- temp->AddThreat(target, 1000000); //don't change target(healers)
+ AddThreat(target, 1000000.0f, temp); //don't change target(healers)
temp->AI()->AttackStart(target);
}
}
@@ -373,7 +373,7 @@ public:
if (temp->isDead())
temp->Respawn();
else if (temp->GetVictim())
- me->getThreatManager().addThreat(temp->GetVictim(), 0.0f);
+ AddThreat(temp->GetVictim(), 0.0f);
}
if (!me->IsInCombat())
@@ -551,7 +551,7 @@ public:
Creature* sisiter = instance->GetCreature(DATA_SACROLASH);
if (sisiter && !sisiter->isDead() && sisiter->GetVictim())
{
- me->AddThreat(sisiter->GetVictim(), 0.0f);
+ AddThreat(sisiter->GetVictim(), 0.0f);
DoStartNoMovement(sisiter->GetVictim());
me->Attack(sisiter->GetVictim(), false);
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 0cf6c67421d..ece1d768695 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -385,7 +385,7 @@ public:
uiFlightCount = 4;
break;
case 9:
- if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
+ if (Unit* target = SelectTarget(SELECT_TARGET_MAXTHREAT))
DoStartMovement(target);
else
{
@@ -397,7 +397,7 @@ public:
me->SetDisableGravity(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
EnterPhase(PHASE_GROUND);
- AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO));
+ AttackStart(SelectTarget(SELECT_TARGET_MAXTHREAT));
break;
}
++uiFlightCount;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 731aba6a0f4..4911ad56a07 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -209,7 +209,7 @@ public:
me->AddUnitFlag(UnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE));
me->InterruptNonMeleeSpells(true);
me->RemoveAllAuras();
- me->DeleteThreatList();
+ me->GetThreatManager().ClearAllThreat();
me->CombatStop();
++TalkSequence;
}
@@ -302,7 +302,7 @@ public:
if (SpectralBlastTimer <= diff)
{
- ThreatContainer::StorageType const& m_threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& m_threatlist = me->GetThreatManager().getThreatList();
std::list<Unit*> targetList;
for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
{
@@ -649,7 +649,7 @@ public:
{
KalecGUID = Kalec->GetGUID();
me->CombatStart(Kalec);
- me->AddThreat(Kalec, 100.0f);
+ AddThreat(Kalec, 100.0f);
Kalec->setActive(true);
}
Talk(SAY_SATH_AGGRO);
@@ -776,12 +776,12 @@ public:
if (ResetThreat <= diff)
{
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetPositionZ() > me->GetPositionZ() + 5)
- me->getThreatManager().modifyThreatPercent(unit, -100);
+ me->GetThreatManager().ModifyThreatByPercent(unit, -100);
}
ResetThreat = 1000;
} else ResetThreat -= diff;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 8940718ef47..b3de767c2e7 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -470,7 +470,7 @@ public:
break;
case NPC_KILJAEDEN:
summoned->CastSpell(summoned, SPELL_REBIRTH, false);
- summoned->AddThreat(me->GetVictim(), 1.0f);
+ AddThreat(me->GetVictim(), 1.0f, summoned);
break;
}
summons.Summon(summoned);
@@ -671,7 +671,7 @@ public:
Talk(SAY_KJ_REFLECTION);
for (uint8 i = 0; i < 4; ++i)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT))
{
float x, y, z;
target->GetPosition(x, y, z);
@@ -956,7 +956,7 @@ public:
{
instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS);
if (Creature* pControl = instance->GetCreature(DATA_KILJAEDEN_CONTROLLER))
- pControl->AddThreat(who, 1.0f);
+ AddThreat(who, 1.0f, pControl);
me->InterruptNonMeleeSpells(true);
}
@@ -992,15 +992,8 @@ public:
if (FelfirePortalTimer <= diff)
{
if (Creature* pPortal = DoSpawnCreature(NPC_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000))
- {
- ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
- for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
- {
- Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
- if (unit)
- pPortal->AddThreat(unit, 1.0f);
- }
- }
+ for (ThreatReference* ref : me->GetThreatManager().GetUnsortedThreatList())
+ AddThreat(ref->GetVictim(), 1.0f, pPortal);
FelfirePortalTimer = 20000;
} else FelfirePortalTimer -= diff;
@@ -1060,7 +1053,7 @@ public:
if (uiSpawnFiendTimer <= diff)
{
if (Creature* pFiend = DoSpawnCreature(NPC_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000))
- pFiend->AddThreat(SelectTarget(SELECT_TARGET_RANDOM, 0), 100000.0f);
+ AddThreat(SelectTarget(SELECT_TARGET_RANDOM, 0), 100000.0f, pFiend);
uiSpawnFiendTimer = urand(4000, 8000);
} else uiSpawnFiendTimer -= diff;
}
@@ -1113,7 +1106,7 @@ public:
if (!bLockedTarget)
{
- me->AddThreat(me->GetVictim(), 10000000.0f);
+ AddThreat(me->GetVictim(), 10000000.0f);
bLockedTarget = true;
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
index 56c7ef6030e..61344d2c2ef 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
@@ -74,18 +74,10 @@ class boss_ironaya : public CreatureScript
return;
//If we are <50% hp do knockaway ONCE
- if (!bHasCastKnockaway && HealthBelowPct(50))
+ if (!bHasCastKnockaway && HealthBelowPct(50) && me->GetVictim())
{
DoCastVictim(SPELL_KNOCKAWAY, true);
-
- // current aggro target is knocked away pick new target
- Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0);
-
- if (!target || target == me->GetVictim())
- target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1);
-
- if (target)
- me->TauntApply(target);
+ me->GetThreatManager().ResetThreat(me->EnsureVictim());
//Shouldn't cast this agian
bHasCastKnockaway = true;
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 3641e1b0321..becc9fcb5d7 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -92,13 +92,7 @@ class npc_jadespine_basilisk : public CreatureScript
//Stop attacking target thast asleep and pick new target
uiCslumberTimer = 28000;
- Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0);
-
- if (!target || target == me->GetVictim())
- target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
-
- if (target)
- me->TauntApply(target);
+ me->GetThreatManager().ResetThreat(me->GetVictim());
} else uiCslumberTimer -= uiDiff;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index f9cd1192777..af4e9e7b4e5 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -553,7 +553,7 @@ class DevastatingSlamTargetSelector : public std::unary_function<Unit *, bool>
bool operator() (WorldObject* target)
{
- if (target == _victim && _me->getThreatManager().getThreatList().size() > 1)
+ if (target == _victim && _me->GetThreatManager().getThreatList().size() > 1)
return true;
if (target->GetTypeId() != TYPEID_PLAYER)
@@ -680,8 +680,8 @@ class spell_mandokir_ohgan_orders_trigger : public SpellScriptLoader
// HACK: research better way
caster->ClearUnitState(UNIT_STATE_CASTING);
caster->GetMotionMaster()->Clear();
- caster->DeleteThreatList();
- caster->AddThreat(target, 50000000.0f);
+ caster->GetThreatManager().ClearAllThreat();
+ caster->GetThreatManager().AddThreat(target, 50000000.0f);
caster->TauntApply(target);
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
index 739b696e21a..e5c40884330 100644
--- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
@@ -69,7 +69,7 @@ public:
if (Creature* Myrmidon = me->FindNearestCreature(NPC_DARKSPINE_MYRIDON, 70))
{
- me->AddThreat(Myrmidon, 100000.0f);
+ AddThreat(Myrmidon, 100000.0f);
AttackStart(Myrmidon);
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 5015ff30cc2..4ea7686519c 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -83,9 +83,9 @@ public:
if (player->GetQuestStatus(QUEST_SAVING_YENNIKU) == QUEST_STATUS_INCOMPLETE) // Yenniku's Release
{
me->SetEmoteState(EMOTE_STATE_STUN);
- me->CombatStop(); // stop combat
- me->DeleteThreatList(); // unsure of this
- me->SetFaction(FACTION_HORDE_GENERIC); // horde generic
+ me->CombatStop(); //stop combat
+ me->GetThreatManager().ClearAllThreat(); //unsure of this
+ me->SetFaction(FACTION_HORDE_GENERIC);
bReset = true;
Reset_Timer = 60000;
@@ -116,7 +116,7 @@ public:
if (player->GetTeam() == HORDE)
{
me->CombatStop();
- me->DeleteThreatList();
+ me->GetThreatManager().ClearAllThreat();
}
}
}
diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
index c7c4dbbeb5b..451095dfe8c 100644
--- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
@@ -117,7 +117,7 @@ public:
me->RestoreFaction();
me->RemoveAllAuras();
- me->DeleteThreatList();
+ me->GetThreatManager().ClearAllThreat();
me->CombatStop(true);
SetRun(false);