summaryrefslogtreecommitdiff
path: root/src/net/eathena/loginrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/loginrecv.cpp')
-rw-r--r--src/net/eathena/loginrecv.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/src/net/eathena/loginrecv.cpp b/src/net/eathena/loginrecv.cpp
index 11b0086bf..92de540da 100644
--- a/src/net/eathena/loginrecv.cpp
+++ b/src/net/eathena/loginrecv.cpp
@@ -23,15 +23,20 @@
#include "net/eathena/loginrecv.h"
#include "client.h"
+#include "configuration.h"
+
+#include "being/being.h"
#include "fs/paths.h"
#include "gui/windows/logindialog.h"
#include "net/logindata.h"
-
+#include "net/loginhandler.h"
#include "net/messagein.h"
+#include "net/ea/loginrecv.h"
+
#include "net/eathena/updateprotocol.h"
#include "utils/gettext.h"
@@ -213,4 +218,58 @@ void LoginRecv::processCharPasswordResponse(Net::MessageIn &msg)
}
}
+void LoginRecv::processLoginData(Net::MessageIn &msg)
+{
+ msg.readInt16("len");
+
+ loginHandler->clearWorlds();
+
+ const int worldCount = (msg.getLength() - 47) / 32;
+
+ Ea::LoginRecv::mToken.session_ID1 = msg.readInt32("session id1");
+ Ea::LoginRecv::mToken.account_ID = msg.readBeingId("accound id");
+ Ea::LoginRecv::mToken.session_ID2 = msg.readInt32("session id2");
+ msg.readInt32("old ip");
+ loginData.lastLogin = msg.readString(24, "last login");
+ msg.readInt16("unused");
+
+ // reserve bits for future usage
+ Ea::LoginRecv::mToken.sex = Being::intToGender(CAST_U8(
+ msg.readUInt8("gender") & 3U));
+
+ if (msg.getVersion() >= 20170315)
+ {
+ msg.readInt32("unused1");
+ msg.readInt32("unused1");
+ msg.readInt32("unused1");
+ msg.readInt32("unused1");
+ msg.readUInt8("unused1");
+ }
+
+ for (int i = 0; i < worldCount; i++)
+ {
+ WorldInfo *const world = new WorldInfo;
+
+ world->address = msg.readInt32("ip address");
+ world->port = msg.readInt16("port");
+ world->name = msg.readString(20, "name");
+ world->online_users = msg.readInt16("online number");
+ config.setValue("updatehost", Ea::LoginRecv::mUpdateHost);
+ world->updateHost = Ea::LoginRecv::mUpdateHost;
+ msg.readInt16("maintenance");
+ msg.readInt16("new");
+ if (msg.getVersion() >= 20170315)
+ {
+ for(int f = 0; f < 32; f ++)
+ msg.readUInt8("unused2");
+ }
+
+ logger->log("Network: Server: %s (%s:%d)", world->name.c_str(),
+ ipToString(world->address), world->port);
+
+ Ea::LoginRecv::mWorlds.push_back(world);
+ }
+ client->setState(State::WORLD_SELECT);
+}
+
} // namespace EAthena