Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions conf/mod-bg-auto-queue.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ BgAutoQueue.CrossFaction = 1

BgAutoQueue.SkipGameMasters = 1

#
# BgAutoQueue.SkipAFK
# Description: Skip players flagged as AFK in both the warning and the
# queueing, so idle characters are not teleported into a
# battleground.
# Default: 1 - Skip AFK players
# 0 - Include AFK players
#

BgAutoQueue.SkipAFK = 1

#
# BgAutoQueue.SkipAuras
# Description: Comma-separated list of aura (spell) IDs. A player who has
Expand Down
12 changes: 10 additions & 2 deletions src/BgAutoQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void BgAutoQueue::LoadConfig()

_crossFaction = sConfigMgr->GetOption<bool>("BgAutoQueue.CrossFaction", true);
_skipGameMasters = sConfigMgr->GetOption<bool>("BgAutoQueue.SkipGameMasters", true);
_skipAfk = sConfigMgr->GetOption<bool>("BgAutoQueue.SkipAFK", true);
_broadcastMessage = sConfigMgr->GetOption<std::string>("BgAutoQueue.BroadcastMessage", BG_AUTO_QUEUE_DEFAULT_BROADCAST);

_skipAuras.clear();
Expand All @@ -131,8 +132,8 @@ void BgAutoQueue::LoadConfig()
_warningSent = false;
_firstPass = true;

LOG_INFO("module", "mod-bg-auto-queue: enabled={}, levels=[{}-{}], pool size={}, interval={} min, initialDelay={} s, warningLead={} s, crossFaction={}, skipGM={}, skipAuras={}.",
_enabled, _levelMin, _levelMax, _poolRaw.size(), intervalMin, initialDelaySec, warningLeadSec, _crossFaction, _skipGameMasters, _skipAuras.size());
LOG_INFO("module", "mod-bg-auto-queue: enabled={}, levels=[{}-{}], pool size={}, interval={} min, initialDelay={} s, warningLead={} s, crossFaction={}, skipGM={}, skipAFK={}, skipAuras={}.",
_enabled, _levelMin, _levelMax, _poolRaw.size(), intervalMin, initialDelaySec, warningLeadSec, _crossFaction, _skipGameMasters, _skipAfk, _skipAuras.size());

// Opt-out is stored via the core PlayerSettings system, which only persists
// across logins when EnablePlayerSettings is on. Without it, .bgevents
Expand Down Expand Up @@ -200,6 +201,7 @@ char const* BgAutoQueue::GetSkipReasonLabel(SkipReason reason)
case SkipReason::DeathKnightEbonHold: return "Death Knight locked to Ebon Hold";
case SkipReason::GameMaster: return "game master";
case SkipReason::Aura: return "has a configured skip aura";
case SkipReason::Afk: return "flagged AFK";
case SkipReason::NoBracket: return "no PvP bracket for level";
default: return "unknown";
}
Expand Down Expand Up @@ -284,6 +286,12 @@ bool BgAutoQueue::IsEligible(Player* player, SkipReason* reason) const
return fail(SkipReason::GameMaster);
}

if (_skipAfk && player->isAFK())
{
LOG_DEBUG("module", "mod-bg-auto-queue: skip {}: flagged AFK.", name);
return fail(SkipReason::Afk);
}

for (uint32 auraId : _skipAuras)
{
if (player->HasAura(auraId))
Expand Down
2 changes: 2 additions & 0 deletions src/BgAutoQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class BgAutoQueue
DeathKnightEbonHold,
GameMaster,
Aura, // carries one of the configured skip auras
Afk, // flagged AFK
NoBracket, // no PvP bracket for the level on the reference map
Count
};
Expand Down Expand Up @@ -154,6 +155,7 @@ class BgAutoQueue
uint32 _warningLeadMs = 60u * 1000u;
bool _crossFaction = true;
bool _skipGameMasters = true;
bool _skipAfk = true;
std::vector<uint32> _skipAuras; // aura ids that exclude a player from a pass
std::string _broadcastMessage;

Expand Down
Loading