PDA

View Full Version : New Event: EVENT_CAMPED


Chrono
02-19-2013, 11:38 AM
I think it would be quite a nice feature to have as at the moment I've integrated various player leaderboards on my website, and I couldn't find a way to detect if a player is online or not.

You can use EVENT_CONNECT to see the player is on, however EVENT_DISCONNECT is only on actual disconnects and not camping.

So on EVENT_CONNECT I set a qglobal to say they are online, but it doesn't always get removed, only if a disconnect happens.

Unless there's another workaround I'm missing? :D

Thanks.

c0ncrete
02-19-2013, 12:25 PM
it looks as though it's because Client::OnDisconnect (which is where the parsing of that event happens) is only called if the client is a GM.

void Client::Handle_OP_Camp(const EQApplicationPacket *app) {
#ifdef BOTS
// This block is necessary to clean up any bot objects owned by a Client
Bot::BotHealRotationsClear(this);
Bot::BotOrderCampAll(this);
#endif
if(IsLFP())
worldserver.StopLFP(CharacterID());

if (GetGM())
{
OnDisconnect(true);
return;
}
camp_timer.Start(29000,true);
return;
}

i'm not sure if the original intent of the event was to catch anything except for sudden disconnects.

c0ncrete
02-19-2013, 12:44 PM
@ line 210 of zone/client_process.cpp, you can try to add the lines in red

if (camp_timer.Check()) {
LeaveGroup();
Save();
if (GetMerc())
{
GetMerc()->Save();
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
GetMerc()->Depop();
}
instalog = true;
if (parse->PlayerHasQuestSub("EVENT_DISCONNECT")) {
parse->EventPlayer(EVENT_DISCONNECT, this, "", 0);
}
}

Chrono
02-20-2013, 09:56 AM
Just added it, works great. Thanks!

Don't suppose the need is great enough to get this added into main code?

I think it's quite useful, could be a good way to clear certain qglobals on logout etc.