Compare commits

..

No commits in common. "bb004825aa289f33f5355038bd5873590702e067" and "e739f7820b87a7ec38cfacd12475a4dfda252371" have entirely different histories.

4 changed files with 16 additions and 38 deletions

View File

@ -717,8 +717,8 @@ AiPlayerbot.BotActiveAloneForceWhenInGuild = 1
# The default is 1. When enabled (smart) scales the 'BotActiveAlone' value. # The default is 1. When enabled (smart) scales the 'BotActiveAlone' value.
# (The scaling will be overruled by the BotActiveAloneForceWhen...rules) # (The scaling will be overruled by the BotActiveAloneForceWhen...rules)
# #
# Limitfloor - when DIFF (latency) is above floor, activity scaling begins # Limitfloor - when DIFF (latency) above floor, activity scaling is applied starting with 90%
# LimitCeiling - when DIFF (latency) is above ceiling, activity is 0% # LimitCeiling - when DIFF (latency) above ceiling, activity is 0%;
# #
# MinLevel - only apply scaling when level is above or equal to min(bot)Level # MinLevel - only apply scaling when level is above or equal to min(bot)Level
# MaxLevel - only apply scaling when level is lower or equal of max(bot)Level # MaxLevel - only apply scaling when level is lower or equal of max(bot)Level

View File

@ -525,11 +525,6 @@ uint32 GuildTaskMgr::GetMaxItemTaskCount(uint32 itemId)
bool GuildTaskMgr::IsGuildTaskItem(uint32 itemId, uint32 guildId) bool GuildTaskMgr::IsGuildTaskItem(uint32 itemId, uint32 guildId)
{ {
if (!sPlayerbotAIConfig->guildTaskEnabled)
{
return 0;
}
uint32 value = 0; uint32 value = 0;
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabasePreparedStatement* stmt =
@ -553,11 +548,6 @@ bool GuildTaskMgr::IsGuildTaskItem(uint32 itemId, uint32 guildId)
std::map<uint32, uint32> GuildTaskMgr::GetTaskValues(uint32 owner, std::string const type, std::map<uint32, uint32> GuildTaskMgr::GetTaskValues(uint32 owner, std::string const type,
[[maybe_unused]] uint32* validIn /* = nullptr */) [[maybe_unused]] uint32* validIn /* = nullptr */)
{ {
if (!sPlayerbotAIConfig->guildTaskEnabled)
{
return std::map<uint32, uint32>();
}
std::map<uint32, uint32> results; std::map<uint32, uint32> results;
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabasePreparedStatement* stmt =
@ -586,11 +576,6 @@ std::map<uint32, uint32> GuildTaskMgr::GetTaskValues(uint32 owner, std::string c
uint32 GuildTaskMgr::GetTaskValue(uint32 owner, uint32 guildId, std::string const type, [[maybe_unused]] uint32* validIn /* = nullptr */) uint32 GuildTaskMgr::GetTaskValue(uint32 owner, uint32 guildId, std::string const type, [[maybe_unused]] uint32* validIn /* = nullptr */)
{ {
if (!sPlayerbotAIConfig->guildTaskEnabled)
{
return 0;
}
uint32 value = 0; uint32 value = 0;
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabasePreparedStatement* stmt =

View File

@ -4365,28 +4365,26 @@ bool PlayerbotAI::AllowActivity(ActivityType activityType, bool checkNow)
uint32 PlayerbotAI::AutoScaleActivity(uint32 mod) uint32 PlayerbotAI::AutoScaleActivity(uint32 mod)
{ {
// Current max server update time (ms), and the configured floor/ceiling values for bot scaling
uint32 maxDiff = sWorldUpdateTime.GetMaxUpdateTimeOfCurrentTable(); uint32 maxDiff = sWorldUpdateTime.GetMaxUpdateTimeOfCurrentTable();
uint32 diffLimitFloor = sPlayerbotAIConfig->botActiveAloneSmartScaleDiffLimitfloor; uint32 diffLimitFloor = sPlayerbotAIConfig->botActiveAloneSmartScaleDiffLimitfloor;
uint32 diffLimitCeiling = sPlayerbotAIConfig->botActiveAloneSmartScaleDiffLimitCeiling; uint32 diffLimitCeiling = sPlayerbotAIConfig->botActiveAloneSmartScaleDiffLimitCeiling;
double spreadSize = (double)(diffLimitCeiling - diffLimitFloor) / 6;
if (diffLimitCeiling <= diffLimitFloor) // apply scaling
{
// Perfrom binary decision if ceiling <= floor: Either all bots are active or none are
return (maxDiff > diffLimitCeiling) ? 0 : mod;
}
if (maxDiff > diffLimitCeiling) if (maxDiff > diffLimitCeiling)
return 0; return 0;
if (maxDiff > diffLimitFloor + (4 * spreadSize))
return (mod * 1) / 10;
if (maxDiff > diffLimitFloor + (3 * spreadSize))
return (mod * 3) / 10;
if (maxDiff > diffLimitFloor + (2 * spreadSize))
return (mod * 5) / 10;
if (maxDiff > diffLimitFloor + (1 * spreadSize))
return (mod * 7) / 10;
if (maxDiff > diffLimitFloor)
return (mod * 9) / 10;
if (maxDiff <= diffLimitFloor) return mod;
return mod;
// Calculate lag progress from floor to ceiling (0 to 1)
double lagProgress = (maxDiff - diffLimitFloor) / (double)(diffLimitCeiling - diffLimitFloor);
// Apply the percentage of active bots (the complement of lag progress) to the mod value
return static_cast<uint32>(mod * (1 - lagProgress));
} }
bool PlayerbotAI::IsOpposing(Player* player) { return IsOpposing(player->getRace(), bot->getRace()); } bool PlayerbotAI::IsOpposing(Player* player) { return IsOpposing(player->getRace(), bot->getRace()); }

View File

@ -40,11 +40,6 @@ bool IsDeadValue::Calculate()
bool PetIsDeadValue::Calculate() bool PetIsDeadValue::Calculate()
{ {
if ((bot->GetLevel() < 10 && bot->getClass() == CLASS_HUNTER) || bot->IsMounted())
{
return false;
}
if (!bot->GetPet()) if (!bot->GetPet())
{ {
uint32 ownerid = bot->GetGUID().GetCounter(); uint32 ownerid = bot->GetGUID().GetCounter();