edubart / otclient

An alternative tibia client for otserv written in C++11 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
652 stars 399 forks source link

Attack cancel (fast attacking monster after kill) #78

Closed Ghorre closed 12 years ago

Ghorre commented 12 years ago

When attacking next creature while the previous one is dying (death delay) you might be able to make one hit and then the "red square" disappears - attack gets cancelled.

Steps to reproduce (kinda hard to catch - might take a few attempts):

  1. Attack monster no1.
  2. While monster no1 is dying (no HP but still standing) attack monster no2.
  3. When the monster no1 drops on the ground your attack on monster no2 gets cancelled.
edubart commented 12 years ago

That's a well know server side only bug, all otservs ignore the attack sequential number in parseAttack,

Taken from TFS source code:

void ProtocolGame::parseAttack(NetworkMessage& msg)
{
    uint32_t creatureId = msg.get<uint32_t>();
    msg.get<uint32_t>(); //?
    msg.get<uint32_t>(); //?

    addGameTask(&Game::playerSetAttackedCreature, player->getID(), creatureId);
}

The first "??" byte represents the attack seq, used to cancel attacks.

void ProtocolGame::sendCancelTarget()
{
    NetworkMessage_ptr msg = getOutputBuffer();
    if(!msg)
        return;

    TRACK_MESSAGE(msg);
    msg->put<char>(0xA3);
    msg->put<uint32_t>(0); //? creatureId?
}

The "unknown" byte must be the same value received in parseAttack, but TFS doesn't implement that. That bug doesn't exist while playing real tibia with otclient.

Ghorre commented 12 years ago

I see. I'll double check next time - sorry I bothered You.