AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ThreatMgr Class Reference

#include "ThreatMgr.h"

Public Member Functions

 ThreatMgr (Unit *owner)
 
 ~ThreatMgr ()
 
UnitSelectVictim ()
 
UnitGetCurrentVictim () const
 
UnitGetAnyTarget () const
 
void clearReferences ()
 
void AddThreat (Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
void DoAddThreat (Unit *victim, float threat)
 
void ModifyThreatByPercent (Unit *victim, int32 percent)
 
float GetThreat (Unit *victim, bool alsoSearchOfflineList=false)
 
float GetThreatListSize () const
 
float getThreatWithoutTemp (Unit *victim, bool alsoSearchOfflineList=false)
 
bool isThreatListEmpty () const
 
bool areThreatListsEmpty () const
 
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetSortedThreatList () const
 
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetUnsortedThreatList () const
 
void processThreatEvent (ThreatRefStatusChangeEvent *threatRefStatusChangeEvent)
 
bool isNeedUpdateToClient (uint32 time)
 
HostileReferencegetCurrentVictim () const
 
UnitGetOwner () const
 
UnitgetHostileTarget ()
 
void tauntApply (Unit *taunter)
 
void tauntFadeOut (Unit *taunter)
 
void setCurrentVictim (HostileReference *hostileRef)
 
void setDirty (bool isDirty)
 
void ResetThreat (Unit const *who)
 
void ResetAllThreat ()
 
void ClearThreat (Unit const *who)
 
void ClearAllThreat ()
 
template<class PREDICATE >
void resetAggro (PREDICATE predicate)
 
ThreatContainer::StorageType const & GetThreatList () const
 
ThreatContainer::StorageType const & GetOfflineThreatList () const
 
ThreatContainerGetOnlineContainer ()
 
ThreatContainerGetOfflineContainer ()
 

Private Member Functions

HostileReferenceFindReference (Unit const *who, bool includeOffline) const
 
void _addThreat (Unit *victim, float threat)
 

Private Attributes

HostileReferenceiCurrentVictim
 
UnitiOwner
 
uint32 iUpdateTimer
 
ThreatContainer iThreatContainer
 
ThreatContainer iThreatOfflineContainer
 

Friends

class HostileReference
 

Detailed Description

Constructor & Destructor Documentation

◆ ThreatMgr()

ThreatMgr::ThreatMgr ( Unit owner)
explicit
482{
483}
#define THREAT_UPDATE_INTERVAL
Definition ThreatMgr.h:35
HostileReference * iCurrentVictim
Definition ThreatMgr.h:287
Unit * iOwner
Definition ThreatMgr.h:288
uint32 iUpdateTimer
Definition ThreatMgr.h:289

◆ ~ThreatMgr()

ThreatMgr::~ThreatMgr ( )
inline
213{ clearReferences(); }
void clearReferences()
Definition ThreatMgr.cpp:494

References clearReferences().

Member Function Documentation

◆ _addThreat()

void ThreatMgr::_addThreat ( Unit victim,
float  threat 
)
private
557{
558 HostileReference* ref = iThreatContainer.AddThreat(victim, threat);
559 // Ref is not in the online refs, search the offline refs next
560 if (!ref)
561 ref = iThreatOfflineContainer.AddThreat(victim, threat);
562
563 if (!ref) // there was no ref => create a new one
564 {
565 // threat has to be 0 here
566 HostileReference* hostileRef = new HostileReference(victim, this, 0);
567 iThreatContainer.addReference(hostileRef);
568 hostileRef->AddThreat(threat); // now we add the real threat
569 if (victim->IsPlayer() && victim->ToPlayer()->IsGameMaster())
570 hostileRef->setOnlineOfflineState(false); // GM is always offline
571 }
572}
Definition ThreatMgr.h:48
void AddThreat(float modThreat)
Definition ThreatMgr.cpp:138
void setOnlineOfflineState(bool isOnline)
Definition ThreatMgr.cpp:214
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
bool IsGameMaster() const
Definition Player.h:1156
HostileReference * AddThreat(Unit *victim, float threat)
Definition ThreatMgr.cpp:286
void addReference(HostileReference *hostileRef)
Definition ThreatMgr.h:188
ThreatContainer iThreatOfflineContainer
Definition ThreatMgr.h:291
ThreatContainer iThreatContainer
Definition ThreatMgr.h:290
friend class HostileReference
Definition ThreatMgr.h:209

References ThreatContainer::addReference(), HostileReference::AddThreat(), ThreatContainer::AddThreat(), HostileReference, Player::IsGameMaster(), Object::IsPlayer(), iThreatContainer, iThreatOfflineContainer, HostileReference::setOnlineOfflineState(), and Object::ToPlayer().

Referenced by DoAddThreat().

◆ AddThreat()

void ThreatMgr::AddThreat ( Unit victim,
float  threat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
505{
506 if (!ThreatCalcHelper::isValidProcess(victim, iOwner, threatSpell))
507 return;
508
509 threat = ThreatCalcHelper::calcThreat(victim, threat, schoolMask, threatSpell);
510 if (Creature* hatingCreature = iOwner->ToCreature())
511 {
512 if (hatingCreature->IsAIEnabled)
513 {
514 hatingCreature->AI()->CalculateThreat(victim, threat, threatSpell);
515 }
516 }
517
518 DoAddThreat(victim, threat);
519}
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:205
void DoAddThreat(Unit *victim, float threat)
Definition ThreatMgr.cpp:521
static float calcThreat(Unit *hatedUnit, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition ThreatMgr.cpp:34
static bool isValidProcess(Unit *hatedUnit, Unit *hatingUnit, SpellInfo const *threatSpell=nullptr)
Definition ThreatMgr.cpp:54

References ThreatCalcHelper::calcThreat(), DoAddThreat(), iOwner, ThreatCalcHelper::isValidProcess(), and Object::ToCreature().

Referenced by HostileReference::AddThreat(), Unit::AddThreat(), ScriptedAI::DoAddThreat(), TemporaryThreatModifierEvent::Execute(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), and boss_netherspite::UpdatePortals().

◆ areThreatListsEmpty()

bool ThreatMgr::areThreatListsEmpty ( ) const
inline
bool empty() const
Definition ThreatMgr.h:167

References ThreatContainer::empty(), iThreatContainer, and iThreatOfflineContainer.

◆ ClearAllThreat()

void ThreatMgr::ClearAllThreat ( )
486{
490}
bool isThreatListEmpty() const
Definition ThreatMgr.h:228
void SendClearThreatListOpcode()
Definition Unit.cpp:20109
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:14732

References Unit::CanHaveThreatList(), clearReferences(), iOwner, isThreatListEmpty(), and Unit::SendClearThreatListOpcode().

Referenced by CreatureAI::_EnterEvadeMode(), Unit::CleanupBeforeRemoveFromMap(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), npc_raging_flames::FixateRandomTarget(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), PetAI::HandleReturnMovement(), boss_high_astromancer_solarian::JustEngagedWith(), Unit::Kill(), boss_urom::boss_uromAI::LeaveCombat(), Unit::setDeathState(), spell_putricide_ooze_channel::StartAttack(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_malygos::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ clearReferences()

◆ ClearThreat()

void ThreatMgr::ClearThreat ( Unit const *  who)
inline
255{ if (auto* ref = FindReference(who, true)) ref->removeReference(); }
HostileReference * FindReference(Unit const *who, bool includeOffline) const
Definition ThreatMgr.h:283

References FindReference().

◆ DoAddThreat()

void ThreatMgr::DoAddThreat ( Unit victim,
float  threat 
)
522{
523 uint32 redirectThreadPct = victim->GetRedirectThreatPercent();
524 Unit* redirectTarget = victim->GetRedirectThreatTarget();
525
526 // Personal Spawns from same summoner can aggro each other
527 if (TempSummon* tempSummonVictim = victim->ToTempSummon())
528 {
529 if (tempSummonVictim->IsVisibleBySummonerOnly())
530 {
531 if (!GetOwner()->ToTempSummon() ||
532 !GetOwner()->ToTempSummon()->IsVisibleBySummonerOnly() ||
533 tempSummonVictim->GetSummonerGUID() != GetOwner()->ToTempSummon()->GetSummonerGUID())
534 {
535 redirectThreadPct = 100;
536 redirectTarget = tempSummonVictim->GetSummonerUnit();
537 }
538 }
539 }
540
541 // must check > 0.0f, otherwise dead loop
542 if (threat > 0.0f && redirectThreadPct)
543 {
544 if (redirectTarget)
545 {
546 float redirectThreat = CalculatePct(threat, redirectThreadPct);
547 threat -= redirectThreat;
548 if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner()))
549 _addThreat(redirectTarget, redirectThreat);
550 }
551 }
552
553 _addThreat(victim, threat);
554}
std::uint32_t uint32
Definition Define.h:107
T CalculatePct(T base, U pct)
Definition Util.h:52
Definition TemporarySummon.h:40
void _addThreat(Unit *victim, float threat)
Definition ThreatMgr.cpp:556
Unit * GetOwner() const
Definition ThreatMgr.h:240
Definition Unit.h:655
Unit * GetRedirectThreatTarget() const
Definition Unit.cpp:19502
TempSummon * ToTempSummon()
Definition Unit.h:721
uint32 GetRedirectThreatPercent()
Definition Unit.h:953

References _addThreat(), CalculatePct(), GetOwner(), Unit::GetRedirectThreatPercent(), Unit::GetRedirectThreatTarget(), ThreatCalcHelper::isValidProcess(), and Unit::ToTempSummon().

Referenced by AddThreat(), Spell::EffectTaunt(), and HostileRefMgr::threatAssist().

◆ FindReference()

HostileReference * ThreatMgr::FindReference ( Unit const *  who,
bool  includeOffline 
) const
inlineprivate
283{ if (auto* ref = iThreatContainer.getReferenceByTarget(who)) return ref; if (includeOffline) if (auto* ref = iThreatOfflineContainer.getReferenceByTarget(who)) return ref; return nullptr; }
HostileReference * getReferenceByTarget(Unit const *victim) const
Definition ThreatMgr.cpp:261

References ThreatContainer::getReferenceByTarget(), iThreatContainer, and iThreatOfflineContainer.

Referenced by ClearThreat(), and ResetThreat().

◆ GetAnyTarget()

Unit * ThreatMgr::GetAnyTarget ( ) const
inline
217{ auto const& list = GetThreatList(); if (!list.empty()) return list.front()->getTarget(); return nullptr; }
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:277

References GetThreatList().

◆ GetCurrentVictim()

Unit * ThreatMgr::GetCurrentVictim ( ) const
inline
216{ if (ThreatReference* ref = getCurrentVictim()) return ref->GetVictim(); else return nullptr; }
HostileReference * getCurrentVictim() const
Definition ThreatMgr.h:238

References getCurrentVictim(), and Unit::GetVictim().

Referenced by boss_talon_king_ikiss::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), NonTankTargetSelector::operator()(), PowerUsersSelector::operator()(), and MalleableGooSelector::operator()().

◆ getCurrentVictim()

HostileReference * ThreatMgr::getCurrentVictim ( ) const
inline

◆ getHostileTarget()

Unit * ThreatMgr::getHostileTarget ( )
584{
587 setCurrentVictim(nextVictim);
588 return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr;
589}
TO * getTarget() const
Definition Reference.h:95
void update()
Definition ThreatMgr.cpp:305
HostileReference * SelectNextVictim(Creature *attacker, HostileReference *currentVictim) const
Definition ThreatMgr.cpp:317
void setCurrentVictim(HostileReference *hostileRef)
Definition ThreatMgr.cpp:640

References getCurrentVictim(), GetOwner(), Reference< TO, FROM >::getTarget(), iThreatContainer, ThreatContainer::SelectNextVictim(), setCurrentVictim(), and ThreatContainer::update().

Referenced by SelectVictim(), and Creature::SelectVictim().

◆ GetOfflineContainer()

ThreatContainer & ThreatMgr::GetOfflineContainer ( )
inline

◆ GetOfflineThreatList()

ThreatContainer::StorageType const & ThreatMgr::GetOfflineThreatList ( ) const
inline
StorageType const & GetThreatList() const
Definition ThreatMgr.h:180

References ThreatContainer::GetThreatList(), and iThreatOfflineContainer.

Referenced by debug_commandscript::HandleDebugThreatListCommand(), and Unit::SetPhaseMask().

◆ GetOnlineContainer()

◆ GetOwner()

◆ GetSortedThreatList()

Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > ThreatMgr::GetSortedThreatList ( ) const
inline
231{ auto& list = iThreatContainer.GetThreatList(); return { list.cbegin(), list.cend() }; }

References ThreatContainer::GetThreatList(), and iThreatContainer.

Referenced by GetUnsortedThreatList(), and UnitAI::SelectTargetList().

◆ GetThreat()

◆ GetThreatList()

ThreatContainer::StorageType const & ThreatMgr::GetThreatList ( ) const
inline

References ThreatContainer::GetThreatList(), and iThreatContainer.

Referenced by boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), UnitAI::DoAddAuraToAllHostilePlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_faction_championsAI::EnemiesInRange(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), boss_supremus::FindHatefulStrikeTarget(), GetAnyTarget(), SmartScript::GetTargets(), GetThreatListSize(), debug_commandscript::HandleDebugThreatListCommand(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), Unit::IsInCombatWith(), boss_hadronox::IsInCombatWithPlayer(), boss_blackheart_the_inciter::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), Unit::SendChangeCurrentVictimOpcode(), Unit::SendThreatListUpdate(), Unit::SetPhaseMask(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), BossAI::TeleportCheaters(), boss_nefarian::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ GetThreatListSize()

