mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
feat(Core/BG): allow MinPlayersPerTeam override for low-levels (#20083)
This commit is contained in:
20
src/server/game/Battlegrounds/BattlegroundUtils.cpp
Normal file
20
src/server/game/Battlegrounds/BattlegroundUtils.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "BattlegroundUtils.h"
|
||||
#include "World.h"
|
||||
|
||||
uint32 GetMinPlayersPerTeam(Battleground* bg, PvPDifficultyEntry const* bracketEntry)
|
||||
{
|
||||
// The problem addressed here is that methods such as bg->GetMinLevel() and bg->GetMaxLevel() have a different meaning
|
||||
// according to whether the BG is a template (then it's the value from the `battleground_template` table)
|
||||
// or if it's the real BG (then it's the specific bracket minimum level, e.g. "60" for "60-69").
|
||||
|
||||
if (!bg->isTemplate() || bg->isArena())
|
||||
{
|
||||
return bg->GetMinPlayersPerTeam();
|
||||
}
|
||||
|
||||
auto maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
auto isMaxLevel = bracketEntry->minLevel <= maxPlayerLevel && maxPlayerLevel <= bracketEntry->maxLevel;
|
||||
auto lowLevelsOverride = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS);
|
||||
|
||||
return (lowLevelsOverride && !isMaxLevel) ? lowLevelsOverride : bg->GetMinPlayersPerTeam();
|
||||
}
|
||||
Reference in New Issue
Block a user