Merge branch 'master' into new_rpg_strats

This commit is contained in:
Yunfan Li
2024-12-13 18:51:55 +08:00

View File

@@ -172,6 +172,13 @@ RandomPlayerbotMgr::RandomPlayerbotMgr() : PlayerbotHolder(), processTicks(0)
}
BattlegroundData.clear();
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
{
for (int queueType = BATTLEGROUND_QUEUE_AV; queueType < MAX_BATTLEGROUND_QUEUE_TYPES; ++queueType)
{
BattlegroundData[queueType][bracket] = BattlegroundInfo();
}
}
BgCheckTimer = 0;
LfgCheckTimer = 0;
PlayersCheckTimer = 0;
@@ -348,19 +355,19 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
if (sPlayerbotAIConfig->syncLevelWithPlayers && !players.empty())
{
if (time(nullptr) > (PlayersCheckTimer + 60))
activateCheckPlayersThread();
sRandomPlayerbotMgr->CheckPlayers();
}
if (sPlayerbotAIConfig->randomBotJoinBG /* && !players.empty()*/)
{
if (time(nullptr) > (BgCheckTimer + 30))
activateCheckBgQueueThread();
sRandomPlayerbotMgr->CheckBgQueue();
}
if (sPlayerbotAIConfig->randomBotJoinLfg /* && !players.empty()*/)
{
if (time(nullptr) > (LfgCheckTimer + 30))
activateCheckLfgQueueThread();
sRandomPlayerbotMgr->CheckLfgQueue();
}
if (time(nullptr) > (printStatsTimer + 300))
@@ -614,6 +621,14 @@ void RandomPlayerbotMgr::CheckBgQueue()
BattlegroundData.clear();
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
{
for (int queueType = BATTLEGROUND_QUEUE_AV; queueType < MAX_BATTLEGROUND_QUEUE_TYPES; ++queueType)
{
BattlegroundData[queueType][bracket] = BattlegroundInfo();
}
}
for (Player* player : players)
{
if (!player->InBattlegroundQueue())
@@ -860,7 +875,8 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
for (const auto& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0)
continue;
LOG_INFO("playerbots",
"ARENA:{} {}: Player (Skirmish:{}, Rated:{}) Bots (Skirmish:{}, Rated:{}) Total (Skirmish:{} "
"Rated:{}), Instances (Skirmish:{} Rated:{})",
@@ -909,6 +925,8 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
for (const auto& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0)
continue;
LOG_INFO("playerbots", "BG:{} {}: Player ({}:{}) Bot ({}:{}) Total (A:{} H:{}), Instances {}", _bgType,
std::to_string(bgInfo.minLevel) + "-" + std::to_string(bgInfo.maxLevel),