diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index f12d4376..d2785ad4 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -44,6 +44,13 @@ AiPlayerbot.MaxRandomBots = 50 AiPlayerbot.RandomBotMinLevel = 1 AiPlayerbot.RandomBotMaxLevel = 80 +# Enable/Disable rotation of bots (randomly select a bot from the bots pool to go online and rotate them periodically) +# default: 0 (disable, the online bots are fixed) +AiPlayerbot.EnableRotation = 0 + +# Bots pool size for rotation (should be less than RandomBotAccountCount * 10) +AiPlayerbot.RotationPoolSize = 500 + # Accounts to create for random bots AiPlayerbot.RandomBotAccountPrefix = "rndbot" AiPlayerbot.RandomBotAccountCount = 200 @@ -251,7 +258,7 @@ AiPlayerbot.LootDelay = 1000 # Distances AiPlayerbot.FarDistance = 20.0 -AiPlayerbot.SightDistance = 100.0 +AiPlayerbot.SightDistance = 75.0 AiPlayerbot.SpellDistance = 28.5 AiPlayerbot.ShootDistance = 5.0 AiPlayerbot.ReactDistance = 150.0 @@ -338,7 +345,7 @@ AiPlayerbot.RandomBotUpdateInterval = 20 AiPlayerbot.RandomBotCountChangeMinInterval = 1800 AiPlayerbot.RandomBotCountChangeMaxInterval = 7200 AiPlayerbot.MinRandomBotInWorldTime = 3600 -AiPlayerbot.MaxRandomBotInWorldTime = 1209600 +AiPlayerbot.MaxRandomBotInWorldTime = 43200 AiPlayerbot.MinRandomBotRandomizeTime = 302400 AiPlayerbot.MaxRandomRandomizeTime = 1209600 AiPlayerbot.RandomBotsPerInterval = 500 @@ -350,6 +357,7 @@ AiPlayerbot.MinRandomBotReviveTime = 60 AiPlayerbot.MaxRandomBotReviveTime = 300 AiPlayerbot.MinRandomBotTeleportInterval = 3600 AiPlayerbot.MaxRandomBotTeleportInterval = 18000 +AiPlayerbot.RandomBotInWorldWithRotaionDisabled = 31104000 # How far random bots are teleported after death AiPlayerbot.RandomBotTeleportDistance = 100 diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index a60c845d..d7033d41 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -124,6 +124,7 @@ bool PlayerbotAIConfig::Initialize() maxRandomBotReviveTime = sConfigMgr->GetOption("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE); minRandomBotTeleportInterval = sConfigMgr->GetOption("AiPlayerbot.MinRandomBotTeleportInterval", 1 * HOUR); maxRandomBotTeleportInterval = sConfigMgr->GetOption("AiPlayerbot.MaxRandomBotTeleportInterval", 5 * HOUR); + randomBotInWorldWithRotaionDisabled = sConfigMgr->GetOption("AiPlayerbot.RandomBotInWorldWithRotaionDisabled", 1 * YEAR); randomBotTeleportDistance = sConfigMgr->GetOption("AiPlayerbot.RandomBotTeleportDistance", 100); randomBotsPerInterval = sConfigMgr->GetOption("AiPlayerbot.RandomBotsPerInterval", MINUTE); minRandomBotsPriceChangeInterval = sConfigMgr->GetOption("AiPlayerbot.MinRandomBotsPriceChangeInterval", 2 * HOUR); @@ -328,6 +329,8 @@ bool PlayerbotAIConfig::Initialize() randombotsWalkingRPGInDoors = sConfigMgr->GetOption("AiPlayerbot.RandombotsWalkingRPG.InDoors", false); minEnchantingBotLevel = sConfigMgr->GetOption("AiPlayerbot.MinEnchantingBotLevel", 60); randombotStartingLevel = sConfigMgr->GetOption("AiPlayerbot.RandombotStartingLevel", 5); + enableRotation = sConfigMgr->GetOption("AiPlayerbot.EnableRotation", false); + rotationPoolSize = sConfigMgr->GetOption("AiPlayerbot.RotationPoolSize", 500); gearscorecheck = sConfigMgr->GetOption("AiPlayerbot.GearScoreCheck", false); randomBotPreQuests = sConfigMgr->GetOption("AiPlayerbot.PreQuests", true); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index ca6477ce..0d6367cb 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -70,6 +70,7 @@ class PlayerbotAIConfig uint32 minRandomBotChangeStrategyTime, maxRandomBotChangeStrategyTime; uint32 minRandomBotReviveTime, maxRandomBotReviveTime; uint32 minRandomBotTeleportInterval, maxRandomBotTeleportInterval; + uint32 randomBotInWorldWithRotaionDisabled; uint32 minRandomBotPvpTime, maxRandomBotPvpTime; uint32 randomBotsPerInterval; uint32 minRandomBotsPriceChangeInterval, maxRandomBotsPriceChangeInterval; @@ -108,6 +109,8 @@ class PlayerbotAIConfig bool randombotsWalkingRPGInDoors; uint32 minEnchantingBotLevel; uint32 randombotStartingLevel; + bool enableRotation; + uint32 rotationPoolSize; bool gearscorecheck; bool randomBotPreQuests; diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index d946912a..3d8ddf73 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -337,6 +337,11 @@ uint32 RandomPlayerbotMgr::AddRandomBots() for (std::vector::iterator i = sPlayerbotAIConfig->randomBotAccounts.begin(); i != sPlayerbotAIConfig->randomBotAccounts.end(); i++) { uint32 accountId = *i; + if (sPlayerbotAIConfig->enableRotation) { + uint32 limit = std::min((uint32)sPlayerbotAIConfig->randomBotAccounts.size(), sPlayerbotAIConfig->rotationPoolSize / 10 + 1); + uint32 index = urand(0, limit); + accountId = sPlayerbotAIConfig->randomBotAccounts[index]; + } CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID); stmt->SetData(0, accountId); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -359,8 +364,12 @@ uint32 RandomPlayerbotMgr::AddRandomBots() if (std::find(currentBots.begin(), currentBots.end(), guid) != currentBots.end()) continue; - - SetEventValue(guid, "add", 1, urand(sPlayerbotAIConfig->minRandomBotInWorldTime, sPlayerbotAIConfig->maxRandomBotInWorldTime)); + + uint32 add_time = sPlayerbotAIConfig->enableRotation ? + urand(sPlayerbotAIConfig->minRandomBotInWorldTime, sPlayerbotAIConfig->maxRandomBotInWorldTime) : + sPlayerbotAIConfig->randomBotInWorldWithRotaionDisabled; + + SetEventValue(guid, "add", 1, add_time); SetEventValue(guid, "logout", 0, 0); currentBots.push_back(guid);