summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-31 20:45:39 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:54 +0300
commit87e351fa21e94991038f3ca1cae1767b81071507 (patch)
treef504d6b760901a3a4f8c7be70d6f7cd84638e6af
parent8ad8da325107ef1b33bd6c3ed985859e7edb78ae (diff)
downloadplus-87e351fa21e94991038f3ca1cae1767b81071507.tar.gz
plus-87e351fa21e94991038f3ca1cae1767b81071507.tar.bz2
plus-87e351fa21e94991038f3ca1cae1767b81071507.tar.xz
plus-87e351fa21e94991038f3ca1cae1767b81071507.zip
Add partial pincode sending.
Need reverse or find way how to encrypt pincode. For now pincodes not supported.
-rw-r--r--src/listeners/pincodelistener.cpp5
-rw-r--r--src/net/charserverhandler.h2
-rw-r--r--src/net/eathena/charserverhandler.cpp15
-rw-r--r--src/net/eathena/charserverhandler.h3
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/tmwa/charserverhandler.h3
7 files changed, 26 insertions, 5 deletions
diff --git a/src/listeners/pincodelistener.cpp b/src/listeners/pincodelistener.cpp
index 7c9c20b71..0c64bb73c 100644
--- a/src/listeners/pincodelistener.cpp
+++ b/src/listeners/pincodelistener.cpp
@@ -20,6 +20,9 @@
#include "listeners/pincodelistener.h"
+#include "net/charserverhandler.h"
+#include "net/net.h"
+
#include "gui/windows/editdialog.h"
#include "debug.h"
@@ -32,6 +35,6 @@ void PincodeListener::action(const ActionEvent &event)
if (dialog)
{
const std::string pincode = dialog->getMsg();
- // here need send pin code to server
+ Net::getCharServerHandler()->setNewPincode(pincode);
}
}
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index 6a0125e1d..df3d806a0 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -75,6 +75,8 @@ class CharServerHandler notfinal
virtual bool isNeedCreatePin() const = 0;
+ virtual void setNewPincode(const std::string &pin) = 0;
+
protected:
CharServerHandler() :
mCharacters(),
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<uint16_t>(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 */
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index 35a4585e3..757474c4c 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -66,6 +66,9 @@ class CharServerHandler final : public MessageHandler,
bool isNeedCreatePin() const
{ return false; }
+ void setNewPincode(const std::string &pin A_UNUSED) override final
+ { }
+
protected:
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,