◆ getThreatWithoutTemp()

float ThreatMgr::getThreatWithoutTemp ( Unit victim,
bool  alsoSearchOfflineList = false 
)
607{
608 float threat = 0.0f;
610 if (!ref && alsoSearchOfflineList)
612 if (ref)
613 threat = ref->GetThreat() - ref->getTempThreatModifier();
614 return threat;
615}
float getTempThreatModifier()
Definition ThreatMgr.h:93

References ThreatContainer::getReferenceByTarget(), HostileReference::getTempThreatModifier(), HostileReference::GetThreat(), iThreatContainer, and iThreatOfflineContainer.

◆ GetUnsortedThreatList()

Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > ThreatMgr::GetUnsortedThreatList ( ) const
inline
232{ return GetSortedThreatList(); }
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetSortedThreatList() const
Definition ThreatMgr.h:231

References GetSortedThreatList().

Referenced by boss_attumen::IsSummonedBy(), and UnitAI::SelectTargetList().

◆ isNeedUpdateToClient()

bool ThreatMgr::isNeedUpdateToClient ( uint32  time)
705{
706 if (isThreatListEmpty())
707 return false;
708
709 if (time >= iUpdateTimer)
710 {
712 return true;
713 }
714 iUpdateTimer -= time;
715 return false;
716}

