mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9010] Implement realmd support realms for different client versions
* Supported 1.12.1, 1.12.2, 2.4.3, 3.2.2a in same time as relams in same realmlist * mangosd by self check correct for it client build and reject all incorrect cases * realmd know from mangosd what builds supported each realm and if realm not support it then in relamlist for specific client this relam show as offline. Not need any manual settings for this. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
41b0b88674
commit
022524c1bb
13 changed files with 239 additions and 73 deletions
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `realmd_db_version`;
|
DROP TABLE IF EXISTS `realmd_db_version`;
|
||||||
CREATE TABLE `realmd_db_version` (
|
CREATE TABLE `realmd_db_version` (
|
||||||
`required_8728_01_realmd_account` bit(1) default NULL
|
`required_9010_01_realmd_realmlist` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -161,6 +161,7 @@ CREATE TABLE `realmlist` (
|
||||||
`timezone` tinyint(3) unsigned NOT NULL default '0',
|
`timezone` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`allowedSecurityLevel` tinyint(3) unsigned NOT NULL default '0',
|
`allowedSecurityLevel` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`population` float unsigned NOT NULL default '0',
|
`population` float unsigned NOT NULL default '0',
|
||||||
|
`realmbuilds` varchar(64) NOT NULL default '',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `idx_name` (`name`)
|
UNIQUE KEY `idx_name` (`name`)
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm System';
|
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm System';
|
||||||
|
|
|
||||||
4
sql/updates/9010_01_realmd_realmlist.sql
Normal file
4
sql/updates/9010_01_realmd_realmlist.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE realmd_db_version CHANGE COLUMN required_8728_01_realmd_account required_9010_01_realmd_realmlist bit;
|
||||||
|
|
||||||
|
ALTER TABLE realmlist
|
||||||
|
ADD COLUMN realmbuilds varchar(64) NOT NULL default '' AFTER population;
|
||||||
|
|
@ -211,6 +211,7 @@ pkgdata_DATA = \
|
||||||
9001_01_mangos_spell_proc_event.sql \
|
9001_01_mangos_spell_proc_event.sql \
|
||||||
9005_01_mangos_spell_proc_event.sql \
|
9005_01_mangos_spell_proc_event.sql \
|
||||||
9007_01_mangos_spell_proc_event.sql \
|
9007_01_mangos_spell_proc_event.sql \
|
||||||
|
9010_01_realmd_realmlist.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -402,4 +403,5 @@ EXTRA_DIST = \
|
||||||
9001_01_mangos_spell_proc_event.sql \
|
9001_01_mangos_spell_proc_event.sql \
|
||||||
9005_01_mangos_spell_proc_event.sql \
|
9005_01_mangos_spell_proc_event.sql \
|
||||||
9007_01_mangos_spell_proc_event.sql \
|
9007_01_mangos_spell_proc_event.sql \
|
||||||
|
9010_01_realmd_realmlist.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -2640,4 +2640,10 @@ enum PetTameFailureReason
|
||||||
PETTAME_UNKNOWNERROR = 12
|
PETTAME_UNKNOWNERROR = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// we need to stick to 1 version or half of the stuff will work for someone
|
||||||
|
// others will not and opposite
|
||||||
|
// will only support WoW:WotLK 3.2.2a, client build 10505.
|
||||||
|
|
||||||
|
#define EXPECTED_MANGOSD_CLIENT_BUILD {10505, 0}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -745,7 +745,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||||
BigNumber K;
|
BigNumber K;
|
||||||
|
|
||||||
// Read the content of the packet
|
// Read the content of the packet
|
||||||
recvPacket >> BuiltNumberClient; // for now no use
|
recvPacket >> BuiltNumberClient;
|
||||||
recvPacket >> unk2;
|
recvPacket >> unk2;
|
||||||
recvPacket >> account;
|
recvPacket >> account;
|
||||||
recvPacket >> unk3;
|
recvPacket >> unk3;
|
||||||
|
|
@ -760,6 +760,29 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||||
unk3,
|
unk3,
|
||||||
clientSeed);
|
clientSeed);
|
||||||
|
|
||||||
|
// Check the version of client trying to connect
|
||||||
|
bool valid_version = false;
|
||||||
|
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
|
||||||
|
for(int i = 0; accepted_versions[i]; ++i)
|
||||||
|
{
|
||||||
|
if(BuiltNumberClient == accepted_versions[i])
|
||||||
|
{
|
||||||
|
valid_version = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!valid_version)
|
||||||
|
{
|
||||||
|
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
|
||||||
|
packet << uint8 (AUTH_VERSION_MISMATCH);
|
||||||
|
|
||||||
|
SendPacket (packet);
|
||||||
|
|
||||||
|
sLog.outError ("WorldSocket::HandleAuthSession: Sent Auth Response (version mismatch).");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the account information from the realmd database
|
// Get the account information from the realmd database
|
||||||
std::string safe_account = account; // Duplicate, else will screw the SHA hash verification below
|
std::string safe_account = account; // Duplicate, else will screw the SHA hash verification below
|
||||||
loginDatabase.escape_string (safe_account);
|
loginDatabase.escape_string (safe_account);
|
||||||
|
|
|
||||||
|
|
@ -227,8 +227,16 @@ int Master::Run()
|
||||||
ACE_Based::Thread world_thread(new WorldRunnable);
|
ACE_Based::Thread world_thread(new WorldRunnable);
|
||||||
world_thread.setPriority(ACE_Based::Highest);
|
world_thread.setPriority(ACE_Based::Highest);
|
||||||
|
|
||||||
// set server online
|
// set realmbuilds depend on mangosd expected builds, and set server online
|
||||||
loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID);
|
{
|
||||||
|
std::ostringstream data;
|
||||||
|
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
|
||||||
|
for(int i = 0; accepted_versions[i]; ++i)
|
||||||
|
{
|
||||||
|
data << accepted_versions[i] << " ";
|
||||||
|
}
|
||||||
|
loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0, realmbuilds = '%s' WHERE id = '%d'", data.str().c_str(), realmID);
|
||||||
|
}
|
||||||
|
|
||||||
ACE_Based::Thread* cliThread = NULL;
|
ACE_Based::Thread* cliThread = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,18 @@ enum LoginResult
|
||||||
LOGIN_LOCKED_ENFORCED = 0x10,
|
LOGIN_LOCKED_ENFORCED = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
// we need to stick to 1 version or half of the stuff will work for someone
|
// will only support WoW 1.12.1/1.12.2 , WoW:TBC 2.4.3 and WoW:WotLK 3.2.2a, client builds 10505, 8606, 6005, 5875
|
||||||
// others will not and opposite
|
// if you need more from old build then add it in cases in relamd sources code
|
||||||
// will only support WoW, WoW:TBC and WoW:WotLK 3.2.2a client build 10505...
|
// list sorted from high to low build and first build used as low bound for accepted by default range (any > it will accepted by realmd at least)
|
||||||
|
|
||||||
#define EXPECTED_MANGOS_CLIENT_BUILD {10505, 0}
|
#define EXPECTED_REALMD_CLIENT_BUILD \
|
||||||
|
{ \
|
||||||
|
10505, /* 3.2.2a and higher */ \
|
||||||
|
8606, /* 2.4.3 */ \
|
||||||
|
6005, /* 1.12.2 */ \
|
||||||
|
5875, /* 1.12.1 */ \
|
||||||
|
0 \
|
||||||
|
}
|
||||||
|
|
||||||
// At update excepted builds please update if need define DEFAULT_MAX_LEVEL
|
// At update excepted builds please update if need define DEFAULT_MAX_LEVEL
|
||||||
// in DBCEnum.h to default max player level expected by build
|
// in DBCEnum.h to default max player level expected by build
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,12 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "ByteBuffer.h"
|
|
||||||
#include "Config/ConfigEnv.h"
|
#include "Config/ConfigEnv.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "RealmList.h"
|
#include "RealmList.h"
|
||||||
#include "AuthSocket.h"
|
#include "AuthSocket.h"
|
||||||
#include "AuthCodes.h"
|
#include "AuthCodes.h"
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#include "Auth/Sha1.h"
|
|
||||||
//#include "Util.h" -- for commented utf8ToUpperOnlyLatin
|
//#include "Util.h" -- for commented utf8ToUpperOnlyLatin
|
||||||
|
|
||||||
extern DatabaseType loginDatabase;
|
extern DatabaseType loginDatabase;
|
||||||
|
|
@ -129,6 +127,16 @@ typedef struct AUTH_LOGON_PROOF_S
|
||||||
uint16 unk3;
|
uint16 unk3;
|
||||||
} sAuthLogonProof_S;
|
} sAuthLogonProof_S;
|
||||||
|
|
||||||
|
typedef struct AUTH_LOGON_PROOF_S_BUILD_6005
|
||||||
|
{
|
||||||
|
uint8 cmd;
|
||||||
|
uint8 error;
|
||||||
|
uint8 M2[20];
|
||||||
|
//uint32 unk1;
|
||||||
|
uint32 unk2;
|
||||||
|
//uint16 unk3;
|
||||||
|
} sAuthLogonProof_S_BUILD_6005;
|
||||||
|
|
||||||
typedef struct AUTH_RECONNECT_PROOF_C
|
typedef struct AUTH_RECONNECT_PROOF_C
|
||||||
{
|
{
|
||||||
uint8 cmd;
|
uint8 cmd;
|
||||||
|
|
@ -321,6 +329,40 @@ void AuthSocket::_SetVSFields(const std::string& rI)
|
||||||
OPENSSL_free((void*)s_hex);
|
OPENSSL_free((void*)s_hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuthSocket::SendProof(Sha1Hash sha)
|
||||||
|
{
|
||||||
|
switch(_build)
|
||||||
|
{
|
||||||
|
case 5875: // 1.12.1
|
||||||
|
case 6005: // 1.12.2
|
||||||
|
{
|
||||||
|
sAuthLogonProof_S_BUILD_6005 proof;
|
||||||
|
memcpy(proof.M2, sha.GetDigest(), 20);
|
||||||
|
proof.cmd = AUTH_LOGON_PROOF;
|
||||||
|
proof.error = 0;
|
||||||
|
proof.unk2 = 0x00;
|
||||||
|
|
||||||
|
SendBuf((char *)&proof, sizeof(proof));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8606: // 2.4.3
|
||||||
|
case 10505: // 3.2.2a
|
||||||
|
default: // or later
|
||||||
|
{
|
||||||
|
sAuthLogonProof_S proof;
|
||||||
|
memcpy(proof.M2, sha.GetDigest(), 20);
|
||||||
|
proof.cmd = AUTH_LOGON_PROOF;
|
||||||
|
proof.error = 0;
|
||||||
|
proof.unk1 = 0x00800000;
|
||||||
|
proof.unk2 = 0x00;
|
||||||
|
proof.unk3 = 0x00;
|
||||||
|
|
||||||
|
SendBuf((char *)&proof, sizeof(proof));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Logon Challenge command handler
|
/// Logon Challenge command handler
|
||||||
bool AuthSocket::_HandleLogonChallenge()
|
bool AuthSocket::_HandleLogonChallenge()
|
||||||
{
|
{
|
||||||
|
|
@ -346,6 +388,11 @@ bool AuthSocket::_HandleLogonChallenge()
|
||||||
buf[buf.size() - 1] = 0;
|
buf[buf.size() - 1] = 0;
|
||||||
sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0];
|
sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0];
|
||||||
|
|
||||||
|
///- Read the remaining of the packet
|
||||||
|
ibuf.Read((char *)&buf[4], remaining);
|
||||||
|
DEBUG_LOG("[AuthChallenge] got full packet, %#04x bytes", ch->size);
|
||||||
|
DEBUG_LOG("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
|
||||||
|
|
||||||
// BigEndian code, nop in little endian case
|
// BigEndian code, nop in little endian case
|
||||||
// size already converted
|
// size already converted
|
||||||
EndianConvert(*((uint32*)(&ch->gamename[0])));
|
EndianConvert(*((uint32*)(&ch->gamename[0])));
|
||||||
|
|
@ -356,11 +403,6 @@ bool AuthSocket::_HandleLogonChallenge()
|
||||||
EndianConvert(ch->timezone_bias);
|
EndianConvert(ch->timezone_bias);
|
||||||
EndianConvert(ch->ip);
|
EndianConvert(ch->ip);
|
||||||
|
|
||||||
///- Read the remaining of the packet
|
|
||||||
ibuf.Read((char *)&buf[4], remaining);
|
|
||||||
DEBUG_LOG("[AuthChallenge] got full packet, %#04x bytes", ch->size);
|
|
||||||
DEBUG_LOG("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
|
|
||||||
|
|
||||||
ByteBuffer pkt;
|
ByteBuffer pkt;
|
||||||
|
|
||||||
_login = (const char*)ch->I;
|
_login = (const char*)ch->I;
|
||||||
|
|
@ -536,8 +578,13 @@ bool AuthSocket::_HandleLogonProof()
|
||||||
|
|
||||||
///- Check if the client has one of the expected version numbers
|
///- Check if the client has one of the expected version numbers
|
||||||
bool valid_version = false;
|
bool valid_version = false;
|
||||||
int accepted_versions[] = EXPECTED_MANGOS_CLIENT_BUILD;
|
int accepted_versions[] = EXPECTED_REALMD_CLIENT_BUILD;
|
||||||
for(int i = 0; accepted_versions[i]; ++i)
|
if (_build >= accepted_versions[0]) // first build is low bound of always accepted range
|
||||||
|
valid_version = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// continue from 1 with explict equal check
|
||||||
|
for(int i = 1; accepted_versions[i]; ++i)
|
||||||
{
|
{
|
||||||
if(_build == accepted_versions[i])
|
if(_build == accepted_versions[i])
|
||||||
{
|
{
|
||||||
|
|
@ -545,6 +592,7 @@ bool AuthSocket::_HandleLogonProof()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <ul><li> If the client has no valid version
|
/// <ul><li> If the client has no valid version
|
||||||
if(!valid_version)
|
if(!valid_version)
|
||||||
|
|
@ -691,15 +739,7 @@ bool AuthSocket::_HandleLogonProof()
|
||||||
sha.UpdateBigNumbers(&A, &M, &K, NULL);
|
sha.UpdateBigNumbers(&A, &M, &K, NULL);
|
||||||
sha.Finalize();
|
sha.Finalize();
|
||||||
|
|
||||||
sAuthLogonProof_S proof;
|
SendProof(sha);
|
||||||
memcpy(proof.M2, sha.GetDigest(), 20);
|
|
||||||
proof.cmd = AUTH_LOGON_PROOF;
|
|
||||||
proof.error = 0;
|
|
||||||
proof.unk1 = 0x00800000;
|
|
||||||
proof.unk2 = 0x00;
|
|
||||||
proof.unk3 = 0x00;
|
|
||||||
|
|
||||||
SendBuf((char *)&proof, sizeof(proof));
|
|
||||||
|
|
||||||
///- Set _authed to true!
|
///- Set _authed to true!
|
||||||
_authed = true;
|
_authed = true;
|
||||||
|
|
@ -882,15 +922,75 @@ bool AuthSocket::_HandleRealmList()
|
||||||
|
|
||||||
///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
|
///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
|
||||||
ByteBuffer pkt;
|
ByteBuffer pkt;
|
||||||
pkt << (uint32) 0;
|
LoadRealmlist(pkt, id);
|
||||||
pkt << (uint16) sRealmList.size();
|
|
||||||
RealmList::RealmMap::const_iterator i;
|
ByteBuffer hdr;
|
||||||
for( i = sRealmList.begin(); i != sRealmList.end(); ++i )
|
hdr << (uint8) REALM_LIST;
|
||||||
|
hdr << (uint16)pkt.size();
|
||||||
|
hdr.append(pkt);
|
||||||
|
|
||||||
|
SendBuf((char const*)hdr.contents(), hdr.size());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid)
|
||||||
|
{
|
||||||
|
switch(_build)
|
||||||
|
{
|
||||||
|
case 5875: // 1.12.1
|
||||||
|
case 6005: // 1.12.2
|
||||||
|
{
|
||||||
|
pkt << uint32(0);
|
||||||
|
pkt << uint8(sRealmList.size());
|
||||||
|
|
||||||
|
for(RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i)
|
||||||
{
|
{
|
||||||
uint8 AmountOfCharacters;
|
uint8 AmountOfCharacters;
|
||||||
|
|
||||||
// No SQL injection. id of realm is controlled by the database.
|
// No SQL injection. id of realm is controlled by the database.
|
||||||
result = loginDatabase.PQuery( "SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'",i->second.m_ID,id);
|
QueryResult *result = loginDatabase.PQuery( "SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid);
|
||||||
|
if( result )
|
||||||
|
{
|
||||||
|
Field *fields = result->Fetch();
|
||||||
|
AmountOfCharacters = fields[0].GetUInt8();
|
||||||
|
delete result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
AmountOfCharacters = 0;
|
||||||
|
|
||||||
|
// Show offline state for unsupported client builds
|
||||||
|
uint8 color = (std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end()) ? i->second.color : 2;
|
||||||
|
color = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 2 : color;
|
||||||
|
|
||||||
|
pkt << uint32(i->second.icon); // realm type
|
||||||
|
pkt << uint8(color); // if 2, then realm is offline
|
||||||
|
pkt << i->first; // name
|
||||||
|
pkt << i->second.address; // address
|
||||||
|
pkt << float(i->second.populationLevel);
|
||||||
|
pkt << uint8(AmountOfCharacters);
|
||||||
|
pkt << uint8(i->second.timezone); // realm category
|
||||||
|
pkt << uint8(0x00); // unk, may be realm number/id?
|
||||||
|
}
|
||||||
|
|
||||||
|
pkt << uint8(0x00);
|
||||||
|
pkt << uint8(0x02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 8606: // 2.4.3
|
||||||
|
case 10505: // 3.2.2a
|
||||||
|
default: // and later
|
||||||
|
{
|
||||||
|
pkt << uint32(0);
|
||||||
|
pkt << uint16(sRealmList.size());
|
||||||
|
|
||||||
|
for(RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i)
|
||||||
|
{
|
||||||
|
uint8 AmountOfCharacters;
|
||||||
|
|
||||||
|
// No SQL injection. id of realm is controlled by the database.
|
||||||
|
QueryResult *result = loginDatabase.PQuery( "SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid);
|
||||||
if( result )
|
if( result )
|
||||||
{
|
{
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
@ -902,27 +1002,25 @@ bool AuthSocket::_HandleRealmList()
|
||||||
|
|
||||||
uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
|
uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
|
||||||
|
|
||||||
pkt << i->second.icon; // realm type
|
// Show offline state for unsupported client builds
|
||||||
pkt << lock; // if 1, then realm locked
|
uint8 color = (std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end()) ? i->second.color : 2;
|
||||||
pkt << i->second.color; // if 2, then realm is offline
|
|
||||||
pkt << i->first;
|
pkt << uint8(i->second.icon); // realm type
|
||||||
pkt << i->second.address;
|
pkt << uint8(lock); // if 1, then realm locked
|
||||||
pkt << i->second.populationLevel;
|
pkt << uint8(color); // if 2, then realm is offline
|
||||||
pkt << AmountOfCharacters;
|
pkt << i->first; // name
|
||||||
pkt << i->second.timezone; // realm category
|
pkt << i->second.address; // address
|
||||||
pkt << (uint8) 0x2C; // unk, may be realm number/id?
|
pkt << float(i->second.populationLevel);
|
||||||
|
pkt << uint8(AmountOfCharacters);
|
||||||
|
pkt << uint8(i->second.timezone); // realm category
|
||||||
|
pkt << uint8(0x2C); // unk, may be realm number/id?
|
||||||
}
|
}
|
||||||
pkt << (uint8) 0x10;
|
|
||||||
pkt << (uint8) 0x00;
|
|
||||||
|
|
||||||
ByteBuffer hdr;
|
pkt << uint8(0x10);
|
||||||
hdr << (uint8) REALM_LIST;
|
pkt << uint8(0x00);
|
||||||
hdr << (uint16)pkt.size();
|
break;
|
||||||
hdr.append(pkt);
|
}
|
||||||
|
}
|
||||||
SendBuf((char const*)hdr.contents(), hdr.size());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resume patch transfer
|
/// Resume patch transfer
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
#include "sockets/Utility.h"
|
#include "sockets/Utility.h"
|
||||||
#include "sockets/Parse.h"
|
#include "sockets/Parse.h"
|
||||||
#include "sockets/Socket.h"
|
#include "sockets/Socket.h"
|
||||||
|
#include "Auth/Sha1.h"
|
||||||
|
#include "ByteBuffer.h"
|
||||||
|
|
||||||
/// Handle login commands
|
/// Handle login commands
|
||||||
class AuthSocket: public TcpSocket
|
class AuthSocket: public TcpSocket
|
||||||
|
|
@ -43,6 +45,8 @@ class AuthSocket: public TcpSocket
|
||||||
|
|
||||||
void OnAccept();
|
void OnAccept();
|
||||||
void OnRead();
|
void OnRead();
|
||||||
|
void SendProof(Sha1Hash sha);
|
||||||
|
void LoadRealmlist(ByteBuffer &pkt, uint32 acctid);
|
||||||
|
|
||||||
bool _HandleLogonChallenge();
|
bool _HandleLogonChallenge();
|
||||||
bool _HandleLogonProof();
|
bool _HandleLogonProof();
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "RealmList.h"
|
#include "RealmList.h"
|
||||||
|
#include "AuthCodes.h"
|
||||||
|
#include "Util.h" // for Tokens typedef
|
||||||
#include "Policies/SingletonImp.h"
|
#include "Policies/SingletonImp.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
|
|
||||||
|
|
@ -48,7 +50,7 @@ void RealmList::Initialize(uint32 updateInterval)
|
||||||
UpdateRealms(true);
|
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)
|
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, const char* builds)
|
||||||
{
|
{
|
||||||
///- Create new if not exist or update existed
|
///- Create new if not exist or update existed
|
||||||
Realm& realm = m_realms[name];
|
Realm& realm = m_realms[name];
|
||||||
|
|
@ -60,6 +62,15 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri
|
||||||
realm.allowedSecurityLevel = allowedSecurityLevel;
|
realm.allowedSecurityLevel = allowedSecurityLevel;
|
||||||
realm.populationLevel = popu;
|
realm.populationLevel = popu;
|
||||||
|
|
||||||
|
Tokens tokens = StrSplit(builds, " ");
|
||||||
|
Tokens::iterator iter;
|
||||||
|
|
||||||
|
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||||
|
{
|
||||||
|
uint32 build = atol((*iter).c_str());
|
||||||
|
realm.realmbuilds.insert(build);
|
||||||
|
}
|
||||||
|
|
||||||
///- Append port to IP address.
|
///- Append port to IP address.
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << address << ":" << port;
|
ss << address << ":" << port;
|
||||||
|
|
@ -85,7 +96,8 @@ void RealmList::UpdateRealms(bool init)
|
||||||
{
|
{
|
||||||
sLog.outDetail("Updating Realm List...");
|
sLog.outDetail("Updating Realm List...");
|
||||||
|
|
||||||
QueryResult *result = loginDatabase.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population FROM realmlist WHERE color <> 3 ORDER BY name" );
|
//// 0 1 2 3 4 5 6 7 8 9
|
||||||
|
QueryResult *result = loginDatabase.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, realmbuilds FROM realmlist WHERE color <> 3 ORDER BY name" );
|
||||||
|
|
||||||
///- Circle through results and add them to the realm map
|
///- Circle through results and add them to the realm map
|
||||||
if(result)
|
if(result)
|
||||||
|
|
@ -96,9 +108,9 @@ void RealmList::UpdateRealms(bool init)
|
||||||
|
|
||||||
uint8 allowedSecurityLevel = fields[7].GetUInt8();
|
uint8 allowedSecurityLevel = fields[7].GetUInt8();
|
||||||
|
|
||||||
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat() );
|
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetString() );
|
||||||
if(init)
|
if(init)
|
||||||
sLog.outString("Added realm \"%s\".", fields[1].GetString());
|
sLog.outString("Added realm \"%s\"", fields[1].GetString());
|
||||||
} while( result->NextRow() );
|
} while( result->NextRow() );
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ struct Realm
|
||||||
uint32 m_ID;
|
uint32 m_ID;
|
||||||
AccountTypes allowedSecurityLevel;
|
AccountTypes allowedSecurityLevel;
|
||||||
float populationLevel;
|
float populationLevel;
|
||||||
|
std::set<uint32> realmbuilds;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Storage object for the list of realms on the server
|
/// Storage object for the list of realms on the server
|
||||||
|
|
@ -57,7 +58,7 @@ class RealmList
|
||||||
uint32 size() const { return m_realms.size(); }
|
uint32 size() const { return m_realms.size(); }
|
||||||
private:
|
private:
|
||||||
void UpdateRealms(bool init);
|
void UpdateRealms(bool init);
|
||||||
void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
|
void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const char* builds);
|
||||||
private:
|
private:
|
||||||
RealmMap m_realms; ///< Internal map of realms
|
RealmMap m_realms; ///< Internal map of realms
|
||||||
uint32 m_UpdateInterval;
|
uint32 m_UpdateInterval;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9009"
|
#define REVISION_NR "9010"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
#define __REVISION_SQL_H__
|
#define __REVISION_SQL_H__
|
||||||
#define REVISION_DB_CHARACTERS "required_8874_01_characters_character_skills"
|
#define REVISION_DB_CHARACTERS "required_8874_01_characters_character_skills"
|
||||||
#define REVISION_DB_MANGOS "required_9007_01_mangos_spell_proc_event"
|
#define REVISION_DB_MANGOS "required_9007_01_mangos_spell_proc_event"
|
||||||
#define REVISION_DB_REALMD "required_8728_01_realmd_account"
|
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
|
||||||
#endif // __REVISION_SQL_H__
|
#endif // __REVISION_SQL_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue