[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
This commit is contained in:
Alex King 2023-03-27 21:45:02 -04:00 committed by GitHub
parent 8bdcf7cb94
commit ea2f431fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -689,18 +689,54 @@ bool Client::Process() {
/* Just a set of actions preformed all over in Client::Process */ /* Just a set of actions preformed all over in Client::Process */
void Client::OnDisconnect(bool hard_disconnect) { void Client::OnDisconnect(bool hard_disconnect) {
if(hard_disconnect) if (hard_disconnect) {
{
LeaveGroup(); LeaveGroup();
if (GetMerc())
{ if (GetMerc()) {
GetMerc()->Save(); GetMerc()->Save();
GetMerc()->Depop(); GetMerc()->Depop();
} }
Raid *MyRaid = entity_list.GetRaidByClient(this);
if (MyRaid) auto* r = entity_list.GetRaidByClient(this);
MyRaid->MemberZoned(this);
if (r) {
r->MemberZoned(this);
}
/* QS: 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) {
SetDynamicZoneMemberStatus(DynamicZoneMemberStatus::Offline);
}
RemoveAllAuras();
auto* o = trade->With();
if (o) {
LogTrading("Client disconnected during a trade. Returning their items");
FinishTrade(this);
if (o->IsClient()) {
o->CastToClient()->FinishTrade(o);
}
/* Reset both sides of the trade */
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 from all proximities */
ClearAllProximities();
auto outapp = new EQApplicationPacket(OP_LogoutReply);
FastQueuePacket(&outapp);
RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{}); RecordPlayerEventLog(PlayerEvent::WENT_OFFLINE, PlayerEvent::EmptyEvent{});
@ -708,42 +744,6 @@ void Client::OnDisconnect(bool hard_disconnect) {
parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); 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());
QServ->PlayerLogEvent(Player_Log_Connect_State, CharacterID(), event_desc);
}
}
if (!bZoning)
{
SetDynamicZoneMemberStatus(DynamicZoneMemberStatus::Offline);
}
RemoveAllAuras();
Mob *Other = trade->With();
if(Other)
{
LogTrading("Client disconnected during a trade. Returning their items");
FinishTrade(this);
if(Other->IsClient())
Other->CastToClient()->FinishTrade(Other);
/* Reset both sides of the trade */
trade->Reset();
Other->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 */
ClearAllProximities();
auto outapp = new EQApplicationPacket(OP_LogoutReply);
FastQueuePacket(&outapp);
Disconnect(); Disconnect();
} }