fixed the login packet
This commit is contained in:
parent
5d03e2fe5b
commit
1f735744a6
@ -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());
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ public:
|
||||
void OnRead(void);
|
||||
//void OnAccept(void);
|
||||
void OnConnect(void);
|
||||
void RealmSocket::OnConnectFailed(void);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user