summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/account-server/accountclient.cpp3
-rw-r--r--src/account-server/accountclient.h1
-rw-r--r--src/account-server/accounthandler.cpp22
-rw-r--r--src/common/manaserv_protocol.h5
4 files changed, 17 insertions, 14 deletions
diff --git a/src/account-server/accountclient.cpp b/src/account-server/accountclient.cpp
index dd55be7a..df1b034c 100644
--- a/src/account-server/accountclient.cpp
+++ b/src/account-server/accountclient.cpp
@@ -22,6 +22,7 @@
AccountClient::AccountClient(ENetPeer *peer):
NetComputer(peer),
- status(CLIENT_LOGIN)
+ status(CLIENT_LOGIN),
+ version(0)
{
}
diff --git a/src/account-server/accountclient.h b/src/account-server/accountclient.h
index 7812f1e9..afb2ef3e 100644
--- a/src/account-server/accountclient.h
+++ b/src/account-server/accountclient.h
@@ -50,6 +50,7 @@ class AccountClient : public NetComputer
Account *getAccount() const;
AccountClientStatus status;
+ int version;
private:
std::unique_ptr<Account> mAccount;
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index b01a16bc..8f871455 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -343,9 +343,9 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg)
return;
}
- const int clientVersion = msg.readInt32();
+ client.version = msg.readInt32();
- if (clientVersion < PROTOCOL_VERSION)
+ if (client.version < MIN_PROTOCOL_VERSION)
{
reply.writeInt8(LOGIN_INVALID_VERSION);
client.send(reply);
@@ -425,13 +425,17 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg)
reply.writeInt8(ERRMSG_OK);
addServerInfo(&reply);
- client.send(reply); // Acknowledge login
- // Return information about available characters
Characters &chars = acc->getCharacters();
- // Send characters list
- sendFullCharacterData(&client, chars);
+ if (client.version < 10) {
+ client.send(reply);
+ sendFullCharacterData(&client, chars);
+ } else {
+ for (auto &charIt : chars)
+ sendCharacterData(reply, charIt.second);
+ client.send(reply);
+ }
}
void AccountHandler::handleLogoutMessage(AccountClient &client)
@@ -498,7 +502,7 @@ void AccountHandler::handleRegisterMessage(AccountClient &client,
{
reply.writeInt8(ERRMSG_FAILURE);
}
- else if (clientVersion < PROTOCOL_VERSION)
+ else if (clientVersion < MIN_PROTOCOL_VERSION)
{
reply.writeInt8(REGISTER_INVALID_VERSION);
}
@@ -963,10 +967,6 @@ void AccountHandler::handleCharacterDeleteMessage(AccountClient &client,
void AccountHandler::addServerInfo(MessageOut *msg)
{
msg->writeString(mUpdateHost);
- /*
- * This is for developing/testing an experimental new resource manager that
- * downloads only the files it needs on demand.
- */
msg->writeString(mDataUrl);
msg->writeInt8(mMaxCharacters);
}
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index cc46301c..ce41c723 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -29,7 +29,8 @@
namespace ManaServ {
enum {
- PROTOCOL_VERSION = 9,
+ PROTOCOL_VERSION = 10,
+ MIN_PROTOCOL_VERSION = 9,
SUPPORTED_DB_VERSION = 26
};
@@ -73,7 +74,7 @@ enum {
PAMSG_REQUEST_REGISTER_INFO = 0x0005, //
APMSG_REGISTER_INFO_RESPONSE = 0x0006, // B byte registration Allowed, byte minNameLength, byte maxNameLength, string captchaURL, string captchaInstructions
PAMSG_LOGIN = 0x0010, // D version, S username, S password
- APMSG_LOGIN_RESPONSE = 0x0012, // B error, S updatehost, S Client data URL, B Character slots
+ APMSG_LOGIN_RESPONSE = 0x0012, // B error, S updatehost, S Client data URL, B Character slots, {content of APMSG_CHAR_CREATE_RESPONSE (without error code)}*
PAMSG_LOGOUT = 0x0013, // -
APMSG_LOGOUT_RESPONSE = 0x0014, // B error
PAMSG_LOGIN_RNDTRGR = 0x0015, // S username