From 19366a7eae5cb6862da3212f8d3e16fe0bf9255e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Jan 2019 23:36:44 +0300 Subject: Add packet CMSG_LOGIN_MOBILE_OTP 0x09a3 --- src/net/eathena/loginhandler.cpp | 18 ++++++++++++++++++ src/net/eathena/loginhandler.h | 3 +++ src/net/eathena/packetsout.inc | 13 +++++++++++++ src/net/loginhandler.h | 6 ++++++ src/net/tmwa/loginhandler.cpp | 5 +++++ src/net/tmwa/loginhandler.h | 3 +++ 6 files changed, 48 insertions(+) (limited to 'src/net') diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index cabc9fad7..3293317c8 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -35,6 +35,10 @@ #include "debug.h" +extern int packetVersionMain; +extern int packetVersionRe; +extern int packets_zero; + namespace EAthena { @@ -164,4 +168,18 @@ void LoginHandler::updatePacketVersion() const updateProtocol(); } +void LoginHandler::sendMobileCode(const BeingId accountId, + const std::string &code) const +{ + if (packetVersionMain < 20181114 && + packetVersionRe < 20181114) + { + return; + } + createOutPacket(CMSG_LOGIN_MOBILE_OTP); + outMsg.writeInt16(14, "len"); + outMsg.writeBeingId(accountId, "account id"); + outMsg.writeStringNoLog(code, 6, "code"); +} + } // namespace EAthena diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index c50b5c465..87d5e16cf 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -58,6 +58,9 @@ class LoginHandler final : public Ea::LoginHandler void updatePacketVersion() const override final; + void sendMobileCode(const BeingId accountId, + const std::string &code) const override final; + private: void sendLoginRegister(const std::string &restrict username, const std::string &restrict password, diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc index 1b515706b..d9b269ba9 100644 --- a/src/net/eathena/packetsout.inc +++ b/src/net/eathena/packetsout.inc @@ -342,6 +342,7 @@ packet(CMSG_PLAYER_SET_TITLE, 0x0000, 0, nullptr); packet(CMSG_CHANGE_DRESS, 0x0000, 0, nullptr); packet(CMSG_INSTANCE_COMMAND, 0x0000, 0, nullptr); packet(CMSG_ACHIEVEMENT_GET_REWARD, 0x0000, 0, nullptr); +packet(CMSG_LOGIN_MOBILE_OTP, 0x0000, 0, nullptr); #else // 20040713 if (packetVersion >= 20040713) @@ -1462,4 +1463,16 @@ if (packetVersionRe >= 20180718) packet(CMSG_PLAYER_SELECT_STYLE, 0x0afc, 16, clif->pReqStyleChange); } +// 20181114 main +if (packetVersionMain >= 20181114) +{ + packet(CMSG_LOGIN_MOBILE_OTP, 0x09a3, -1, lclif->p->parse_CA_ACK_MOBILE_OTP); +} + +// 20181114 re +if (packetVersionRe >= 20181114) +{ + packet(CMSG_LOGIN_MOBILE_OTP, 0x09a3, -1, lclif->p->parse_CA_ACK_MOBILE_OTP); +} + #endif diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index d3c01dc70..3abc91443 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -24,6 +24,9 @@ #define NET_LOGINHANDLER_H #include "net/serverinfo.h" + +#include "enums/simpletypes/beingid.h" + #include "net/worldinfo.h" class LoginData; @@ -95,6 +98,9 @@ class LoginHandler notfinal virtual void updatePacketVersion() const = 0; + virtual void sendMobileCode(const BeingId accountId, + const std::string &code) const = 0; + virtual ~LoginHandler() { } diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 88ce7057b..e88069d25 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -141,4 +141,9 @@ void LoginHandler::updatePacketVersion() const itemIdLen = 2; } +void LoginHandler::sendMobileCode(const BeingId accountId A_UNUSED, + const std::string &code A_UNUSED) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index ee04d82d3..7539569a0 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -60,6 +60,9 @@ class LoginHandler final : public Ea::LoginHandler static void requestUpdateHosts(); + void sendMobileCode(const BeingId accountId, + const std::string &code) const override final; + private: void sendLoginRegister(const std::string &restrict username, const std::string &restrict password, -- cgit v1.2.3-70-g09d2