mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Feat: Bot rotation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -124,6 +124,7 @@ bool PlayerbotAIConfig::Initialize()
|
||||
maxRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE);
|
||||
minRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotTeleportInterval", 1 * HOUR);
|
||||
maxRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotTeleportInterval", 5 * HOUR);
|
||||
randomBotInWorldWithRotaionDisabled = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotInWorldWithRotaionDisabled", 1 * YEAR);
|
||||
randomBotTeleportDistance = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleportDistance", 100);
|
||||
randomBotsPerInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotsPerInterval", MINUTE);
|
||||
minRandomBotsPriceChangeInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotsPriceChangeInterval", 2 * HOUR);
|
||||
@@ -328,6 +329,8 @@ bool PlayerbotAIConfig::Initialize()
|
||||
randombotsWalkingRPGInDoors = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG.InDoors", false);
|
||||
minEnchantingBotLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.MinEnchantingBotLevel", 60);
|
||||
randombotStartingLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.RandombotStartingLevel", 5);
|
||||
enableRotation = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableRotation", false);
|
||||
rotationPoolSize = sConfigMgr->GetOption<int32>("AiPlayerbot.RotationPoolSize", 500);
|
||||
gearscorecheck = sConfigMgr->GetOption<bool>("AiPlayerbot.GearScoreCheck", false);
|
||||
randomBotPreQuests = sConfigMgr->GetOption<bool>("AiPlayerbot.PreQuests", true);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -337,6 +337,11 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
|
||||
for (std::vector<uint32>::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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user