References isThreatListEmpty(), iUpdateTimer, and THREAT_UPDATE_INTERVAL.

◆ isThreatListEmpty()

◆ ModifyThreatByPercent()

◆ processThreatEvent()

void ThreatMgr::processThreatEvent ( ThreatRefStatusChangeEvent threatRefStatusChangeEvent)
654{
655 threatRefStatusChangeEvent->setThreatMgr(this); // now we can set the threat manager
656
657 HostileReference* hostileRef = threatRefStatusChangeEvent->getReference();
658
659 switch (threatRefStatusChangeEvent->getType())
660 {
662 if ((getCurrentVictim() == hostileRef && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
663 (getCurrentVictim() != hostileRef && threatRefStatusChangeEvent->getFValue() > 0.0f))
664 setDirty(true); // the order in the threat list might have changed
665 break;
667 if (!hostileRef->IsOnline())
668 {
669 if (hostileRef == getCurrentVictim())
670 {
671 setCurrentVictim(nullptr);
672 setDirty(true);
673 }
674 if (GetOwner() && GetOwner()->IsInWorld())
675 if (Unit* target = ObjectAccessor::GetUnit(*GetOwner(), hostileRef->getUnitGuid()))
676 if (GetOwner()->IsInMap(target))
678 iThreatContainer.remove(hostileRef);
680 }
681 else
682 {
683 if (getCurrentVictim() && hostileRef->GetThreat() > (1.1f * getCurrentVictim()->GetThreat()))
684 setDirty(true);
685 iThreatContainer.addReference(hostileRef);
687 }
688 break;
690 if (hostileRef == getCurrentVictim())
691 {
692 setCurrentVictim(nullptr);
693 setDirty(true);
694 }
696 if (hostileRef->IsOnline())
697 iThreatContainer.remove(hostileRef);
698 else
700 break;
701 }
702}
@ UEV_THREAT_REF_THREAT_CHANGE
Definition UnitEvents.h:36
@ UEV_THREAT_REF_ONLINE_STATUS
Definition UnitEvents.h:33
@ UEV_THREAT_REF_REMOVE_FROM_LIST
Definition UnitEvents.h:39
ObjectGuid getUnitGuid() const
Definition ThreatMgr.h:106
bool IsOnline() const
Definition ThreatMgr.h:66
void remove(HostileReference *hostileRef)
Definition ThreatMgr.h:183
void setDirty(bool isDirty)
Definition ThreatMgr.h:249
float GetThreat(Unit *victim, bool alsoSearchOfflineList=false)
Definition ThreatMgr.cpp:593
float getFValue() const
Definition UnitEvents.h:105
void setThreatMgr(ThreatMgr *pThreatMgr)
Definition UnitEvents.h:113
HostileReference * getReference() const
Definition UnitEvents.h:111
uint32 getType() const
Definition UnitEvents.h:75
void SendRemoveFromThreatListOpcode(HostileReference *pHostileReference)
Definition Unit.cpp:20117
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:199

References ThreatContainer::addReference(), getCurrentVictim(), ThreatRefStatusChangeEvent::getFValue(), GetOwner(), ThreatRefStatusChangeEvent::getReference(), HostileReference::GetThreat(), GetThreat(), UnitBaseEvent::getType(), ObjectAccessor::GetUnit(), HostileReference::getUnitGuid(), iOwner, HostileReference::IsOnline(), iThreatContainer, iThreatOfflineContainer, ThreatContainer::remove(), Unit::SendRemoveFromThreatListOpcode(), setCurrentVictim(), setDirty(), ThreatRefStatusChangeEvent::setThreatMgr(), UEV_THREAT_REF_ONLINE_STATUS, UEV_THREAT_REF_REMOVE_FROM_LIST, and UEV_THREAT_REF_THREAT_CHANGE.

Referenced by HostileReference::fireStatusChanged().

◆ resetAggro()

template<class PREDICATE >
void ThreatMgr::resetAggro ( PREDICATE  predicate)
inline
260 {
262 if (threatList.empty())
263 return;
264
265 for (auto& ref : threatList)
266 {
267 if (predicate(ref->getTarget()))
268 {
269 ref->SetThreat(0);
270 setDirty(true);
271 }
272 }
273 }
StorageType iThreatList
Definition ThreatMgr.h:198
std::list< HostileReference * > StorageType
Definition ThreatMgr.h:147

References iThreatContainer, ThreatContainer::iThreatList, and setDirty().

Referenced by boss_gothik::boss_gothikAI::UpdateAI().

◆ ResetAllThreat()

◆ ResetThreat()

void ThreatMgr::ResetThreat ( Unit const *  who)
inline
252{ if (auto* ref = FindReference(who, true)) ref->SetThreat(0.0f); }

References FindReference().

Referenced by ScriptedAI::DoResetThreat(), and spell_kaelthas_mind_control::HandleEffect().

◆ SelectVictim()

Unit * ThreatMgr::SelectVictim ( )
inline
215{ return getHostileTarget(); }
Unit * getHostileTarget()
Definition ThreatMgr.cpp:583

References getHostileTarget().

◆ setCurrentVictim()

void ThreatMgr::setCurrentVictim ( HostileReference hostileRef)
641{
642 if (pHostileReference && pHostileReference != iCurrentVictim)
643 {
644 iOwner->SendChangeCurrentVictimOpcode(pHostileReference);
645 }
646 iCurrentVictim = pHostileReference;
647}
void SendChangeCurrentVictimOpcode(HostileReference *pHostileReference)
Definition Unit.cpp:20088

References iCurrentVictim, iOwner, and Unit::SendChangeCurrentVictimOpcode().

Referenced by Spell::EffectTaunt(), getHostileTarget(), and processThreatEvent().

◆ setDirty()

void ThreatMgr::setDirty ( bool  isDirty)
inline
249{ iThreatContainer.setDirty(isDirty); }
void setDirty(bool isDirty)
Definition ThreatMgr.h:163

References iThreatContainer, and ThreatContainer::setDirty().

Referenced by processThreatEvent(), resetAggro(), and ResetAllThreat().

◆ tauntApply()

void ThreatMgr::tauntApply ( Unit taunter)

◆ tauntFadeOut()

void ThreatMgr::tauntFadeOut ( Unit taunter)
632{
634 if (ref)
635 ref->resetTempThreat();
636}
void resetTempThreat()
Definition ThreatMgr.h:84

References ThreatContainer::getReferenceByTarget(), iThreatContainer, and HostileReference::resetTempThreat().

Friends And Related Symbol Documentation

◆ HostileReference

friend class HostileReference
friend

Referenced by _addThreat().

Member Data Documentation

◆ iCurrentVictim

HostileReference* ThreatMgr::iCurrentVictim
private

◆ iOwner

Unit* ThreatMgr::iOwner
private

◆ iThreatContainer

◆ iThreatOfflineContainer

◆ iUpdateTimer

uint32 ThreatMgr::iUpdateTimer
private

The documentation for this class was generated from the following files: