feat(Core/BattlegroundQueue): add limited Battleground.QueueAnnouncer (#5093)

This commit is contained in:
Kargatum
2021-04-10 01:55:10 +07:00
committed by GitHub
parent cde067390f
commit 91a39f27d9
4 changed files with 44 additions and 18 deletions

View File

@@ -976,6 +976,7 @@ void BattlegroundQueue::SendMessageQueue(Player* leader, Battleground* bg, PvPDi
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
uint32 qHorde = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_HORDE);
uint32 qAlliance = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
uint32 leftPlayers = MaxPlayers - qHorde - qAlliance;
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bg->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
@@ -990,11 +991,16 @@ void BattlegroundQueue::SendMessageQueue(Player* leader, Battleground* bg, PvPDi
if (searchGUID == BGSpamProtection.end())
BGSpamProtection[leader->GetGUID()] = 0; // Leader GUID not found, initialize with 0
if (sWorld->GetGameTime() - BGSpamProtection[leader->GetGUID()] >= 30)
{
BGSpamProtection[leader->GetGUID()] = sWorld->GetGameTime();
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
}
// Skip if spam time < 30 secs (default)
if (sWorld->GetGameTime() - BGSpamProtection[leader->GetGUID()] < sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY))
return;
// If left players > 1 - skip announce
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMITED_ENABLE) && leftPlayers != 1)
return;
BGSpamProtection[leader->GetGUID()] = sWorld->GetGameTime();
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
}
}