random bots maintanence

This commit is contained in:
Yunfan Li
2023-08-08 15:22:01 +08:00
parent e3094f2558
commit f383f46e2d
3 changed files with 8 additions and 12 deletions

View File

@@ -533,7 +533,7 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje
return "bot not found";
if (!isRandomAccount || isRandomBot) {
return "ERROR: You can not use this command on summoned random bot.";
return "ERROR: You can not use this command on non-summoned random bot.";
}
if (Player* master = GET_PLAYERBOT_AI(bot)->GetMaster())

View File

@@ -2182,7 +2182,7 @@ void RandomItemMgr::BuildAmmoCache()
for (uint32 subClass = ITEM_SUBCLASS_ARROW; subClass <= ITEM_SUBCLASS_THROWN; subClass++)
{
QueryResult results = WorldDatabase.Query("SELECT entry FROM item_template WHERE class = {} AND subclass = {} AND RequiredLevel <= {} "
"ORDER BY RequiredLevel DESC", ITEM_CLASS_PROJECTILE, subClass, level);
"ORDER BY RequiredLevel DESC, Quality DESC, ItemLevel DESC", ITEM_CLASS_PROJECTILE, subClass, level);
if (!results)
return;

View File

@@ -261,13 +261,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
if (time(nullptr) > (PlayersCheckTimer + 60))
activateCheckPlayersThread();
}
if (sPlayerbotAIConfig->syncLevelWithPlayers && !players.empty())
{
if (time(nullptr) > (PlayersCheckTimer + 60))
activateCheckPlayersThread();
}
if (sPlayerbotAIConfig->randomBotJoinBG/* && !players.empty()*/)
{
if (time(nullptr) > (BgCheckTimer + 30))
@@ -1483,8 +1477,9 @@ bool RandomPlayerbotMgr::IsRandomBot(ObjectGuid::LowType bot)
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(bot);
if (!sPlayerbotAIConfig->IsInRandomAccountList(sCharacterCache->GetCharacterAccountIdByGuid(guid)))
return false;
return GetEventValue(bot, "add");
if (std::find(currentBots.begin(), currentBots.end(), bot) != currentBots.end())
return true;
return false;
}
std::list<uint32> RandomPlayerbotMgr::GetBots()
@@ -1501,7 +1496,8 @@ std::list<uint32> RandomPlayerbotMgr::GetBots()
{
Field* fields = result->Fetch();
uint32 bot = fields[0].Get<uint32>();
currentBots.push_back(bot);
if (GetEventValue(bot, "add"))
currentBots.push_back(bot);
}
while (result->NextRow());
}