File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,6 +281,17 @@ size_t ThreatManager::GetThreatListSize() const
281281 return _sortedThreatList->size ();
282282}
283283
284+ uint32 ThreatManager::GetThreatListPlayerCount (bool includeOffline/* = false*/ ) const
285+ {
286+ if (includeOffline)
287+ return uint32 (_sortedThreatList->size ());
288+ uint32 returnValue = 0 ;
289+ for (ThreatReference const * ref : *_sortedThreatList)
290+ if (ref->IsAvailable () && ref->GetOwner ()->GetTypeId () == TYPEID_PLAYER)
291+ ++returnValue;
292+ return returnValue;
293+ }
294+
284295Trinity::IteratorPair<ThreatManager::ThreatListIterator, std::nullptr_t > ThreatManager::GetUnsortedThreatList () const
285296{
286297 auto itr = _myThreatListEntries.begin ();
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ class TC_GAME_API ThreatManager
116116 // returns ThreatReference amount if a ref exists, 0.0f otherwise
117117 float GetThreat (Unit const * who, bool includeOffline = false ) const ;
118118 size_t GetThreatListSize () const ;
119+ uint32 GetThreatListPlayerCount (bool includeOffline = false ) const ;
119120 // fastest of the three threat list getters - gets the threat list in "arbitrary" order
120121 // iterators will invalidate on adding/removing entries from the threat list; slightly less finicky than GetSorted.
121122 Trinity::IteratorPair<ThreatListIterator, std::nullptr_t > GetUnsortedThreatList () const ;
You can’t perform that action at this time.
0 commit comments