TrinityCore
Loading...
Searching...
No Matches
RealmList Class Reference

Storage object for the list of realms on the server. More...

#include <RealmList.h>

Public Types

typedef std::map< Battlenet::RealmHandle, std::shared_ptr< Realm > > RealmMap
 

Public Member Functions

 RealmList (RealmList const &)=delete
 
 RealmList (RealmList &&)=delete
 
RealmList & operator= (RealmList const &)=delete
 
RealmList & operator= (RealmList &&)=delete
 
 ~RealmList ()
 
void Initialize (Trinity::Asio::IoContext &ioContext, uint32 updateInterval)
 
void Close ()
 
std::shared_ptr< Realm const > GetRealm (Battlenet::RealmHandle const &id) const
 
Battlenet::RealmHandle GetCurrentRealmId () const
 
void SetCurrentRealmId (Battlenet::RealmHandle const &id)
 
std::shared_ptr< Realm const > GetCurrentRealm () const
 
std::vector< std::string > GetSubRegions () const
 
std::string GetRealmEntryJSON (Battlenet::RealmHandle const &id, uint32 build, AccountTypes accountSecurityLevel) const
 
std::vector< uint8 > GetRealmList (uint32 build, AccountTypes accountSecurityLevel, std::string const &subRegion) const
 
RealmJoinResult JoinRealm (uint32 realmAddress, uint32 build, ClientBuild::VariantId const &buildVariant, boost::asio::ip::address const &clientAddress, std::array< uint8, 32 > const &clientSecret, LocaleConstant locale, std::string const &os, Minutes timezoneOffset, std::string const &accountName, AccountTypes accountSecurityLevel) const
 

Static Public Member Functions

static RealmList * Instance ()
 

Private Member Functions

 RealmList ()
 
void UpdateRealms ()
 
void FillRealmEntry (Realm const &realm, uint32 clientBuild, AccountTypes accountSecurityLevel, JSON::RealmList::RealmEntry *realmEntry) const
 

Static Private Member Functions

static void UpdateRealm (Realm &realm, Battlenet::RealmHandle const &id, uint32 build, std::string const &name, std::vector< boost::asio::ip::address > &&addresses, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, RealmPopulationState population)
 

Private Attributes

std::shared_mutex _realmsMutex
 
RealmMap _realms
 
std::map< Battlenet::RealmHandle, std::string > _removedRealms
 
std::unordered_set< std::string > _subRegions
 
uint32 _updateInterval
 
std::unique_ptr< Trinity::Asio::DeadlineTimer > _updateTimer
 
std::unique_ptr< Trinity::Net::Resolver > _resolver
 
Optional< Battlenet::RealmHandle > _currentRealmId
 

Detailed Description

Storage object for the list of realms on the server.

Definition at line 47 of file RealmList.h.

Member Typedef Documentation

◆ RealmMap

typedef std::map<Battlenet::RealmHandle, std::shared_ptr<Realm> > RealmList::RealmMap

Definition at line 50 of file RealmList.h.

Constructor & Destructor Documentation

◆ RealmList() [1/3]

RealmList::RealmList ( RealmList const &  )
delete

◆ RealmList() [2/3]

RealmList::RealmList ( RealmList &&  )
delete

◆ ~RealmList()

RealmList::~RealmList ( )
default

◆ RealmList() [3/3]

RealmList::RealmList ( )
private

Definition at line 53 of file RealmList.cpp.

Member Function Documentation

◆ Close()

void RealmList::Close ( )

Definition at line 77 of file RealmList.cpp.

References _updateTimer.

◆ FillRealmEntry()

void RealmList::FillRealmEntry ( Realm const &  realm,
uint32  clientBuild,
AccountTypes  accountSecurityLevel,
JSON::RealmList::RealmEntry *  realmEntry 
) const
private

◆ GetCurrentRealm()

std::shared_ptr< Realm const > RealmList::GetCurrentRealm ( ) const

Definition at line 229 of file RealmList.cpp.

References _currentRealmId, and GetRealm().

