Skip to content

Commit

Permalink
Merge pull request #845 from liyunfan1223/lfg_leave
Browse files Browse the repository at this point in the history
Remove from group when no real player in lfg group
  • Loading branch information
liyunfan1223 authored Jan 4, 2025
2 parents a62fa3e + d3868e7 commit 7c8c20b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 7c8c20b

Please sign in to comment.