mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
fix(Core/Worldsession): add option to prevent logout when AFK in a sanctuary zone (#2205)
This commit is contained in:
@@ -424,6 +424,12 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
bool instantLogout = ((GetSecurity() >= 0 && uint32(GetSecurity()) >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT))
|
||||
|| (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight();
|
||||
|
||||
bool preventAfkSanctuaryLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 1
|
||||
&& GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary();
|
||||
|
||||
bool preventAfkLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 2
|
||||
&& GetPlayer()->isAFK();
|
||||
|
||||
/// TODO: Possibly add RBAC permission to log out in combat
|
||||
bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
|
||||
@@ -432,7 +438,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
reason = 1;
|
||||
else if (GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR))
|
||||
reason = 3; // is jumping or falling
|
||||
else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
|
||||
else if (preventAfkSanctuaryLogout || preventAfkLogout || GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
|
||||
reason = 2; // FIXME - Need the correct value
|
||||
|
||||
WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
|
||||
|
||||
@@ -1323,6 +1323,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
// Player can join LFG anywhere
|
||||
m_bool_configs[CONFIG_LFG_LOCATION_ALL] = sConfigMgr->GetBoolDefault("LFG.Location.All", false);
|
||||
|
||||
// Prevent players AFK from being logged out
|
||||
m_int_configs[CONFIG_AFK_PREVENT_LOGOUT] = sConfigMgr->GetIntDefault("PreventAFKLogout", 0);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
sScriptMgr->OnAfterConfigLoad(reload);
|
||||
}
|
||||
|
||||
@@ -339,6 +339,7 @@ enum WorldIntConfigs
|
||||
CONFIG_BIRTHDAY_TIME,
|
||||
CONFIG_SOCKET_TIMEOUTTIME_ACTIVE,
|
||||
CONFIG_INSTANT_TAXI,
|
||||
CONFIG_AFK_PREVENT_LOGOUT,
|
||||
INT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -1162,6 +1162,15 @@ RecruitAFriend.MaxDifference = 4
|
||||
|
||||
InstantLogout = 1
|
||||
|
||||
#
|
||||
# PreventAFKLogout
|
||||
# Description: Prevent players AFK from being logged out
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled, prevent players AFK from being logged out in Sanctuary zones)
|
||||
# 2 - (Enabled, prevent players AFK from being logged out in all zones)
|
||||
|
||||
PreventAFKLogout = 0
|
||||
|
||||
#
|
||||
# DisableWaterBreath
|
||||
# Description: Required security level for water breathing.
|
||||
@@ -1438,7 +1447,7 @@ Motd = "Welcome to an AzerothCore server."
|
||||
# PLEASE NOTE: another (hardcoded) text will appear below the MOTD:
|
||||
#
|
||||
# "This server runs on AzerothCore www.azerothcore.org"
|
||||
#
|
||||
#
|
||||
# All the AzerothCore contributors, as well as its father projects (MaNGOS, TrinityCore, etc..),
|
||||
# have worked for free to provide you this software. Please do not remove the credits.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user