[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.
This commit is contained in:
Alex King 2023-11-23 12:36:54 -05:00 committed by GitHub
parent ebeaef598b
commit 6d8e80b1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,14 @@ void HateList::WipeHateList(bool npc_only) {
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) { while (iterator != list.end()) {
Mob *m = (*iterator)->entity_on_hatelist; 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++; iterator++;
} else { } else {
if (m) { if (m) {
@ -58,6 +65,7 @@ void HateList::WipeHateList(bool npc_only) {
m->CastToClient()->DecrementAggroCount(); m->CastToClient()->DecrementAggroCount();
m->CastToClient()->RemoveXTarget(hate_owner, true); m->CastToClient()->RemoveXTarget(hate_owner, true);
} }
delete (*iterator); delete (*iterator);
iterator = list.erase(iterator); iterator = list.erase(iterator);
} }