• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Custom Client Version

Some1

New Member
Joined
Jan 12, 2013
Messages
40
Reaction score
4
Hello.

I'm trying to make a custom client but I also want to change the version/protocol (like to 1.0) but I've been stuck at some point for hours now.

I've edited the resources.h file and changed those lines:
Code:
#define CLIENT_VERSION_MIN 100
#define CLIENT_VERSION_MAX 100
#define CLIENT_VERSION_STRING "Only client with protocol 1.00 allowed!"
...
#define STATUS_SERVER_PROTOCOL "1.00"

Then I tried to edit the client (tibia.exe), I changed the RSA key, IP so it doesn't need any IP changer to login and I changed the version from 8.54 to 1.00 at 3 places. (somewhere near the bottom).

Now it's loading the char list but if I try to login it still says "Only client with protocol 1.00 allowed!"
I think that the compiling part is okay and the problem has to be in the client, but I can't find where else to change it. I found version 8.54 at 3 places only and changed them all.
I found the 'Info' about the client but I don't think it has anything to do with preventing me from logging.
What did I forget? Tips? Help?
Also, is it necessary to change the RSA key in otserv.cpp too?
 
Use a HEX editor and change these values:

[Address, Value]

Code:
0x00015A74, " 56 03 " to " 64 00 "
And the same thing at
Code:
0x00016403
 
Use a HEX editor and change these values:

[Address, Value]

Code:
0x00015A74, " 56 03 " to " 64 00 "
And the same thing at
Code:
0x00016403


Earlier it would let me load the char. list but when trying to login it would say that only client 1.00 is allowed.
I have changed what you said above and now it's not loading the char. list but instead it says that only client 8.54 is allowed.
 
Earlier it would let me load the char. list but when trying to login it would say that only client 1.00 is allowed.
I have changed what you said above and now it's not loading the char. list but instead it says that only client 8.54 is allowed.

Then you need to fix your server properly so it only connects with protocol version " 100 "
 
I've changed the resources.h file and apart from that I don't really know where to look at.
I found this in itemloader.h but don't know what those values mean.
Code:
enum clientVersion_t
{
    CLIENT_VERSION_750 = 1,
    CLIENT_VERSION_755 = 2,
    CLIENT_VERSION_760 = 3,
    CLIENT_VERSION_770 = 3,
    CLIENT_VERSION_780 = 4,
    CLIENT_VERSION_790 = 5,
    CLIENT_VERSION_792 = 6,
    CLIENT_VERSION_800 = 7,
    CLIENT_VERSION_810 = 8,
    CLIENT_VERSION_811 = 9,
    CLIENT_VERSION_820 = 10,
    CLIENT_VERSION_830 = 11,
    CLIENT_VERSION_840 = 12,
    CLIENT_VERSION_841 = 13,
    CLIENT_VERSION_842 = 14,
    CLIENT_VERSION_850 = 15,
    CLIENT_VERSION_854 = 16
};

I also found this in protocolgame.cpp
Code:
    msg.SkipBytes(6); //841- wtf?
    if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX)
    {
        disconnectClient(0x14, CLIENT_VERSION_STRING);
        return false;
    }
And something similar in protocollogin.cpp
Code:
    }

    if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX)
    {
        disconnectClient(0x0A, CLIENT_VERSION_STRING);
        return false;
    }
However, both CLIENT_VERSION_MIN/MAX are set to 100 in resources.h and the CLIENT_VERSION_STRING should be saying about protocol 1.00, not 8.54.
There is also this in protocolold.cpp. I tried to set both to 100 but it didn't change a thing.
Code:
    /*uint16_t operatingSystem = */msg.GetU16();
    uint16_t version = msg.GetU16();
    msg.SkipBytes(12);
    if(version <= 760)
        disconnectClient(0x0A, CLIENT_VERSION_STRING);

    if(!RSA_decrypt(msg))
    {
        getConnection()->close();
        return false;
    }

    uint32_t key[4] = {msg.GetU32(), msg.GetU32(), msg.GetU32(), msg.GetU32()};
    enableXTEAEncryption();
    setXTEAKey(key);

    if(version <= 822)
        disableChecksum();

    disconnectClient(0x0A, CLIENT_VERSION_STRING);
    return false;
 
Try this: (protocolold.cpp)

Code:
////////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
////////////////////////////////////////////////////////////////////////
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
#include "otpch.h"
#include "resources.h"

#include "protocolold.h"
#include "rsa.h"

#include "outputmessage.h"
#include "connection.h"
#if defined(WINDOWS) && !defined(__CONSOLE__)
#include "gui.h"
#endif

#include "game.h"
extern Game g_game;

#ifdef __ENABLE_SERVER_DIAGNOSTIC__
uint32_t ProtocolOld::protocolOldCount = 0;
#endif

#ifdef __DEBUG_NET_DETAIL__
void ProtocolOld::deleteProtocolTask()
{
   std::cout << "Deleting ProtocolOld" << std::endl;
   Protocol::deleteProtocolTask();
}
#endif

void ProtocolOld::disconnectClient(uint8_t error, const char* message)
{
   if(OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false))
   {
     TRACK_MESSAGE(output);
     output->AddByte(error);
     output->AddString(message);
     OutputMessagePool::getInstance()->send(output);
   }

   getConnection()->close();
}

bool ProtocolOld::parseFirstPacket(NetworkMessage& msg)
{
   if(
#if defined(WINDOWS) && !defined(__CONSOLE__)
     !GUI::getInstance()->m_connections ||
#endif
     g_game.getGameState() == GAME_STATE_SHUTDOWN)
   {
     getConnection()->close();
     return false;
   }

   /*uint16_t operatingSystem = */msg.GetU16();
   uint16_t version = msg.GetU16();
   msg.SkipBytes(12);
   if(version <= 760 && (version < CLIENT_VERSION_MIN && version > CLIENT_VERSION_MAX))
     disconnectClient(0x0A, CLIENT_VERSION_STRING);

   if(!RSA_decrypt(msg))
   {
     getConnection()->close();
     return false;
   }

   uint32_t key[4] = {msg.GetU32(), msg.GetU32(), msg.GetU32(), msg.GetU32()};
   enableXTEAEncryption();
   setXTEAKey(key);

   if(version <= 822 && version != CLIENT_VERSION_MIN && version != CLIENT_VERSION_MAX)
     disableChecksum();
 
   if(version < CLIENT_VERSION_MIN && version > CLIENT_VERSION_MAX)
     disconnectClient(0x0A, CLIENT_VERSION_STRING);
   return false;
}

void ProtocolOld::onRecvFirstMessage(NetworkMessage& msg)
{
   parseFirstPacket(msg);
}

I haven't tried it myself, but it should work.
 
Back
Top