• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ TFS 1.3 Max mounts above 256

Solution
‎Change red text to the code below. Its basically changing uint8 to 16. Watch out for protocolgame tho, you'd need also to update the client src.


src/luascript.cpp‎

uint8_t mountId;
uint16_t mountId;

mountId = getNumber<uint8_t>(L, 2);
mountId = getNumber<uint16_t>(L, 2);

mount = g_game.mounts.getMountByID(getNumber<uint8_t>(L, 2));
mount = g_game.mounts.getMountByID(getNumber<uint16_t>(L, 2));

‎src/mounts.cpp‎

if (nodeId == 0 || nodeId > std::numeric_limits<uint8_t>::max()) {
if (nodeId == 0 || nodeId > std::numeric_limits<uint16_t>::max()) {


static_cast<uint8_t>(nodeId),
static_cast<uint16_t>(nodeId),...
‎Change red text to the code below. Its basically changing uint8 to 16. Watch out for protocolgame tho, you'd need also to update the client src.


src/luascript.cpp‎

uint8_t mountId;
uint16_t mountId;

mountId = getNumber<uint8_t>(L, 2);
mountId = getNumber<uint16_t>(L, 2);

mount = g_game.mounts.getMountByID(getNumber<uint8_t>(L, 2));
mount = g_game.mounts.getMountByID(getNumber<uint16_t>(L, 2));

‎src/mounts.cpp‎

if (nodeId == 0 || nodeId > std::numeric_limits<uint8_t>::max()) {
if (nodeId == 0 || nodeId > std::numeric_limits<uint16_t>::max()) {


static_cast<uint8_t>(nodeId),
static_cast<uint16_t>(nodeId),

Mount* Mounts::getMountByID(uint8_t id)
Mount* Mounts::getMountByID(uint16_t id)


src/mounts.h‎

Mount(uint8_t id, uint16_t clientId, std::string name, int32_t speed, bool premium) :
Mount(uint16_t id, uint16_t clientId, std::string name, int32_t speed, bool premium) :

uint8_t id;
uint16_t id;

Mount* getMountByID(uint8_t id);
Mount* getMountByID(uint16_t id);

‎src/player.cpp‎

uint8_t Player::getCurrentMount() const
uint16_t Player::getCurrentMount() const

void Player::setCurrentMount(uint8_t mountId)
void Player::setCurrentMount(uint16_t mountId)

uint8_t currentMountId = getCurrentMount();
uint16_t currentMountId = getCurrentMount();

bool Player::tameMount(uint8_t mountId)
bool Player::tameMount(uint16_t mountId)

const uint8_t tmpMountId = mountId - 1;
const uint16_t tmpMountId = mountId - 1;

bool Player::untameMount(uint8_t mountId)
bool Player::untameMount(uint16_t mountId)

const uint8_t tmpMountId = mountId - 1;
const uint16_t tmpMountId = mountId - 1;

const uint8_t tmpMountId = mount->id - 1;
const uint16_t tmpMountId = mount->id - 1;

‎src/player.h‎

uint8_t getCurrentMount() const;
void setCurrentMount(uint8_t mountId);

uint16_t getCurrentMount() const;
void setCurrentMount(uint16_t mountId);

bool tameMount(uint8_t mountId);
bool untameMount(uint8_t mountId);

bool tameMount(uint16_t mountId);
bool untameMount(uint16_t mountId);

‎src/protocolgame.cpp‎

msg.addByte(mounts.size());
msg.add<uint16_t>(mounts.size());


and also important is to change it in OTC

protocolgameparse.cpp

void ProtocolGame::ParseOpenOutfitWindow(const InputMessagePtr& msg)

change:
int mountCount = g_game.getFeature(Otc::GameTibia12Protocol) ? msg->getU16() : msg->getU8();
int mountCount = msg->getU16();

here:

C++:
    if (g_game.getFeature(Otc::GamePlayerMounts)) {
        int mountCount = g_game.getFeature(Otc::GameTibia12Protocol) ? msg->getU16() : msg->getU8();
        for (int i = 0; i < mountCount; ++i) {
            int mountId = msg->getU16(); // mount type
            std::string mountName = msg->getString(); // mount name
            if (g_game.getFeature(Otc::GameTibia12Protocol)) {
                bool locked = msg->getU8() > 0;
                if (locked) {
                    msg->getU32(); // store offer id
                }
            }

            mountList.push_back(std::make_tuple(mountId, mountName));
        }
    }
 
Solution
‎Change red text to the code below. Its basically changing uint8 to 16. Watch out for protocolgame tho, you'd need also to update the client src.


src/luascript.cpp‎

uint8_t mountId;
uint16_t mountId;

mountId = getNumber<uint8_t>(L, 2);
mountId = getNumber<uint16_t>(L, 2);

mount = g_game.mounts.getMountByID(getNumber<uint8_t>(L, 2));
mount = g_game.mounts.getMountByID(getNumber<uint16_t>(L, 2));

‎src/mounts.cpp‎

if (nodeId == 0 || nodeId > std::numeric_limits<uint8_t>::max()) {
if (nodeId == 0 || nodeId > std::numeric_limits<uint16_t>::max()) {


static_cast<uint8_t>(nodeId),
static_cast<uint16_t>(nodeId),

Mount* Mounts::getMountByID(uint8_t id)
Mount* Mounts::getMountByID(uint16_t id)


src/mounts.h‎

Mount(uint8_t id, uint16_t clientId, std::string name, int32_t speed, bool premium) :
Mount(uint16_t id, uint16_t clientId, std::string name, int32_t speed, bool premium) :

uint8_t id;
uint16_t id;

Mount* getMountByID(uint8_t id);
Mount* getMountByID(uint16_t id);

‎src/player.cpp‎

uint8_t Player::getCurrentMount() const
uint16_t Player::getCurrentMount() const

void Player::setCurrentMount(uint8_t mountId)
void Player::setCurrentMount(uint16_t mountId)

uint8_t currentMountId = getCurrentMount();
uint16_t currentMountId = getCurrentMount();

bool Player::tameMount(uint8_t mountId)
bool Player::tameMount(uint16_t mountId)

const uint8_t tmpMountId = mountId - 1;
const uint16_t tmpMountId = mountId - 1;

bool Player::untameMount(uint8_t mountId)
bool Player::untameMount(uint16_t mountId)

const uint8_t tmpMountId = mountId - 1;
const uint16_t tmpMountId = mountId - 1;

const uint8_t tmpMountId = mount->id - 1;
const uint16_t tmpMountId = mount->id - 1;

‎src/player.h‎

uint8_t getCurrentMount() const;
void setCurrentMount(uint8_t mountId);

uint16_t getCurrentMount() const;
void setCurrentMount(uint16_t mountId);

bool tameMount(uint8_t mountId);
bool untameMount(uint8_t mountId);

bool tameMount(uint16_t mountId);
bool untameMount(uint16_t mountId);

‎src/protocolgame.cpp‎

msg.addByte(mounts.size());
msg.add<uint16_t>(mounts.size());


and also important is to change it in OTC

protocolgameparse.cpp

void ProtocolGame::ParseOpenOutfitWindow(const InputMessagePtr& msg)

change:
int mountCount = g_game.getFeature(Otc::GameTibia12Protocol) ? msg->getU16() : msg->getU8();
int mountCount = msg->getU16();

here:

C++:
    if (g_game.getFeature(Otc::GamePlayerMounts)) {
        int mountCount = g_game.getFeature(Otc::GameTibia12Protocol) ? msg->getU16() : msg->getU8();
        for (int i = 0; i < mountCount; ++i) {
            int mountId = msg->getU16(); // mount type
            std::string mountName = msg->getString(); // mount name
            if (g_game.getFeature(Otc::GameTibia12Protocol)) {
                bool locked = msg->getU8() > 0;
                if (locked) {
                    msg->getU32(); // store offer id
                }
            }

            mountList.push_back(std::make_tuple(mountId, mountName));
        }
    }
Thank you for taking the time to help me and others <3
 
Back
Top