From fe9df46a2484b4aff109b2639d88e583fe6a94c8 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:30:29 -0500 Subject: [PATCH] [Bug Fix] Fix EVENT_COMBAT on NPC Death (#4558) --- zone/mob_ai.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index fa2a48aa5..69255073b 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1815,12 +1815,18 @@ void Mob::AI_Event_NoLongerEngaged() { StopNavigation(); ClearRampage(); - parse->EventBotMercNPC(EVENT_COMBAT, this, nullptr, [&]() { return "0"; }); - if (IsNPC()) { SetPrimaryAggro(false); SetAssistAggro(false); - if (CastToNPC()->GetCombatEvent() && GetHP() > 0) { + if ( + CastToNPC()->GetCombatEvent() && + GetHP() > 0 && + entity_list.GetNPCByID(GetID()) + ) { + if (parse->HasQuestSub(GetNPCTypeID(), EVENT_COMBAT)) { + parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0); + } + const uint32 emote_id = CastToNPC()->GetEmoteID(); if (emote_id) { CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::LeaveCombat, emote_id); @@ -1829,6 +1835,8 @@ void Mob::AI_Event_NoLongerEngaged() { m_combat_record.Stop(); CastToNPC()->SetCombatEvent(false); } + } else { + parse->EventBotMerc(EVENT_COMBAT, this, nullptr, [&]() { return "0"; }); } }