From 4d118ab978614b4086c9d117df86c5bfeb708c05 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Sat, 16 Dec 2023 15:08:16 -0600 Subject: [PATCH] [Bots] Fix ^oo autodefend from sending bots/pets to invalid haters (#3772) Bots and especially their pets could get in a loop where they try to attack an invalid target. This would result in their pets spamming "That is not a legal target" messages. --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 778b4dd46..adcbbdf4b 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2357,7 +2357,7 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) { } auto hater = entity_list.GetMob(hater_iter.spawn_id); - if (hater && !hater->IsMezzed() && DistanceSquared(hater->GetPosition(), bot_owner->GetPosition()) <= leash_distance) { + if (hater && hater->CastToNPC()->IsOnHatelist(bot_owner) && !hater->IsMezzed() && DistanceSquared(hater->GetPosition(), bot_owner->GetPosition()) <= leash_distance) { // This is roughly equivilent to npc attacking a client pet owner AddToHateList(hater, 1); SetTarget(hater);