TrinityCore
Realm.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef Realm_h__
19#define Realm_h__
20
21#include "Common.h"
22#include "AsioHacksFwd.h"
23#include <compare>
24#include <vector>
25
27{
36 REALM_FLAG_FULL = 0x80
37};
38
39namespace Battlenet
40{
42 {
43 RealmHandle() : Region(0), Site(0), Realm(0) { }
44 RealmHandle(uint8 region, uint8 battlegroup, uint32 index)
45 : Region(region), Site(battlegroup), Realm(index) { }
46 RealmHandle(uint32 realmAddress) : Region((realmAddress >> 24) & 0xFF), Site((realmAddress >> 16) & 0xFF), Realm(realmAddress & 0xFFFF) { }
47
50 uint32 Realm; // primary key in `realmlist` table
51
52 bool operator==(RealmHandle const& r) const { return Realm == r.Realm; }
53
54 std::strong_ordering operator<=>(RealmHandle const& r) const { return Realm <=> r.Realm; }
55
56 uint32 GetAddress() const { return (Region << 24) | (Site << 16) | uint16(Realm); }
57 std::string GetAddressString() const;
58 std::string GetSubRegionAddress() const;
59 };
60}
61
64{
70
72
73 REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
74 // replaced by REALM_PVP in realm list
75};
76
78
79// Storage object for a realm
81{
84 std::vector<boost::asio::ip::address> Addresses;
86 std::string Name;
87 std::string NormalizedName;
93
94 void SetName(std::string name);
95
96 boost::asio::ip::address GetAddressForClient(boost::asio::ip::address const& clientAddr) const;
97 uint32 GetConfigId() const;
98
99 static uint32 const ConfigIdByType[MAX_CLIENT_REALM_TYPE];
100};
101
102#endif // Realm_h__
AccountTypes
Definition: Common.h:39
uint8_t uint8
Definition: Define.h:144
#define TC_SHARED_API
Definition: Define.h:117
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
constexpr uint32 HARDCODED_DEVELOPMENT_REALM_CATEGORY_ID
Definition: Realm.h:77
RealmFlags
Definition: Realm.h:27
@ REALM_FLAG_NEW
Definition: Realm.h:35
@ REALM_FLAG_OFFLINE
Definition: Realm.h:30
@ REALM_FLAG_UNK1
Definition: Realm.h:32
@ REALM_FLAG_NONE
Definition: Realm.h:28
@ REALM_FLAG_UNK2
Definition: Realm.h:33
@ REALM_FLAG_VERSION_MISMATCH
Definition: Realm.h:29
@ REALM_FLAG_RECOMMENDED
Definition: Realm.h:34
@ REALM_FLAG_FULL
Definition: Realm.h:36
@ REALM_FLAG_SPECIFYBUILD
Definition: Realm.h:31
RealmType
Type of server, this is values from second column of Cfg_Configs.dbc.
Definition: Realm.h:64
@ REALM_TYPE_FFA_PVP
Definition: Realm.h:73
@ MAX_CLIENT_REALM_TYPE
Definition: Realm.h:71
@ REALM_TYPE_RPPVP
Definition: Realm.h:69
@ REALM_TYPE_PVP
Definition: Realm.h:66
@ REALM_TYPE_RP
Definition: Realm.h:68
@ REALM_TYPE_NORMAL2
Definition: Realm.h:67
@ REALM_TYPE_NORMAL
Definition: Realm.h:65
uint32 GetAddress() const
Definition: Realm.h:56
bool operator==(RealmHandle const &r) const
Definition: Realm.h:52
RealmHandle(uint8 region, uint8 battlegroup, uint32 index)
Definition: Realm.h:44
std::strong_ordering operator<=>(RealmHandle const &r) const
Definition: Realm.h:54
RealmHandle(uint32 realmAddress)
Definition: Realm.h:46
Definition: Realm.h:81
uint16 Port
Definition: Realm.h:85
RealmFlags Flags
Definition: Realm.h:89
AccountTypes AllowedSecurityLevel
Definition: Realm.h:91
uint8 Timezone
Definition: Realm.h:90
float PopulationLevel
Definition: Realm.h:92
uint32 Build
Definition: Realm.h:83
std::string NormalizedName
Definition: Realm.h:87
std::string Name
Definition: Realm.h:86
Battlenet::RealmHandle Id
Definition: Realm.h:82
std::vector< boost::asio::ip::address > Addresses
Definition: Realm.h:84
uint8 Type
Definition: Realm.h:88