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

C++ Addon/Outfit System | Nostalrius 7.7 TFS 1.2

helviio

Member
Joined
Apr 30, 2019
Messages
42
Solutions
1
Reaction score
7

I Search For Help To Install Outfit / Addon System on Nostalrius 7.7 TSF 1.2

[ Member Based Image ...
wizinx ]

Sem título.png

I tried to use the tfs 1.2 server from celohere/forgottenserver (https://github.com/celohere/forgottenserver)

but I was not successful my map bugged the char was not walking

bug client (all I've tried ... OTC, OTCV8, Classic TIbia client)

I am new to tibia server editing and would like help
Thank you and I'm waiting!






 
OP
OP
helviio

helviio

Member
Joined
Apr 30, 2019
Messages
42
Solutions
1
Reaction score
7
He needs more than just adding few files to the client.

@OP
You need to add the protocols required to make work the client (adding the outfit structure back), etc




I understand what you mean but I need an example or a guide on how to do it ... I do it myself without any problems ... I would need a "base" and an explanation
 

ayusutina

Banned User
Joined
May 10, 2013
Messages
127
Solutions
3
Reaction score
101
I understand what you mean but I need an example or a guide on how to do it ... I do it myself without any problems ... I would need a "base" and an explanation
Take original TFS 1.1 and do the compare between both servers, if you know a bit of c++ you will know what to do
 

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
898
Solutions
21
Reaction score
428
Location
Santiago - Chile
@helviio Hi, please avoid bumping.
OTLand rules said:
2. Spamming / Double post:
You may not repeat the same message multiple times. It is seen as spamming, and will be deleted. If you accidentally post the same content twice, report one of the duplicate posts so a moderator can delete or merge that post.
This also applies if you for example "bump" a thread.

About the topic, you will first need to know how to compile. Second, how to use OTClient, because that will allow you to edit client sources (OTCv8 is closed source so it is impossible to do this edition on that client). I don't know which OTClient repository is the best for 7.7 but you can try mehah/otclient (https://github.com/mehah/otclient/tree/cache-for-all/data) or edubart/otclient (https://github.com/edubart/otclient)

I won't solve your question, that would requiere a lot of test and work, but I can guide you how to start building a solution.
First, I see you're requesting addons for an old client. You need to check for this void in protocolgame.cpp on your server sources
Code:
void ProtocolGame::sendOutfitWindow() <--- this void is related to the outfit window

If you go to a 8.60 github branch, for example, this one Fablow77/otx3.8rebirth (https://github.com/Fablow77/otx3.8rebirth/blob/main/src/protocolgame.cpp) you will see that void SendOutfitWindow contains this
Code:
void ProtocolGame::sendOutfitWindow()
{
    NetworkMessage msg;
    msg.addByte(0xC8);

    Outfit_t currentOutfit = player->getDefaultOutfit();
    AddOutfit(msg, currentOutfit);

    std::vector<ProtocolOutfit> protocolOutfits;
    if (player->isAccessPlayer()) {
        static const std::string gamemasterOutfitName = "Gamemaster";
        protocolOutfits.emplace_back(gamemasterOutfitName, 75, 0);
    }

    const auto& outfits = Outfits::getInstance()->getOutfits(player->getSex());
    protocolOutfits.reserve(outfits.size());
    for (const Outfit& outfit : outfits) {
        uint8_t addons;
        if (!player->getOutfitAddons(outfit, addons)) {
            continue;
        }

        protocolOutfits.emplace_back(outfit.name, outfit.lookType, addons);
        if (protocolOutfits.size() == 26) { // Game client doesn't allow more than 26 outfits
            break;
        }
    }

    msg.addByte(protocolOutfits.size());
    for (const ProtocolOutfit& outfit : protocolOutfits) {
        msg.add<uint16_t>(outfit.lookType);
        msg.addString(outfit.name);
        msg.addByte(outfit.addons);
    }

    writeToOutputBuffer(msg);
}

And Nostalrius, for example, in this git repository TwistedScorpio/Nostalrius (https://github.com/TwistedScorpio/Nostalrius/blob/master/src/protocolgame.cpp) have this on void setOutfitWindow:
Code:
void ProtocolGame::sendOutfitWindow()
{
    NetworkMessage msg;
    msg.addByte(0xC8);

    Outfit_t currentOutfit = player->getDefaultOutfit();
    AddOutfit(msg, currentOutfit);

    if (player->getSex() == PLAYERSEX_MALE) {
        msg.add<uint16_t>(128);
        if (player->isPremium()) {
            msg.add<uint16_t>(134);
        } else {
            msg.add<uint16_t>(131);
        }
    } else {
        msg.add<uint16_t>(136);
        if (player->isPremium()) {
            msg.add<uint16_t>(142);
        } else {
            msg.add<uint16_t>(139);
    }
    }

    writeToOutputBuffer(msg);
}

You will see there's a clear difference between this two C++ codes. From this line AddOutfit(msg, currentOutfit); the code start changing. You will have to figure out how does the rest of the code from 8.60 repository works and which difference it has with Nostalrius. You will see this line
Code:
        uint8_t addons;
        if (!player->getOutfitAddons(outfit, addons)) {
            continue;
Is related to player addons. This is a hint of what you should start searching and which posts have relation to this line. For example, search on google "if (!player->getOutfitAddons(outfit, addons)) otland" and you will see that the results start appearing. Try to descompose the source code and start searching for results. That will help you finding solutions instead of just bumping the thread.

I can tell you that protocolgame.cpp isn't the only file you will need to change from the sources, there's some editions you have to do, for example, on bool Player::getOutfitAddons at outfit.h and outfit.cpp. You will have to do a lot of search and see if you get a good result. Another example could be player.cpp in bool Player::canWear that refers if a player can wear an addon or not.

After know which changes you need to apply to server sources, the rest is OTClient editing to let the client work along with your server editions (with this I mean, sprite edition with Object Builder, source change like is mentioned here TFS 0.X - [7.72] Adding outfits OTClient (https://otland.net/threads/7-72-adding-outfits-otclient.275856/), among other things). It's a lot of work. Good luck!
 
Last edited:
OP
OP
helviio

helviio

Member
Joined
Apr 30, 2019
Messages
42
Solutions
1
Reaction score
7
@helviio Hi, please avoid bumping.


About the topic, you will first need to know how to compile. Second, how to use OTClient, because that will allow you to edit client sources (OTCv8 is closed source so it is impossible to do this edition on that client). I don't know which OTClient repository is the best for 7.7 but you can try mehah/otclient (https://github.com/mehah/otclient/tree/cache-for-all/data) or edubart/otclient (https://github.com/edubart/otclient)

I won't solve your question, that would requiere a lot of test and work, but I can guide you how to start building a solution.
First, I see you're requesting addons for an old client. You need to check for this void in protocolgame.cpp on your server sources
Code:
void ProtocolGame::sendOutfitWindow() <--- this void is related to the outfit window

If you go to a 8.60 github branch, for example, this one Fablow77/otx3.8rebirth (https://github.com/Fablow77/otx3.8rebirth/blob/main/src/protocolgame.cpp) you will see that void SendOutfitWindow contains this
Code:
void ProtocolGame::sendOutfitWindow()
{
    NetworkMessage msg;
    msg.addByte(0xC8);

    Outfit_t currentOutfit = player->getDefaultOutfit();
    AddOutfit(msg, currentOutfit);

    std::vector<ProtocolOutfit> protocolOutfits;
    if (player->isAccessPlayer()) {
        static const std::string gamemasterOutfitName = "Gamemaster";
        protocolOutfits.emplace_back(gamemasterOutfitName, 75, 0);
    }

    const auto& outfits = Outfits::getInstance()->getOutfits(player->getSex());
    protocolOutfits.reserve(outfits.size());
    for (const Outfit& outfit : outfits) {
        uint8_t addons;
        if (!player->getOutfitAddons(outfit, addons)) {
            continue;
        }

        protocolOutfits.emplace_back(outfit.name, outfit.lookType, addons);
        if (protocolOutfits.size() == 26) { // Game client doesn't allow more than 26 outfits
            break;
        }
    }

    msg.addByte(protocolOutfits.size());
    for (const ProtocolOutfit& outfit : protocolOutfits) {
        msg.add<uint16_t>(outfit.lookType);
        msg.addString(outfit.name);
        msg.addByte(outfit.addons);
    }

    writeToOutputBuffer(msg);
}

And Nostalrius, for example, in this git repository TwistedScorpio/Nostalrius (https://github.com/TwistedScorpio/Nostalrius/blob/master/src/protocolgame.cpp) have this on void setOutfitWindow:
Code:
void ProtocolGame::sendOutfitWindow()
{
    NetworkMessage msg;
    msg.addByte(0xC8);

    Outfit_t currentOutfit = player->getDefaultOutfit();
    AddOutfit(msg, currentOutfit);

    if (player->getSex() == PLAYERSEX_MALE) {
        msg.add<uint16_t>(128);
        if (player->isPremium()) {
            msg.add<uint16_t>(134);
        } else {
            msg.add<uint16_t>(131);
        }
    } else {
        msg.add<uint16_t>(136);
        if (player->isPremium()) {
            msg.add<uint16_t>(142);
        } else {
            msg.add<uint16_t>(139);
    }
    }

    writeToOutputBuffer(msg);
}

You will see there's a clear difference between this two C++ codes. From this line AddOutfit(msg, currentOutfit); the code start changing. You will have to figure out how does the rest of the code from 8.60 repository works and which difference it has with Nostalrius. You will see this line
Code:
        uint8_t addons;
        if (!player->getOutfitAddons(outfit, addons)) {
            continue;
Is related to player addons. This is a hint of what you should start searching and which posts have relation to this line. For example, search on google "if (!player->getOutfitAddons(outfit, addons)) otland" and you will see that the results start appearing. Try to descompose the source code and start searching for results. That will help you finding solutions instead of just bumping the thread.

I can tell you that protocolgame.cpp isn't the only file you will need to change from the sources, there's some editions you have to do, for example, on bool Player::getOutfitAddons at outfit.h and outfit.cpp. You will have to do a lot of search and see if you get a good result. Another example could be player.cpp in bool Player::canWear that refers if a player can wear an addon or not.

After know which changes you need to apply to server sources, the rest is OTClient editing to let the client work along with your server editions (with this I mean, sprite edition with Object Builder, source change like is mentioned here TFS 0.X - [7.72] Adding outfits OTClient (https://otland.net/threads/7-72-adding-outfits-otclient.275856/), among other things). It's a lot of work. Good luck!



thank you very much @ralke and I'm sorry for my mistake ... I was almost giving up ... your explanation motivated me to continue, thank you very much for taking the time to create this explanation!
 
Top