Added more defense programming (#1195)

This commit is contained in:
bash
2025-04-17 05:51:42 +02:00
committed by GitHub
parent 9c816b682a
commit 2f549295d5

View File

@@ -4269,17 +4269,24 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
// HasFriend
if (sPlayerbotAIConfig->BotActiveAloneForceWhenIsFriend)
{
if (!bot || !bot->IsInWorld() || !bot->GetGUID())
return false;
for (auto& player : sRandomPlayerbotMgr->GetPlayers())
{
if (!player || !player->IsInWorld() || !player->GetSocial() || !bot->GetGUID())
{
if (!player || !player->IsInWorld())
continue;
}
if (player->GetSocial()->HasFriend(bot->GetGUID()))
{
Player* connectedPlayer = ObjectAccessor::FindPlayer(player->GetGUID());
if (!connectedPlayer)
continue;
PlayerSocial* social = player->GetSocial();
if (!social)
continue;
if (social->HasFriend(bot->GetGUID()))
return true;
}
}
}