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
25{
27 return &instance;
28}
Definition WhoListCacheMgr.h:77
static WhoListCacheMgr * instance()
Definition WhoListCacheMgr.cpp:24

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 ( )
31{
32 // clear current list
33 _whoListStorage.clear();
34 _whoListStorage.reserve(sWorldSessionMgr->GetPlayerCount() + 1);
35
36 for (auto const& [guid, player] : ObjectAccessor::GetPlayers())
37 {
38 if (!player->FindMap() || player->GetSession()->PlayerLoading())
39 continue;
40
41 std::string playerName = player->GetName();
42 std::wstring widePlayerName;
43
44 if (!Utf8toWStr(playerName, widePlayerName))
45 continue;
46
47 wstrToLower(widePlayerName);
48
49 std::string guildName = sGuildMgr->GetGuildNameById(player->GetGuildId());
50 std::wstring wideGuildName;
51
52 if (!Utf8toWStr(guildName, wideGuildName))
53 continue;
54
55 wstrToLower(wideGuildName);
56
57 _whoListStorage.emplace_back(player->GetGUID(), player->GetTeamId(), player->GetSession()->GetSecurity(), player->GetLevel(),
58 player->getClass(), player->getRace(),
59 (player->IsSpectator() ? 4395 /*Dalaran*/ : player->GetZoneId()), player->getGender(), player->IsVisible(),
60 widePlayerName, wideGuildName, playerName, guildName);
61 }
62}
#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, 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: