mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 18:00:27 +00:00
Put IsValidAttackTarget check on both bots and their pets (#833)
* Prevent PetAttackAction on invalid targets * Prevent AttackAction on invalid targets in general
This commit is contained in:
@@ -75,6 +75,14 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot->IsValidAttackTarget(target))
|
||||
{
|
||||
if (verbose)
|
||||
botAI->TellError("I cannot attack an invalid target");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ostringstream msg;
|
||||
msg << target->GetName();
|
||||
|
||||
@@ -106,7 +114,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
}
|
||||
|
||||
if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId())
|
||||
&& (target->IsPlayer() || target->IsPet() || !bot->IsValidAttackTarget(target)))
|
||||
&& (target->IsPlayer() || target->IsPet()))
|
||||
{
|
||||
if (verbose)
|
||||
botAI->TellError("I cannot attack others in PvP prohibited zones");
|
||||
|
||||
Reference in New Issue
Block a user