Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Core/Worldsession): add option to prevent logout when AFK in a sanctuary zone #2205

Merged
6 commits merged into from
Sep 9, 2019

Conversation

mik1893
Copy link
Contributor

@mik1893 mik1893 commented Aug 14, 2019

Closes #2139

This will prevent logout by sending a reason for denying logout - preventing CMSG_LOGOUT_REQUEST to be spammed again immediatly.

@PkllonG
Copy link
Contributor

PkllonG commented Aug 14, 2019

TIM截图20190814184435
Success. great job.

@PkllonG
Copy link
Contributor

PkllonG commented Aug 14, 2019

2
Is there a way to remove the”message"?
Message content " because there is no action for a long time, will automatically exit the game”

@mik1893
Copy link
Contributor Author

mik1893 commented Aug 14, 2019

Yes - will complete the fix tonight

@andoys
Copy link

andoys commented Aug 14, 2019

This is the packet issue @lineagedr was talking about the yellow spam message

@ELdoBA

This comment has been minimized.

@FrancescoBorzi

This comment has been minimized.

@azerothcore azerothcore deleted a comment from ELdoBA Aug 14, 2019
@PkllonG
Copy link
Contributor

PkllonG commented Aug 15, 2019

The message is most likely generated by the client

@mik1893
Copy link
Contributor Author

mik1893 commented Aug 15, 2019

yes. it's client generated so nothing to do about it :|
I thought it was some AFK text but apparently it's just coming out from the client

@ghost
Copy link

ghost commented Aug 21, 2019

Code looks ok, so is this still WIP or is it ready to be merged?

@Racknar0
Copy link

One question is there any way to modify it so that it not only works in the sanctuary, but throughout the world?

@PkllonG
Copy link
Contributor

PkllonG commented Aug 22, 2019

Does the server send a move or jump instruction to the client?

@ghost
Copy link

ghost commented Aug 22, 2019

One question is there any way to modify it so that it not only works in the sanctuary, but throughout the world?

Should be easy to implement, perhaps we could adjust this PR for this:

  • use another parameter name, e.g. "PreventAFKLogout", and make it an int instead of a bool
  • values:
    0: normal behaviour
    1: prevent AFK logout in sanctuaries
    2: prevent AFK logout everywhere
  • in the code use something like this:
    bool preventAfkSanctuaryLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT_SANCTUARY) == 1
        && GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary();
    
    bool preventAfkLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT_SANCTUARY) == 2
        && GetPlayer()->isAFK();
    .
    .
    .
    else if (preventAfkSanctuaryLogout || preventAfkLogout || GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
        reason = 2;

@ghost
Copy link

ghost commented Aug 22, 2019

Does the server send a move or jump instruction to the client?

As far as I understand this the client sends a "logout" request to the server (e.g. if too long AFK or triggered by the player) and the server can deny or accept the logout. You can also do nothing about the yellow message because this is written by the client, not the server.

@PkllonG
Copy link
Contributor

PkllonG commented Aug 22, 2019

@mik1893 @Stoabrogga Can the server send"move"or"jump"instructions to the client?
Server regularly send "move" or "jump" to the client, the client release AFK state.

@ghost
Copy link

ghost commented Aug 23, 2019

Can the server send"move"or"jump"instructions to the client?
Server regularly send "move" or "jump" to the client, the client release AFK state.

I don't think this is possible. Also to my understanding the client sets the AFK state, so it would not matter if the server forces actions on the player. But I don't have deep knowledge concerning the client / server communication, so could be totally wrong here.

@ghost
Copy link

ghost commented Aug 31, 2019

@mik1893
Are you still working on this? What do you think about extending the parameter like I mentioned above?

@ghost
Copy link

ghost commented Sep 5, 2019

I added the 3rd option and tested this successfully:

  • option 0: AFK logout is not prevented at all (default)
  • option 1: AFK logout is only prevented in Sanctuaries (like Dalaran or Shattrath)
  • option 2: AFK logout is prevented in all zones

As this PR does not cause any harm (option 0 is default) and it is a nice addition to the core I think this is ready to be merged.

@ghost ghost removed the WIP label Sep 5, 2019
@ghost ghost added the To Be Merged label Sep 5, 2019
@ghost ghost merged commit 67d180e into azerothcore:master Sep 9, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants