summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-14 00:49:40 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-14 00:49:40 +0300
commitacd87806b767d70c0676c0f800e23a7ce4f623e0 (patch)
tree3929d2c0e19d4abe9db62943816a156e7472eb19
parenta14077ce17133d7a7e12a747c067c07deca1c1f7 (diff)
downloadplus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.gz
plus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.bz2
plus-acd87806b767d70c0676c0f800e23a7ce4f623e0.tar.xz
plus-acd87806b767d70c0676c0f800e23a7ce4f623e0.zip
Add packet SMSG_CHAR_PINCODE_STATUS2 0x0ae9.
-rw-r--r--src/net/eathena/charserverrecv.cpp44
-rw-r--r--src/net/eathena/charserverrecv.h1
-rw-r--r--src/net/eathena/packetsin.inc20
-rw-r--r--src/pincodemanager.cpp51
-rw-r--r--src/pincodemanager.h8
5 files changed, 93 insertions, 31 deletions
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index 85662e92b..3100aaebb 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -349,38 +349,24 @@ void CharServerRecv::processPincodeStatus(Net::MessageIn &msg)
{
pincodeManager.setSeed(msg.readUInt32("pincode seed"));
pincodeManager.setAccountId(msg.readBeingId("account id"));
+ pincodeManager.setPincodeLockFlag(false);
+ if (pincodeManager.processPincodeStatus(CAST_U16(
+ msg.readInt16("state"))) == false)
+ {
+ UNIMPLEMENTEDPACKET;
+ }
+}
+
+void CharServerRecv::processPincodeStatus2(Net::MessageIn &msg)
+{
+ pincodeManager.setSeed(msg.readUInt32("pincode seed"));
+ pincodeManager.setAccountId(msg.readBeingId("account id"));
const uint16_t state = CAST_U16(msg.readInt16("state"));
- switch (state)
+ pincodeManager.setPincodeLockFlag(msg.readInt16("flag") == 0);
+ if (pincodeManager.processPincodeStatus(state) == false)
{
- case 0: // pin ok
- pincodeManager.pinOk();
- break;
- case 1: // ask for pin
- pincodeManager.setState(PincodeState::Ask);
- break;
- case 2: // create new pin
- case 4: // create new pin?
- {
- pincodeManager.setState(PincodeState::Create);
- break;
- }
- case 3: // pin must be changed
- pincodeManager.setState(PincodeState::Change);
- break;
- case 8: // pincode was incorrect
- case 5: // client show error?
- pincodeManager.wrongPin();
- return;
- case 6: // Unable to use your KSSN number
- break;
- case 7: // char select window shows a button
- break;
- default:
- UNIMPLEMENTEDPACKET;
- break;
+ UNIMPLEMENTEDPACKET;
}
- if (client)
- client->updatePinState();
}
void CharServerRecv::processPincodeMakeStatus(Net::MessageIn &msg)
diff --git a/src/net/eathena/charserverrecv.h b/src/net/eathena/charserverrecv.h
index 5b776f82d..78092d3dd 100644
--- a/src/net/eathena/charserverrecv.h
+++ b/src/net/eathena/charserverrecv.h
@@ -44,6 +44,7 @@ namespace EAthena
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character);
void processPincodeStatus(Net::MessageIn &msg);
+ void processPincodeStatus2(Net::MessageIn &msg);
void processPincodeMakeStatus(Net::MessageIn &msg);
void processPincodeEditStatus(Net::MessageIn &msg);
void processCharLogin2(Net::MessageIn &msg);
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index 83d30570a..8fa74e371 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -1037,6 +1037,24 @@ if (packetVersion >= 20171207)
packet(SMSG_PARTY_INFO, 0x0ae5, -1, &PartyRecv::processPartyInfo, 20171207);
}
+// main 20180124
+if (packetVersionMain >= 20180124)
+{
+ packet(SMSG_CHAR_PINCODE_STATUS2, 0x0ae9, 13, &CharServerRecv::processPincodeStatus2, 20180124);
+}
+
+// re 20180124
+if (packetVersionRe >= 20180124)
+{
+ packet(SMSG_CHAR_PINCODE_STATUS2, 0x0ae9, 13, &CharServerRecv::processPincodeStatus2, 20180124);
+}
+
+// zero 20180131
+if (packetVersionZero >= 20180131)
+{
+ packet(SMSG_CHAR_PINCODE_STATUS2, 0x0ae9, 13, &CharServerRecv::processPincodeStatus2, 20180124);
+}
+
// re 20180221
if (packetVersionRe >= 20180221)
{
@@ -1081,7 +1099,7 @@ if (packetVersionZero >= 20180411)
}
// 20180418
-if (packetVersion == 20180418)
+if (packetVersion >= 20180418)
{
packet(SMSG_ITEM_DROPPED, 0x0add, 22, &ItemRecv::processItemDropped, 20180418);
}
diff --git a/src/pincodemanager.cpp b/src/pincodemanager.cpp
index 67b14f2bf..a97c813ef 100644
--- a/src/pincodemanager.cpp
+++ b/src/pincodemanager.cpp
@@ -46,7 +46,8 @@ PincodeManager::PincodeManager() :
mSeed(0U),
mAccountId(BeingId_zero),
mDialog(nullptr),
- mState(PincodeState::None)
+ mState(PincodeState::None),
+ mLockFlag(false)
{
}
@@ -235,6 +236,14 @@ void PincodeManager::pinOk()
client->focusWindow();
}
+void PincodeManager::lockedPin()
+{
+ // +++ here can be handled locked account by pin code.
+ // but hercules for now not have this feature
+ mState = PincodeState::Ask;
+ updateState();
+}
+
void PincodeManager::wrongPin()
{
mState = PincodeState::Ask;
@@ -254,3 +263,43 @@ bool PincodeManager::isBlocked()
{
return mState != PincodeState::None;
}
+
+bool PincodeManager::processPincodeStatus(const uint16_t state)
+{
+ switch (state)
+ {
+ case 0: // pin ok
+ pincodeManager.pinOk();
+ break;
+ case 1: // ask for pin
+ pincodeManager.setState(PincodeState::Ask);
+ break;
+ case 2: // create new pin
+ case 4: // create new pin?
+ {
+ pincodeManager.setState(PincodeState::Create);
+ break;
+ }
+ case 3: // pin must be changed
+ pincodeManager.setState(PincodeState::Change);
+ break;
+ case 8: // pincode was incorrect
+ case 5: // client show error?
+ if (mLockFlag)
+ pincodeManager.lockedPin();
+ else
+ pincodeManager.wrongPin();
+ return true;
+ case 6: // Unable to use your KSSN number
+ break;
+ case 7: // char select window shows a button
+ break;
+ default:
+ if (client)
+ client->updatePinState();
+ return false;
+ }
+ if (client)
+ client->updatePinState();
+ return true;
+}
diff --git a/src/pincodemanager.h b/src/pincodemanager.h
index c1613fa7e..49d081157 100644
--- a/src/pincodemanager.h
+++ b/src/pincodemanager.h
@@ -49,6 +49,8 @@ class PincodeManager final
void wrongPin();
+ void lockedPin();
+
void setSeed(const uint32_t seed)
{ mSeed = seed; }
@@ -58,6 +60,9 @@ class PincodeManager final
void setState(const PincodeStateT state)
{ mState = state; }
+ void setPincodeLockFlag(const bool flag)
+ { mLockFlag = flag; }
+
void changePincode(const std::string &pincode);
void clearDialog(const PincodeDialog *const PincodeDialog);
@@ -70,6 +75,8 @@ class PincodeManager final
bool isBlocked();
+ bool processPincodeStatus(const uint16_t state);
+
protected:
std::string mOldPincode;
std::string mNewPincode;
@@ -77,6 +84,7 @@ class PincodeManager final
BeingId mAccountId;
Window *mDialog;
PincodeStateT mState;
+ bool mLockFlag;
};
extern PincodeManager pincodeManager;