feat: check attackers user type

This commit is contained in:
Иванов Иван
2024-08-22 23:07:06 +02:00
parent 936697defc
commit e0ffa3a62e

View File

@@ -103,9 +103,13 @@ namespace Interlude
if (m_Hero && m_Hero->GetId() != casted.GetAttackerId()) if (m_Hero && m_Hero->GetId() != casted.GetAttackerId())
{ {
if (m_Hero->GetId() == casted.GetTargetId()) if (m_Hero->GetId() == casted.GetTargetId())
{
const auto attacker = m_NetworkHandler.GetUser(casted.GetAttackerId());
if (attacker && attacker->userType == L2::UserType::NPC)
{ {
m_Hero->AddAttacker(casted.GetAttackerId()); m_Hero->AddAttacker(casted.GetAttackerId());
} }
}
else if (casted.GetAttackerId() != casted.GetTargetId()) else if (casted.GetAttackerId() != casted.GetTargetId())
{ {
// try to remove creature that is attacking another target from the attackers // try to remove creature that is attacking another target from the attackers