bot auto leave group

This commit is contained in:
Yunfan Li 2023-10-27 19:46:29 +08:00
parent 0f544e6baa
commit 966c33f944

View File

@ -273,7 +273,6 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
// bot->GetMotionMaster()->Clear(); // bot->GetMotionMaster()->Clear();
// bot->GetMotionMaster()->MoveIdle(); // bot->GetMotionMaster()->MoveIdle();
// } // }
// cheat options // cheat options
if (bot->IsAlive() && ((uint32)GetCheat() > 0 || (uint32)sPlayerbotAIConfig->botCheatMask > 0)) if (bot->IsAlive() && ((uint32)GetCheat() > 0 || (uint32)sPlayerbotAIConfig->botCheatMask > 0))
{ {
@ -303,6 +302,14 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
return; 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; bool min = minimal;
UpdateAIInternal(elapsed, min); UpdateAIInternal(elapsed, min);
inCombat = bot->IsInCombat(); inCombat = bot->IsInCombat();