From 9e16cd8ae82733728ecb15e00c8e6fca606f74d6 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 12 Feb 2023 22:48:23 -0500 Subject: [PATCH] [Quest API] (Performance) Check event exists before export and execute EVENT_POPUP_RESPONSE (#2881) # Notes - Optionally parses this event instead of always doing so. --- zone/client_packet.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 269a7da09..9a82329e5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11334,16 +11334,20 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) break; } - const auto export_string = fmt::format("{}", popup_response->popupid); - - parse->EventPlayer(EVENT_POPUP_RESPONSE, this, export_string, 0); + if (parse->PlayerHasQuestSub(EVENT_POPUP_RESPONSE)) { + parse->EventPlayer(EVENT_POPUP_RESPONSE, this, std::to_string(popup_response->popupid), 0); + } auto t = GetTarget(); if (t) { if (t->IsNPC()) { - parse->EventNPC(EVENT_POPUP_RESPONSE, t->CastToNPC(), this, export_string, 0); + if (parse->HasQuestSub(t->GetNPCTypeID(), EVENT_POPUP_RESPONSE)) { + parse->EventNPC(EVENT_POPUP_RESPONSE, t->CastToNPC(), this, std::to_string(popup_response->popupid), 0); + } } else if (t->IsBot()) { - parse->EventBot(EVENT_POPUP_RESPONSE, t->CastToBot(), this, export_string, 0); + if (parse->BotHasQuestSub(EVENT_POPUP_RESPONSE)) { + parse->EventBot(EVENT_POPUP_RESPONSE, t->CastToBot(), this, std::to_string(popup_response->popupid), 0); + } } } }