Core/Combat: rename getThreatMgr() to GetThreatMgr() (#11758)

This commit is contained in:
Maelthyr
2022-05-18 10:36:57 +02:00
committed by GitHub
parent 8c058791ed
commit c5368816fa
67 changed files with 129 additions and 129 deletions
+2 -2
View File
@@ -110,7 +110,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{ {
if (me->IsInCombat()) if (me->IsInCombat())
{ {
ThreatContainer::StorageType threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -133,7 +133,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered
{ {
if (me->IsInCombat()) if (me->IsInCombat())
{ {
ThreatContainer::StorageType threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
+2 -2
View File
@@ -216,7 +216,7 @@ public:
template <class PREDICATE> template <class PREDICATE>
Unit* SelectTarget(SelectTargetMethod targetType, uint32 position, PREDICATE const& predicate) Unit* SelectTarget(SelectTargetMethod targetType, uint32 position, PREDICATE const& predicate)
{ {
ThreatContainer::StorageType const& threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
if (position >= threatlist.size()) if (position >= threatlist.size())
return nullptr; return nullptr;
@@ -278,7 +278,7 @@ public:
template <class PREDICATE> template <class PREDICATE>
void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectTargetMethod targetType) void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectTargetMethod targetType)
{ {
ThreatContainer::StorageType const& threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
if (threatlist.empty()) if (threatlist.empty())
return; return;
+1 -1
View File
@@ -283,7 +283,7 @@ bool CreatureAI::UpdateVictim()
// xinef: if we have any victim, just return true // xinef: if we have any victim, just return true
else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f) else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f)
return true; return true;
else if (me->getThreatMgr().isThreatListEmpty()) else if (me->GetThreatMgr().isThreatListEmpty())
{ {
EnterEvadeMode(); EnterEvadeMode();
return false; return false;
@@ -370,27 +370,27 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
void ScriptedAI::DoResetThreat() void ScriptedAI::DoResetThreat()
{ {
if (!me->CanHaveThreatList() || me->getThreatMgr().isThreatListEmpty()) if (!me->CanHaveThreatList() || me->GetThreatMgr().isThreatListEmpty())
{ {
LOG_ERROR("entities.unit.ai", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = {})", me->GetEntry()); LOG_ERROR("entities.unit.ai", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = {})", me->GetEntry());
return; return;
} }
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
} }
float ScriptedAI::DoGetThreat(Unit* unit) float ScriptedAI::DoGetThreat(Unit* unit)
{ {
if (!unit) if (!unit)
return 0.0f; return 0.0f;
return me->getThreatMgr().getThreat(unit); return me->GetThreatMgr().getThreat(unit);
} }
void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct) void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct)
{ {
if (!unit) if (!unit)
return; return;
me->getThreatMgr().modifyThreatPercent(unit, pct); me->GetThreatMgr().modifyThreatPercent(unit, pct);
} }
void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o) void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
@@ -564,7 +564,7 @@ void BossAI::TeleportCheaters()
float x, y, z; float x, y, z;
me->GetPosition(x, y, z); me->GetPosition(x, y, z);
ThreatContainer::StorageType threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target)) if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target))
@@ -616,12 +616,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me) if (!me)
break; break;
ThreatContainer::StorageType threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
{ {
if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
{ {
me->getThreatMgr().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetThreatMgr().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature {} modify threat for unit {}, value {}", LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature {} modify threat for unit {}, value {}",
me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
} }
@@ -641,7 +641,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{ {
if (IsUnit(*itr)) if (IsUnit(*itr))
{ {
me->getThreatMgr().modifyThreatPercent((*itr)->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetThreatMgr().modifyThreatPercent((*itr)->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature {} modify threat for unit {}, value {}", LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature {} modify threat for unit {}, value {}",
me->GetGUID().ToString(), (*itr)->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetGUID().ToString(), (*itr)->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
} }
@@ -3878,7 +3878,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{ {
if (me) if (me)
{ {
ThreatContainer::StorageType threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
// Xinef: added distance check // Xinef: added distance check
+1 -1
View File
@@ -112,7 +112,7 @@ public:
void setThreatMgr(ThreatMgr* pThreatMgr) { iThreatMgr = pThreatMgr; } void setThreatMgr(ThreatMgr* pThreatMgr) { iThreatMgr = pThreatMgr; }
[[nodiscard]] ThreatMgr* getThreatMgr() const { return iThreatMgr; } [[nodiscard]] ThreatMgr* GetThreatMgr() const { return iThreatMgr; }
}; };
//============================================================== //==============================================================
@@ -207,8 +207,8 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{ {
if (m_owner.IsInCombatWith(victim)) if (m_owner.IsInCombatWith(victim))
{ {
m_owner.getThreatMgr().modifyThreatPercent(victim, -100); // Reset threat to zero. m_owner.GetThreatMgr().modifyThreatPercent(victim, -100); // Reset threat to zero.
m_owner.getThreatMgr().addThreat(victim, m_threatValue); // Set to the previous value it had, first before modification. m_owner.GetThreatMgr().addThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
} }
} }
@@ -3548,11 +3548,11 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds
{ {
if (victim) if (victim)
{ {
float currentThreat = getThreatMgr().getThreat(victim); float currentThreat = GetThreatMgr().getThreat(victim);
if (percent != 0.0f) if (percent != 0.0f)
{ {
getThreatMgr().modifyThreatPercent(victim, percent); GetThreatMgr().modifyThreatPercent(victim, percent);
} }
TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat); TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);
+10 -10
View File
@@ -422,7 +422,7 @@ void Unit::Update(uint32 p_time)
_UpdateSpells( p_time ); _UpdateSpells( p_time );
if (CanHaveThreatList() && getThreatMgr().isNeedUpdateToClient(p_time)) if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
SendThreatListUpdate(); SendThreatListUpdate();
// update combat timer only for players and pets (only pets with PetAI) // update combat timer only for players and pets (only pets with PetAI)
@@ -8915,7 +8915,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false; return false;
if (victim && victim->IsAlive()) if (victim && victim->IsAlive())
victim->getThreatMgr().modifyThreatPercent(this, -10); victim->GetThreatMgr().modifyThreatPercent(this, -10);
basepoints0 = int32(CountPctFromMaxHealth(triggerAmount)); basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
trigger_spell_id = 31616; trigger_spell_id = 31616;
@@ -18569,8 +18569,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// modify threat lists for new phasemask // modify threat lists for new phasemask
if (GetTypeId() != TYPEID_PLAYER) if (GetTypeId() != TYPEID_PLAYER)
{ {
ThreatContainer::StorageType threatList = getThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = GetThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = getThreatMgr().getOfflineThreatList(); ThreatContainer::StorageType offlineThreatList = GetThreatMgr().getOfflineThreatList();
// merge expects sorted lists // merge expects sorted lists
threatList.sort(); threatList.sort();
@@ -19521,15 +19521,15 @@ void Unit::UpdateHeight(float newZ)
void Unit::SendThreatListUpdate() void Unit::SendThreatListUpdate()
{ {
if (!getThreatMgr().isThreatListEmpty()) if (!GetThreatMgr().isThreatListEmpty())
{ {
uint32 count = getThreatMgr().getThreatList().size(); uint32 count = GetThreatMgr().getThreatList().size();
//LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message"); //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID(); data << GetPackGUID();
data << uint32(count); data << uint32(count);
ThreatContainer::StorageType const& tlist = getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{ {
data << (*itr)->getUnitGuid().WriteAsPacked(); data << (*itr)->getUnitGuid().WriteAsPacked();
@@ -19541,16 +19541,16 @@ void Unit::SendThreatListUpdate()
void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
{ {
if (!getThreatMgr().isThreatListEmpty()) if (!GetThreatMgr().isThreatListEmpty())
{ {
uint32 count = getThreatMgr().getThreatList().size(); uint32 count = GetThreatMgr().getThreatList().size();
LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID(); data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked(); data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count); data << uint32(count);
ThreatContainer::StorageType const& tlist = getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{ {
data << (*itr)->getUnitGuid().WriteAsPacked(); data << (*itr)->getUnitGuid().WriteAsPacked();
+1 -1
View File
@@ -2108,7 +2108,7 @@ public:
void DeleteThreatList(); void DeleteThreatList();
void TauntApply(Unit* victim); void TauntApply(Unit* victim);
void TauntFadeOut(Unit* taunter); void TauntFadeOut(Unit* taunter);
ThreatMgr& getThreatMgr() { return m_ThreatMgr; } ThreatMgr& GetThreatMgr() { return m_ThreatMgr; }
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefMgr.insertFirst(pHostileReference); }; void addHatedBy(HostileReference* pHostileReference) { m_HostileRefMgr.insertFirst(pHostileReference); };
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
HostileRefMgr& getHostileRefMgr() { return m_HostileRefMgr; } HostileRefMgr& getHostileRefMgr() { return m_HostileRefMgr; }
+7 -7
View File
@@ -3290,17 +3290,17 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
return; return;
} }
if (!unitTarget->getThreatMgr().getOnlineContainer().empty()) if (!unitTarget->GetThreatMgr().getOnlineContainer().empty())
{ {
// Also use this effect to set the taunter's threat to the taunted creature's highest value // Also use this effect to set the taunter's threat to the taunted creature's highest value
float myThreat = unitTarget->getThreatMgr().getThreat(m_caster); float myThreat = unitTarget->GetThreatMgr().getThreat(m_caster);
float topThreat = unitTarget->getThreatMgr().getOnlineContainer().getMostHated()->getThreat(); float topThreat = unitTarget->GetThreatMgr().getOnlineContainer().getMostHated()->getThreat();
if (topThreat > myThreat) if (topThreat > myThreat)
unitTarget->getThreatMgr().doAddThreat(m_caster, topThreat - myThreat); unitTarget->GetThreatMgr().doAddThreat(m_caster, topThreat - myThreat);
//Set aggro victim to caster //Set aggro victim to caster
if (HostileReference* forcedVictim = unitTarget->getThreatMgr().getOnlineContainer().getReferenceByTarget(m_caster)) if (HostileReference* forcedVictim = unitTarget->GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->getThreatMgr().setCurrentVictim(forcedVictim); unitTarget->GetThreatMgr().setCurrentVictim(forcedVictim);
} }
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE)) if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
@@ -5310,7 +5310,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/)
if (!unitTarget) if (!unitTarget)
return; return;
unitTarget->getThreatMgr().modifyThreatPercent(m_caster, damage); unitTarget->GetThreatMgr().modifyThreatPercent(m_caster, damage);
} }
void Spell::EffectTransmitted(SpellEffIndex effIndex) void Spell::EffectTransmitted(SpellEffIndex effIndex)
+2 -2
View File
@@ -783,7 +783,7 @@ public:
if (!target || target->IsTotem() || target->IsPet()) if (!target || target->IsTotem() || target->IsPet())
return false; return false;
auto const& threatList = target->getThreatMgr().getThreatList(); auto const& threatList = target->GetThreatMgr().getThreatList();
ThreatContainer::StorageType::const_iterator itr; ThreatContainer::StorageType::const_iterator itr;
uint32 count = 0; uint32 count = 0;
@@ -801,7 +801,7 @@ public:
handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->getThreat()); handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->getThreat());
} }
auto const& threatList2 = target->getThreatMgr().getOfflineThreatList(); auto const& threatList2 = target->GetThreatMgr().getOfflineThreatList();
for (itr = threatList2.begin(); itr != threatList2.end(); ++itr) for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
{ {
Unit* unit = (*itr)->getTarget(); Unit* unit = (*itr)->getTarget();
@@ -91,8 +91,8 @@ public:
if (Unit* target = me->GetVictim()) if (Unit* target = me->GetVictim())
{ {
_conflagrateTarget = me->GetVictim()->GetGUID(); _conflagrateTarget = me->GetVictim()->GetGUID();
_conflagrateThreat = me->getThreatMgr().getThreat(me->GetVictim()); _conflagrateThreat = me->GetThreatMgr().getThreat(me->GetVictim());
me->getThreatMgr().modifyThreatPercent(target, -100); me->GetThreatMgr().modifyThreatPercent(target, -100);
} }
events.ScheduleEvent(EVENT_CONFLAGRATION, urand(10000, 13000)); events.ScheduleEvent(EVENT_CONFLAGRATION, urand(10000, 13000));
events.ScheduleEvent(EVENT_CHECK_CONFLAGRATION_TARGET, 10000); events.ScheduleEvent(EVENT_CHECK_CONFLAGRATION_TARGET, 10000);
@@ -112,7 +112,7 @@ public:
case EVENT_CHECK_CONFLAGRATION_TARGET: case EVENT_CHECK_CONFLAGRATION_TARGET:
if (Unit* target = ObjectAccessor::GetUnit(*me, _conflagrateTarget)) if (Unit* target = ObjectAccessor::GetUnit(*me, _conflagrateTarget))
{ {
me->getThreatMgr().addThreat(target, _conflagrateThreat); me->GetThreatMgr().addThreat(target, _conflagrateThreat);
} }
break; break;
} }
@@ -122,13 +122,13 @@ struct boss_mor_grayhoof : public BossAI
// Sleep can target tank, we need to drop threat temporarily on the target. // Sleep can target tank, we need to drop threat temporarily on the target.
_sleepTargetGUID = target->GetGUID(); _sleepTargetGUID = target->GetGUID();
_sleepTargetThreat = me->getThreatMgr().getThreat(target); _sleepTargetThreat = me->GetThreatMgr().getThreat(target);
me->getThreatMgr().modifyThreatPercent(target, -100); me->GetThreatMgr().modifyThreatPercent(target, -100);
_scheduler.Schedule(10s, [this](TaskContext /*context*/) _scheduler.Schedule(10s, [this](TaskContext /*context*/)
{ {
if (Unit* sleepTarget = ObjectAccessor::GetUnit(*me, _sleepTargetGUID)) if (Unit* sleepTarget = ObjectAccessor::GetUnit(*me, _sleepTargetGUID))
{ {
me->getThreatMgr().addThreat(sleepTarget, _sleepTargetThreat); me->GetThreatMgr().addThreat(sleepTarget, _sleepTargetThreat);
} }
}); });
} }
@@ -674,7 +674,7 @@ struct boss_nefarian : public BossAI
break; break;
case EVENT_CLASSCALL: case EVENT_CLASSCALL:
std::set<uint8> classesPresent; std::set<uint8> classesPresent;
for (auto& ref : me->getThreatMgr().getThreatList()) for (auto& ref : me->GetThreatMgr().getThreatList())
{ {
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER) if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -597,7 +597,7 @@ public:
{ {
if (Creature* creatureCaster = caster->ToCreature()) if (Creature* creatureCaster = caster->ToCreature())
{ {
creatureCaster->getThreatMgr().ResetAllThreat(); creatureCaster->GetThreatMgr().ResetAllThreat();
} }
} }
} }
@@ -234,7 +234,7 @@ public:
void EnterEvadeMode(EvadeReason why) override void EnterEvadeMode(EvadeReason why) override
{ {
if (!me->getThreatMgr().getThreatList().empty()) if (!me->GetThreatMgr().getThreatList().empty())
{ {
if (!_processingMagmaBurst) if (!_processingMagmaBurst)
{ {
@@ -170,8 +170,8 @@ public:
if (Creature* creatureCaster = caster->ToCreature()) if (Creature* creatureCaster = caster->ToCreature())
{ {
creatureCaster->getThreatMgr().ResetAllThreat(); creatureCaster->GetThreatMgr().ResetAllThreat();
creatureCaster->getThreatMgr().addThreat(target, 1); creatureCaster->GetThreatMgr().addThreat(target, 1);
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to. creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
} }
} }
@@ -212,7 +212,7 @@ public:
} }
// aggro target if Red Beam // aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER) if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
me->getThreatMgr().addThreat(target, 100000.0f + DoGetThreat(me->GetVictim())); me->GetThreatMgr().addThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
} }
} }
@@ -251,7 +251,7 @@ public:
if (!info) if (!info)
return; return;
ThreatContainer::StorageType const& t_list = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
std::vector<Unit*> targets; std::vector<Unit*> targets;
if (t_list.empty()) if (t_list.empty())
@@ -162,7 +162,7 @@ public:
void FlameWreathEffect() void FlameWreathEffect()
{ {
std::vector<Unit*> targets; std::vector<Unit*> targets;
ThreatContainer::StorageType const& t_list = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
if (t_list.empty()) if (t_list.empty())
return; return;
@@ -393,7 +393,7 @@ public:
void HandleDummy(SpellEffIndex effIndex) void HandleDummy(SpellEffIndex effIndex)
{ {
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
GetCaster()->getThreatMgr().ResetAllThreat(); GetCaster()->GetThreatMgr().ResetAllThreat();
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_BLINK, true); GetCaster()->CastSpell(target, SPELL_BLINK, true);
} }
@@ -299,15 +299,15 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void RecalculateThreat() void RecalculateThreat()
{ {
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
{ {
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatMgr().getThreat(pUnit) ) if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().getThreat(pUnit) )
{ {
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->getThreatMgr().modifyThreatPercent(pUnit, -100); me->GetThreatMgr().modifyThreatPercent(pUnit, -100);
if (HostileReference* ref = me->getThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit)) if (HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit))
ref->addThreat(10000000.0f * threatMod); ref->addThreat(10000000.0f * threatMod);
} }
} }
@@ -741,7 +741,7 @@ public:
case EVENT_SPELL_BLINK: case EVENT_SPELL_BLINK:
{ {
bool InMeleeRange = false; bool InMeleeRange = false;
ThreatContainer::StorageType const& t_list = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (target->IsWithinMeleeRange(me)) if (target->IsWithinMeleeRange(me))
@@ -368,7 +368,7 @@ public:
Unit* SelectUnitCasting() Unit* SelectUnitCasting()
{ {
ThreatContainer::StorageType threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -325,7 +325,7 @@ public:
return; return;
// Now lets get archimode threat list // Now lets get archimode threat list
ThreatContainer::StorageType const& t_list = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
if (t_list.empty()) if (t_list.empty())
return; return;
@@ -435,7 +435,7 @@ public:
if (victim && me->IsWithinMeleeRange(victim)) if (victim && me->IsWithinMeleeRange(victim))
return false; return false;
ThreatContainer::StorageType const& threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
if (threatlist.empty()) if (threatlist.empty())
return false; return false;
@@ -142,7 +142,7 @@ public:
{ {
std::list<Unit*> targetList; std::list<Unit*> targetList;
{ {
const std::list<HostileReference*>& threatlist = me->getThreatMgr().getThreatList(); const std::list<HostileReference*>& threatlist = me->GetThreatMgr().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA) if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA)
targetList.push_back((*itr)->getTarget()); targetList.push_back((*itr)->getTarget());
@@ -421,7 +421,7 @@ class spell_vem_knockback : public SpellScript
{ {
if (Creature* cCaster = GetCaster()->ToCreature()) if (Creature* cCaster = GetCaster()->ToCreature())
{ {
cCaster->getThreatMgr().modifyThreatPercent(target, -80); cCaster->GetThreatMgr().modifyThreatPercent(target, -80);
} }
} }
} }
@@ -659,7 +659,7 @@ public:
//Place all units in threat list on outside of stomach //Place all units in threat list on outside of stomach
Stomach_Map.clear(); Stomach_Map.clear();
for (std::list<HostileReference*>::const_iterator i = me->getThreatMgr().getThreatList().begin(); i != me->getThreatMgr().getThreatList().end(); ++i) for (std::list<HostileReference*>::const_iterator i = me->GetThreatMgr().getThreatList().begin(); i != me->GetThreatMgr().getThreatList().end(); ++i)
Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach
//Spawn 2 flesh tentacles //Spawn 2 flesh tentacles
@@ -415,7 +415,7 @@ public:
void CastSpellOnBug(Creature* target) override void CastSpellOnBug(Creature* target) override
{ {
target->SetFaction(FACTION_MONSTER); target->SetFaction(FACTION_MONSTER);
target->AI()->AttackStart(me->getThreatMgr().getHostileTarget()); target->AI()->AttackStart(me->GetThreatMgr().getHostileTarget());
target->AddAura(SPELL_MUTATE_BUG, target); target->AddAura(SPELL_MUTATE_BUG, target);
target->SetFullHealth(); target->SetFullHealth();
} }
@@ -191,7 +191,7 @@ class spell_arcane_vacuum : public SpellScript
Unit* hitUnit = GetHitUnit(); Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->ToPlayer()) if (caster && hitUnit && hitUnit->ToPlayer())
{ {
caster->getThreatMgr().modifyThreatPercent(hitUnit, -100); caster->GetThreatMgr().modifyThreatPercent(hitUnit, -100);
caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true); caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true);
} }
} }
@@ -409,7 +409,7 @@ struct boss_taldaram : public BossAI
{ {
//Count alive players //Count alive players
uint8 count = 0; uint8 count = 0;
std::list<HostileReference*> const t_list = me->getThreatMgr().getThreatList(); std::list<HostileReference*> const t_list = me->GetThreatMgr().getThreatList();
if (!t_list.empty()) if (!t_list.empty())
{ {
for (HostileReference const* reference : t_list) for (HostileReference const* reference : t_list)
@@ -1158,7 +1158,7 @@ public:
GetTarget()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); GetTarget()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE);
GetTarget()->GetMotionMaster()->Clear(); GetTarget()->GetMotionMaster()->Clear();
GetTarget()->getThreatMgr().clearReferences(); GetTarget()->GetThreatMgr().clearReferences();
GetTarget()->RemoveAllAttackers(); GetTarget()->RemoveAllAttackers();
GetTarget()->AttackStop(); GetTarget()->AttackStop();
} }
@@ -1168,7 +1168,7 @@ public:
GetTarget()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); GetTarget()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE);
GetTarget()->GetMotionMaster()->Clear(); GetTarget()->GetMotionMaster()->Clear();
GetTarget()->getThreatMgr().clearReferences(); GetTarget()->GetThreatMgr().clearReferences();
GetTarget()->RemoveAllAttackers(); GetTarget()->RemoveAllAttackers();
GetTarget()->AttackStop(); GetTarget()->AttackStop();
} }
@@ -155,7 +155,7 @@ public:
me->SetFaction(FACTION_FRIENDLY); me->SetFaction(FACTION_FRIENDLY);
events.Reset(); events.Reset();
Talk(TEXT_EADRIC_DEATH); Talk(TEXT_EADRIC_DEATH);
me->getThreatMgr().clearReferences(); me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false); me->SetRegeneratingHealth(false);
_EnterEvadeMode(); _EnterEvadeMode();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
@@ -302,7 +302,7 @@ public:
me->SetFaction(FACTION_FRIENDLY); me->SetFaction(FACTION_FRIENDLY);
events.Reset(); events.Reset();
Talk(TEXT_PALETRESS_DEATH); Talk(TEXT_PALETRESS_DEATH);
me->getThreatMgr().clearReferences(); me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false); me->SetRegeneratingHealth(false);
_EnterEvadeMode(); _EnterEvadeMode();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
@@ -296,7 +296,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0; uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{ {
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f); me->AddThreat(target, 10000.0f);
AttackStart(target); AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false); me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
@@ -749,7 +749,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0; uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{ {
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f); me->AddThreat(target, 10000.0f);
AttackStart(target); AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false); me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
@@ -102,16 +102,16 @@ struct boss_faction_championsAI : public ScriptedAI
void RecalculateThreat() void RecalculateThreat()
{ {
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
{ {
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatMgr().getThreat(pUnit) ) if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().getThreat(pUnit) )
{ {
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->getThreatMgr().modifyThreatPercent(pUnit, -100); me->GetThreatMgr().modifyThreatPercent(pUnit, -100);
//me->getThreatMgr().doAddThreat(pUnit, 10000000.0f * threatMod); //me->getThreatMgr().doAddThreat(pUnit, 10000000.0f * threatMod);
if (HostileReference* ref = me->getThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit)) if (HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit))
ref->addThreat(10000000.0f * threatMod); ref->addThreat(10000000.0f * threatMod);
} }
} }
@@ -177,7 +177,7 @@ struct boss_faction_championsAI : public ScriptedAI
uint32 EnemiesInRange(float distance) uint32 EnemiesInRange(float distance)
{ {
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
uint32 count = 0; uint32 count = 0;
Unit* target; Unit* target;
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
@@ -191,7 +191,7 @@ struct boss_faction_championsAI : public ScriptedAI
Unit* SelectEnemyCaster(bool casting, float range) Unit* SelectEnemyCaster(bool casting, float range)
{ {
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
Unit* target; Unit* target;
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
{ {
@@ -161,7 +161,7 @@ public:
if (me->HealthBelowPct(50)) if (me->HealthBelowPct(50))
{ {
Talk(SAY_FLESH); Talk(SAY_FLESH);
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false); me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false);
events.Reset(); events.Reset();
@@ -257,7 +257,7 @@ public:
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
PreventDefaultAction(); PreventDefaultAction();
GetUnitOwner()->getThreatMgr().ResetAllThreat(); GetUnitOwner()->GetThreatMgr().ResetAllThreat();
GetUnitOwner()->GetMotionMaster()->Clear(); GetUnitOwner()->GetMotionMaster()->Clear();
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false); GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES); GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);
@@ -125,7 +125,7 @@ public:
case EVENT_ECK_SPRING: case EVENT_ECK_SPRING:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true)) if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true))
{ {
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 500.0f); me->AddThreat(target, 500.0f);
me->CastSpell(target, SPELL_ECK_SPRING, false); me->CastSpell(target, SPELL_ECK_SPRING, false);
} }
@@ -335,7 +335,7 @@ public:
if (Player* p = itr->GetSource()) if (Player* p = itr->GetSource())
if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 70.0f) if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 70.0f)
{ {
float th = me->getThreatMgr().getThreatWithoutTemp(p); float th = me->GetThreatMgr().getThreatWithoutTemp(p);
if (!target || th > maxThreat) if (!target || th > maxThreat)
{ {
target = p; target = p;
@@ -299,7 +299,7 @@ public:
if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA)) if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA))
{ {
// reset threat // reset threat
ThreatContainer::StorageType const& threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid());
@@ -930,7 +930,7 @@ public:
ScriptedAI::AttackStart(who); ScriptedAI::AttackStart(who);
if (!targetGUID) if (!targetGUID)
{ {
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->AddThreat(who, 1000000.0f); me->AddThreat(who, 1000000.0f);
targetGUID = who->GetGUID(); targetGUID = who->GetGUID();
} }
@@ -499,7 +499,7 @@ public:
bool Execute(uint64 /*time*/, uint32 /*diff*/) override bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{ {
_owner->SetReactState(REACT_AGGRESSIVE); _owner->SetReactState(REACT_AGGRESSIVE);
if (!_owner->getThreatMgr().isThreatListEmpty()) if (!_owner->GetThreatMgr().isThreatListEmpty())
if (Unit* target = _owner->SelectVictim()) if (Unit* target = _owner->SelectVictim())
_owner->AI()->AttackStart(target); _owner->AI()->AttackStart(target);
if (!_owner->GetVictim()) if (!_owner->GetVictim())
@@ -2378,7 +2378,7 @@ public:
{ {
me->SetControlled(false, UNIT_STATE_ROOT); me->SetControlled(false, UNIT_STATE_ROOT);
if (!me->getThreatMgr().isThreatListEmpty()) if (!me->GetThreatMgr().isThreatListEmpty())
if (Unit* target = me->SelectVictim()) if (Unit* target = me->SelectVictim())
AttackStart(target); AttackStart(target);
if (!me->GetVictim()) if (!me->GetVictim())
@@ -592,7 +592,7 @@ public:
{ {
checkTimer = 3000; checkTimer = 3000;
me->SetInCombatWithZone(); me->SetInCombatWithZone();
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
if (!threatList.empty()) if (!threatList.empty())
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
@@ -1773,15 +1773,15 @@ public:
Position myPos = me->GetPosition(); Position myPos = me->GetPosition();
me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation());
c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation()); c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation());
const ThreatContainer::StorageType me_tl = me->getThreatMgr().getThreatList(); const ThreatContainer::StorageType me_tl = me->GetThreatMgr().getThreatList();
const ThreatContainer::StorageType target_tl = c->getThreatMgr().getThreatList(); const ThreatContainer::StorageType target_tl = c->GetThreatMgr().getThreatList();
DoResetThreat(); DoResetThreat();
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter) for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
me->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat()); me->GetThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
c->getThreatMgr().ResetAllThreat(); c->GetThreatMgr().ResetAllThreat();
for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter) for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter)
c->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat()); c->GetThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
} }
} }
@@ -452,10 +452,10 @@ public:
{ {
me->CastSpell(me, SPELL_TELEPORT_LIVE, false); me->CastSpell(me, SPELL_TELEPORT_LIVE, false);
} }
me->getThreatMgr().resetAggro(NotOnSameSide(me)); me->GetThreatMgr().resetAggro(NotOnSameSide(me));
if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0)) if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0))
{ {
me->getThreatMgr().addThreat(pTarget, 100.0f); me->GetThreatMgr().addThreat(pTarget, 100.0f);
AttackStart(pTarget); AttackStart(pTarget);
} }
events.RepeatEvent(20000); events.RepeatEvent(20000);
@@ -438,7 +438,7 @@ public:
case EVENT_DETONATE_MANA: case EVENT_DETONATE_MANA:
{ {
std::vector<Unit*> unitList; std::vector<Unit*> unitList;
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
for (auto itr : threatList) for (auto itr : threatList)
{ {
if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER
@@ -128,8 +128,8 @@ public:
std::list<Unit*> meleeRangeTargets; std::list<Unit*> meleeRangeTargets;
Unit* finalTarget = nullptr; Unit* finalTarget = nullptr;
uint8 counter = 0; uint8 counter = 0;
auto i = me->getThreatMgr().getThreatList().begin(); auto i = me->GetThreatMgr().getThreatList().begin();
for (; i != me->getThreatMgr().getThreatList().end(); ++i, ++counter) for (; i != me->GetThreatMgr().getThreatList().end(); ++i, ++counter)
{ {
// Gather all units with melee range // Gather all units with melee range
Unit* target = (*i)->getTarget(); Unit* target = (*i)->getTarget();
@@ -321,8 +321,8 @@ public:
} }
std::vector<Unit*> targets; std::vector<Unit*> targets;
auto i = me->getThreatMgr().getThreatList().begin(); auto i = me->GetThreatMgr().getThreatList().begin();
for (; i != me->getThreatMgr().getThreatList().end(); ++i) for (; i != me->GetThreatMgr().getThreatList().end(); ++i)
{ {
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -553,17 +553,17 @@ public:
if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim()) if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim())
return; return;
float threatFeugen = feugen->getThreatMgr().getThreat(feugen->GetVictim()); float threatFeugen = feugen->GetThreatMgr().getThreat(feugen->GetVictim());
float threatStalagg = me->getThreatMgr().getThreat(me->GetVictim()); float threatStalagg = me->GetThreatMgr().getThreat(me->GetVictim());
Unit* tankFeugen = feugen->GetVictim(); Unit* tankFeugen = feugen->GetVictim();
Unit* tankStalagg = me->GetVictim(); Unit* tankStalagg = me->GetVictim();
feugen->getThreatMgr().modifyThreatPercent(tankFeugen, -100); feugen->GetThreatMgr().modifyThreatPercent(tankFeugen, -100);
feugen->AddThreat(tankStalagg, threatFeugen); feugen->AddThreat(tankStalagg, threatFeugen);
feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true); feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true);
feugen->AI()->DoAction(ACTION_MAGNETIC_PULL); feugen->AI()->DoAction(ACTION_MAGNETIC_PULL);
me->getThreatMgr().modifyThreatPercent(tankStalagg, -100); me->GetThreatMgr().modifyThreatPercent(tankStalagg, -100);
me->AddThreat(tankFeugen, threatStalagg); me->AddThreat(tankFeugen, threatStalagg);
me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true); me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true);
DoAction(ACTION_MAGNETIC_PULL); DoAction(ACTION_MAGNETIC_PULL);
@@ -1674,7 +1674,7 @@ public:
if (!target || !caster) if (!target || !caster)
return; return;
caster->getThreatMgr().ResetAllThreat(); caster->GetThreatMgr().ResetAllThreat();
caster->GetAI()->AttackStart(target); // Chase target caster->GetAI()->AttackStart(target); // Chase target
caster->AddThreat(target, 10000000.0f); caster->AddThreat(target, 10000000.0f);
} }
@@ -138,7 +138,7 @@ public:
heat->ModStackAmount(-1); heat->ModStackAmount(-1);
} }
me->CastSpell(me, SPELL_MOLTEN, true); me->CastSpell(me, SPELL_MOLTEN, true);
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
} }
} }
} }
@@ -670,7 +670,7 @@ public:
bool operator() (WorldObject* target) const bool operator() (WorldObject* target) const
{ {
if (target == _victim && _me->getThreatMgr().getThreatList().size() > 1) if (target == _victim && _me->GetThreatMgr().getThreatList().size() > 1)
return true; return true;
if (target->GetTypeId() != TYPEID_PLAYER) if (target->GetTypeId() != TYPEID_PLAYER)
@@ -1158,7 +1158,7 @@ public:
} }
} }
_playerAttack = true; _playerAttack = true;
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->CallForHelp(40.0f); me->CallForHelp(40.0f);
AttackStart(who); AttackStart(who);
} }
@@ -191,7 +191,7 @@ public:
if (switchTimer >= 10000) if (switchTimer >= 10000)
{ {
switchTimer = 0; switchTimer = 0;
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
if (Player* player = SelectTargetFromPlayerList(100.0f)) if (Player* player = SelectTargetFromPlayerList(100.0f))
me->AddThreat(player, 100000.0f); me->AddThreat(player, 100000.0f);
} }
@@ -116,7 +116,7 @@ public:
{ {
me->CastSpell(me, SPELL_INCITE_CHAOS, false); me->CastSpell(me, SPELL_INCITE_CHAOS, false);
std::list<HostileReference*> t_list = me->getThreatMgr().getThreatList(); std::list<HostileReference*> t_list = me->GetThreatMgr().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
{ {
Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
@@ -150,7 +150,7 @@ public:
if (!me->IsWithinMeleeRange(me->GetVictim())) if (!me->IsWithinMeleeRange(me->GetVictim()))
{ {
ThreatContainer::StorageType threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
if (target->IsAlive() && me->IsWithinMeleeRange(target)) if (target->IsAlive() && me->IsWithinMeleeRange(target))
@@ -245,7 +245,7 @@ public:
{ {
PreventHitEffect(effIndex); PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
GetCaster()->getThreatMgr().modifyThreatPercent(target, -20); GetCaster()->GetThreatMgr().modifyThreatPercent(target, -20);
} }
void Register() override void Register() override
@@ -618,7 +618,7 @@ public:
me->SetDisableGravity(false); me->SetDisableGravity(false);
break; break;
case EVENT_START_PHASE_3_LAND: case EVENT_START_PHASE_3_LAND:
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetTarget(me->GetVictim()->GetGUID()); me->SetTarget(me->GetVictim()->GetGUID());
AttackStart(me->GetVictim()); AttackStart(me->GetVictim());
@@ -631,7 +631,7 @@ public:
// /////////////////////////// // ///////////////////////////
case EVENT_PHASE_4_START: case EVENT_PHASE_4_START:
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f); me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f);
events.Reset(); events.Reset();
events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000); events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000);
@@ -654,7 +654,7 @@ public:
break; break;
case EVENT_REMOVE_DEMON_FORM: case EVENT_REMOVE_DEMON_FORM:
me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true);
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
events.Reset(); events.Reset();
if (summons.HasEntry(NPC_MAIEV_SHADOWSONG)) if (summons.HasEntry(NPC_MAIEV_SHADOWSONG))
{ {
@@ -126,7 +126,7 @@ public:
Unit* FindHatefulStrikeTarget() Unit* FindHatefulStrikeTarget()
{ {
Unit* target = nullptr; Unit* target = nullptr;
ThreatContainer::StorageType const& threatlist = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{ {
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
@@ -355,7 +355,7 @@ public:
void HandleScriptEffect(SpellEffIndex effIndex) void HandleScriptEffect(SpellEffIndex effIndex)
{ {
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
GetCaster()->getThreatMgr().ResetAllThreat(); GetCaster()->GetThreatMgr().ResetAllThreat();
if (roll_chance_i(33)) if (roll_chance_i(33))
if (Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true)) if (Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
@@ -187,7 +187,7 @@ public:
target = me->GetVictim(); target = me->GetVictim();
else else
{ {
ThreatContainer::StorageType const& t_list = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (me->IsWithinMeleeRange(threatTarget)) if (me->IsWithinMeleeRange(threatTarget))
@@ -221,7 +221,7 @@ public:
// Xinef: if we have target we currently follow, return // Xinef: if we have target we currently follow, return
if (Unit* target = GetCaster()->GetVictim()) if (Unit* target = GetCaster()->GetVictim())
if (GetCaster()->getThreatMgr().getThreat(target) >= 100000.0f) if (GetCaster()->GetThreatMgr().getThreat(target) >= 100000.0f)
return; return;
// Xinef: acquire new target // Xinef: acquire new target
@@ -323,7 +323,7 @@ public:
else else
{ {
me->resetAttackTimer(); me->resetAttackTimer();
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (me->IsWithinMeleeRange(unit)) if (me->IsWithinMeleeRange(unit))
@@ -994,7 +994,7 @@ public:
{ {
PreventHitEffect(effIndex); PreventHitEffect(effIndex);
ThreatContainer::StorageType const& ThreatList = GetCaster()-> getThreatMgr().getThreatList(); ThreatContainer::StorageType const& ThreatList = GetCaster()-> GetThreatMgr().getThreatList();
std::list<Unit*> targetList; std::list<Unit*> targetList;
for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{ {
@@ -1741,7 +1741,7 @@ public:
// some code to cast spell Mana Burn on random target which has mana // some code to cast spell Mana Burn on random target which has mana
if (ManaBurnTimer <= diff) if (ManaBurnTimer <= diff)
{ {
std::list<HostileReference*> AggroList = me->getThreatMgr().getThreatList(); std::list<HostileReference*> AggroList = me->GetThreatMgr().getThreatList();
std::list<Unit*> UnitsWithMana; std::list<Unit*> UnitsWithMana;
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
@@ -488,7 +488,7 @@ public:
AttackStart(Dragonmaw); AttackStart(Dragonmaw);
} }
HostileReference* ref = me->getThreatMgr().getOnlineContainer().getReferenceByTarget(caster); HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(caster);
if (ref) if (ref)
ref->removeReference(); ref->removeReference();
} }
+1 -1
View File
@@ -164,7 +164,7 @@ struct npc_pet_mage_mirror_image : CasterAI
if (selection) if (selection)
{ {
me->getThreatMgr().ResetAllThreat(); me->GetThreatMgr().ResetAllThreat();
me->AddThreat(selection, 1000000.0f); me->AddThreat(selection, 1000000.0f);
if (owner->IsInCombat()) if (owner->IsInCombat())
+2 -2
View File
@@ -935,7 +935,7 @@ class spell_gen_knock_away : public SpellScript
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
if (Creature* caster = GetCaster()->ToCreature()) if (Creature* caster = GetCaster()->ToCreature())
caster->getThreatMgr().modifyThreatPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes caster->GetThreatMgr().modifyThreatPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes
} }
void Register() override void Register() override
@@ -1041,7 +1041,7 @@ class spell_gen_hate_to_zero : public SpellScript
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
if (Creature* caster = GetCaster()->ToCreature()) if (Creature* caster = GetCaster()->ToCreature())
caster->getThreatMgr().modifyThreatPercent(target, -100); caster->GetThreatMgr().modifyThreatPercent(target, -100);
} }
void Register() override void Register() override
+1 -1
View File
@@ -698,7 +698,7 @@ class spell_warl_soulshatter : public SpellScript
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{ {
if (target->CanHaveThreatList() && target->getThreatMgr().getThreat(caster) > 0.0f) if (target->CanHaveThreatList() && target->GetThreatMgr().getThreat(caster) > 0.0f)
caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true); caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true);
} }
} }
@@ -138,7 +138,7 @@ struct NPCStaveQuestAI : public ScriptedAI
ObjectGuid gossipPlayerGUID; ObjectGuid gossipPlayerGUID;
ObjectGuid playerGUID; ObjectGuid playerGUID;
bool encounterStarted; bool encounterStarted;
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
std::map<int, int> entryKeys = { std::map<int, int> entryKeys = {
{ ARTORIUS_NORMAL_ENTRY, 1 }, { ARTORIUS_NORMAL_ENTRY, 1 },