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

Any ideas how to break 2b HP limit in monsters?

Dran Ryszard

Member
Joined
Apr 25, 2023
Messages
72
Reaction score
15
Location
Poland
Any ideas how to break 2b HP limit in monsters?
TFS 1.5 Downgraded 8.6 Nekiro

I was change all what i found with health/monsters int/uint32 to int/uint64 but still limit is 2.1B
Changed files:
creature.h
creature.cpp
iologindata.cpp
luascript.cpp
monster.cpp
monster.h
player.cpp (but here i think is only about hp for player?, but on player hp limit is still 2.1b, so that needed something more)
player.h(up)
 
protocolgame.cpp
search for:
void ProtocolGame::sendCreatureHealth(const Creature* creature)
void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bool known, uint32_t remove)
and apply your changes, should be working then
 
void ProtocolGame::sendCreatureHealth(const Creature* creature)

Changed but still limit not brake :/
I tried change uint32_t inside function too, but then i get few bugs when i login to the game, i don't see health and character outfit, and few sqm on the map be only black.

protocolgame.cpp
Code:
void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bool known, uint64_t remove)
{
    const Player* otherPlayer = creature->getPlayer();
    if (known) {
        msg.add<uint16_t>(0x62);
        msg.add<uint32_t>(creature->getID());
    } else {
        msg.add<uint16_t>(0x61);
        msg.add<uint32_t>(remove);
        msg.add<uint32_t>(creature->getID());
                const Monster* monster = creature->getMonster();
        if (monster && monster->getLevel() > 0) {
            msg.addString(creature->getName() + " [" + std::to_string(monster->getLevel()) + "]");
        } else {
            msg.addString(creature->getName());
        }
    }

    if (creature->isHealthHidden()) {
        msg.addByte(0x00);
    } else {
        msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int64_t>(creature->getMaxHealth(), 1)) * 100));
    }

    msg.addByte(creature->getDirection());

    if (!creature->isInGhostMode() && !creature->isInvisible()) {
        AddOutfit(msg, creature->getCurrentOutfit());
    } else {
        static Outfit_t outfit;
        AddOutfit(msg, outfit);
    }

    LightInfo lightInfo = creature->getCreatureLight();
    msg.addByte(player->isAccessPlayer() ? 0xFF : lightInfo.level);
    msg.addByte(lightInfo.color);

    msg.add<uint16_t>(creature->getStepSpeed());

    msg.addByte(creature->getSkullClient(creature));
    msg.addByte(player->getPartyShield(otherPlayer));

    if (!known) {
        msg.addByte(player->getGuildEmblem(otherPlayer));
    }

    msg.addByte(player->canWalkthroughEx(creature) ? 0x00 : 0x01);
}

Code:
void ProtocolGame::sendCreatureHealth(const Creature* creature)
{
    NetworkMessage msg;
    msg.addByte(0x8C);
    msg.add<uint64_t>(creature->getID());

    if (creature->isHealthHidden()) {
        msg.addByte(0x00);
    } else {
        msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int64_t>(creature->getMaxHealth(), 1)) * 100));
    }
    writeToOutputBuffer(msg);
}

protocolgame.h
Code:
        void AddCreature(NetworkMessage& msg, const Creature* creature, bool known, uint64_t remove);
 
Npc, players and monsters are creatures.

Yes but that wasn't my question but its prob because I wrote it wrong :D
I got ready to use source from Nekiro which contains more int32 to int64 changes than only for "health"
That's the reason why I asked him it so I can just send him the source and he can compare it or use it :p

Anyway,
@Dran Ryszard
You can check those source and compare what you missed :D
 

Attachments

Last edited:
Yes but that wasn't my question but its prob because I wrote it wrong :D
I got ready to use source from Nekiro which contains more int32 to int64 changes than only for "health"
That's the reason why I asked him it so I can just send him the source and he can compare it or use it :p

Anyway,
@Dran Ryszard
You can check those source and compare what you missed :D
Ye, only for monsters, thanks i will check it 😀
 
Back
Top