Skip to content

Commit 6282471

Browse files
authored
Core/Players: Check if target is valid for melee auto attacks (TrinityCore#31850)
1 parent 02a17ec commit 6282471

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/server/game/Entities/Player/Player.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,15 @@ void Player::Update(uint32 p_time)
10291029
m_swingErrorMsg = 2;
10301030
}
10311031
}
1032+
else if (!IsValidAttackTarget(victim))
1033+
{
1034+
setAttackTimer(BASE_ATTACK, 100);
1035+
if (m_swingErrorMsg != 3) // send single time (client auto repeat)
1036+
{
1037+
SendAttackSwingCantAttack();
1038+
m_swingErrorMsg = 3;
1039+
}
1040+
}
10321041
else
10331042
{
10341043
m_swingErrorMsg = 0; // reset swing error state
@@ -1050,6 +1059,8 @@ void Player::Update(uint32 p_time)
10501059
setAttackTimer(OFF_ATTACK, 100);
10511060
else if (!HasInArc(2 * float(M_PI) / 3, victim))
10521061
setAttackTimer(OFF_ATTACK, 100);
1062+
else if (!IsValidAttackTarget(victim))
1063+
setAttackTimer(OFF_ATTACK, 100);
10531064
else
10541065
{
10551066
// prevent base and off attack in same time, delay attack at 0.2 sec

0 commit comments

Comments
 (0)