TrinityCore
CombatManager Class Reference

#include <CombatManager.h>

Public Types

using UnitFilter = bool(Unit const *otherUnit)
 

Public Member Functions

 CombatManager (Unit *owner)
 
 ~CombatManager ()
 
void Update (uint32 tdiff)
 
UnitGetOwner () const
 
bool HasCombat () const
 
bool HasPvECombat () const
 
bool HasPvECombatWithPlayers () const
 
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs () const
 
bool HasPvPCombat () const
 
std::unordered_map< ObjectGuid, PvPCombatReference * > const & GetPvPCombatRefs () const
 
UnitGetAnyTarget () const
 
bool SetInCombatWith (Unit *who, bool addSecondUnitSuppressed=false)
 
bool IsInCombatWith (ObjectGuid const &who) const
 
bool IsInCombatWith (Unit const *who) const
 
void InheritCombatStatesFrom (Unit const *who)
 
void EndCombatBeyondRange (float range, bool includingPvP=false)
 
void SuppressPvPCombat (UnitFilter *unitFilter=nullptr)
 
void EndAllPvECombat (UnitFilter *unitFilter=nullptr)
 
void RevalidateCombat ()
 
void EndAllPvPCombat (UnitFilter *unitFilter=nullptr)
 
void EndAllCombat (UnitFilter *unitFilter=nullptr)
 
 CombatManager (CombatManager const &)=delete
 
CombatManageroperator= (CombatManager const &)=delete
 

Static Public Member Functions

static bool CanBeginCombat (Unit const *a, Unit const *b)
 

Private Member Functions

void PutReference (ObjectGuid const &guid, CombatReference *ref)
 
void PurgeReference (ObjectGuid const &guid, bool pvp)
 
bool UpdateOwnerCombatState () const
 

Static Private Member Functions

static void NotifyAICombat (Unit *me, Unit *other)
 

Private Attributes

Unit *const _owner
 
std::unordered_map< ObjectGuid, CombatReference * > _pveRefs
 
std::unordered_map< ObjectGuid, PvPCombatReference * > _pvpRefs
 

Friends

struct CombatReference
 
struct PvPCombatReference
 

Detailed Description

Definition at line 98 of file CombatManager.h.

Member Typedef Documentation

◆ UnitFilter

using CombatManager::UnitFilter = bool(Unit const* otherUnit)

Definition at line 124 of file CombatManager.h.

Constructor & Destructor Documentation

◆ CombatManager() [1/2]

CombatManager::CombatManager ( Unit owner)
inline

Definition at line 103 of file CombatManager.h.

◆ ~CombatManager()

CombatManager::~CombatManager ( )

Definition at line 129 of file CombatManager.cpp.

+ Here is the call graph for this function:

◆ CombatManager() [2/2]

CombatManager::CombatManager ( CombatManager const &  )
delete

Member Function Documentation

◆ CanBeginCombat()

bool CombatManager::CanBeginCombat ( Unit const *  a,
Unit const *  b 
)
static

Definition at line 24 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndAllCombat()

void CombatManager::EndAllCombat ( UnitFilter unitFilter = nullptr)
inline

Definition at line 131 of file CombatManager.h.

+ Here is the caller graph for this function:

◆ EndAllPvECombat()

void CombatManager::EndAllPvECombat ( UnitFilter unitFilter = nullptr)

Definition at line 309 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndAllPvPCombat()

void CombatManager::EndAllPvPCombat ( UnitFilter unitFilter = nullptr)

Definition at line 354 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ EndCombatBeyondRange()

void CombatManager::EndCombatBeyondRange ( float  range,
bool  includingPvP = false 
)

Definition at line 266 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAnyTarget()

Unit * CombatManager::GetAnyTarget ( ) const

Definition at line 176 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ GetOwner()

Unit * CombatManager::GetOwner ( ) const
inline

Definition at line 107 of file CombatManager.h.

◆ GetPvECombatRefs()

std::unordered_map< ObjectGuid, CombatReference * > const & CombatManager::GetPvECombatRefs ( ) const
inline

Definition at line 111 of file CombatManager.h.

+ Here is the caller graph for this function:

◆ GetPvPCombatRefs()

std::unordered_map< ObjectGuid, PvPCombatReference * > const & CombatManager::GetPvPCombatRefs ( ) const
inline

Definition at line 113 of file CombatManager.h.

+ Here is the caller graph for this function:

◆ HasCombat()

bool CombatManager::HasCombat ( ) const
inline

Definition at line 108 of file CombatManager.h.

+ Here is the caller graph for this function:

◆ HasPvECombat()

bool CombatManager::HasPvECombat ( ) const

Definition at line 151 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ HasPvECombatWithPlayers()

bool CombatManager::HasPvECombatWithPlayers ( ) const

Definition at line 159 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ HasPvPCombat()

bool CombatManager::HasPvPCombat ( ) const

Definition at line 168 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ InheritCombatStatesFrom()

void CombatManager::InheritCombatStatesFrom ( Unit const *  who)

Definition at line 242 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInCombatWith() [1/2]

bool CombatManager::IsInCombatWith ( ObjectGuid const &  who) const

Definition at line 232 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ IsInCombatWith() [2/2]

bool CombatManager::IsInCombatWith ( Unit const *  who) const

Definition at line 237 of file CombatManager.cpp.

+ Here is the call graph for this function:

◆ NotifyAICombat()

void CombatManager::NotifyAICombat ( Unit me,
Unit other 
)
staticprivate

Definition at line 366 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

CombatManager & CombatManager::operator= ( CombatManager const &  )
delete

◆ PurgeReference()

void CombatManager::PurgeReference ( ObjectGuid const &  guid,
bool  pvp 
)
private

Definition at line 388 of file CombatManager.cpp.

+ Here is the caller graph for this function:

◆ PutReference()

void CombatManager::PutReference ( ObjectGuid const &  guid,
CombatReference ref 
)
private

Definition at line 372 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RevalidateCombat()

void CombatManager::RevalidateCombat ( )

Definition at line 325 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetInCombatWith()

bool CombatManager::SetInCombatWith ( Unit who,
bool  addSecondUnitSuppressed = false 
)

Definition at line 187 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SuppressPvPCombat()

void CombatManager::SuppressPvPCombat ( UnitFilter unitFilter = nullptr)

Definition at line 298 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

void CombatManager::Update ( uint32  tdiff)

Definition at line 135 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateOwnerCombatState()

bool CombatManager::UpdateOwnerCombatState ( ) const
private

Definition at line 396 of file CombatManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CombatReference

friend struct CombatReference
friend

Definition at line 145 of file CombatManager.h.

◆ PvPCombatReference

friend struct PvPCombatReference
friend

Definition at line 146 of file CombatManager.h.

Member Data Documentation

◆ _owner

Unit* const CombatManager::_owner
private

Definition at line 141 of file CombatManager.h.

◆ _pveRefs

std::unordered_map<ObjectGuid, CombatReference*> CombatManager::_pveRefs
private

Definition at line 142 of file CombatManager.h.

◆ _pvpRefs

std::unordered_map<ObjectGuid, PvPCombatReference*> CombatManager::_pvpRefs
private

Definition at line 143 of file CombatManager.h.


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