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

@@ -409,7 +409,7 @@ struct boss_taldaram : public BossAI
{
//Count alive players
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())
{
for (HostileReference const* reference : t_list)

View File

@@ -1158,7 +1158,7 @@ public:
GetTarget()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE);
GetTarget()->GetMotionMaster()->Clear();
GetTarget()->getThreatMgr().clearReferences();
GetTarget()->GetThreatMgr().clearReferences();
GetTarget()->RemoveAllAttackers();
GetTarget()->AttackStop();
}
@@ -1168,7 +1168,7 @@ public:
GetTarget()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE);
GetTarget()->GetMotionMaster()->Clear();
GetTarget()->getThreatMgr().clearReferences();
GetTarget()->GetThreatMgr().clearReferences();
GetTarget()->RemoveAllAttackers();
GetTarget()->AttackStop();
}

View File

@@ -155,7 +155,7 @@ public:
me->SetFaction(FACTION_FRIENDLY);
events.Reset();
Talk(TEXT_EADRIC_DEATH);
me->getThreatMgr().clearReferences();
me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false);
_EnterEvadeMode();
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);
events.Reset();
Talk(TEXT_PALETRESS_DEATH);
me->getThreatMgr().clearReferences();
me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false);
_EnterEvadeMode();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);

View File

@@ -296,7 +296,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f);
AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);
@@ -749,7 +749,7 @@ public:
uint8 rnd = LIST.size() > 1 ? urand(0, LIST.size() - 1) : 0;
if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) )
{
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 10000.0f);
AttackStart(target);
me->CastSpell(target, SPELL_MINIONS_CHARGE, false);

View File

@@ -102,16 +102,16 @@ struct boss_faction_championsAI : public ScriptedAI
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 )
{
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);
me->getThreatMgr().modifyThreatPercent(pUnit, -100);
me->GetThreatMgr().modifyThreatPercent(pUnit, -100);
//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);
}
}
@@ -177,7 +177,7 @@ struct boss_faction_championsAI : public ScriptedAI
uint32 EnemiesInRange(float distance)
{
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList();
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
uint32 count = 0;
Unit* target;
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)
{
ThreatContainer::StorageType const& tList = me->getThreatMgr().getThreatList();
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
Unit* target;
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
{

View File

@@ -161,7 +161,7 @@ public:
if (me->HealthBelowPct(50))
{
Talk(SAY_FLESH);
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->CastSpell((Unit*)nullptr, SPELL_TURN_FLESH, false);
events.Reset();
@@ -257,7 +257,7 @@ public:
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
GetUnitOwner()->getThreatMgr().ResetAllThreat();
GetUnitOwner()->GetThreatMgr().ResetAllThreat();
GetUnitOwner()->GetMotionMaster()->Clear();
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_TURN_BONES, false);
GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES);

View File

@@ -125,7 +125,7 @@ public:
case EVENT_ECK_SPRING:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 30.0f, true))
{
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(target, 500.0f);
me->CastSpell(target, SPELL_ECK_SPRING, false);
}

View File

@@ -335,7 +335,7 @@ public:
if (Player* p = itr->GetSource())
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)
{
target = p;

View File

@@ -299,7 +299,7 @@ public:
if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA))
{
// 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)
{
Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid());
@@ -930,7 +930,7 @@ public:
ScriptedAI::AttackStart(who);
if (!targetGUID)
{
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->AddThreat(who, 1000000.0f);
targetGUID = who->GetGUID();
}

View File

@@ -499,7 +499,7 @@ public:
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{
_owner->SetReactState(REACT_AGGRESSIVE);
if (!_owner->getThreatMgr().isThreatListEmpty())
if (!_owner->GetThreatMgr().isThreatListEmpty())
if (Unit* target = _owner->SelectVictim())
_owner->AI()->AttackStart(target);
if (!_owner->GetVictim())
@@ -2378,7 +2378,7 @@ public:
{
me->SetControlled(false, UNIT_STATE_ROOT);
if (!me->getThreatMgr().isThreatListEmpty())
if (!me->GetThreatMgr().isThreatListEmpty())
if (Unit* target = me->SelectVictim())
AttackStart(target);
if (!me->GetVictim())

View File

@@ -592,7 +592,7 @@ public:
{
checkTimer = 3000;
me->SetInCombatWithZone();
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList();
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
if (!threatList.empty())
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget())

View File

@@ -1773,15 +1773,15 @@ public:
Position myPos = me->GetPosition();
me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation());
c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation());
const ThreatContainer::StorageType me_tl = me->getThreatMgr().getThreatList();
const ThreatContainer::StorageType target_tl = c->getThreatMgr().getThreatList();
const ThreatContainer::StorageType me_tl = me->GetThreatMgr().getThreatList();
const ThreatContainer::StorageType target_tl = c->GetThreatMgr().getThreatList();
DoResetThreat();
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)
c->getThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
c->GetThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat());
}
}

View File

@@ -452,10 +452,10 @@ public:
{
me->CastSpell(me, SPELL_TELEPORT_LIVE, false);
}
me->getThreatMgr().resetAggro(NotOnSameSide(me));
me->GetThreatMgr().resetAggro(NotOnSameSide(me));
if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0))
{
me->getThreatMgr().addThreat(pTarget, 100.0f);
me->GetThreatMgr().addThreat(pTarget, 100.0f);
AttackStart(pTarget);
}
events.RepeatEvent(20000);

View File

@@ -438,7 +438,7 @@ public:
case EVENT_DETONATE_MANA:
{
std::vector<Unit*> unitList;
ThreatContainer::StorageType const& threatList = me->getThreatMgr().getThreatList();
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList();
for (auto itr : threatList)
{
if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER

View File

@@ -128,8 +128,8 @@ public:
std::list<Unit*> meleeRangeTargets;
Unit* finalTarget = nullptr;
uint8 counter = 0;
auto i = me->getThreatMgr().getThreatList().begin();
for (; i != me->getThreatMgr().getThreatList().end(); ++i, ++counter)
auto i = me->GetThreatMgr().getThreatList().begin();
for (; i != me->GetThreatMgr().getThreatList().end(); ++i, ++counter)
{
// Gather all units with melee range
Unit* target = (*i)->getTarget();

View File

@@ -321,8 +321,8 @@ public:
}
std::vector<Unit*> targets;
auto i = me->getThreatMgr().getThreatList().begin();
for (; i != me->getThreatMgr().getThreatList().end(); ++i)
auto i = me->GetThreatMgr().getThreatList().begin();
for (; i != me->GetThreatMgr().getThreatList().end(); ++i)
{
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER)
{

View File

@@ -553,17 +553,17 @@ public:
if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim())
return;
float threatFeugen = feugen->getThreatMgr().getThreat(feugen->GetVictim());
float threatStalagg = me->getThreatMgr().getThreat(me->GetVictim());
float threatFeugen = feugen->GetThreatMgr().getThreat(feugen->GetVictim());
float threatStalagg = me->GetThreatMgr().getThreat(me->GetVictim());
Unit* tankFeugen = feugen->GetVictim();
Unit* tankStalagg = me->GetVictim();
feugen->getThreatMgr().modifyThreatPercent(tankFeugen, -100);
feugen->GetThreatMgr().modifyThreatPercent(tankFeugen, -100);
feugen->AddThreat(tankStalagg, threatFeugen);
feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true);
feugen->AI()->DoAction(ACTION_MAGNETIC_PULL);
me->getThreatMgr().modifyThreatPercent(tankStalagg, -100);
me->GetThreatMgr().modifyThreatPercent(tankStalagg, -100);
me->AddThreat(tankFeugen, threatStalagg);
me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true);
DoAction(ACTION_MAGNETIC_PULL);

View File

@@ -1674,7 +1674,7 @@ public:
if (!target || !caster)
return;
caster->getThreatMgr().ResetAllThreat();
caster->GetThreatMgr().ResetAllThreat();
caster->GetAI()->AttackStart(target); // Chase target
caster->AddThreat(target, 10000000.0f);
}

View File

@@ -138,7 +138,7 @@ public:
heat->ModStackAmount(-1);
}
me->CastSpell(me, SPELL_MOLTEN, true);
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
}
}
}

View File

@@ -670,7 +670,7 @@ public:
bool operator() (WorldObject* target) const
{
if (target == _victim && _me->getThreatMgr().getThreatList().size() > 1)
if (target == _victim && _me->GetThreatMgr().getThreatList().size() > 1)
return true;
if (target->GetTypeId() != TYPEID_PLAYER)

View File

@@ -1158,7 +1158,7 @@ public:
}
}
_playerAttack = true;
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
me->CallForHelp(40.0f);
AttackStart(who);
}

View File

@@ -191,7 +191,7 @@ public:
if (switchTimer >= 10000)
{
switchTimer = 0;
me->getThreatMgr().ResetAllThreat();
me->GetThreatMgr().ResetAllThreat();
if (Player* player = SelectTargetFromPlayerList(100.0f))
me->AddThreat(player, 100000.0f);
}