From 09187552601a2b6c26225cf2fa4a700347a02224 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 Sep 2013 21:09:09 +0300 Subject: add server version check for "new" tmw servers. --- src/net/tmwa/loginhandler.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 4f7a35d3b..91e2c3027 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -196,16 +196,38 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg) mRegistrationEnabled = options & FLAG_REGISTRATION; msg.skip(2); // 0 unused serverVersion = msg.readInt8(); + tmwServerVersion = 0; if (serverVersion >= 5) requestUpdateHosts(); } + else if (b1 == 255) + { // old TMWA + const unsigned int options = msg.readInt32(); + mRegistrationEnabled = options & FLAG_REGISTRATION; + serverVersion = 0; + tmwServerVersion = 0; + } + else if (b1 >= 0x0d) + { // new TMWA + const unsigned int options = msg.readInt32(); + mRegistrationEnabled = options & FLAG_REGISTRATION; + serverVersion = 0; + tmwServerVersion = (b1 << 16) | (b2 << 8) | b3; + } else - { + { // eAthena const unsigned int options = msg.readInt32(); mRegistrationEnabled = options & FLAG_REGISTRATION; serverVersion = 0; + tmwServerVersion = 0; } - logger->log("Server version: %d", serverVersion); + if (serverVersion > 0) + logger->log("Evol server version: %d", serverVersion); + else if (tmwServerVersion > 0) + logger->log("Tmw server version: x%06x", tmwServerVersion); + else + logger->log("Server witout version"); + if (serverVersion < 5) { if (client->getState() != STATE_LOGIN) -- cgit v1.2.3-70-g09d2