feat(Core/Player): Allow stay in group when logged out (#10887)

* Config option

* Extra check

* Fixes

Updated some comments
Removed the config option from the first if since it's not necessary (afaik)

* REVERT

Reverting the if to what I had it at originally until I can get some input on it...

* Updated if

Got some input and this is working as intended

* Update World.cpp

* Update src/server/worldserver/worldserver.conf.dist

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Revision
2022-04-25 14:29:44 +02:00
committed by GitHub
parent 4774772a42
commit a1707b2d14
4 changed files with 17 additions and 4 deletions

View File

@@ -616,12 +616,13 @@ void WorldSession::LogoutPlayer(bool save)
// there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses
_player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
///- If the player is in a group (or invited), remove him. If the group if then only 1 person, disband the group.
_player->UninviteFromGroup();
///- If the player is in a group and LeaveGroupOnLogout is enabled or if the player is invited to a group, remove him. If the group is then only 1 person, disband the group.
if (!_player->GetGroup() || sWorld->getBoolConfig(CONFIG_LEAVE_GROUP_ON_LOGOUT))
_player->UninviteFromGroup();
// remove player from the group if he is:
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected)
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && !_player->GetGroup()->isLFGGroup() && m_Socket)
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected) d) LeaveGroupOnLogout is enabled
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && !_player->GetGroup()->isLFGGroup() && m_Socket && sWorld->getBoolConfig(CONFIG_LEAVE_GROUP_ON_LOGOUT))
_player->RemoveFromGroup();
// pussywizard: checked second time after being removed from a group

View File

@@ -174,6 +174,7 @@ enum WorldBoolConfigs
CONFIG_PLAYER_SETTINGS_ENABLED,
CONFIG_ALLOW_JOIN_BG_AND_LFG,
CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS,
CONFIG_LEAVE_GROUP_ON_LOGOUT,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -1263,6 +1263,8 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_ALLOW_JOIN_BG_AND_LFG] = sConfigMgr->GetOption<bool>("JoinBGAndLFG.Enable", false);
m_bool_configs[CONFIG_LEAVE_GROUP_ON_LOGOUT] = sConfigMgr->GetOption<bool>("LeaveGroupOnLogout.Enabled", true);
m_int_configs[CONFIG_CHANGE_FACTION_MAX_MONEY] = sConfigMgr->GetOption<uint32>("ChangeFaction.MaxMoney", 0);
///- Read the "Data" directory from the config file

View File

@@ -3709,6 +3709,15 @@ EnablePlayerSettings = 0
JoinBGAndLFG.Enable = 0
#
# LeaveGroupOnLogout.Enabled
# Description: Should the player leave their group when they log out?
# (It does not affect raids or dungeon finder groups)
#
# Default: 1 - (Enabled)
LeaveGroupOnLogout.Enabled = 1
#
# ChangeFaction.MaxMoney
# Description: Maximum amount of gold allowed on the character to perform a faction change.