Compare commits

..

No commits in common. "a37dd2b9ae64904cb636cdbcd5dd6bd7c83ab418" and "e5bc495dbeff73afba4e00b3485ea83e65103b81" have entirely different histories.

5 changed files with 14 additions and 42 deletions

View File

@ -1196,46 +1196,24 @@ AiPlayerbot.FastReactInBG = 1
#################################################################################################### ####################################################################################################
#################################################################################################### ####################################################################################################
# RANDOM BOT TIMING AND BEHAVIOR # INTERVALS
# #
# #
# How often (in seconds) the random bot manager runs its main update loop # All in seconds
# Default: 20
AiPlayerbot.RandomBotUpdateInterval = 20 AiPlayerbot.RandomBotUpdateInterval = 20
# Minimum and maximum seconds before the manager re-evaluates and adjusts total random bot count
# Defaults: 1800 (min), 7200 (max)
AiPlayerbot.RandomBotCountChangeMinInterval = 1800 AiPlayerbot.RandomBotCountChangeMinInterval = 1800
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200 AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
# Minimum and maximum seconds a random bot will stay online before logging out
# Defaults: 600 (min), 28800 (max)
AiPlayerbot.MinRandomBotInWorldTime = 600 AiPlayerbot.MinRandomBotInWorldTime = 600
AiPlayerbot.MaxRandomBotInWorldTime = 28800 AiPlayerbot.MaxRandomBotInWorldTime = 28800
# Minimum and maximum seconds before a bot is eligible for re-randomization (gear, class, talents, etc.)
# Defaults: 7200 (min), 1209600 (max)
AiPlayerbot.MinRandomBotRandomizeTime = 7200 AiPlayerbot.MinRandomBotRandomizeTime = 7200
AiPlayerbot.MaxRandomBotRandomizeTime = 1209600 AiPlayerbot.MaxRandomBotRandomizeTime = 1209600
# Number of bots processed (login, logout, update) per manager update cycle
# Default: 60
AiPlayerbot.RandomBotsPerInterval = 60 AiPlayerbot.RandomBotsPerInterval = 60
# Minimum and maximum seconds after death before a bot revives
# Defaults: 60 (min), 300 (max)
AiPlayerbot.MinRandomBotReviveTime = 60 AiPlayerbot.MinRandomBotReviveTime = 60
AiPlayerbot.MaxRandomBotReviveTime = 300 AiPlayerbot.MaxRandomBotReviveTime = 300
# Minimum and maximum seconds between bot teleports to new areas or zones
# Defaults: 3600 (min), 18000 (max)
AiPlayerbot.MinRandomBotTeleportInterval = 3600 AiPlayerbot.MinRandomBotTeleportInterval = 3600
AiPlayerbot.MaxRandomBotTeleportInterval = 18000 AiPlayerbot.MaxRandomBotTeleportInterval = 18000
AiPlayerbot.PermanantlyInWorldTime = 31104000
# Number of seconds bots flagged as permanent stay in the world (31,104,000 ≈ 1 year)
# Default: 31104000
AiPlayerbot.PermanentlyInWorldTime = 31104000
# #
# #

View File

@ -367,19 +367,11 @@ void PlayerbotAI::UpdateAIGroupAndMaster()
{ {
if (!bot) if (!bot)
return; return;
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
if (!botAI)
return;
Group* group = bot->GetGroup(); Group* group = bot->GetGroup();
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
// If bot is not in group verify that for is RandomBot before clearing master and resetting. // If bot is not in group verify that for is RandomBot before clearing master and resetting.
if (!group) if (!group)
{ {
if (master && IsRandomBot) if (master && sRandomPlayerbotMgr->IsRandomBot(bot))
{ {
SetMaster(nullptr); SetMaster(nullptr);
Reset(true); Reset(true);
@ -388,10 +380,12 @@ void PlayerbotAI::UpdateAIGroupAndMaster()
return; return;
} }
// Bot in BG, but master no longer part of a group: release master if (bot->InBattleground() && bot->GetBattleground()->GetBgTypeID() != BATTLEGROUND_AV)
// Exclude alt and addclass bots as they rely on current (real player) master, security-wise. return;
if (bot->InBattleground() && IsRandomBot && master && !master->GetGroup())
SetMaster(nullptr); PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
if (!botAI)
return;
PlayerbotAI* masterBotAI = nullptr; PlayerbotAI* masterBotAI = nullptr;
if (master) if (master)

View File

@ -199,8 +199,8 @@ bool PlayerbotAIConfig::Initialize()
maxRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE); maxRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE);
minRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotTeleportInterval", 1 * HOUR); minRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotTeleportInterval", 1 * HOUR);
maxRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotTeleportInterval", 5 * HOUR); maxRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotTeleportInterval", 5 * HOUR);
permanentlyInWorldTime = permanantlyInWorldTime =
sConfigMgr->GetOption<int32>("AiPlayerbot.PermanentlyInWorldTime", 1 * YEAR); sConfigMgr->GetOption<int32>("AiPlayerbot.PermanantlyInWorldTime", 1 * YEAR);
randomBotTeleportDistance = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleportDistance", 100); randomBotTeleportDistance = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleportDistance", 100);
randomBotsPerInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotsPerInterval", 60); randomBotsPerInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotsPerInterval", 60);
minRandomBotsPriceChangeInterval = minRandomBotsPriceChangeInterval =

View File

@ -132,7 +132,7 @@ public:
uint32 minRandomBotChangeStrategyTime, maxRandomBotChangeStrategyTime; uint32 minRandomBotChangeStrategyTime, maxRandomBotChangeStrategyTime;
uint32 minRandomBotReviveTime, maxRandomBotReviveTime; uint32 minRandomBotReviveTime, maxRandomBotReviveTime;
uint32 minRandomBotTeleportInterval, maxRandomBotTeleportInterval; uint32 minRandomBotTeleportInterval, maxRandomBotTeleportInterval;
uint32 permanentlyInWorldTime; uint32 permanantlyInWorldTime;
uint32 minRandomBotPvpTime, maxRandomBotPvpTime; uint32 minRandomBotPvpTime, maxRandomBotPvpTime;
uint32 randomBotsPerInterval; uint32 randomBotsPerInterval;
uint32 minRandomBotsPriceChangeInterval, maxRandomBotsPriceChangeInterval; uint32 minRandomBotsPriceChangeInterval, maxRandomBotsPriceChangeInterval;

View File

@ -822,7 +822,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
uint32 add_time = sPlayerbotAIConfig->enablePeriodicOnlineOffline uint32 add_time = sPlayerbotAIConfig->enablePeriodicOnlineOffline
? urand(sPlayerbotAIConfig->minRandomBotInWorldTime, ? urand(sPlayerbotAIConfig->minRandomBotInWorldTime,
sPlayerbotAIConfig->maxRandomBotInWorldTime) sPlayerbotAIConfig->maxRandomBotInWorldTime)
: sPlayerbotAIConfig->permanentlyInWorldTime; : sPlayerbotAIConfig->permanantlyInWorldTime;
SetEventValue(charInfo.guid, "add", 1, add_time); SetEventValue(charInfo.guid, "add", 1, add_time);
SetEventValue(charInfo.guid, "logout", 0, 0); SetEventValue(charInfo.guid, "logout", 0, 0);