mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix bots attacking others despite being in a prohibited zone - Issue 227 (#793)
* Fix bots attacking despite being in a prohibited zone * Protect pets as well and move logic to not skip IsFriendlyTo * Fix prohibited typo * Update AttackAction.cpp
This commit is contained in:
@@ -74,6 +74,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << target->GetName();
|
msg << target->GetName();
|
||||||
|
|
||||||
@@ -88,9 +89,11 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
|
|
||||||
if (!bot->IsWithinLOSInMap(target))
|
if (!bot->IsWithinLOSInMap(target))
|
||||||
{
|
{
|
||||||
msg << " is not on my sight";
|
msg << " is not in my sight";
|
||||||
if (verbose)
|
if (verbose)
|
||||||
botAI->TellError(msg.str());
|
botAI->TellError(msg.str());
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->isDead())
|
if (target->isDead())
|
||||||
@@ -102,6 +105,14 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bot->IsValidAttackTarget(target) && sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
botAI->TellError("I cannot attack others in PvP prohibited zones");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// if (bot->IsMounted() && bot->IsWithinLOSInMap(target))
|
// if (bot->IsMounted() && bot->IsWithinLOSInMap(target))
|
||||||
// {
|
// {
|
||||||
// WorldPacket emptyPacket;
|
// WorldPacket emptyPacket;
|
||||||
|
|||||||
Reference in New Issue
Block a user