added additional botActiveAlone confguration options (#780)

This commit is contained in:
bash
2024-12-15 19:18:36 +01:00
committed by GitHub
parent f45d03f62b
commit ea944aeefa
4 changed files with 41 additions and 18 deletions

View File

@@ -1511,6 +1511,12 @@ AiPlayerbot.RandombotsWalkingRPG.InDoors = 0
# enforced to 100%
AiPlayerbot.BotActiveAlone = 100
# Force botActiveAlone when bot is ... of real player
AiPlayerbot.BotActiveAloneForceWhenInRadius = 150;
AiPlayerbot.BotActiveAloneForceWhenInZone = 1;
AiPlayerbot.BotActiveAloneForceWhenIsFriend = 1;
AiPlayerbot.BotActiveAloneForceWhenInGuild = 1;
# Specify smart scaling is enabled or not.
# The default is 1. When enabled (smart) scales the 'BotActiveAlone' value.
# Only when botLevel is between WhenMinLevel and WhenMaxLevel.

View File

@@ -4173,19 +4173,31 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
}
// bot zone has active players.
if (ZoneHasRealPlayers(bot))
if (sPlayerbotAIConfig->BotActiveAloneForceWhenInZone)
{
return true;
if (ZoneHasRealPlayers(bot))
{
return true;
}
}
// when in real guild
if (IsInRealGuild())
if (sPlayerbotAIConfig->BotActiveAloneForceWhenInGuild)
{
if (IsInRealGuild())
{
return true;
}
}
// Player is near. Always active.
if (HasPlayerNearby(sPlayerbotAIConfig->BotActiveAloneWhenInRadius))
{
return true;
}
// Has player master. Always active.
if (GetMaster())
if (GetMaster())
{
PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(GetMaster());
if (!masterBotAI || masterBotAI->IsRealPlayer())
@@ -4253,30 +4265,27 @@ bool PlayerbotAI::AllowActive(ActivityType activityType)
return true;
}
// Player is near. Always active.
if (HasPlayerNearby(300.f))
{
return true;
}
// HasFriend
for (auto& player : sRandomPlayerbotMgr->GetPlayers())
if (sPlayerbotAIConfig->BotActiveAloneForceWhenIsFriend)
{
if (!player || !player->IsInWorld() || !player->GetSocial() || !bot->GetGUID())
for (auto& player : sRandomPlayerbotMgr->GetPlayers())
{
continue;
}
if (!player || !player->IsInWorld() || !player->GetSocial() || !bot->GetGUID())
{
continue;
}
if (player->GetSocial()->HasFriend(bot->GetGUID()))
{
return true;
if (player->GetSocial()->HasFriend(bot->GetGUID()))
{
return true;
}
}
}
// Force the bots to spread
if (activityType == OUT_OF_PARTY_ACTIVITY || activityType == GRIND_ACTIVITY)
{
if (HasManyPlayersNearby(10, sPlayerbotAIConfig->sightDistance))
if (HasManyPlayersNearby(10, 40))
{
return true;
}

View File

@@ -468,6 +468,10 @@ bool PlayerbotAIConfig::Initialize()
playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1);
disableDeathKnightLogin = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableDeathKnightLogin", 0);
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 100);
BotActiveAloneWhenInRadius = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAloneWhenInRadius", 150);
BotActiveAloneForceWhenInZone = sConfigMgr->GetOption<bool>("AiPlayerbot.BotActiveAloneForceWhenInZone", 1);
BotActiveAloneForceWhenIsFriend = sConfigMgr->GetOption<bool>("AiPlayerbot.BotActiveAloneForceWhenIsFriend", 1);
BotActiveAloneForceWhenInGuild = sConfigMgr->GetOption<bool>("AiPlayerbot.BotActiveAloneForceWhenInGuild", 1);
botActiveAloneSmartScale = sConfigMgr->GetOption<bool>("AiPlayerbot.botActiveAloneSmartScale", 1);
botActiveAloneSmartScaleWhenMinLevel =
sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleWhenMinLevel", 1);

View File

@@ -264,6 +264,10 @@ public:
uint32 playerbotsXPrate;
bool disableDeathKnightLogin;
uint32 botActiveAlone;
uint32 BotActiveAloneWhenInRadius;
bool BotActiveAloneForceWhenInZone;
bool BotActiveAloneForceWhenIsFriend;
bool BotActiveAloneForceWhenInGuild;
bool botActiveAloneSmartScale;
uint32 botActiveAloneSmartScaleWhenMinLevel;
uint32 botActiveAloneSmartScaleWhenMaxLevel;