From ea2f431fcefed1a582746fec1834422e3d593f91 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Mon, 27 Mar 2023 21:45:02 -0400 Subject: [PATCH] [Fix] Fix an issue with EVENT_DISCONNECT not firing on regular /camp (#3153) * [Fix] Fix an issue with EVENT_DISCONNECT not firing on regular /camp # Notes - We were only sending `EVENT_DISCONNECT` on GM instant camps or linkdeads. * Update client_process.cpp --- zone/client_process.cpp | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 748fd80f5..53a41bfe7 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -689,61 +689,61 @@ bool Client::Process() { /* Just a set of actions preformed all over in Client::Process */ void Client::OnDisconnect(bool hard_disconnect) { - if(hard_disconnect) - { + if (hard_disconnect) { LeaveGroup(); - if (GetMerc()) - { + + if (GetMerc()) { GetMerc()->Save(); GetMerc()->Depop(); } - Raid *MyRaid = entity_list.GetRaidByClient(this); - if (MyRaid) - MyRaid->MemberZoned(this); + auto* r = entity_list.GetRaidByClient(this); - RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{}); - - if (parse->PlayerHasQuestSub(EVENT_DISCONNECT)) { - parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + if (r) { + r->MemberZoned(this); } /* QS: PlayerLogConnectDisconnect */ - if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ + if (RuleB(QueryServ, PlayerLogConnectDisconnect)) { std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", GetZoneID(), GetInstanceID()); QServ->PlayerLogEvent(Player_Log_Connect_State, CharacterID(), event_desc); } } - if (!bZoning) - { + if (!bZoning) { SetDynamicZoneMemberStatus(DynamicZoneMemberStatus::Offline); } RemoveAllAuras(); - Mob *Other = trade->With(); - if(Other) - { + auto* o = trade->With(); + if (o) { LogTrading("Client disconnected during a trade. Returning their items"); FinishTrade(this); - if(Other->IsClient()) - Other->CastToClient()->FinishTrade(Other); + if (o->IsClient()) { + o->CastToClient()->FinishTrade(o); + } /* Reset both sides of the trade */ trade->Reset(); - Other->trade->Reset(); + o->trade->Reset(); } database.SetFirstLogon(CharacterID(), 0); //We change firstlogon status regardless of if a player logs out to zone or not, because we only want to trigger it on their first login from world. - /* Remove ourself from all proximities */ + /* Remove from all proximities */ ClearAllProximities(); auto outapp = new EQApplicationPacket(OP_LogoutReply); FastQueuePacket(&outapp); + RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{}); + + if (parse->PlayerHasQuestSub(EVENT_DISCONNECT)) { + parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + } + Disconnect(); }