Hey,
I have problem, and i don't know its working properly even in latets new tfs, so i need to figure out that players using classic tibia version or otclient.
I search in code that's something exists that might read it.
protocolgame.cpp
and further in ProtocolGame::login important line
enum
So I read every time when I log in to player and printing operatingSystem what server read, and always get number 2 whats is defined for windows. That's correct because I always log in on windows clients but why doesn't recognize that I using otclient? I used 2 otclients for check if even otclients wrong but no, changed getOs in otclient for other values but even tho doen't work...
Any idea?
I am using tfs 1.2 but I checked latest tfs on github and code is the same for this actions so I guess that's part of code doesn't work properly
I have problem, and i don't know its working properly even in latets new tfs, so i need to figure out that players using classic tibia version or otclient.
I search in code that's something exists that might read it.
protocolgame.cpp
C++:
void ProtocolGame::onRecvFirstMessage(NetworkMessage& msg)
{
if (g_game.getGameState() == GAME_STATE_SHUTDOWN) {
disconnect();
return;
}
OperatingSystem_t operatingSystem = static_cast<OperatingSystem_t>(msg.get<uint16_t>());
std::cout << operatingSystem << std::endl;
version = msg.get<uint16_t>();
if (!Protocol::RSA_decrypt(msg)) {
disconnect();
return;
}
uint32_t key[4];
key[0] = msg.get<uint32_t>();
key[1] = msg.get<uint32_t>();
key[2] = msg.get<uint32_t>();
key[3] = msg.get<uint32_t>();
enableXTEAEncryption();
setXTEAKey(key);
if (operatingSystem >= CLIENTOS_OTCLIENT_LINUX) {
NetworkMessage opcodeMessage;
opcodeMessage.addByte(0x32);
opcodeMessage.addByte(0x00);
opcodeMessage.add<uint16_t>(0x00);
writeToOutputBuffer(opcodeMessage);
}
msg.skipBytes(1); // gamemaster flag
uint32_t accountName = msg.get<uint32_t>();
std::string characterName = msg.getString();
std::string password = msg.getString();
if (version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) {
disconnectClient("Only clients with protocol " CLIENT_VERSION_STR " allowed!");
return;
}
if (accountName == 0) {
disconnectClient("You must enter your account number.");
return;
}
if (g_game.getGameState() == GAME_STATE_STARTUP) {
disconnectClient("Gameworld is starting up. Please wait.");
return;
}
if (g_game.getGameState() == GAME_STATE_MAINTAIN) {
disconnectClient("Gameworld is under maintenance. Please re-connect in a while.");
return;
}
BanInfo banInfo;
if (IOBan::isIpBanned(getIP(), banInfo)) {
if (banInfo.reason.empty()) {
banInfo.reason = "(none)";
}
std::ostringstream ss;
ss << "Your IP has been banned until " << formatDateShort(banInfo.expiresAt) << " by " << banInfo.bannedBy << ".\n\nReason specified:\n" << banInfo.reason;
disconnectClient(ss.str());
return;
}
uint32_t accountId = IOLoginData::gameworldAuthentication(accountName, password, characterName);
if (accountId == 0) {
disconnectClient("Account number or password is not correct.");
return;
}
g_dispatcher.addTask(createTask(std::bind(&ProtocolGame::login, getThis(), characterName, accountId, operatingSystem)));
}
and further in ProtocolGame::login important line
C++:
player->setOperatingSystem(operatingSystem);
enum
C++:
enum OperatingSystem_t : uint8_t {
CLIENTOS_NONE = 0,
CLIENTOS_LINUX = 1,
CLIENTOS_WINDOWS = 2,
CLIENTOS_FLASH = 3,
CLIENTOS_OTCLIENT_LINUX = 10,
CLIENTOS_OTCLIENT_WINDOWS = 11,
CLIENTOS_OTCLIENT_MAC = 12,
};
So I read every time when I log in to player and printing operatingSystem what server read, and always get number 2 whats is defined for windows. That's correct because I always log in on windows clients but why doesn't recognize that I using otclient? I used 2 otclients for check if even otclients wrong but no, changed getOs in otclient for other values but even tho doen't work...
Any idea?
I am using tfs 1.2 but I checked latest tfs on github and code is the same for this actions so I guess that's part of code doesn't work properly