mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[performance] server_and_bot_init_phase_patch1 (#652)
This commit is contained in:
@@ -728,7 +728,7 @@ AiPlayerbot.FastReactInBG = 1
|
|||||||
#
|
#
|
||||||
|
|
||||||
# All In seconds
|
# All In seconds
|
||||||
AiPlayerbot.RandomBotUpdateInterval = 5
|
AiPlayerbot.RandomBotUpdateInterval = 1
|
||||||
AiPlayerbot.RandomBotCountChangeMinInterval = 1800
|
AiPlayerbot.RandomBotCountChangeMinInterval = 1800
|
||||||
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
|
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
|
||||||
AiPlayerbot.MinRandomBotInWorldTime = 3600
|
AiPlayerbot.MinRandomBotInWorldTime = 3600
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
|
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
|
||||||
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);
|
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);
|
||||||
maxRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBots", 200);
|
maxRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBots", 200);
|
||||||
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 5);
|
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 1);
|
||||||
randomBotCountChangeMinInterval =
|
randomBotCountChangeMinInterval =
|
||||||
sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE);
|
sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE);
|
||||||
randomBotCountChangeMaxInterval =
|
randomBotCountChangeMaxInterval =
|
||||||
|
|||||||
@@ -995,32 +995,32 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
|
|||||||
|
|
||||||
|
|
||||||
uint32 randomTime;
|
uint32 randomTime;
|
||||||
if (!player)
|
if (!player)
|
||||||
{
|
{
|
||||||
AddPlayerBot(botGUID, 0);
|
AddPlayerBot(botGUID, 0);
|
||||||
randomTime = urand(1, 2);
|
randomTime = urand(1, 2);
|
||||||
SetEventValue(bot, "login", 1, randomTime);
|
SetEventValue(bot, "login", 1, randomTime);
|
||||||
|
|
||||||
uint32 updateIntervalTurboBoost = isBotInitializing() ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
|
uint32 updateIntervalTurboBoost = isBotInitializing() ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
|
||||||
randomTime = urand(std::max(5, static_cast<int>(updateIntervalTurboBoost * 0.5)),
|
randomTime = urand(std::max(5, static_cast<int>(updateIntervalTurboBoost * 0.5)),
|
||||||
std::max(10, static_cast<int>(updateIntervalTurboBoost * 2)));
|
std::max(12, static_cast<int>(updateIntervalTurboBoost * 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(3, std::max(4, static_cast<int>(updateIntervalTurboBoost * 0.4)));
|
randomTime = urand(3, std::max(4, static_cast<int>(updateIntervalTurboBoost * 0.4)));
|
||||||
ScheduleRandomize(bot, randomTime);
|
ScheduleRandomize(bot, randomTime);
|
||||||
}
|
}
|
||||||
if (!GetEventValue(bot, "teleport"))
|
if (!GetEventValue(bot, "teleport"))
|
||||||
{
|
{
|
||||||
randomTime = urand(std::max(7, static_cast<int>(updateIntervalTurboBoost * 0.7)),
|
randomTime = urand(std::max(7, static_cast<int>(updateIntervalTurboBoost * 0.7)),
|
||||||
std::max(14, static_cast<int>(updateIntervalTurboBoost * 1.4)));
|
std::max(14, static_cast<int>(updateIntervalTurboBoost * 1.4)));
|
||||||
ScheduleTeleport(bot, randomTime);
|
ScheduleTeleport(bot, randomTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEventValue(bot, "login", 0, 0);
|
SetEventValue(bot, "login", 0, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user