AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BGSpamProtect Class Reference

#include "BattlegroundSpamProtect.h"

Public Member Functions

bool CanAnnounce (Player *player, Battleground *bg, uint32 minLevel, uint32 queueTotal)
 

Static Public Member Functions

static BGSpamProtectinstance ()
 

Detailed Description

Member Function Documentation

◆ CanAnnounce()

bool BGSpamProtect::CanAnnounce ( Player player,
Battleground bg,
uint32  minLevel,
uint32  queueTotal 
)
59{
60 ObjectGuid guid = player->GetGUID();
61
62 // Check prev time
63 if (!IsCorrectDelay(guid))
64 {
65 return false;
66 }
67
68 if (bg)
69 {
70 // When limited, it announces only if there are at least CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS in queue
71 auto limitQueueMinLevel = sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_LEVEL);
72 if (limitQueueMinLevel && minLevel >= limitQueueMinLevel)
73 {
74 // limit only RBG for 80, WSG for lower levels
75 auto bgTypeToLimit = minLevel == 80 ? BATTLEGROUND_RB : BATTLEGROUND_WS;
76
77 if (bg->GetBgTypeID() == bgTypeToLimit && queueTotal < sWorld->getIntConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS))
78 {
79 return false;
80 }
81 }
82 }
83
84 AddTime(guid);
85 return true;
86}
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3482
@ BATTLEGROUND_RB
Definition: SharedDefines.h:3493
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_LEVEL
Definition: IWorld.h:320
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS
Definition: IWorld.h:321
#define sWorld
Definition: World.h:443
bool IsCorrectDelay(ObjectGuid guid)
Definition: BattlegroundSpamProtect.cpp:45
void AddTime(ObjectGuid guid)
Definition: BattlegroundSpamProtect.cpp:29
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:329
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
Definition: ObjectGuid.h:118

References BATTLEGROUND_RB, BATTLEGROUND_WS, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_LEVEL, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_LIMIT_MIN_PLAYERS, Battleground::GetBgTypeID(), Object::GetGUID(), and sWorld.

◆ instance()

BGSpamProtect * BGSpamProtect::instance ( )
static
53{
55 return &instance;
56}
Definition: BattlegroundSpamProtect.h:27
static BGSpamProtect * instance()
Definition: BattlegroundSpamProtect.cpp:52

References instance().

Referenced by instance().