From 1f735744a60db65e540d2fab5cc8fab22bfc3404 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Fri, 5 Jan 2007 23:43:55 +0000 Subject: [PATCH] fixed the login packet --- src/Client/PseuWoW.cpp | 10 +++++++--- src/Client/Realm/RealmSocket.cpp | 19 ++++++++++++++----- src/Client/Realm/RealmSocket.h | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp index 54f775d..7fd9e1e 100644 --- a/src/Client/PseuWoW.cpp +++ b/src/Client/PseuWoW.cpp @@ -45,6 +45,10 @@ PseuInstance::PseuInstance() PseuInstance::~PseuInstance() { + delete _scp; + delete _conf; + delete _rsession; + delete _wsession; } bool PseuInstance::Init(void) { @@ -118,13 +122,13 @@ void PseuInstance::Run(void) if(!_initialized) return; - + _rsession->SetDeleteByHandler(); _rsession->SetHost(GetConf()->realmlist); _rsession->SetPort(GetConf()->realmport); _rsession->SetInstance(this); _rsession->Start(); - if(_rsession->IsValid()) // TODO: need better check for IsValid(), it must check also if it could connect + if(_rsession->IsValid()) { _sh.Add(_rsession); _sh.Select(1,0); @@ -265,7 +269,7 @@ void PseuInstanceConf::ApplyFromVarSet(VarSet &v) realmport=atoi(v.Get("REALMPORT").c_str()); clientversion_string=v.Get("CLIENTVERSION"); clientbuild=atoi(v.Get("CLIENTBUILD").c_str()); - clientlang=v.Get("CLIENTLANG"); + clientlang=v.Get("CLIENTLANGUAGE"); realmname=v.Get("REALMNAME"); charname=v.Get("CHARNAME"); networksleeptime=atoi(v.Get("NETWORKSLEEPTIME").c_str()); diff --git a/src/Client/Realm/RealmSocket.cpp b/src/Client/Realm/RealmSocket.cpp index 5ce7832..7270122 100644 --- a/src/Client/Realm/RealmSocket.cpp +++ b/src/Client/Realm/RealmSocket.cpp @@ -179,8 +179,8 @@ void RealmSocket::_HandleRealmList(void) void RealmSocket::OnRead(void) { - printf("RealmSocket::OnRead() %u bytes\n",ibuf.GetLength()); TcpSocket::OnRead(); + printf("RealmSocket::OnRead() %u bytes\n",ibuf.GetLength()); if(!ibuf.GetLength()) return; uint8 cmd, i=0; @@ -288,17 +288,21 @@ void RealmSocket::SendLogonChallenge(void) packet << (uint8)AUTH_LOGON_CHALLENGE; packet << (uint8)2; packet << (uint8)(acc.length()+30); // length of the rest of the packet - packet << "WOW"; // game name = World Of Warcraft + packet << (uint8)0; + packet.append("WOW",3); // game name = World Of Warcraft packet.append(GetInstance()->GetConf()->clientversion,3); // 1.12.2 etc - packet << GetInstance()->GetConf()->clientbuild; // (uint16) 5875 + packet << (uint8)0; + packet << (uint16)(GetInstance()->GetConf()->clientbuild); // (uint16) 5875 packet << "68x" << "niW"; // "x86" - platform; "Win" - Operating system; both reversed and zero terminated - for(uint8 i=2;i>0;i--) - packet << (uint8)GetInstance()->GetConf()->clientlang[i]; // "enUS" -> "SUne" : reversed and NOT zero terminated + for(uint8 i=0;i<4;i++) + packet << (uint8)(GetInstance()->GetConf()->clientlang[3-i]); // "enUS" -> "SUne" : reversed and NOT zero terminated packet << (uint32)0x3c; // timezone packet << (uint32)GetClientRemoteAddr(); // my IP address packet << (uint8)acc.length(); // length of acc name without \0 packet.append(acc.c_str(),acc.length()); // append accname, skip \0 + packet.hexlike(); + SendBuf((char*)packet.contents(),packet.size()); } @@ -477,4 +481,9 @@ void RealmSocket::OnConnect() printf("DEBUG: RealmSocket connected!\n"); SendLogonChallenge(); } + +void RealmSocket::OnConnectFailed(void) +{ + printf("RealmSocket::OnConnectFailed()\n"); +} diff --git a/src/Client/Realm/RealmSocket.h b/src/Client/Realm/RealmSocket.h index 3afdf23..15c47f4 100644 --- a/src/Client/Realm/RealmSocket.h +++ b/src/Client/Realm/RealmSocket.h @@ -33,6 +33,7 @@ public: void OnRead(void); //void OnAccept(void); void OnConnect(void); + void RealmSocket::OnConnectFailed(void); private: