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

View File

@@ -110,7 +110,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{
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)
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -133,7 +133,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered
{
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)
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))

View File

@@ -216,7 +216,7 @@ public:
template <class 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())
return nullptr;
@@ -278,7 +278,7 @@ public:
template <class PREDICATE>
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())
return;

View File

@@ -283,7 +283,7 @@ bool CreatureAI::UpdateVictim()
// xinef: if we have any victim, just return true
else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f)
return true;
else if (me->getThreatMgr().isThreatListEmpty())
else if (me->GetThreatMgr().isThreatListEmpty())
{
EnterEvadeMode();
return false;

View File

@@ -370,27 +370,27 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
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());
return;
}
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
}
float ScriptedAI::DoGetThreat(Unit* unit)
{
if (!unit)
return 0.0f;
return me->getThreatMgr().getThreat(unit);
return me->GetThreatMgr().getThreat(unit);
}
void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct)
{
if (!unit)
return;
me->getThreatMgr().modifyThreatPercent(unit, pct);
me->GetThreatMgr().modifyThreatPercent(unit, pct);
}
void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
@@ -564,7 +564,7 @@ void BossAI::TeleportCheaters()
float 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)
if (Unit* target = (*itr)->getTarget())
if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target))

View File

@@ -616,12 +616,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
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)
{
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 {}",
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))
{
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 {}",
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)
{
ThreatContainer::StorageType threatList = me->getThreatMgr().getThreatList();
ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
// Xinef: added distance check

View File

@@ -112,7 +112,7 @@ public:
void setThreatMgr(ThreatMgr* pThreatMgr) { iThreatMgr = pThreatMgr; }
[[nodiscard]] ThreatMgr* getThreatMgr() const { return iThreatMgr; }
[[nodiscard]] ThreatMgr* GetThreatMgr() const { return iThreatMgr; }
};
//==============================================================

View File

@@ -207,8 +207,8 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
if (m_owner.IsInCombatWith(victim))
{
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().modifyThreatPercent(victim, -100); // Reset threat to zero.
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)
{
float currentThreat = getThreatMgr().getThreat(victim);
float currentThreat = GetThreatMgr().getThreat(victim);
if (percent != 0.0f)
{
getThreatMgr().modifyThreatPercent(victim, percent);
GetThreatMgr().modifyThreatPercent(victim, percent);
}
TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);

View File

@@ -422,7 +422,7 @@ void Unit::Update(uint32 p_time)
_UpdateSpells( p_time );
if (CanHaveThreatList() && getThreatMgr().isNeedUpdateToClient(p_time))
if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
SendThreatListUpdate();
// 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;
if (victim && victim->IsAlive())
victim->getThreatMgr().modifyThreatPercent(this, -10);
victim->GetThreatMgr().modifyThreatPercent(this, -10);
basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
trigger_spell_id = 31616;
@@ -18569,8 +18569,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// modify threat lists for new phasemask
if (GetTypeId() != TYPEID_PLAYER)
{
ThreatContainer::StorageType threatList = getThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = getThreatMgr().getOfflineThreatList();
ThreatContainer::StorageType threatList = GetThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = GetThreatMgr().getOfflineThreatList();
// merge expects sorted lists
threatList.sort();
@@ -19521,15 +19521,15 @@ void Unit::UpdateHeight(float newZ)
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");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID();
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)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
@@ -19541,16 +19541,16 @@ void Unit::SendThreatListUpdate()
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");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked();
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)
{
data << (*itr)->getUnitGuid().WriteAsPacked();

View File

@@ -2108,7 +2108,7 @@ public:
void DeleteThreatList();
void TauntApply(Unit* victim);
void TauntFadeOut(Unit* taunter);
ThreatMgr& getThreatMgr() { return m_ThreatMgr; }
ThreatMgr& GetThreatMgr() { return m_ThreatMgr; }
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefMgr.insertFirst(pHostileReference); };
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
HostileRefMgr& getHostileRefMgr() { return m_HostileRefMgr; }

View File

@@ -3290,17 +3290,17 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
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
float myThreat = unitTarget->getThreatMgr().getThreat(m_caster);
float topThreat = unitTarget->getThreatMgr().getOnlineContainer().getMostHated()->getThreat();
float myThreat = unitTarget->GetThreatMgr().getThreat(m_caster);
float topThreat = unitTarget->GetThreatMgr().getOnlineContainer().getMostHated()->getThreat();
if (topThreat > myThreat)
unitTarget->getThreatMgr().doAddThreat(m_caster, topThreat - myThreat);
unitTarget->GetThreatMgr().doAddThreat(m_caster, topThreat - myThreat);
//Set aggro victim to caster
if (HostileReference* forcedVictim = unitTarget->getThreatMgr().getOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->getThreatMgr().setCurrentVictim(forcedVictim);
if (HostileReference* forcedVictim = unitTarget->GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->GetThreatMgr().setCurrentVictim(forcedVictim);
}
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
@@ -5310,7 +5310,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
unitTarget->getThreatMgr().modifyThreatPercent(m_caster, damage);
unitTarget->GetThreatMgr().modifyThreatPercent(m_caster, damage);
}
void Spell::EffectTransmitted(SpellEffIndex effIndex)