mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
Added more defense programming (#1195)
This commit is contained in:
parent
9c816b682a
commit
2f549295d5
@ -4269,19 +4269,26 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force the bots to spread
|
||||
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user