From 71b2bf6a649400447d291be88203133770e32b0f Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 12 Feb 2023 23:32:37 -0500 Subject: [PATCH] [Quest API] (Performance) Check event exists before export and execute EVENT_ENTER_ZONE and EVENT_ZONE (#2900) # Notes - Optionally parse these events instead of always doing so. --- zone/client_packet.cpp | 4 +++- zone/zoning.cpp | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b3933340e..f998d0902 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -779,7 +779,9 @@ void Client::CompleteConnect() TotalKarma = database.GetKarma(AccountID()); SendDisciplineTimers(); - parse->EventPlayer(EVENT_ENTER_ZONE, this, "", 0); + if (parse->PlayerHasQuestSub(EVENT_ENTER_ZONE)) { + parse->EventPlayer(EVENT_ENTER_ZONE, this, "", 0); + } // the way that the client deals with positions during the initial spawn struct // is subtly different from how it deals with getting a position update diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 4da1dd26a..bdfdc4c86 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -202,19 +202,21 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { min_status = zone_data->min_status; min_level = zone_data->min_level; - const auto& export_string = fmt::format( - "{} {} {} {} {} {}", - zone->GetZoneID(), - zone->GetInstanceID(), - zone->GetInstanceVersion(), - target_zone_id, - target_instance_id, - target_instance_version - ); + if (parse->PlayerHasQuestSub(EVENT_ZONE)) { + const auto& export_string = fmt::format( + "{} {} {} {} {} {}", + zone->GetZoneID(), + zone->GetInstanceID(), + zone->GetInstanceVersion(), + target_zone_id, + target_instance_id, + target_instance_version + ); - if (parse->EventPlayer(EVENT_ZONE, this, export_string, 0) != 0) { - SendZoneCancel(zc); - return; + if (parse->EventPlayer(EVENT_ZONE, this, export_string, 0) != 0) { + SendZoneCancel(zc); + return; + } } if (player_event_logs.IsEventEnabled(PlayerEvent::ZONING)) {