![]() |
TrinityCore
|
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 |
Storage object for the list of realms on the server.
Definition at line 47 of file RealmList.h.
| typedef std::map<Battlenet::RealmHandle, std::shared_ptr<Realm> > RealmList::RealmMap |
Definition at line 50 of file RealmList.h.
|
delete |
|
delete |
|
default |
|
private |
Definition at line 53 of file RealmList.cpp.
| void RealmList::Close | ( | ) |
Definition at line 77 of file RealmList.cpp.
References _updateTimer.
|
private |
Definition at line 242 of file RealmList.cpp.
References Realm::AllowedSecurityLevel, AsUnderlyingType(), Realm::Build, Realm::Flags, Battlenet::RealmHandle::GetAddress(), ClientBuild::GetBuildInfo(), Realm::GetConfigId(), Realm::Id, Locked, Realm::Name, Offline, Realm::PopulationLevel, Battlenet::RealmHandle::Realm, Realm::Timezone, and VersionMismatch.
Referenced by GetRealmEntryJSON(), and GetRealmList().
| std::shared_ptr< Realm const > RealmList::GetCurrentRealm | ( | ) | const |
Definition at line 229 of file RealmList.cpp.
References _currentRealmId, and GetRealm().
| Battlenet::RealmHandle RealmList::GetCurrentRealmId | ( | ) | const |
Definition at line 219 of file RealmList.cpp.
References _currentRealmId.
| std::shared_ptr< Realm const > RealmList::GetRealm | ( | Battlenet::RealmHandle const & | id | ) | const |
Definition at line 213 of file RealmList.cpp.
References _realms, _realmsMutex, and Trinity::Containers::MapGetValuePtr().
Referenced by GetCurrentRealm(), GetRealmEntryJSON(), and JoinRealm().
| 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().
| 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().
| std::vector< std::string > RealmList::GetSubRegions | ( | ) | const |
Definition at line 236 of file RealmList.cpp.
References _realmsMutex, and _subRegions.
| void RealmList::Initialize | ( | Trinity::Asio::IoContext & | ioContext, |
| uint32 | updateInterval | ||
| ) |
Definition at line 66 of file RealmList.cpp.
References _resolver, _updateInterval, _updateTimer, ClientBuild::LoadBuildInfo(), and UpdateRealms().
|
static |
Definition at line 59 of file RealmList.cpp.
| RealmJoinResult RealmList::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 |
Definition at line 329 of file RealmList.cpp.
References ClientBuild::VariantId::Arch, ERROR_OK, ERROR_USER_SERVER_NOT_PERMITTED_ON_REALM, ERROR_UTIL_SERVER_FAILED_TO_SERIALIZE_RESPONSE, ERROR_UTIL_SERVER_UNKNOWN_REALM, Trinity::Crypto::GetRandomBytes(), GetRealm(), LOGIN_UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, LoginDatabase, Offline, ClientBuild::VariantId::Platform, RealmJoinResult::Result, JSON::Serialize(), PreparedStatementBase::setBinary(), PreparedStatementBase::setInt16(), PreparedStatementBase::setString(), PreparedStatementBase::setUInt32(), PreparedStatementBase::setUInt8(), and ClientBuild::VariantId::Type.
| void RealmList::SetCurrentRealmId | ( | Battlenet::RealmHandle const & | id | ) |
Definition at line 224 of file RealmList.cpp.
References _currentRealmId.
|
staticprivate |
Definition at line 82 of file RealmList.cpp.
References Realm::Addresses, Realm::AllowedSecurityLevel, Realm::Build, Realm::Flags, Realm::Id, Realm::Name, Realm::PopulationLevel, Realm::Port, Realm::SetName(), Realm::Timezone, and Realm::Type.
Referenced by UpdateRealms().
|
private |
Definition at line 100 of file RealmList.cpp.
References _currentRealmId, _realms, _realmsMutex, _removedRealms, _resolver, _subRegions, _updateInterval, _updateTimer, advstd::ranges::contains, Battlenet::RealmHandle::GetAddressString(), Field::GetString(), Field::GetUInt16(), Field::GetUInt32(), Field::GetUInt8(), LOGIN_SEL_REALMLIST, LoginDatabase, Trinity::Containers::MapGetValuePtr(), MAX_CLIENT_REALM_TYPE, REALM_TYPE_FFA_PVP, REALM_TYPE_NORMAL, REALM_TYPE_PVP, SEC_ADMINISTRATOR, TC_LOG_DEBUG, TC_LOG_ERROR, TC_LOG_INFO, UpdateRealm(), and UpdateRealms().
Referenced by Initialize(), and UpdateRealms().
|
private |
Definition at line 92 of file RealmList.h.
Referenced by GetCurrentRealm(), GetCurrentRealmId(), SetCurrentRealmId(), and UpdateRealms().
|
private |
Definition at line 86 of file RealmList.h.
Referenced by GetRealm(), GetRealmList(), and UpdateRealms().
|
mutableprivate |
Definition at line 85 of file RealmList.h.
Referenced by GetRealm(), GetRealmList(), GetSubRegions(), and UpdateRealms().
|
private |
Definition at line 87 of file RealmList.h.
Referenced by GetRealmList(), and UpdateRealms().
|
private |
Definition at line 91 of file RealmList.h.
Referenced by Initialize(), and UpdateRealms().
|
private |
Definition at line 88 of file RealmList.h.
Referenced by GetSubRegions(), and UpdateRealms().
|
private |
Definition at line 89 of file RealmList.h.
Referenced by Initialize(), and UpdateRealms().
|
private |
Definition at line 90 of file RealmList.h.
Referenced by Close(), Initialize(), and UpdateRealms().