From 8ad8da325107ef1b33bd6c3ed985859e7edb78ae Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 Aug 2014 16:53:06 +0300 Subject: add basic implimentation for set pincode. For now it not sending pincode to server. --- src/net/charserverhandler.h | 2 ++ src/net/eathena/charserverhandler.cpp | 18 ++++++++++++++---- src/net/eathena/charserverhandler.h | 7 +++++++ src/net/tmwa/charserverhandler.h | 3 +++ 4 files changed, 26 insertions(+), 4 deletions(-) (limited to 'src/net') diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 8f78905c6..6a0125e1d 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -73,6 +73,8 @@ class CharServerHandler notfinal virtual void clear() = 0; + virtual bool isNeedCreatePin() const = 0; + protected: CharServerHandler() : mCharacters(), diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index af3c012dd..7d6e2e74c 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -28,6 +28,8 @@ #include "being/attributes.h" +#include "gui/windows/editdialog.h" + #include "net/character.h" #include "net/logindata.h" #include "net/net.h" @@ -45,6 +47,9 @@ #include "resources/db/itemdb.h" #include "utils/dtor.h" +#include "utils/gettext.h" + +#include "listeners/pincodelistener.h" #include "debug.h" @@ -58,7 +63,9 @@ extern ServerInfo mapServer; CharServerHandler::CharServerHandler() : MessageHandler(), - Ea::CharServerHandler() + Ea::CharServerHandler(), + mPinSeed(0), + mNeedCreatePin(false) { static const uint16_t _messages[] = { @@ -378,7 +385,7 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg) void CharServerHandler::processPincodeStatus(Net::MessageIn &msg) { - msg.readInt32("pincode seed"); + const uint32_t seed = msg.readInt32("pincode seed"); msg.readInt32("account id"); const uint16_t state = static_cast(msg.readInt16("state")); switch (state) @@ -388,11 +395,14 @@ void CharServerHandler::processPincodeStatus(Net::MessageIn &msg) case 1: // ask for pin break; case 2: // create new pin + case 4: // create new pin? + { + mPinSeed = seed; + mNeedCreatePin = true; break; + } case 3: // pin must be changed break; - case 4: // create new pin? - break; case 5: // client show error? break; case 6: // Unable to use your KSSN number diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index 9a58a50e7..e647a6d60 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -63,12 +63,19 @@ class CharServerHandler final : public MessageHandler, void processChangeMapServer(Net::MessageIn &msg); + bool isNeedCreatePin() const A_WARN_UNUSED + { return mNeedCreatePin; } + protected: void readPlayerData(Net::MessageIn &msg, Net::Character *const character, const bool) const override final; void processPincodeStatus(Net::MessageIn &msg); + + private: + uint32_t mPinSeed; + bool mNeedCreatePin; }; } // namespace EAthena diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 062360800..35a4585e3 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -63,6 +63,9 @@ class CharServerHandler final : public MessageHandler, void processChangeMapServer(Net::MessageIn &msg); + bool isNeedCreatePin() const + { return false; } + protected: void readPlayerData(Net::MessageIn &msg, Net::Character *const character, -- cgit v1.2.3-70-g09d2