From e2c40b7ff941facf6547ddee8b77ee99b6fbdc20 Mon Sep 17 00:00:00 2001 From: SaW Date: Fri, 7 Nov 2025 19:51:36 +0100 Subject: [PATCH] FIX: Battlegrounds - Remove bot's master when master left the BG and group 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. --- src/PlayerbotAI.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 414b4b227..9ab1c8973 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -367,7 +367,13 @@ void PlayerbotAI::UpdateAIGroupAndMaster() { if (!bot) return; + + PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); + if (!botAI) + return; + Group* group = bot->GetGroup(); + // If bot is not in group verify that for is RandomBot before clearing master and resetting. if (!group) { @@ -380,12 +386,9 @@ 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 + if (bot->InBattleground() && master && !master->GetGroup()) + SetMaster(nullptr); PlayerbotAI* masterBotAI = nullptr; if (master)