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