• 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+ sendCreatureHealth issue with clients 11+

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
315
Solutions
3
Reaction score
68
Hello!

Clients of version 11+ have an issue with ProtocolGame::sendCreatureHealth (TFS 1.3).
  1. it causes the name and health bar of killed monsters to still show after the last hit and before the corpse is created;
  2. name and health bar of gods using 'hide' (with setHiddenHealth) can still be seen by players;
  3. monsters with hidden health (e. g. magicthrowers) can still be seen by players.
C++:
void ProtocolGame::sendCreatureHealth(const Creature* creature)
{
    NetworkMessage msg;
    msg.addByte(0x8C);
    msg.add<uint32_t>(creature->getID());

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

WRONG behavior (clients 11+) - monster is killed with the last hit, but name and health bar are still showing, until the corpse is created:
ezgif.com-optimize (1).gif

RIGHT behavior (client 10) - name and health bar stop showing with the last hit, before the monster is removed and the corpse created:
ezgif.com-optimize (2).gif

God using 'hide' (with setHiddenHealth) in clients 11+:
god_hide_health.png

Magicthrower in clients 11+:
magicthrower.png

Has anybody managed to solve this?
Or, has anybody got an idea on how to solve this?

Extra info:
Monsters don't hit the ground immediately when killed because the function that checks for killed monsters is called with a think interval, and not directly after the last hit - (game.cpp) Game::checkCreatures
 
Solution
The solve requires using this to figure out how 0x8c has changed (or does hiding the health now use a different/new packet?):
On 11+ clients cipsoft changed it so that it need to be handle inside ProtocolGame::AddCreature and to update creature one might want to use packet: {0x03, "protobuf.protocol.GameserverMessageCreatureData"}
Also sending health packet with 0 percent actually make 11+ clients buggy(for example when you move your character clients lags a lot).

Example that it works:
2.png
I stumbled across this a few weeks ago too.
It seems the 0x8c packet has changed, but we haven't aligned it on the TFS end.


The solve requires using this to figure out how 0x8c has changed (or does hiding the health now use a different/new packet?):
 
It seems the 0x8c packet has changed, but we haven't aligned it on the TFS end.
Yea, I've also posted this earlier today in the conversation in github, to avoid the issue being closed before it is effectively fixed.
 
The solve requires using this to figure out how 0x8c has changed (or does hiding the health now use a different/new packet?):
On 11+ clients cipsoft changed it so that it need to be handle inside ProtocolGame::AddCreature and to update creature one might want to use packet: {0x03, "protobuf.protocol.GameserverMessageCreatureData"}
Also sending health packet with 0 percent actually make 11+ clients buggy(for example when you move your character clients lags a lot).

Example that it works:
2.png
 
Last edited:
Solution
Hi guys, Leu here, (jlcvp@github)

The client 10 automatically hides the health bar if a value 0 is sent. clients 11/12 don't.

On cipsoft`s side, they didn't need to handle this kind of logic because they changed how creatures die at all. They remove the creature and creates the body as long as the creature health reaches 0

On the TFS when we kill a creature, first we send health 0 and in the next tick we send the remove creature/body logic. this needs to be changed.


In the last flash client (protocol 11.43) we have this method to handle packet with header 0x8c
As you will see in the image bellow, it had the same structure we have in protocolgame.cpp

(<uint32> creature id)
(<uint8> percent health)
1587562481590.png
 
Back
Top