Fix playerbots database request queue stacking (#870)

* Clear added random bots on server start

* Remove duplicate set login event

* Remove login event value

* Remove deletion of add event value
This commit is contained in:
Yunfan Li
2025-01-15 03:30:06 +08:00
committed by GitHub
parent 7a71cd57f9
commit bf4deff717

View File

@@ -1065,16 +1065,11 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
return false; return false;
} }
uint32 isLogginIn = GetEventValue(bot, "login");
if (isLogginIn)
return false;
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);
uint32 randomBotUpdateInterval = _isBotInitializing ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval; uint32 randomBotUpdateInterval = _isBotInitializing ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
randomTime = urand(std::max(5, static_cast<int>(randomBotUpdateInterval * 0.5)), randomTime = urand(std::max(5, static_cast<int>(randomBotUpdateInterval * 0.5)),
@@ -1097,8 +1092,6 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
return true; return true;
} }
SetEventValue(bot, "login", 0, 0);
if (!player->IsInWorld()) if (!player->IsInWorld())
return false; return false;
@@ -2504,7 +2497,6 @@ void RandomPlayerbotMgr::OnPlayerLogin(Player* player)
if (IsRandomBot(player)) if (IsRandomBot(player))
{ {
ObjectGuid::LowType guid = player->GetGUID().GetCounter(); ObjectGuid::LowType guid = player->GetGUID().GetCounter();
SetEventValue(guid, "login", 0, 0);
} }
else else
{ {