• 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!

Compiling changes for 10.80

Scrappy Coco

Member
Joined
Dec 27, 2014
Messages
95
Reaction score
17
Is tedious wait update TFS servers for that reason I make this thread.
I would like to learn how to update my server by editing the source code .
NO LOOKING GIVE ME CODES .

Just I wanted to tell me where there need to modify the code and thank you.


MyHOkso.png
 
@Sir Islam
try changing the protocol and the result was a debug . I do not enter either the account

!bump bump bump...................................
 
Last edited by a moderator:
I think it would have to edit some of this line conection.cpp @gs1994

Code:
void Connection::parsePacket(const boost::system::error_code& error)
{
    std::lock_guard<std::recursive_mutex> lockClass(m_connectionLock);
    m_readTimer.cancel();

    if (error) {
        handleReadError(error);
    }

    if (m_connectionState != CONNECTION_STATE_OPEN || m_readError) {
        close();
        return;
    }

    //Check packet checksum
    uint32_t checksum;
    int32_t len = m_msg.getLength() - m_msg.getBufferPosition() - 4;
    if (len > 0) {
        checksum = adlerChecksum(m_msg.getBuffer() + m_msg.getBufferPosition() + 4, len);
    } else {
        checksum = 0;
    }

    uint32_t recvChecksum = m_msg.get<uint32_t>();
    if (recvChecksum != checksum) {
        // it might not have been the checksum, step back
        m_msg.skipBytes(-4);
    }

    if (!m_receivedFirst) {
        // First message received
        m_receivedFirst = true;

        if (!m_protocol) {
            // Game protocol has already been created at this point
            m_protocol = m_service_port->make_protocol(recvChecksum == checksum, m_msg);
            if (!m_protocol) {
                close();
                return;
            }

            m_protocol->setConnection(shared_from_this());
        } else {
            m_msg.getByte();    // Skip protocol ID
        }

        m_protocol->onRecvFirstMessage(m_msg);
    } else {
        m_protocol->onRecvMessage(m_msg);    // Send the packet to the current protocol
    }

    try {
        m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::read_timeout));
        m_readTimer.async_wait( std::bind(&Connection::handleReadTimeout, std::weak_ptr<Connection>(shared_from_this()),
                                            std::placeholders::_1));

        // Wait to the next packet
        boost::asio::async_read(getHandle(),
                                boost::asio::buffer(m_msg.getBuffer(), NetworkMessage::header_length),
                                std::bind(&Connection::parseHeader, shared_from_this(), std::placeholders::_1));
    } catch (boost::system::system_error& e) {
        if (m_logError) {
            std::cout << "[Network error - Connection::parsePacket] " << e.what() << std::endl;
            m_logError = false;
        }

        close();
    }
}
 
just change 1077 to 1078 dudeeeeeee
ROFL
just take an example to my sir Islam.
my definitions.h

Code:
#define CLIENT_VERSION_MIN 1077
#define CLIENT_VERSION_MAX 1080
#define CLIENT_VERSION_STR "10.80"




10.80 has alot of changes, it's no longer posible to just change the definitions.
Either do as we all have when trying to learn it "try, fail and hopefully succed" or wait for someone to update it.
TFS will be updated when 1.2 is released (most likely) so it's gonna be a while.

if you're right and everyone hopes to actualize the TFS team . but I want to learn and to contribute what they can esque ask why an orientation that is what I have to change .
As thanks for taking the time to read this post thanks

-- Double Post Merged, at Sun Aug 2, 2015 22:26 PM --

bump!
 
Last edited by a moderator:
10.80 has alot of changes, it's no longer posible to just change the definitions.
Either do as we all have when trying to learn it "try, fail and hopefully succed" or wait for someone to update it.
TFS will be updated when 1.2 is released (most likely) so it's gonna be a while.
 
First solution is to change this whole code:
Code:
//Add premium days
    if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        output->add<uint16_t>(0xFFFF);    //client displays free premium
    } else {
        output->add<uint16_t>(account.premiumDays);
    }

to:
Code:
output->add<uint16_t>(0xFFFFFFFFFF);
or
Code:
output->add<uint16_t>(0x0000000000);

