summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-08 06:07:15 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-08 06:07:15 +0300
commitfc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d (patch)
treef7f8af4849bc214a27ea8205410568b76ce5ec30 /src/net
parent6b3b81988ea37207eeeb2994761e307c6b6fb340 (diff)
downloadmanaverse-fc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d.tar.gz
manaverse-fc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d.tar.bz2
manaverse-fc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d.tar.xz
manaverse-fc1ca42ed5a1b2d83a1dc8f94709a057b8e28e9d.zip
Add support for change pin code by server request.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/charserverhandler.h4
-rw-r--r--src/net/eathena/charserverhandler.cpp10
-rw-r--r--src/net/eathena/charserverhandler.h4
-rw-r--r--src/net/eathena/charserverrecv.cpp4
-rw-r--r--src/net/tmwa/charserverhandler.h6
5 files changed, 27 insertions, 1 deletions
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index fdf744cc4..9bc3aa86a 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -93,6 +93,10 @@ class CharServerHandler notfinal
virtual void sendCheckPincode(const BeingId accountId,
const std::string &pin) const = 0;
+ virtual void changePincode(const BeingId accountId,
+ const std::string &oldPin,
+ const std::string &newPin) const = 0;
+
virtual void changeSlot(const int oldSlot,
const int newSlot) const = 0;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 71bf6aeee..630dca675 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -214,6 +214,16 @@ void CharServerHandler::sendCheckPincode(const BeingId accountId,
outMsg.writeString(pin, 4, "encrypted pin");
}
+void CharServerHandler::changePincode(const BeingId accountId,
+ const std::string &oldPin,
+ const std::string &newPin) const
+{
+ createOutPacket(CMSG_CHAR_PIN_CHANGE);
+ outMsg.writeBeingId(accountId, "account id");
+ outMsg.writeString(oldPin, 4, "old encrypted pin");
+ outMsg.writeString(newPin, 4, "new encrypted pin");
+}
+
void CharServerHandler::renameCharacter(const BeingId id,
const std::string &newName) const
{
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index f41b14a79..a712c5a56 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -68,6 +68,10 @@ class CharServerHandler final : public Ea::CharServerHandler
void sendCheckPincode(const BeingId accountId,
const std::string &pin) const override final;
+ void changePincode(const BeingId accountId,
+ const std::string &oldPin,
+ const std::string &newPin) const override final;
+
/**
* Sets the character create dialog. The handler will clean up this
* dialog when a new character is successfully created, and will unlock
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index 6d5fd63ca..ece603ac2 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -370,7 +370,7 @@ void CharServerRecv::processPincodeStatus(Net::MessageIn &msg)
case 8: // pincode was incorrect
case 5: // client show error?
pincodeManager.wrongPin();
- break;
+ return;
case 6: // Unable to use your KSSN number
break;
case 7: // char select window shows a button
@@ -379,6 +379,8 @@ void CharServerRecv::processPincodeStatus(Net::MessageIn &msg)
UNIMPLEMENTEDPACKET;
break;
}
+ if (client)
+ client->updatePinState();
}
void CharServerRecv::processCharCreate(Net::MessageIn &msg)
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 37e71744e..8e2b25767 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -72,6 +72,12 @@ class CharServerHandler final : public Ea::CharServerHandler
override final
{ }
+ void changePincode(const BeingId accountId A_UNUSED,
+ const std::string &oldPin A_UNUSED,
+ const std::string &newPin A_UNUSED) const
+ override final
+ { }
+
/**
* Sets the character create dialog. The handler will clean up this
* dialog when a new character is successfully created, and will unlock