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

#include "WhoListCacheMgr.h"

Public Member Functions

void Update ()
 
WhoListInfoVector const & GetWhoList () const
 

Static Public Member Functions

static WhoListCacheMgrinstance ()
 

Protected Attributes

WhoListInfoVector _whoListStorage
 

Private Member Functions

 WhoListCacheMgr ()=default
 
 ~WhoListCacheMgr ()=default
 
 WhoListCacheMgr (WhoListCacheMgr const &)=delete
 
 WhoListCacheMgr (WhoListCacheMgr &&)=delete
 
WhoListCacheMgroperator= (WhoListCacheMgr const &)=delete
 
WhoListCacheMgroperator= (WhoListCacheMgr &&)=delete
 

Detailed Description

Constructor & Destructor Documentation

◆ WhoListCacheMgr() [1/3]

WhoListCacheMgr::WhoListCacheMgr ( )
privatedefault

◆ ~WhoListCacheMgr()

WhoListCacheMgr::~WhoListCacheMgr ( )
privatedefault

◆ WhoListCacheMgr() [2/3]

WhoListCacheMgr::WhoListCacheMgr ( WhoListCacheMgr const &  )
privatedelete

◆ WhoListCacheMgr() [3/3]

WhoListCacheMgr::WhoListCacheMgr ( WhoListCacheMgr &&  )
privatedelete

Member Function Documentation

◆ GetWhoList()

WhoListInfoVector const & WhoListCacheMgr::GetWhoList ( ) const
inline
90{ return _whoListStorage; }
WhoListInfoVector _whoListStorage
Definition WhoListCacheMgr.h:93

◆ instance()

WhoListCacheMgr * WhoListCacheMgr::instance ( )
static
26{
28 return &instance;
29}
Definition WhoListCacheMgr.h:77
static WhoListCacheMgr * instance()
Definition WhoListCacheMgr.cpp:25

References instance().

Referenced by instance().

◆ operator=() [1/2]

WhoListCacheMgr & WhoListCacheMgr::operator= ( WhoListCacheMgr &&  )
privatedelete

◆ operator=() [2/2]

WhoListCacheMgr & WhoListCacheMgr::operator= ( WhoListCacheMgr const &  )
privatedelete

◆ Update()

void WhoListCacheMgr::Update ( )
32{
33 // clear current list
34 _whoListStorage.clear();
35 _whoListStorage.reserve(sWorldSessionMgr->GetPlayerCount() + 1);
36
37 for (auto const& [guid, player] : ObjectAccessor::GetPlayers())
38 {
39 if (!player->FindMap() || player->GetSession()->PlayerLoading())
40 continue;
41
42 std::string playerName = player->GetName();
43 std::wstring widePlayerName;
44
45 if (!Utf8toWStr(playerName, widePlayerName))
46 continue;
47
48 wstrToLower(widePlayerName);
49
50 std::string guildName = sGuildMgr->GetGuildNameById(player->GetGuildId());
51 std::wstring wideGuildName;
52
53 if (!Utf8toWStr(guildName, wideGuildName))
54 continue;
55
56 wstrToLower(wideGuildName);
57
58 _whoListStorage.emplace_back(player->GetGUID(), player->GetTeamId(), player->GetSession()->GetSecurity(), player->GetLevel(),
59 player->getClass(), player->getRace(),
60 (player->IsSpectator() ? AREA_DALARAN : player->GetZoneId()), player->getGender(), player->IsVisible(),
61 widePlayerName, wideGuildName, playerName, guildName);
62 }
63}
@ AREA_DALARAN
Definition AreaDefines.h:149
#define sGuildMgr
Definition GuildMgr.h:51
bool Utf8toWStr(char const *utf8str, std::size_t csize, wchar_t *wstr, std::size_t &wsize)
Definition Util.cpp:281
void wstrToLower(std::wstring &str)
Definition Util.cpp:382
#define sWorldSessionMgr
Definition WorldSessionMgr.h:110
Definition ObjectAccessor.h:61
HashMapHolder< Player >::MapType const & GetPlayers()
Definition ObjectAccessor.cpp:75

References _whoListStorage, AREA_DALARAN, ObjectAccessor::GetPlayers(), sGuildMgr, sWorldSessionMgr, Utf8toWStr(), and wstrToLower().

Member Data Documentation

◆ _whoListStorage

WhoListInfoVector WhoListCacheMgr::_whoListStorage
protected

Referenced by Update().


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