From b701810b15fb8e6d549b8c395fb6f1aa394b750e Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Sat, 6 Jan 2007 01:17:03 +0000 Subject: [PATCH] got realms working again, next thing to do is opening the world connection. --- src/Client/Realm/RealmSocket.cpp | 42 +++++++++++++++++++++---------- src/Client/World/WorldSession.cpp | 2 ++ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/Client/Realm/RealmSocket.cpp b/src/Client/Realm/RealmSocket.cpp index 2c32af9..2560a4f 100644 --- a/src/Client/Realm/RealmSocket.cpp +++ b/src/Client/Realm/RealmSocket.cpp @@ -18,7 +18,7 @@ struct SRealmHeader { uint8 cmd; // OP code = CMD_REALM_LIST 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 }; @@ -122,25 +122,41 @@ void RealmSocket::Stop(void) void RealmSocket::_HandleRealmList(void) { - SRealmHeader hd; 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); - - ////DEBUG1(printf("Realms in List: %d\n",count);); - // no realm?! - if(hd.count==0) + // no realm? + if(count==0) return; // alloc space for as many realms as needed - SRealmInfo *realms=new SRealmInfo[hd.count]; + SRealmInfo *realms=new SRealmInfo[count]; // readout realms - for(uint8 i=0;i> 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 - for(uint8 i=0;iGetConf()->realmname) { @@ -463,9 +479,9 @@ void RealmSocket::_HandleLogonChallenge(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; - 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); if(!memcmp(lp.M2,this->_m2,20)) { diff --git a/src/Client/World/WorldSession.cpp b/src/Client/World/WorldSession.cpp index 0a92c46..6406d5b 100644 --- a/src/Client/World/WorldSession.cpp +++ b/src/Client/World/WorldSession.cpp @@ -62,6 +62,8 @@ void WorldSession::SendWorldPacket(WorldPacket &pkt) void WorldSession::Update(void) { + if (GetInstance()->GetConf()->worldhost.empty() || GetInstance()->GetConf()->worldport==0) + return; WorldPacket packet; OpcodeHandler *table = _GetOpcodeHandlerTable(); while(pktQueue.size()>5)