Optimized the init bots, assign first level and teleportForLevel

This commit is contained in:
bash
2024-09-10 20:24:38 +00:00
parent ae78d51d8f
commit 010a1101eb
2 changed files with 15 additions and 14 deletions

View File

@@ -728,14 +728,14 @@ AiPlayerbot.FastReactInBG = 1
# #
# All In seconds # All In seconds
AiPlayerbot.RandomBotUpdateInterval = 20 AiPlayerbot.RandomBotUpdateInterval = 1
AiPlayerbot.RandomBotCountChangeMinInterval = 1800 AiPlayerbot.RandomBotCountChangeMinInterval = 1800
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200 AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
AiPlayerbot.MinRandomBotInWorldTime = 3600 AiPlayerbot.MinRandomBotInWorldTime = 3600
AiPlayerbot.MaxRandomBotInWorldTime = 43200 AiPlayerbot.MaxRandomBotInWorldTime = 1209600
AiPlayerbot.MinRandomBotRandomizeTime = 302400 AiPlayerbot.MinRandomBotRandomizeTime = 7200
AiPlayerbot.MaxRandomBotRandomizeTime = 1209600 AiPlayerbot.MaxRandomBotRandomizeTime = 1209600
AiPlayerbot.RandomBotsPerInterval = 500 AiPlayerbot.RandomBotsPerInterval = 60
AiPlayerbot.MinRandomBotReviveTime = 60 AiPlayerbot.MinRandomBotReviveTime = 60
AiPlayerbot.MaxRandomBotReviveTime = 300 AiPlayerbot.MaxRandomBotReviveTime = 300
AiPlayerbot.MinRandomBotTeleportInterval = 3600 AiPlayerbot.MinRandomBotTeleportInterval = 3600

View File

@@ -1014,26 +1014,26 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
if (isLogginIn) if (isLogginIn)
return false; return false;
uint32 randomTime;
if (!player) if (!player)
{ {
AddPlayerBot(botGUID, 0); AddPlayerBot(botGUID, 0);
SetEventValue(bot, "login", 1, sPlayerbotAIConfig->randomBotUpdateInterval); SetEventValue(bot, "login", 1,
std::max(1, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.2)));
uint32 randomTime = randomTime = urand(std::max(5, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval)),
urand(sPlayerbotAIConfig->minRandomBotReviveTime, sPlayerbotAIConfig->maxRandomBotReviveTime); std::max(15, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2.2)));
SetEventValue(bot, "update", 1, randomTime); SetEventValue(bot, "update", 1, randomTime);
// do not randomize or teleport immediately after server start (prevent lagging) // do not randomize or teleport immediately after server start (prevent lagging)
if (!GetEventValue(bot, "randomize")) if (!GetEventValue(bot, "randomize"))
{ {
randomTime = urand(sPlayerbotAIConfig->randomBotUpdateInterval * 5, ScheduleRandomize(bot, std::max(3, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5)));
sPlayerbotAIConfig->randomBotUpdateInterval * 20);
ScheduleRandomize(bot, randomTime);
} }
if (!GetEventValue(bot, "teleport")) if (!GetEventValue(bot, "teleport"))
{ {
randomTime = urand(sPlayerbotAIConfig->randomBotUpdateInterval * 5, randomTime = urand(std::max(7, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.8)),
sPlayerbotAIConfig->randomBotUpdateInterval * 20); std::max(14, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2)));
ScheduleTeleport(bot, randomTime); ScheduleTeleport(bot, randomTime);
} }
return true; return true;
@@ -1076,8 +1076,9 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
if (update) if (update)
ProcessBot(player); ProcessBot(player);
uint32 randomTime = randomTime = urand(
urand(sPlayerbotAIConfig->minRandomBotReviveTime, sPlayerbotAIConfig->maxRandomBotReviveTime); sPlayerbotAIConfig->minRandomBotReviveTime,
sPlayerbotAIConfig->maxRandomBotReviveTime);
SetEventValue(bot, "update", 1, randomTime); SetEventValue(bot, "update", 1, randomTime);
return true; return true;