Thread: Afk
View Single Post
  #8  
Old 11-20-2012, 06:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, the client automatically sends an AFK packet after no client interaction for 15 minutes. We currently don't have packet handling built for it, so it is just ignored for now. It would be pretty trivial to add handling for that packet that would simply set a character flag/variable and add a new sub EVENT_AFK that would trigger in player.pl so you could do whatever you want when a player goes into an AFK state.

I have thought about doing this many times, but I would have to check out the packets again to see if they send any different data for when a player goes from AFK back to active again. IIRC, the client just sends the same 0 sized AFK packet when the player interacts with the client again after AFK was sent. If no data is in the packet, that just means we have to maintain their AFK status server-side (which is probably needed anyway).

To add to this, we could also probably implement an auto /afk message rule for servers that wanted to use it. Then, when a client sends that AFK packet, we could actually set them with the AFK flag and give a default AFK message if they get any tells while flagged as AFK. This part might be slightly more complicated to add in, but shouldn't be too bad and would of course be an optional rule setting. The only issue I see with this idea is that we would also need to remove the AFK flag and auto-response message if the player interacts with the client again. This would probably also have to remove the AFK flag for people that used the /afk command, which would not be idea. If different packets are send for the command vs the auto-afk packet, we should be able to just track both as variables and then handle each type of AFK appropriately.

Maybe I will look into this if I get some free time, but don't hold me to it!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote