From 6d8e80b1e53d1b46971079645ff8c8b30e6e9de1 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:36:54 -0500 Subject: [PATCH] [Bug Fix] Fix bots/Mercenaries being removed from hatelist (#3708) # Notes - https://github.com/EQEmu/Server/pull/3595 caused bots, bot pets, and mercenaries to be removed from hate list because we were only checking for `IsClient()` not `IsOfClientBotMerc()`. - Resolves an issue mentioned [here](https://discord.com/channels/212663220849213441/1177288302383079534) where NPCs would run past bots/mercenaries to attack the owner. --- zone/hate_list.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 5b3af0190..b8f202132 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -46,7 +46,14 @@ void HateList::WipeHateList(bool npc_only) { auto iterator = list.begin(); while (iterator != list.end()) { Mob *m = (*iterator)->entity_on_hatelist; - if (m && (m->IsClient() || (m->IsPet() && m->GetOwner()->IsClient())) && npc_only) { + if ( + m && + ( + m->IsOfClientBotMerc() || + (m->IsPet() && m->GetOwner() && m->GetOwner()->IsOfClientBotMerc()) + ) && + npc_only + ) { iterator++; } else { if (m) { @@ -58,6 +65,7 @@ void HateList::WipeHateList(bool npc_only) { m->CastToClient()->DecrementAggroCount(); m->CastToClient()->RemoveXTarget(hate_owner, true); } + delete (*iterator); iterator = list.erase(iterator); } @@ -733,7 +741,7 @@ int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOption caster->CombatRange(h->entity_on_hatelist, 1.0, true, opts)) { id_list.push_back(h->entity_on_hatelist->GetID()); } - + if (count != -1 && id_list.size() > count) { break; }