summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-05 20:41:48 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-05 20:41:48 +0300
commit8032eb0f2345ed6b9097277034d94066af66f4fd (patch)
tree6e4490564a53cd1ac3e80a8d60e63906ce4e6e67 /src/net
parent55c9a94d904bb7fb6351f55e652ad241c079cf96 (diff)
downloadmanaverse-8032eb0f2345ed6b9097277034d94066af66f4fd.tar.gz
manaverse-8032eb0f2345ed6b9097277034d94066af66f4fd.tar.bz2
manaverse-8032eb0f2345ed6b9097277034d94066af66f4fd.tar.xz
manaverse-8032eb0f2345ed6b9097277034d94066af66f4fd.zip
Add empty pincode manager.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/charserverhandler.h2
-rw-r--r--src/net/eathena/charserverhandler.cpp8
-rw-r--r--src/net/eathena/charserverhandler.h2
-rw-r--r--src/net/eathena/charserverrecv.cpp17
-rw-r--r--src/net/eathena/charserverrecv.h3
-rw-r--r--src/net/tmwa/charserverhandler.h3
6 files changed, 9 insertions, 26 deletions
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index f7d1bfd6f..8c41db2ad 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -87,8 +87,6 @@ class CharServerHandler notfinal
virtual void clear() const = 0;
- virtual bool isNeedCreatePin() const = 0;
-
virtual void setNewPincode(const std::string &pin) const = 0;
virtual void changeSlot(const int oldSlot,
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 5b042aaa5..e98f963e4 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -50,10 +50,7 @@ CharServerHandler::CharServerHandler() :
Ea::CharServerHandler()
{
CharServerRecv::mNewName.clear();
- CharServerRecv::mPinSeed = 0;
- CharServerRecv::mPinAccountId = BeingId_zero;
CharServerRecv::mRenameId = BeingId_zero;
- CharServerRecv::mNeedCreatePin = false;
charServerHandler = this;
}
@@ -240,9 +237,4 @@ unsigned int CharServerHandler::hatSprite() const
return 7;
}
-bool CharServerHandler::isNeedCreatePin() const
-{
- return CharServerRecv::mNeedCreatePin;
-}
-
} // namespace EAthena
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index 662873e00..e86e03721 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -62,8 +62,6 @@ class CharServerHandler final : public Ea::CharServerHandler
void connect() const override final;
- bool isNeedCreatePin() const override final A_WARN_UNUSED;
-
void setNewPincode(const std::string &pin) const override final;
/**
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index abae9b0e1..3e69005e3 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
+#include "pincodemanager.h"
#include "settings.h"
#include "gui/windows/charcreatedialog.h"
@@ -65,10 +66,7 @@ extern ServerInfo mapServer;
namespace CharServerRecv
{
std::string mNewName;
- uint32_t mPinSeed = 0;
- BeingId mPinAccountId = BeingId_zero;
BeingId mRenameId = BeingId_zero;
- bool mNeedCreatePin = false;
} // namespace CharServerRecv
// callers must count each packet size by self
@@ -349,31 +347,34 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg)
void CharServerRecv::processPincodeStatus(Net::MessageIn &msg)
{
- mPinSeed = msg.readInt32("pincode seed");
- mPinAccountId = msg.readBeingId("account id");
+ pincodeManager.setSeed(msg.readInt32("pincode seed"));
+ pincodeManager.setAccountId(msg.readBeingId("account id"));
const uint16_t state = CAST_U16(msg.readInt16("state"));
switch (state)
{
case 0: // pin ok
+ pincodeManager.pinOk();
break;
case 1: // ask for pin
+ pincodeManager.askPin();
break;
case 2: // create new pin
case 4: // create new pin?
{
- mNeedCreatePin = true;
+ pincodeManager.createNewPin();
break;
}
case 3: // pin must be changed
+ pincodeManager.changePin();
break;
+ case 8: // pincode was incorrect
case 5: // client show error?
+ pincodeManager.wrongPin();
break;
case 6: // Unable to use your KSSN number
break;
case 7: // char select window shows a button
break;
- case 8: // pincode was incorrect
- break;
default:
UNIMPLEMENTEDPACKET;
break;
diff --git a/src/net/eathena/charserverrecv.h b/src/net/eathena/charserverrecv.h
index b19273877..3ad63a311 100644
--- a/src/net/eathena/charserverrecv.h
+++ b/src/net/eathena/charserverrecv.h
@@ -39,10 +39,7 @@ namespace EAthena
namespace CharServerRecv
{
extern std::string mNewName;
- extern uint32_t mPinSeed;
- extern BeingId mPinAccountId;
extern BeingId mRenameId;
- extern bool mNeedCreatePin;
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character);
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 5ea4b6a5c..6d2051a63 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -62,9 +62,6 @@ class CharServerHandler final : public Ea::CharServerHandler
void connect() const override final;
- bool isNeedCreatePin() const override final
- { return false; }
-
void setNewPincode(const std::string &pin A_UNUSED) const
override final
{ }