From 9c8ba42c641e857975595a9fc514a970d8857603 Mon Sep 17 00:00:00 2001 From: SaW Date: Tue, 11 Nov 2025 09:10:09 +0100 Subject: [PATCH] FIX: Battlegrounds - Unset bot's master when current master left BG (#1819) Adds a check for if current master left the BG and group, if so release set master and carry on in BG. This prevents multiple bots in (potentially multiple different) BG's to still consider you as their master when you yourself have left. - Applies when you join BGs with a party of bots. --- src/PlayerbotAI.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 414b4b22..4292a48b 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -367,11 +367,19 @@ void PlayerbotAI::UpdateAIGroupAndMaster() { if (!bot) return; + + PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); + if (!botAI) + return; + Group* group = bot->GetGroup(); + + bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot); + // If bot is not in group verify that for is RandomBot before clearing master and resetting. if (!group) { - if (master && sRandomPlayerbotMgr->IsRandomBot(bot)) + if (master && IsRandomBot) { SetMaster(nullptr); Reset(true); @@ -380,12 +388,10 @@ void PlayerbotAI::UpdateAIGroupAndMaster() return; } - if (bot->InBattleground() && bot->GetBattleground()->GetBgTypeID() != BATTLEGROUND_AV) - return; - - PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); - if (!botAI) - return; + // Bot in BG, but master no longer part of a group: release master + // Exclude alt and addclass bots as they rely on current (real player) master, security-wise. + if (bot->InBattleground() && IsRandomBot && master && !master->GetGroup()) + SetMaster(nullptr); PlayerbotAI* masterBotAI = nullptr; if (master)