From a2af952c687ff666208a316d8b7b4e394df19d2f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Sep 2015 22:15:19 +0300 Subject: Read server packet version from server (hercules). --- src/client.cpp | 2 ++ src/dyetool/client.cpp | 1 + src/net/eathena/loginrecv.cpp | 16 ++++++++++++++++ src/net/tmwa/loginrecv.cpp | 3 +++ 4 files changed, 22 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index 8c8276f7e..d0c4e38c0 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -171,6 +171,7 @@ extern FPSmanager fpsManager; volatile bool runCounters; bool isSafeMode = false; int serverVersion = 0; +int packetVersion = 0; unsigned int tmwServerVersion = 0; int start_time; unsigned int mLastHost = 0; @@ -1010,6 +1011,7 @@ int Client::gameExec() loginData.clearUpdateHost(); serverVersion = 0; + packetVersion = 0; tmwServerVersion = 0; // Allow changing this using a server choice dialog diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index 77964bd17..72e58385e 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -94,6 +94,7 @@ extern FPSmanager fpsManager; volatile bool runCounters; bool isSafeMode = false; int serverVersion = 0; +int packetVersion = 0; unsigned int tmwServerVersion = 0; int start_time; unsigned int mLastHost = 0; diff --git a/src/net/eathena/loginrecv.cpp b/src/net/eathena/loginrecv.cpp index 472ce76be..cd0a09060 100644 --- a/src/net/eathena/loginrecv.cpp +++ b/src/net/eathena/loginrecv.cpp @@ -35,6 +35,8 @@ #include "debug.h" +extern int packetVersion; + namespace EAthena { @@ -145,9 +147,23 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg) msg.readInt32("unused"); serverVersion = msg.readInt32("server version"); if (serverVersion > 0) + { logger->log("Evol2 server version: %d", serverVersion); + if (serverVersion >= 8) + { + packetVersion = msg.readInt32("packet version"); + logger->log("Hercules packet version: %d", packetVersion); + } + else + { + packetVersion = 20150000; + logger->log("Possible hercules packet version: %d", packetVersion); + } + } else + { logger->log("Hercules without version"); + } client->setState(STATE_LOGIN); } diff --git a/src/net/tmwa/loginrecv.cpp b/src/net/tmwa/loginrecv.cpp index 772691573..d5ca68241 100644 --- a/src/net/tmwa/loginrecv.cpp +++ b/src/net/tmwa/loginrecv.cpp @@ -33,6 +33,8 @@ #include "debug.h" +extern int packetVersion; + namespace TmwAthena { @@ -45,6 +47,7 @@ enum ServerFlags void LoginRecv::processServerVersion(Net::MessageIn &msg) { + packetVersion = 0; const uint8_t b1 = msg.readUInt8("b1"); // -1 const uint8_t b2 = msg.readUInt8("b2"); const uint8_t b3 = msg.readUInt8("b3"); -- cgit v1.2.3-70-g09d2