mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
feat(Core/Battlegrounds): Implemented new timed config for queue anno… (#8053)
* feat(Core/Battlegrounds): Implemented new timed config for queue announce system. Closes #6637. * Update. * typo. * Update.
This commit is contained in:
@@ -105,25 +105,25 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||||||
uint32 arenaRatedTeamId = scheduled[i] >> 32;
|
uint32 arenaRatedTeamId = scheduled[i] >> 32;
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
|
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
|
||||||
BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
|
BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
|
||||||
m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(bracket_id, true, arenaRatedTeamId); // pussywizard: looking for opponents only for this team
|
m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(diff, bracket_id, true, arenaRatedTeamId); // pussywizard: looking for opponents only for this team
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// periodic queue update
|
// periodic queue update
|
||||||
if (m_NextPeriodicQueueUpdateTime < diff)
|
if (m_NextPeriodicQueueUpdateTime < diff)
|
||||||
{
|
{
|
||||||
|
m_NextPeriodicQueueUpdateTime = 5 * IN_MILLISECONDS;
|
||||||
|
|
||||||
// for rated arenas
|
// for rated arenas
|
||||||
for (uint32 qtype = BATTLEGROUND_QUEUE_2v2; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
for (uint32 qtype = BATTLEGROUND_QUEUE_2v2; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), true, 0); // pussywizard: 0 for rated means looking for opponents for every team
|
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(m_NextPeriodicQueueUpdateTime, BattlegroundBracketId(bracket), true, 0); // pussywizard: 0 for rated means looking for opponents for every team
|
||||||
|
|
||||||
// for battlegrounds and not rated arenas
|
// for battlegrounds and not rated arenas
|
||||||
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
||||||
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), false, 0);
|
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(m_NextPeriodicQueueUpdateTime, BattlegroundBracketId(bracket), false, 0);
|
||||||
|
|
||||||
m_NextPeriodicQueueUpdateTime = 5 * IN_MILLISECONDS;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_NextPeriodicQueueUpdateTime -= diff;
|
m_NextPeriodicQueueUpdateTime -= diff;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ BattlegroundQueue::BattlegroundQueue() : m_bgTypeId(BATTLEGROUND_TYPE_NONE), m_a
|
|||||||
m_WaitTimes[i][j][k] = 0;
|
m_WaitTimes[i][j][k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_queueAnnouncementTimer.fill(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
BattlegroundQueue::~BattlegroundQueue()
|
BattlegroundQueue::~BattlegroundQueue()
|
||||||
@@ -664,7 +666,7 @@ void BattlegroundQueue::UpdateEvents(uint32 diff)
|
|||||||
struct BgEmptinessComp { bool operator()(Battleground* const& bg1, Battleground* const& bg2) const { return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam()); } };
|
struct BgEmptinessComp { bool operator()(Battleground* const& bg1, Battleground* const& bg2) const { return ((float)bg1->GetMaxFreeSlots() / (float)bg1->GetMaxPlayersPerTeam()) > ((float)bg2->GetMaxFreeSlots() / (float)bg2->GetMaxPlayersPerTeam()); } };
|
||||||
typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
||||||
|
|
||||||
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId)
|
void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId)
|
||||||
{
|
{
|
||||||
// if no players in queue - do nothing
|
// if no players in queue - do nothing
|
||||||
if (IsAllQueuesEmpty(bracket_id))
|
if (IsAllQueuesEmpty(bracket_id))
|
||||||
@@ -939,6 +941,35 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMED))
|
||||||
|
{
|
||||||
|
uint32 qPlayers = GetPlayersCountInGroupsQueue(bracket_id, BG_QUEUE_NORMAL_HORDE) + GetPlayersCountInGroupsQueue(bracket_id, BG_QUEUE_NORMAL_ALLIANCE);
|
||||||
|
if (!qPlayers)
|
||||||
|
{
|
||||||
|
_queueAnnouncementTimer[bracket_id] = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_queueAnnouncementTimer[bracket_id] >= 0)
|
||||||
|
{
|
||||||
|
if (_queueAnnouncementTimer[bracket_id] <= static_cast<int32>(diff))
|
||||||
|
{
|
||||||
|
_queueAnnouncementTimer[bracket_id] = -1;
|
||||||
|
|
||||||
|
char const* bgName = bg_template->GetName();
|
||||||
|
uint32 MaxPlayers = bg_template->GetMinPlayersPerTeam() * 2;
|
||||||
|
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32) 80);
|
||||||
|
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32) 80);
|
||||||
|
|
||||||
|
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qPlayers, MaxPlayers);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_queueAnnouncementTimer[bracket_id] -= static_cast<int32>(diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 BattlegroundQueue::GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue)
|
uint32 BattlegroundQueue::GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue)
|
||||||
@@ -1001,12 +1032,22 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
|
|||||||
}
|
}
|
||||||
else // Show queue status to server (when joining battleground queue)
|
else // Show queue status to server (when joining battleground queue)
|
||||||
{
|
{
|
||||||
if (!sBGSpam->CanAnnounce(leader, bg, q_min_level, qTotal))
|
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMED))
|
||||||
{
|
{
|
||||||
return;
|
if (_queueAnnouncementTimer[bracketId] < 0)
|
||||||
|
{
|
||||||
|
_queueAnnouncementTimer[bracketId] = sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!sBGSpam->CanAnnounce(leader, bg, q_min_level, qTotal))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
|
sWorld->SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "DBCEnums.h"
|
#include "DBCEnums.h"
|
||||||
#include "EventProcessor.h"
|
#include "EventProcessor.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
|
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ public:
|
|||||||
BattlegroundQueue();
|
BattlegroundQueue();
|
||||||
~BattlegroundQueue();
|
~BattlegroundQueue();
|
||||||
|
|
||||||
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId);
|
void BattlegroundQueueUpdate(uint32 diff, BattlegroundBracketId bracket_id, bool isRated, uint32 arenaRatedTeamId);
|
||||||
void UpdateEvents(uint32 diff);
|
void UpdateEvents(uint32 diff);
|
||||||
|
|
||||||
void FillPlayersToBG(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId bracket_id);
|
void FillPlayersToBG(Battleground* bg, int32 aliFree, int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||||
@@ -115,6 +116,10 @@ public:
|
|||||||
|
|
||||||
ArenaType GetArenaType() { return m_arenaType; }
|
ArenaType GetArenaType() { return m_arenaType; }
|
||||||
BattlegroundTypeId GetBGTypeID() { return m_bgTypeId; }
|
BattlegroundTypeId GetBGTypeID() { return m_bgTypeId; }
|
||||||
|
|
||||||
|
void SetQueueAnnouncementTimer(uint32 bracketId, int32 timer) { _queueAnnouncementTimer[bracketId] = timer; }
|
||||||
|
[[nodiscard]] int32 GetQueueAnnouncementTimer(uint32 bracketId) { return _queueAnnouncementTimer[bracketId]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BattlegroundTypeId m_bgTypeId;
|
BattlegroundTypeId m_bgTypeId;
|
||||||
ArenaType m_arenaType;
|
ArenaType m_arenaType;
|
||||||
@@ -123,6 +128,8 @@ private:
|
|||||||
|
|
||||||
// Event handler
|
// Event handler
|
||||||
EventProcessor m_events;
|
EventProcessor m_events;
|
||||||
|
|
||||||
|
std::array<int32, BG_BRACKET_ID_LAST> _queueAnnouncementTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ enum WorldBoolConfigs
|
|||||||
CONFIG_BATTLEGROUND_CAST_DESERTER,
|
CONFIG_BATTLEGROUND_CAST_DESERTER,
|
||||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,
|
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,
|
||||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,
|
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,
|
||||||
|
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMED,
|
||||||
CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE,
|
CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE,
|
||||||
CONFIG_BATTLEGROUND_TRACK_DESERTERS,
|
CONFIG_BATTLEGROUND_TRACK_DESERTERS,
|
||||||
CONFIG_BG_XP_FOR_KILL,
|
CONFIG_BG_XP_FOR_KILL,
|
||||||
@@ -279,6 +280,7 @@ enum WorldIntConfigs
|
|||||||
CONFIG_INSTANT_LOGOUT,
|
CONFIG_INSTANT_LOGOUT,
|
||||||
CONFIG_DISABLE_BREATHING,
|
CONFIG_DISABLE_BREATHING,
|
||||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY,
|
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY,
|
||||||
|
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMER,
|
||||||
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,
|
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,
|
||||||
CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH,
|
CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH,
|
||||||
CONFIG_BATTLEGROUND_REPORT_AFK_TIMER,
|
CONFIG_BATTLEGROUND_REPORT_AFK_TIMER,
|
||||||
|
|||||||
@@ -1098,6 +1098,8 @@ void World::LoadConfigSettings(bool reload)
|
|||||||
m_int_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS] = sConfigMgr->GetOption<uint32>("Battleground.QueueAnnouncer.Limit.MinPlayers", 3);
|
m_int_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS] = sConfigMgr->GetOption<uint32>("Battleground.QueueAnnouncer.Limit.MinPlayers", 3);
|
||||||
m_int_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY] = sConfigMgr->GetOption<uint32>("Battleground.QueueAnnouncer.SpamProtection.Delay", 30);
|
m_int_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY] = sConfigMgr->GetOption<uint32>("Battleground.QueueAnnouncer.SpamProtection.Delay", 30);
|
||||||
m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetOption<bool>("Battleground.QueueAnnouncer.PlayerOnly", false);
|
m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetOption<bool>("Battleground.QueueAnnouncer.PlayerOnly", false);
|
||||||
|
m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMED] = sConfigMgr->GetOption<bool>("Battleground.QueueAnnouncer.Timed", false);
|
||||||
|
m_int_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMER] = sConfigMgr->GetOption<uint32>("Battleground.QueueAnnouncer.Timer", 30000);
|
||||||
m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetOption<bool>("Battleground.StoreStatistics.Enable", false);
|
m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetOption<bool>("Battleground.StoreStatistics.Enable", false);
|
||||||
m_bool_configs[CONFIG_BATTLEGROUND_TRACK_DESERTERS] = sConfigMgr->GetOption<bool>("Battleground.TrackDeserters.Enable", false);
|
m_bool_configs[CONFIG_BATTLEGROUND_TRACK_DESERTERS] = sConfigMgr->GetOption<bool>("Battleground.TrackDeserters.Enable", false);
|
||||||
m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetOption<int32> ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
|
m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetOption<int32> ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
|
||||||
|
|||||||
@@ -2842,6 +2842,23 @@ Arena.QueueAnnouncer.Enable = 0
|
|||||||
|
|
||||||
Arena.QueueAnnouncer.PlayerOnly = 0
|
Arena.QueueAnnouncer.PlayerOnly = 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# Battleground.QueueAnnouncer.Timed
|
||||||
|
# Description: Enabled battleground queue announcements based on timer
|
||||||
|
# Default: 0 - (Disabled)
|
||||||
|
# 1 - (Enabled - Set Arena.QueueAnnouncer.Timer)
|
||||||
|
#
|
||||||
|
|
||||||
|
Battleground.QueueAnnouncer.Timed = 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# Battleground.QueueAnnouncer.Timer
|
||||||
|
# Description: Set timer for queue announcements
|
||||||
|
# Default: 30000 (30 sec)
|
||||||
|
#
|
||||||
|
|
||||||
|
Battleground.QueueAnnouncer.Timer = 30000
|
||||||
|
|
||||||
#
|
#
|
||||||
# Arena.ArenaSeason.ID
|
# Arena.ArenaSeason.ID
|
||||||
# Description: Current arena season id shown in clients.
|
# Description: Current arena season id shown in clients.
|
||||||
|
|||||||
Reference in New Issue
Block a user