mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #845 from liyunfan1223/lfg_leave
Remove from group when no real player in lfg group
This commit is contained in:
@@ -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;
|
bool min = minimal;
|
||||||
UpdateAIInternal(elapsed, min);
|
UpdateAIInternal(elapsed, min);
|
||||||
YieldThread(GetReactDelay());
|
YieldThread(GetReactDelay());
|
||||||
|
|||||||
Reference in New Issue
Block a user