mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
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:
@@ -130,6 +130,11 @@ AiPlayerbot.AddClassAccountPoolSize = 50
|
||||
# Default: 1 (accept based on level)
|
||||
AiPlayerbot.GroupInvitationPermission = 1
|
||||
|
||||
# Keep alt bots in the party even when the master leaves
|
||||
# 0 = disabled (default behavior)
|
||||
# 1 = enabled (prevents bots from automatically leaving the group)
|
||||
AiPlayerbot.KeepAltsInGroup = 0
|
||||
|
||||
# Auto-login all player alts as altbots on player login
|
||||
AiPlayerbot.BotAutologin = 0
|
||||
|
||||
|
||||
@@ -510,6 +510,7 @@ bool PlayerbotAIConfig::Initialize()
|
||||
equipmentPersistence = sConfigMgr->GetOption<bool>("AiPlayerbot.EquipmentPersistence", false);
|
||||
equipmentPersistenceLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.EquipmentPersistenceLevel", 80);
|
||||
groupInvitationPermission = sConfigMgr->GetOption<int32>("AiPlayerbot.GroupInvitationPermission", 1);
|
||||
keepAltsInGroup = sConfigMgr->GetOption<bool>("AiPlayerbot.KeepAltsInGroup", false);
|
||||
allowSummonInCombat = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonInCombat", true);
|
||||
allowSummonWhenMasterIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenMasterIsDead", true);
|
||||
allowSummonWhenBotIsDead = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowSummonWhenBotIsDead", true);
|
||||
|
||||
@@ -333,6 +333,8 @@ public:
|
||||
bool equipmentPersistence;
|
||||
int32 equipmentPersistenceLevel;
|
||||
int32 groupInvitationPermission;
|
||||
bool keepAltsInGroup = false;
|
||||
bool KeepAltsInGroup() const { return keepAltsInGroup; }
|
||||
bool allowSummonInCombat;
|
||||
bool allowSummonWhenMasterIsDead;
|
||||
bool allowSummonWhenBotIsDead;
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user