Do not disband alt bots group when master goes away (#702)

* Do not disband alt bots group when master goes away

* This update makes the original PR functionality optional, which prevents alternative bots (random bots) from automatically leaving the group when the master leaves.

* Fix

---------

Co-authored-by: bash <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
EricksOliveira
2025-05-24 19:19:11 -03:00
committed by GitHub
parent c24b7a7bb3
commit f8660bc939
4 changed files with 16 additions and 5 deletions

View File

@@ -473,11 +473,11 @@ void PlayerbotHolder::OnBotLogin(Player* const bot)
}
Player* master = botAI->GetMaster();
if (!master)
if (master)
{
// Log a warning to indicate that the master is null
LOG_DEBUG("mod-playerbots", "Master is null for bot with GUID: {}", bot->GetGUID().GetRawValue());
return;
ObjectGuid masterGuid = master->GetGUID();
if (master->GetGroup() && !master->GetGroup()->IsLeader(masterGuid))
master->GetGroup()->ChangeLeader(masterGuid);
}
Group* group = bot->GetGroup();
@@ -496,7 +496,10 @@ void PlayerbotHolder::OnBotLogin(Player* const bot)
break;
}
}
else
// Don't disband alt groups when master goes away
// Controlled by config
if (sPlayerbotAIConfig->KeepAltsInGroup())
{
uint32 account = sCharacterCache->GetCharacterAccountIdByGuid(member);
if (!sPlayerbotAIConfig->IsInRandomAccountList(account))