TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Realm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 <boost/asio/ip/address.hpp>
23 #include <boost/asio/ip/tcp.hpp>
24 
25 using namespace boost::asio;
26 
28 {
38 };
39 
40 #pragma pack(push, 1)
41 
42 namespace Battlenet
43 {
45  {
46  RealmHandle() : Region(0), Site(0), Realm(0) { }
47  RealmHandle(uint8 region, uint8 battlegroup, uint32 index)
48  : Region(region), Site(battlegroup), Realm(index) { }
49  RealmHandle(uint32 realmAddress) : Region((realmAddress >> 24) & 0xFF), Site((realmAddress >> 16) & 0xFF), Realm(realmAddress & 0xFFFF) { }
50 
53  uint32 Realm; // primary key in `realmlist` table
54 
55  bool operator<(RealmHandle const& r) const
56  {
57  return Realm < r.Realm;
58  }
59 
60  uint32 GetAddress() const { return (Region << 24) | (Site << 16) | uint16(Realm); }
61  std::string GetAddressString() const;
62  std::string GetSubRegionAddress() const;
63  };
64 }
65 
66 #pragma pack(pop)
67 
70 {
76 
78 
79  REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
80  // replaced by REALM_PVP in realm list
81 };
82 
83 // Storage object for a realm
85 {
88  ip::address ExternalAddress;
89  ip::address LocalAddress;
90  ip::address LocalSubnetMask;
92  std::string Name;
98 
99  ip::tcp::endpoint GetAddressForClient(ip::address const& clientAddr) const;
100  uint32 GetConfigId() const;
101 
102  static uint32 const ConfigIdByType[MAX_CLIENT_REALM_TYPE];
103 };
104 
105 #endif // Realm_h__
Definition: Realm.h:37
uint32 Realm
Definition: Realm.h:53
uint8 Region
Definition: Realm.h:51
Definition: Realm.h:71
bool operator<(RealmHandle const &r) const
Definition: Realm.h:55
std::string Name
Definition: Realm.h:92
AccountTypes AllowedSecurityLevel
Definition: Realm.h:96
Definition: Realm.h:72
Definition: Realm.h:30
Definition: Realm.h:75
Definition: method_options.pb.h:28
Definition: Realm.h:84
Definition: Realm.h:74
Definition: Realm.h:33
uint32 GetAddress() const
Definition: Realm.h:60
uint16 Port
Definition: Realm.h:91
Definition: Realm.h:29
Definition: Realm.h:31
ip::address ExternalAddress
Definition: Realm.h:88
uint16_t uint16
Definition: g3dmath.h:166
Definition: Realm.h:36
ip::address LocalSubnetMask
Definition: Realm.h:90
RealmType
Type of server, this is values from second column of Cfg_Configs.dbc.
Definition: Realm.h:69
uint8 Site
Definition: Realm.h:52
RealmHandle(uint32 realmAddress)
Definition: Realm.h:49
RealmHandle()
Definition: Realm.h:46
Battlenet::RealmHandle Id
Definition: Realm.h:86
ip::address LocalAddress
Definition: Realm.h:89
uint32_t uint32
Definition: Define.h:150
AccountTypes
Definition: Common.h:106
#define TC_SHARED_API
Definition: Define.h:128
uint16_t uint16
Definition: Define.h:151
Definition: Realm.h:77
RealmHandle(uint8 region, uint8 battlegroup, uint32 index)
Definition: Realm.h:47
uint32 Build
Definition: Realm.h:87
RealmFlags
Definition: Realm.h:27
uint8 Timezone
Definition: Realm.h:95
Definition: Realm.h:44
uint8_t uint8
Definition: Define.h:152
uint8 Type
Definition: Realm.h:93
Definition: Realm.h:34
RealmFlags Flags
Definition: Realm.h:94
Definition: Realm.h:32
Definition: Realm.h:35
Definition: Realm.h:73
Definition: Realm.h:79
float PopulationLevel
Definition: Realm.h:97