EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Feature Requests (https://www.eqemulator.org/forums/forumdisplay.php?f=612)
-   -   New Event: EVENT_CAMPED (https://www.eqemulator.org/forums/showthread.php?t=36527)

Chrono 02-19-2013 11:38 AM

New Event: EVENT_CAMPED
 
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.

Code:

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

Code:

        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.


All times are GMT -4. The time now is 05:59 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.