Skip to content

[Player] Core does not check if target is valid for melee auto attacks. #24651

@joshwhedon

Description

@joshwhedon

Description:

https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Player/Player.cpp#L1139
and
https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Player/Player.cpp#L1157
At the moment, the target isn't checked for validity when performing melee attacks. As a result, if the target changed faction / flag / etc, while the target was already melee attacked, it is possible for the player to keep melee attacking the target.

I propose to add a IsValidAttackTarget check for melee, need feedback.

Expected behaviour:

Melee attack should get cancelled if the target is not targetable for attack

Steps to reproduce the problem:

  1. .go creature id 26631
  2. Right click as to engage combat
  3. Novos will go unattackable (part of the script), move to melee range, you can melee him (and additionally the script gets broken as a result of the melee)

Branch(es):

CHANGEME 3.3.5 (not sure about master)

TC rev. hash/commit:

0c7655e

Operating system: Doesn't matter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions