got realms working again, next thing to do is opening the world connection.

This commit is contained in:
False.Genesis 2007-01-06 01:17:03 +00:00
parent 02a88bc273
commit b701810b15
2 changed files with 31 additions and 13 deletions

View File

@ -18,7 +18,7 @@ struct SRealmHeader
{ {
uint8 cmd; // OP code = CMD_REALM_LIST uint8 cmd; // OP code = CMD_REALM_LIST
uint16 size; // size of the rest of packet, without this part uint16 size; // size of the rest of packet, without this part
uint32 unknown; // 0x00 00 00 00 uint32 unknown; // 0x00 00 00 00
uint8 count; // quantity of realms uint8 count; // quantity of realms
}; };
@ -122,25 +122,41 @@ void RealmSocket::Stop(void)
void RealmSocket::_HandleRealmList(void) void RealmSocket::_HandleRealmList(void)
{ {
SRealmHeader hd;
std::string realmAddr; std::string realmAddr;
ibuf.Read((char*)&hd, sizeof(SRealmHeader)); ByteBuffer realmbuf;
realmbuf.reserve(ibuf.GetLength());
ibuf.Read((char*)realmbuf.contents(), ibuf.GetLength());
uint32 unk;
uint16 len;
uint8 cmd,count;
realmbuf >> cmd >> len >> unk >> count;
printf("DEBUG: Realm cmd=%u, count=%u, size=%u, unk=%u\n",cmd,count,len,unk);
// no realm?
////DEBUG1(printf("Realms in List: %d\n",count);); if(count==0)
// no realm?!
if(hd.count==0)
return; return;
// alloc space for as many realms as needed // alloc space for as many realms as needed
SRealmInfo *realms=new SRealmInfo[hd.count]; SRealmInfo *realms=new SRealmInfo[count];
// readout realms // readout realms
for(uint8 i=0;i<hd.count;i++) for(uint8 i=0;i<count;i++)
ibuf.Read((char*)&realms[i], sizeof(SRealmInfo)); {
realmbuf >> realms[i].icon;
realmbuf >> realms[i].color;
realmbuf >> realms[i].name;
realmbuf >> realms[i].addr_port;
realmbuf >> realms[i].population;
realmbuf >> realms[i].chars_here;
realmbuf >> realms[i].timezone;
realmbuf >> realms[i].unknown;
}
// the rest of the packet is not interesting // the rest of the packet is not interesting
for(uint8 i=0;i<hd.count;i++) for(uint8 i=0;i<count;i++)
{ {
if(realms[i].name==GetInstance()->GetConf()->realmname) if(realms[i].name==GetInstance()->GetConf()->realmname)
{ {
@ -463,9 +479,9 @@ void RealmSocket::_HandleLogonChallenge(void)
void RealmSocket::_HandleLogonProof(void) void RealmSocket::_HandleLogonProof(void)
{ {
printf("RealmSocket: Got AUTH_LOGON_PROOF [%u of %u bytes]\n",ibuf.GetLength(),sizeof(sAuthLogonProof_S)); printf("RealmSocket: Got AUTH_LOGON_PROOF [%u of %u bytes]\n",ibuf.GetLength(),26);
sAuthLogonProof_S lp; sAuthLogonProof_S lp;
ibuf.Read((char*)&lp, sizeof(sAuthLogonProof_S)); ibuf.Read((char*)&lp, 26); // the compiler didnt like 'sizeof(sAuthLogonProof_S)', said it was 28
printchex((char*)&lp, sizeof(sAuthLogonProof_S),true); printchex((char*)&lp, sizeof(sAuthLogonProof_S),true);
if(!memcmp(lp.M2,this->_m2,20)) if(!memcmp(lp.M2,this->_m2,20))
{ {

View File

@ -62,6 +62,8 @@ void WorldSession::SendWorldPacket(WorldPacket &pkt)
void WorldSession::Update(void) void WorldSession::Update(void)
{ {
if (GetInstance()->GetConf()->worldhost.empty() || GetInstance()->GetConf()->worldport==0)
return;
WorldPacket packet; WorldPacket packet;
OpcodeHandler *table = _GetOpcodeHandlerTable(); OpcodeHandler *table = _GetOpcodeHandlerTable();
while(pktQueue.size()>5) while(pktQueue.size()>5)