Skip to content

Commit

Permalink
Game protocol 10.20 support
Browse files Browse the repository at this point in the history
Protocol 10.10 will still be maintained until OTLand IP Changer has been
updated.
  • Loading branch information
marksamman committed Oct 14, 2013
1 parent c5aee40 commit 6457062
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 17 deletions.
Binary file modified data/items/items.otb
Binary file not shown.
6 changes: 3 additions & 3 deletions src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#define __OTSERV_DEFINITIONS_H__

#define STATUS_SERVER_NAME "The Forgotten Server"
#define STATUS_SERVER_PROTOCOL "10.1"
#define STATUS_SERVER_PROTOCOL "10.20"
#define STATUS_SERVER_VERSION "1.0"
#define STATUS_SERVER_DEVELOPERS "Mark Samman"

#define CLIENT_VERSION_MIN 1010
#define CLIENT_VERSION_MAX 1010
#define CLIENT_VERSION_STR "10.1"
#define CLIENT_VERSION_MAX 1020
#define CLIENT_VERSION_STR "10.20"

#ifndef __FUNCTION__
#define __FUNCTION__ __func__
Expand Down
4 changes: 3 additions & 1 deletion src/itemloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ enum clientVersion_t {
CLIENT_VERSION_982 = 46,
CLIENT_VERSION_983 = 47,
CLIENT_VERSION_985 = 48,
CLIENT_VERSION_986 = 49
CLIENT_VERSION_986 = 49,
CLIENT_VERSION_1010 = 50,
CLIENT_VERSION_1020 = 51
};

enum rootattrib_ {
Expand Down
2 changes: 1 addition & 1 deletion src/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ int32_t Items::loadFromOtb(const std::string& file)
} else if (Items::dwMajorVersion != 3) {
std::cout << "Old version detected, a newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
} else if (Items::dwMinorVersion < CLIENT_VERSION_980) {
} else if (Items::dwMinorVersion < CLIENT_VERSION_1010) {
std::cout << "A newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
}
Expand Down
62 changes: 50 additions & 12 deletions src/protocollogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,62 @@ bool ProtocolLogin::parseFirstPacket(NetworkMessage& msg)

//Add char list
output->AddByte(0x64);
output->AddByte((uint8_t)account.charList.size());

for (const std::string& characterName : account.charList) {
output->AddString(characterName);

if (version > 1010) {
if (g_config.getBoolean(ConfigManager::ON_OR_OFF_CHARLIST)) {
if (g_game.getPlayerByName(characterName)) {
output->AddString("Online");
} else {
output->AddString("Offline");
}
output->AddByte(2);

output->AddByte(0);
output->AddString("Offline");
output->AddString(g_config.getString(ConfigManager::IP));
output->AddU16(g_config.getNumber(ConfigManager::GAME_PORT));
output->AddByte(0);

output->AddByte(1);
output->AddString("Online");
output->AddString(g_config.getString(ConfigManager::IP));
output->AddU16(g_config.getNumber(ConfigManager::GAME_PORT));
output->AddByte(0);
} else {
output->AddByte(1); // number of worlds

output->AddByte(0); // world id
output->AddString(g_config.getString(ConfigManager::SERVER_NAME));
output->AddString(g_config.getString(ConfigManager::IP));
output->AddU16(g_config.getNumber(ConfigManager::GAME_PORT));
output->AddByte(0);
}

output->AddU32(serverip);
output->AddU16(g_config.getNumber(ConfigManager::GAME_PORT));
output->AddByte(0x00);
output->AddByte((uint8_t)account.charList.size());
for (const std::string& characterName : account.charList) {
if (g_config.getBoolean(ConfigManager::ON_OR_OFF_CHARLIST)) {
output->AddByte(g_game.getPlayerByName(characterName) != NULL ? 1 : 0);
} else {
output->AddByte(0);
}

output->AddString(characterName);
}
} else {
output->AddByte((uint8_t)account.charList.size());

for (const std::string& characterName : account.charList) {
output->AddString(characterName);

if (g_config.getBoolean(ConfigManager::ON_OR_OFF_CHARLIST)) {
if (g_game.getPlayerByName(characterName)) {
output->AddString("Online");
} else {
output->AddString("Offline");
}
} else {
output->AddString(g_config.getString(ConfigManager::SERVER_NAME));
}

output->AddU32(serverip);
output->AddU16(g_config.getNumber(ConfigManager::GAME_PORT));
output->AddByte(0x00);
}
}

//Add premium days
Expand Down

0 comments on commit 6457062

Please sign in to comment.