It will display free/premium account. I think, that in 10.80 tibia client get the full date of premium expire date, and then count days left before shows it.

Next you need to change something after login :D I will get it tomorrow and paste here.

-- Double Post Merged, at Sun Aug 2, 2015 22:28 PM --

Next part is something with:

Code:
void ProtocolGame::sendAddCreature(const Creature* creature, const Position& pos, int32_t stackpos, bool isLogin)

After

Code:
msg.AddByte(0x17);

There is something missing. I saw that in client, before the vip list in the client is printed the character logged name, idk what for, but i think that this is missing in tfs.
 
Last edited by a moderator:
if you're right and everyone hopes to actualize the TFS team . but I want to learn and to contribute what they can esque ask why an orientation that is what I have to change .
As thanks for taking the time to read this post thanks

Serach on how you read incoming and outgoing packages, aswell as the decrypting of these.
Hint: map tracker.

Secondly, learn to read the debug messages, as below.


In this case it gets the wrong lenght of something (read last 2 lines).
To then find the problem, read and understand the Last Packet Types aswell as Last packet.
Get the hex value (since TFS uses hex), find the related package and then track that package on RL, see what you send on your OT aswell as what RL sends.
There are easier and harder ways, but id say this is the quickest to learn with what you can get to right now.

I can say that you will also need to know plenty of C++ to be able to create the new protocol for 10.80, aswell as a good understanding of how TFS handles everything.
So id start with trying to learn the coding of TFS insted of trying to learn this first, but the things above should be able to get you going if you have a basic understanding of the things spoken of.
- Learn to ride a bicycle before you learn to drive a motorcycle.
 
First solution is to change this whole code:
Code:
//Add premium days
    if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        output->add<uint16_t>(0xFFFF);    //client displays free premium
    } else {
        output->add<uint16_t>(account.premiumDays);
    }

to:
Code:
output->add<uint16_t>(0xFFFFFFFFFF);
or
Code:
output->add<uint16_t>(0x0000000000);

It will display free/premium account. I think, that in 10.80 tibia client get the full date of premium expire date, and then count days left before shows it.

Next you need to change something after login :D I will get it tomorrow and paste here.

-- Double Post Merged, at Sun Aug 2, 2015 22:28 PM --

Next part is something with:

Code:
void ProtocolGame::sendAddCreature(const Creature* creature, const Position& pos, int32_t stackpos, bool isLogin)

After

Code:
msg.AddByte(0x17);

There is something missing. I saw that in client, before the vip list in the client is printed the character logged name, idk what for, but i think that this is missing in tfs.

no effect of code changes and try different ways and still enter the characterlist .


@WibbenZ
you're right about all that's why I made this thread to learn more about the program and how it works .
spoiling learn a Mexican proverb says


I did not understand in the part of the Get the hexadecimal value could explain that a little more in depth and how to understand debug messages scrappy thanks and best regards.
 
no effect of code changes and try different ways and still enter the characterlist .


@WibbenZ
you're right about all that's why I made this thread to learn more about the program and how it works .
spoiling learn a Mexican proverb says


I did not understand in the part of the Get the hexadecimal value could explain that a little more in depth and how to understand debug messages scrappy thanks and best regards.

Let's take the error you got an as example.

Lets start by reading the last 2 packets, (Last Packet Types aswell as Last packet).
We now have 2 values, 100 and 020.
We then google "100 to hex" and find 0x64 we then serach for the hex value (note not the decimal value) in the source code, we then end up here - https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L2252-L2259
Then we do the same with "20 to hex" and then we get 0x14 - https://github.com/otland/forgottenserver/blob/master/src/protocollogin.cpp#L62

Then you have to check how the client is sending the packages - this is the hard and not so fun part.
In some cases you can go by just reading the debug log, but you won't see where the new / old packages should be added / removed.

If let's say with the new shop, to get the values of it you have to track the packages the server is sending to the client, then convert them to hex values (atleast the headers) to then be able to write the new C++ and Lua code to be able to handle the new things that the server has to offer :p

This is not something I would start doing right away, as I said before learn how TFS works first of all, then how TFS handles packages etc
After that start with these things, you will most likely just end up wasting time as it is right now.
 
Back
Top