mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user