From efb2ab57aa92bb5760159b49c7caa8679d0239f9 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:01:48 -0500 Subject: [PATCH] [Quest API] Optionally parse EVENT_CONNECT and EVENT_DISCONNECT (#2913) - Optionally parse these events instead of always doing so. --- zone/client_packet.cpp | 6 +++++- zone/client_process.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ff683c6ce..1bed432c1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -793,8 +793,12 @@ void Client::CompleteConnect() /* This sub event is for if a player logs in for the first time since entering world. */ if (firstlogon == 1) { - parse->EventPlayer(EVENT_CONNECT, this, "", 0); RecordPlayerEventLog(PlayerEvent::WENT_ONLINE, PlayerEvent::EmptyEvent{}); + + if (parse->PlayerHasQuestSub(EVENT_CONNECT)) { + parse->EventPlayer(EVENT_CONNECT, this, "", 0); + } + /* QS: PlayerLogConnectDisconnect */ if (RuleB(QueryServ, PlayerLogConnectDisconnect)) { std::string event_desc = StringFormat("Connect :: Logged into zoneid:%i instid:%i", GetZoneID(), GetInstanceID()); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 21d6f80a0..c18e42ebd 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -184,9 +184,12 @@ bool Client::Process() { SetDynamicZoneMemberStatus(DynamicZoneMemberStatus::Offline); - parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{}); + if (parse->PlayerHasQuestSub(EVENT_DISCONNECT)) { + parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + } + return false; //delete client } @@ -694,9 +697,12 @@ void Client::OnDisconnect(bool hard_disconnect) { if (MyRaid) MyRaid->MemberZoned(this); - parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{}); + if (parse->PlayerHasQuestSub(EVENT_DISCONNECT)) { + parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + } + /* QS: PlayerLogConnectDisconnect */ if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", GetZoneID(), GetInstanceID());