aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/auth/2012_03_26_00_auth_realmlist.sql2
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.cpp8
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.h17
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp11
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.h13
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.cpp2
-rw-r--r--src/server/worldserver/CMakeLists.txt1
-rwxr-xr-xsrc/server/worldserver/Master.cpp7
8 files changed, 37 insertions, 24 deletions
diff --git a/sql/updates/auth/2012_03_26_00_auth_realmlist.sql b/sql/updates/auth/2012_03_26_00_auth_realmlist.sql
new file mode 100644
index 00000000000..0a570a31773
--- /dev/null
+++ b/sql/updates/auth/2012_03_26_00_auth_realmlist.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `realmlist`
+ CHANGE `color` `flag` tinyint(3) unsigned NOT NULL DEFAULT '2';
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index 245b9c7cc8c..efcced51089 100755
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true);
}
-void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
+void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
{
// Create new if not exist or update existed
Realm& realm = m_realms[name];
@@ -39,7 +39,7 @@ void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::strin
realm.m_ID = ID;
realm.name = name;
realm.icon = icon;
- realm.color = color;
+ realm.flag = flag;
realm.timezone = timezone;
realm.allowedSecurityLevel = allowedSecurityLevel;
realm.populationLevel = popu;
@@ -84,13 +84,13 @@ void RealmList::UpdateRealms(bool init)
const std::string& address = fields[2].GetString();
uint32 port = fields[3].GetUInt32();
uint8 icon = fields[4].GetUInt8();
- uint8 color = fields[5].GetUInt8();
+ RealmFlags flag = RealmFlags(fields[5].GetUInt8());
uint8 timezone = fields[6].GetUInt8();
uint8 allowedSecurityLevel = fields[7].GetUInt8();
float pop = fields[8].GetFloat();
uint32 build = fields[9].GetUInt32();
- UpdateRealm(realmId, name, address, port, icon, color, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
+ UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
if (init)
sLog->outString("Added realm \"%s\".", fields[1].GetCString());
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index 698026876fb..4d258953ae0 100755
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -23,13 +23,26 @@
#include <ace/Null_Mutex.h>
#include "Common.h"
+enum RealmFlags
+{
+ REALM_FLAG_NONE = 0x00,
+ REALM_FLAG_INVALID = 0x01,
+ REALM_FLAG_OFFLINE = 0x02,
+ REALM_FLAG_SPECIFYBUILD = 0x04,
+ REALM_FLAG_UNK1 = 0x08,
+ REALM_FLAG_UNK2 = 0x10,
+ REALM_FLAG_RECOMMENDED = 0x20,
+ REALM_FLAG_NEW = 0x40,
+ REALM_FLAG_FULL = 0x80
+};
+
// Storage object for a realm
struct Realm
{
std::string address;
std::string name;
uint8 icon;
- uint8 color;
+ RealmFlags flag;
uint8 timezone;
uint32 m_ID;
AccountTypes allowedSecurityLevel;
@@ -58,7 +71,7 @@ public:
private:
void UpdateRealms(bool init=false);
- void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
+ void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
RealmMap m_realms;
uint32 m_UpdateInterval;
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index e1d77c60286..15555e4d607 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -871,7 +871,7 @@ bool AuthSocket::_HandleRealmList()
pkt << i->second.icon; // realm type
if ( _expversion & POST_BC_EXP_FLAG ) // only 2.x and 3.x clients
pkt << lock; // if 1, then realm locked
- pkt << i->second.color; // if 2, then realm is offline
+ pkt << uint8(i->second.flag); // RealmFlags
pkt << i->first;
pkt << i->second.address;
pkt << i->second.populationLevel;
@@ -882,6 +882,15 @@ bool AuthSocket::_HandleRealmList()
else
pkt << (uint8)0x0; // 1.12.1 and 1.12.2 clients
+ if (i->second.flag & REALM_FLAG_SPECIFYBUILD)
+ {
+ // TODO: Make this customizable
+ pkt << uint8(3);
+ pkt << uint8(3);
+ pkt << uint8(5);
+ pkt << uint16(12340);
+ }
+
++RealmListSize;
}
diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h
index 9d59a9f7602..9be2136b55c 100755
--- a/src/server/authserver/Server/AuthSocket.h
+++ b/src/server/authserver/Server/AuthSocket.h
@@ -23,19 +23,6 @@
#include "BigNumber.h"
#include "RealmSocket.h"
-enum RealmFlags
-{
- REALM_FLAG_NONE = 0x00,
- REALM_FLAG_INVALID = 0x01,
- REALM_FLAG_OFFLINE = 0x02,
- REALM_FLAG_SPECIFYBUILD = 0x04,
- REALM_FLAG_UNK1 = 0x08,
- REALM_FLAG_UNK2 = 0x10,
- REALM_FLAG_RECOMMENDED = 0x20,
- REALM_FLAG_NEW = 0x40,
- REALM_FLAG_FULL = 0x80
-};
-
// Handle login commands
class AuthSocket: public RealmSocket::Session
{
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index bc8eb709788..df92c6fa77c 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -22,7 +22,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
if (!m_reconnecting)
m_stmts.resize(MAX_LOGINDATABASE_STATEMENTS);
- PREPARE_STATEMENT(LOGIN_SEL_REALMLIST, "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE color <> 3 ORDER BY name", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(LOGIN_SEL_REALMLIST, "SELECT id, name, address, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH)
PREPARE_STATEMENT(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC)
PREPARE_STATEMENT(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC)
PREPARE_STATEMENT(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH)
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index 28aab37d1dd..d1419cb0fcb 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -134,6 +134,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
+ ${CMAKE_SOURCE_DIR}/src/server/authserver/Realms
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CommandLine
${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 45827b10c2c..f1be4a6889b 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -41,6 +41,7 @@
#include "Timer.h"
#include "Util.h"
#include "AuthSocket.h"
+#include "RealmList.h"
#include "BigNumber.h"
@@ -162,7 +163,7 @@ int Master::Run()
return 1;
// set server offline (not connectable)
- LoginDatabase.DirectPExecute("UPDATE realmlist SET color = (color & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
+ LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
///- Initialize the World
sWorld->SetInitialWorldSettings();
@@ -273,7 +274,7 @@ int Master::Run()
}
// set server online (allow connecting now)
- LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
+ LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION);
sWorldSocketMgr->Wait();
@@ -286,7 +287,7 @@ int Master::Run()
}
// set server offline
- LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
+ LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master