Remove from group when no real player in lfg group

This commit is contained in:
Yunfan Li
2025-01-04 16:41:02 +08:00
parent 01c257005e
commit d3868e7af7

View File

@@ -406,6 +406,27 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
}
}
if (bot->GetGroup() && bot->GetGroup()->isLFGGroup())
{
bool hasRealPlayer = false;
for (GroupReference* ref = bot->GetGroup()->GetFirstMember(); ref; ref = ref->next())
{
Player* member = ref->GetSource();
if (!member)
continue;
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (memberAI && !memberAI->IsRealPlayer())
continue;
hasRealPlayer = true;
break;
}
if (!hasRealPlayer)
{
bot->RemoveFromGroup();
ResetStrategies();
}
}
bool min = minimal;
UpdateAIInternal(elapsed, min);
YieldThread(GetReactDelay());