[Bug Fix] Fix EVENT_COMBAT on NPC Death (#4558)

This commit is contained in:
Alex King 2024-11-27 20:30:29 -05:00 committed by GitHub
parent 3d7cf4235c
commit fe9df46a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"; });
}
}