◆ GetCurrentRealmId()

Battlenet::RealmHandle RealmList::GetCurrentRealmId ( ) const

Definition at line 219 of file RealmList.cpp.

References _currentRealmId.

◆ GetRealm()

std::shared_ptr< Realm const > RealmList::GetRealm ( Battlenet::RealmHandle const &  id) const

◆ GetRealmEntryJSON()

std::string RealmList::GetRealmEntryJSON ( Battlenet::RealmHandle const &  id,
uint32  build,
AccountTypes  accountSecurityLevel 
) const

Definition at line 282 of file RealmList.cpp.

References FillRealmEntry(), GetRealm(), Offline, and JSON::Serialize().

◆ GetRealmList()

std::vector< uint8 > RealmList::GetRealmList ( uint32  build,
AccountTypes  accountSecurityLevel,
std::string const &  subRegion 
) const

Definition at line 297 of file RealmList.cpp.

References _realms, _realmsMutex, _removedRealms, FillRealmEntry(), and JSON::Serialize().

◆ GetSubRegions()

std::vector< std::string > RealmList::GetSubRegions ( ) const

Definition at line 236 of file RealmList.cpp.

References _realmsMutex, and _subRegions.

◆ Initialize()

void RealmList::Initialize ( Trinity::Asio::IoContext &  ioContext,
uint32  updateInterval 
)

◆ Instance()

RealmList * RealmList::Instance ( )
static

Definition at line 59 of file RealmList.cpp.

◆ JoinRealm()

◆ operator=() [1/2]

RealmList & RealmList::operator= ( RealmList &&  )
delete

◆ operator=() [2/2]

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

◆ SetCurrentRealmId()

void RealmList::SetCurrentRealmId ( Battlenet::RealmHandle const &  id)

Definition at line 224 of file RealmList.cpp.

References _currentRealmId.

◆ UpdateRealm()

void RealmList::UpdateRealm ( Realm &  realm,
Battlenet::RealmHandle const &  id,
uint32  build,
std::string const &  name,
std::vector< boost::asio::ip::address > &&  addresses,
uint16  port,
uint8  icon,
RealmFlags  flag,
uint8  timezone,
AccountTypes  allowedSecurityLevel,
RealmPopulationState  population 
)
staticprivate

◆ UpdateRealms()

Member Data Documentation

◆ _currentRealmId

Optional<Battlenet::RealmHandle> RealmList::_currentRealmId
private

Definition at line 92 of file RealmList.h.

Referenced by GetCurrentRealm(), GetCurrentRealmId(), SetCurrentRealmId(), and UpdateRealms().

◆ _realms

RealmMap RealmList::_realms
private

Definition at line 86 of file RealmList.h.

Referenced by GetRealm(), GetRealmList(), and UpdateRealms().

◆ _realmsMutex

std::shared_mutex RealmList::_realmsMutex
mutableprivate

Definition at line 85 of file RealmList.h.

Referenced by GetRealm(), GetRealmList(), GetSubRegions(), and UpdateRealms().

◆ _removedRealms

std::map<Battlenet::RealmHandle, std::string> RealmList::_removedRealms
private

Definition at line 87 of file RealmList.h.

Referenced by GetRealmList(), and UpdateRealms().

◆ _resolver

std::unique_ptr<Trinity::Net::Resolver> RealmList::_resolver
private

Definition at line 91 of file RealmList.h.

Referenced by Initialize(), and UpdateRealms().

◆ _subRegions

std::unordered_set<std::string> RealmList::_subRegions
private

Definition at line 88 of file RealmList.h.

Referenced by GetSubRegions(), and UpdateRealms().

◆ _updateInterval

uint32 RealmList::_updateInterval
private

Definition at line 89 of file RealmList.h.

Referenced by Initialize(), and UpdateRealms().

◆ _updateTimer

std::unique_ptr<Trinity::Asio::DeadlineTimer> RealmList::_updateTimer
private

Definition at line 90 of file RealmList.h.

Referenced by Close(), Initialize(), and UpdateRealms().


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