mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Added more defense programming (#1195)
This commit is contained in:
@@ -4269,17 +4269,24 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
|
|||||||
// HasFriend
|
// HasFriend
|
||||||
if (sPlayerbotAIConfig->BotActiveAloneForceWhenIsFriend)
|
if (sPlayerbotAIConfig->BotActiveAloneForceWhenIsFriend)
|
||||||
{
|
{
|
||||||
|
if (!bot || !bot->IsInWorld() || !bot->GetGUID())
|
||||||
|
return false;
|
||||||
|
|
||||||
for (auto& player : sRandomPlayerbotMgr->GetPlayers())
|
for (auto& player : sRandomPlayerbotMgr->GetPlayers())
|
||||||
{
|
{
|
||||||
if (!player || !player->IsInWorld() || !player->GetSocial() || !bot->GetGUID())
|
if (!player || !player->IsInWorld())
|
||||||
{
|
|
||||||
continue;
|
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;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user