AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BattlegroundUtils.cpp File Reference
#include "BattlegroundUtils.h"
#include "World.h"

Go to the source code of this file.

Functions

uint32 GetMinPlayersPerTeam (Battleground *bg, PvPDifficultyEntry const *bracketEntry)
 

Function Documentation

◆ GetMinPlayersPerTeam()

uint32 GetMinPlayersPerTeam ( Battleground bg,
PvPDifficultyEntry const *  bracketEntry 
)
5{
6 // The problem addressed here is that methods such as bg->GetMinLevel() and bg->GetMaxLevel() have a different meaning
7 // according to whether the BG is a template (then it's the value from the `battleground_template` table)
8 // or if it's the real BG (then it's the specific bracket minimum level, e.g. "60" for "60-69").
9
10 if (!bg->isTemplate() || bg->isArena())
11 {
12 return bg->GetMinPlayersPerTeam();
13 }
14
15 auto maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
16 auto isMaxLevel = bracketEntry->minLevel <= maxPlayerLevel && maxPlayerLevel <= bracketEntry->maxLevel;
17 auto lowLevelsOverride = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS);
18
19 return (lowLevelsOverride && !isMaxLevel) ? lowLevelsOverride : bg->GetMinPlayersPerTeam();
20}
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:236
@ CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS
Definition: IWorld.h:308
#define sWorld
Definition: World.h:443
uint32 GetMinPlayersPerTeam() const
Definition: Battleground.h:350
bool isArena() const
Definition: Battleground.h:413
bool isTemplate() const
Definition: Battleground.h:341

References CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS, CONFIG_MAX_PLAYER_LEVEL, Battleground::GetMinPlayersPerTeam(), Battleground::isArena(), Battleground::isTemplate(), PvPDifficultyEntry::maxLevel, PvPDifficultyEntry::minLevel, and sWorld.

Referenced by BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), BattlegroundQueue::BattlegroundQueueUpdate(), and BattlegroundQueue::SendMessageBGQueue().