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

TFS 1.X+ Removing Browse Field

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,748
Solutions
30
Reaction score
1,529
I already removed it from client and also set the player event to return false. But still, player can open a container in the floor and through the parent container arrow that appears in container window reach the "browse field container".

Untitled-1.png

I thought about 2 possible solutions (without the need to rewrite everything to totally remove it). First, don't ever create the browse field container, so there will be no parent container to another container in the floor. Or second, if the parent container is a browse field container, don't send to the client information to add the parent container arrow to give access to the browse field container.

I tried to search stuff in game.cpp and container.cpp but couldn't identify the code that handle the stuff I pointed out. Any ideas?

otland/forgottenserver

otland/forgottenserver

otland/forgottenserver

otland/forgottenserver
 
I would do a comparison or diff between a version of sources where browsefield does not exist and where it does. That will give you a better idea on how to disable it.
 
I would do a comparison or diff between a version of sources where browsefield does not exist and where it does. That will give you a better idea on how to disable it.
I did that with 0.4, but the whole thing is so different at this point that I couldn't figure it out.
 
I did that with 0.4, but the whole thing is so different at this point that I couldn't figure it out.
I would love to dig in and find a solution for you but i really have no time til Sunday to work on or trouble-shoot anything :(
 
I did that to my server way back ago, it was an if in container.cpp but I don't quite remember how it was and where.
After changing the whole source to disable the browse field I find out all I had to do is enable the player event onBrowseField and make a return false to disable it. :)
 
I did that to my server way back ago, it was an if in container.cpp but I don't quite remember how it was and where.
After changing the whole source to disable the browse field I find out all I had to do is enable the player event onBrowseField and make a return false to disable it. :)

If you do that players can still reach browse field by using throwing containers on floor.
 
Theres a lot of related code. If you want a quick way try just remove the call from protocol (since its a Client sided action)

protocolgame.cpp
```
void ProtocolGame::parseBrowseField(NetworkMessage& msg)
{
const Position& pos = msg.getPosition();
addGameTask(&Game::playerBrowseField, player->getID(), pos);
}
```

So if you use OTC just remove Client interface stuff and its done. If theres not protocol for parse it so internal code cant do anything.
I can be missing some server side call of browse field so you need to try it anyway.
 
Theres a lot of related code. If you want a quick way try just remove the call from protocol (since its a Client sided action)

protocolgame.cpp
```
void ProtocolGame::parseBrowseField(NetworkMessage& msg)
{
const Position& pos = msg.getPosition();
addGameTask(&Game::playerBrowseField, player->getID(), pos);
}
```

So if you use OTC just remove Client interface stuff and its done. If theres not protocol for parse it so internal code cant do anything.
I can be missing some server side call of browse field so you need to try it anyway.

Player would still be able to reach the browse field option by the route I said, open a container in the floor and press the "parent arrow" in the inventory. I was thinking of report hasParent as false if parent if a browse field container, but I'm not sure how to do it otland/forgottenserver
 
I already removed it from client and also set the player event to return false. But still, player can open a container in the floor and through the parent container arrow that appears in container window reach the "browse field container".

View attachment 32403

I thought about 2 possible solutions (without the need to rewrite everything to totally remove it). First, don't ever create the browse field container, so there will be no parent container to another container in the floor. Or second, if the parent container is a browse field container, don't send to the client information to add the parent container arrow to give access to the browse field container.

I tried to search stuff in game.cpp and container.cpp but couldn't identify the code that handle the stuff I pointed out. Any ideas?

otland/forgottenserver

otland/forgottenserver

otland/forgottenserver

otland/forgottenserver

C++:
void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool hasParent, uint16_t firstIndex)
{
    NetworkMessage msg;
    msg.addByte(0x6E);

    msg.addByte(cid);

    if (container->getID() == ITEM_BROWSEFIELD) {
        return;
    } else {
        msg.addItem(container);
        msg.addString(container->getName());
    }

    msg.addByte(container->capacity());

    msg.addByte(hasParent ? 0x01 : 0x00);

    msg.addByte(container->isUnlocked() ? 0x01 : 0x00); // Drag and drop
    msg.addByte(container->hasPagination() ? 0x01 : 0x00); // Pagination

    uint32_t containerSize = container->size();
    msg.add<uint16_t>(containerSize);
    msg.add<uint16_t>(firstIndex);
    if (firstIndex < containerSize) {
        uint8_t itemsToSend = std::min<uint32_t>(std::min<uint32_t>(container->capacity(), containerSize - firstIndex), std::numeric_limits<uint8_t>::max());

        msg.addByte(itemsToSend);
        for (auto it = container->getItemList().begin() + firstIndex, end = it + itemsToSend; it != end; ++it) {
            msg.addItem(*it);
        }
    } else {
        msg.addByte(0x00);
    }
    writeToOutputBuffer(msg);
}

Should work
 
C++:
void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool hasParent, uint16_t firstIndex)
{
    NetworkMessage msg;
    msg.addByte(0x6E);

    msg.addByte(cid);

    if (container->getID() == ITEM_BROWSEFIELD) {
        return;
    } else {
        msg.addItem(container);
        msg.addString(container->getName());
    }

    msg.addByte(container->capacity());

    msg.addByte(hasParent ? 0x01 : 0x00);

    msg.addByte(container->isUnlocked() ? 0x01 : 0x00); // Drag and drop
    msg.addByte(container->hasPagination() ? 0x01 : 0x00); // Pagination

    uint32_t containerSize = container->size();
    msg.add<uint16_t>(containerSize);
    msg.add<uint16_t>(firstIndex);
    if (firstIndex < containerSize) {
        uint8_t itemsToSend = std::min<uint32_t>(std::min<uint32_t>(container->capacity(), containerSize - firstIndex), std::numeric_limits<uint8_t>::max());

        msg.addByte(itemsToSend);
        for (auto it = container->getItemList().begin() + firstIndex, end = it + itemsToSend; it != end; ++it) {
            msg.addItem(*it);
        }
    } else {
        msg.addByte(0x00);
    }
    writeToOutputBuffer(msg);
}

Should work

It works, I can't reach browse field anymore, but I want the parent container arrow to disappear also, and it still there.

untitled-1-png.32403
 
It works, I can't reach browse field anymore, but I want the parent container arrow to disappear also, and it still there.

untitled-1-png.32403
You have to change something in Tibia.exe. You can use OllyDBG and "sniff" this arrow button and fill with NOPs. Is this an official Tibia Client?
 
Last edited:
You have to change something in Tibia.exe. You can use OllyDBG and "sniff" this arrow button and fill with NOPs. Is this an official Tibia Client?
I'm using OtClient, it should be doable if I make the server return to the client a container has no parent if the parent is browse field. If I sniff the arrow button it would fuck up the cases where it's needed without browse field.

This should help you.
Server crashes when I throw a container in the floor, the arrow stills there and I click it. The crash report says it's because something with void Game:: playerMoveUpContainer(uint32_t playerId, uint8_t cid) in game.cpp.
 
Last edited:
JIC someone might come to face this...
in TFS 1.5 8.0 if i have a container on ground, it shows me the "previous/parent" container button, also, items inside have the "move up" option...

i managed to fix that this way:
on container.cpp
from
C:
bool Container::hasParent() const
{
  //return getID() != ITEM_BROWSEFIELD && dynamic_cast<const Player*>(getParent()) == nullptr;
  return dynamic_cast<const Player*>(getParent()) == nullptr;
}

to:
C:
bool Container::hasParent() const
{
return getParent()->getItem() != nullptr && dynamic_cast<const Player*>(getParent()) == nullptr;
}
 
Back
Top