From 87e351fa21e94991038f3ca1cae1767b81071507 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 Aug 2014 20:45:39 +0300 Subject: Add partial pincode sending. Need reverse or find way how to encrypt pincode. For now pincodes not supported. --- src/net/eathena/charserverhandler.cpp | 15 ++++++++++++--- src/net/eathena/charserverhandler.h | 3 +++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 7d6e2e74c..39ebe52e2 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -65,6 +65,7 @@ CharServerHandler::CharServerHandler() : MessageHandler(), Ea::CharServerHandler(), mPinSeed(0), + mPinAccountId(0), mNeedCreatePin(false) { static const uint16_t _messages[] = @@ -385,8 +386,8 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg) void CharServerHandler::processPincodeStatus(Net::MessageIn &msg) { - const uint32_t seed = msg.readInt32("pincode seed"); - msg.readInt32("account id"); + mPinSeed = msg.readInt32("pincode seed"); + mPinAccountId = msg.readInt32("account id"); const uint16_t state = static_cast(msg.readInt16("state")); switch (state) { @@ -397,7 +398,6 @@ void CharServerHandler::processPincodeStatus(Net::MessageIn &msg) case 2: // create new pin case 4: // create new pin? { - mPinSeed = seed; mNeedCreatePin = true; break; } @@ -418,4 +418,13 @@ void CharServerHandler::processPincodeStatus(Net::MessageIn &msg) } } +void CharServerHandler::setNewPincode(const std::string &pin) +{ +// here need ecript pin with mPinSeed and pin values. + +// MessageOut outMsg(CMSG_CHAR_CREATE_PIN); +// outMsg.writeInt32(mPinAccountId, "account id"); +// outMsg.writeString(pin, 4, "encrypted pin"); +} + } // namespace EAthena diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index e647a6d60..1f9cbbcfb 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -66,6 +66,8 @@ class CharServerHandler final : public MessageHandler, bool isNeedCreatePin() const A_WARN_UNUSED { return mNeedCreatePin; } + void setNewPincode(const std::string &pin) override final; + protected: void readPlayerData(Net::MessageIn &msg, Net::Character *const character, @@ -75,6 +77,7 @@ class CharServerHandler final : public MessageHandler, private: uint32_t mPinSeed; + uint32_t mPinAccountId; bool mNeedCreatePin; }; diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 72ae89dfe..b4f36b722 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -228,7 +228,7 @@ int16_t packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 10, 0, 0, 0, 0, 0, // #0x08C0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index a716d8a6e..60a10dbac 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -197,6 +197,7 @@ #define CMSG_CHAR_SELECT 0x0066 #define CMSG_CHAR_CREATE 0x0970 #define CMSG_CHAR_DELETE 0x0068 +#define CMSG_CHAR_CREATE_PIN 0x08ba #define CMSG_MAP_SERVER_CONNECT 0x0072 #define CMSG_CLIENT_PING 0x007e /**< Send to server with tick */ -- cgit v1.2.3-60-g2f50