summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/eathena/loginhandler.cpp32
-rw-r--r--src/net/eathena/loginhandler.h5
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/eathena/serverfeatures.cpp2
4 files changed, 29 insertions, 11 deletions
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index c36b6a1d1..7153468aa 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -143,14 +143,24 @@ void LoginHandler::changePassword(const std::string &restrict username
void LoginHandler::sendLoginRegister(const std::string &restrict username,
const std::string &restrict password,
- const std::string &restrict email
- A_UNUSED) const
+ const std::string &restrict email) const
{
- createOutPacket(CMSG_LOGIN_REGISTER);
- outMsg.writeInt32(20, "client version");
- outMsg.writeString(username, 24, "login");
- outMsg.writeStringNoLog(password, 24, "password");
- outMsg.writeInt8(0x03, "client type");
+ if (email.empty())
+ {
+ createOutPacket(CMSG_LOGIN_REGISTER);
+ outMsg.writeInt32(20, "client version");
+ outMsg.writeString(username, 24, "login");
+ outMsg.writeStringNoLog(password, 24, "password");
+ outMsg.writeInt8(0x03, "client type");
+ }
+ else
+ {
+ createOutPacket(CMSG_LOGIN_REGISTER2);
+ outMsg.writeString(username, 24, "login");
+ outMsg.writeStringNoLog(password, 24, "password");
+ outMsg.writeInt8(0x03, "client type");
+ outMsg.writeString(email, 40, "email");
+ }
}
ServerInfo *LoginHandler::getCharServer() const
@@ -258,4 +268,12 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
client->setState(STATE_LOGIN);
}
+int LoginHandler::supportedOptionalActions() const
+{
+ return serverFeatures->haveEmailOnRegister()
+ ? Net::RegistrationOptions::SetEmailOnRegister
+ | Net::RegistrationOptions::SetGenderOnRegister
+ : Net::RegistrationOptions::SetGenderOnRegister;
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h
index 4f8b3110c..ae5f63677 100644
--- a/src/net/eathena/loginhandler.h
+++ b/src/net/eathena/loginhandler.h
@@ -49,9 +49,6 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler
void disconnect() override final;
- int supportedOptionalActions() const override final A_WARN_UNUSED
- { return Net::RegistrationOptions::SetGenderOnRegister; }
-
unsigned int getMaxPasswordLength() const override final A_WARN_UNUSED
{ return 24; }
@@ -64,6 +61,8 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler
ServerInfo *getCharServer() const override final A_WARN_UNUSED;
+ int supportedOptionalActions() const override final A_WARN_UNUSED;
+
static void processLoginError2(Net::MessageIn &msg);
static void processUpdateHost2(Net::MessageIn &msg);
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 7a83d5c84..09e615cfd 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -315,6 +315,7 @@
#define CMSG_SERVER_VERSION_REQUEST 0x7530
#define CMSG_LOGIN_REGISTER 0x0064
+#define CMSG_LOGIN_REGISTER2 0x027c
#define CMSG_NAME_REQUEST 0x088a
// Custom change password packet
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index 943c6314e..911bacbe3 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -132,7 +132,7 @@ bool ServerFeatures::haveMonsterAttackRange() const
bool ServerFeatures::haveEmailOnRegister() const
{
- return false;
+ return serverVersion >= 2;
}
bool ServerFeatures::haveEightDirections() const