From 966c33f9446b11960c0145ce5ea67c0c9eb03b32 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 27 Oct 2023 19:46:29 +0800 Subject: [PATCH] bot auto leave group --- src/PlayerbotAI.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 65d5612c..8a51e6f4 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -273,7 +273,6 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) // bot->GetMotionMaster()->Clear(); // bot->GetMotionMaster()->MoveIdle(); // } - // cheat options if (bot->IsAlive() && ((uint32)GetCheat() > 0 || (uint32)sPlayerbotAIConfig->botCheatMask > 0)) { @@ -303,6 +302,14 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) return; } + if (!bot->InBattleground() && !bot->inRandomLfgDungeon() && bot->GetGroup()) { + Player* leader = bot->GetGroup()->GetLeader(); + PlayerbotAI* leaderAI = GET_PLAYERBOT_AI(leader); + if (leaderAI && !leaderAI->IsRealPlayer()) { + bot->RemoveFromGroup(); + } + } + bool min = minimal; UpdateAIInternal(elapsed, min); inCombat = bot->IsInCombat();