Jump to content

[fix][6503] Autohit At Dead Targets


pasdVn

Recommended Posts

Bug (I think it is not reported yet):

Take a hunter and make sure that the autoswitch between autoshot and autohit is enabled (menue->Interface->Combat; on default this option is activated). Start a melee combat with a mob and kill the mob by .die (the command), or anything else.. pet, other player, etc. during the comabt. What happens: Quite often (but not always) the hunter stays in autohit mode (mostly the button is not toggled on in the client, but you can recognize it by the fight posture of your char). In this state you can not start melee or use autoshot at a new target before you reset this state by reloging.

What's the reason?:

I don't know exactly why but the client sends some strange ClientMessages. After the mob died he sends CMSG_ATTACKSWING with the dead mod as target and than an SMSG_ATTACKSTOP. Because the server does not accept dead targets in Unit::Attack() AttackStop() won't call SendAttackStop what makes the client not cancel autohit while out of combat.

Client won't send any new CMSG_ATTACKSWING or Autoshot cast messages so that only the relog can reset this state...

This strange behaviour occured only with this open mentioned interface option (as far as I investigated the problem),... sometimes also if you kill a mob by yourself with one hit. Don't know how long this problem exsist (maybe it is also connected with my past autorepeat spells patch?).

The fix: Check if the target is dead in WorldSession::HandleAttackSwingOpcode() and call SendAttackStop.

Index: src/game/CombatHandler.cpp
===================================================================
--- src/game/CombatHandler.cpp        (revision 6458)
+++ src/game/CombatHandler.cpp        (working copy)
@@ -57,6 +57,15 @@
                return;
        }

+        if(!pEnemy->isAlive())
+        {
+                sLog.outError( "WORLD: Enemy %s %u is not alive",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid));
+
+                // stop attack state at client
+                SendAttackStop(pEnemy);
+                return;
+        }
+
        _player->Attack(pEnemy,true);
}

Link to comment
Share on other sites

I only added this because all checks in HandleAttackSwingOpcode() have those error log outputs ;) Don't know if there is really a need for any of those debug messages.

Edit: Hmm... those checks and arror messages are originally only against cheating/ hack using, am I right!?

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use