feat(Core/Battlegrounds): rework LowLevelsMinPlayersOverride (#26601)

This commit is contained in:
Francesco Borzì
2026-07-14 17:45:48 +02:00
committed by GitHub
parent 81a8c779bd
commit 178c9c69e6
8 changed files with 272 additions and 6 deletions
@@ -3976,10 +3976,35 @@ Battleground.SpeedBuffRespawn = 150
#
# Battleground.Override.LowLevels.MinPlayers
# Description: Overrides the minimum number of required players per team for all levels < MaxPlayerLevel
# Used as fallback for any battleground without a per-battleground override (see below)
# Default: 0 (Disabled)
Battleground.Override.LowLevels.MinPlayers = 0
#
# Battleground.Override.LowLevels.MinPlayers.AV
# Battleground.Override.LowLevels.MinPlayers.WS
# Battleground.Override.LowLevels.MinPlayers.AB
# Battleground.Override.LowLevels.MinPlayers.EY
# Battleground.Override.LowLevels.MinPlayers.SA
# Battleground.Override.LowLevels.MinPlayers.IC
# Description: Per-battleground overrides of the minimum number of required players per team
# for all levels < MaxPlayerLevel.
# AV = Alterac Valley, WS = Warsong Gulch, AB = Arathi Basin,
# EY = Eye of the Storm, SA = Strand of the Ancients, IC = Isle of Conquest
# Resolution order: per-battleground key, then Battleground.Override.LowLevels.MinPlayers,
# then the battleground_template DB value.
# Matches entered through the Random Battleground queue always use the global
# Battleground.Override.LowLevels.MinPlayers, never the per-battleground keys.
# Default: 0 (Disabled, use Battleground.Override.LowLevels.MinPlayers)
Battleground.Override.LowLevels.MinPlayers.AV = 0
Battleground.Override.LowLevels.MinPlayers.WS = 0
Battleground.Override.LowLevels.MinPlayers.AB = 0
Battleground.Override.LowLevels.MinPlayers.EY = 0
Battleground.Override.LowLevels.MinPlayers.SA = 0
Battleground.Override.LowLevels.MinPlayers.IC = 0
#
# Battleground.Warsong.Flags
# Description: Set the number of flags required for a team to win in Warsong battleground
@@ -19,6 +19,7 @@
#include "ArenaSpectator.h"
#include "ArenaTeam.h"
#include "BattlegroundMgr.h"
#include "BattlegroundUtils.h"
#include "Chat.h"
#include "ChatTextBuilder.h"
#include "Creature.h"
@@ -242,6 +243,12 @@ Battleground::~Battleground()
delete itr.second;
}
uint32 Battleground::GetMinPlayersPerTeam() const
{
uint32 lowLevelsOverride = GetLowLevelsMinPlayersOverride(GetBgTypeID());
return (lowLevelsOverride && !isTemplate() && !isMaxLevel() && !isArena()) ? lowLevelsOverride : m_MinPlayersPerTeam;
}
void Battleground::Update(uint32 diff)
{
// pussywizard:
+1 -5
View File
@@ -347,11 +347,7 @@ public:
}
[[nodiscard]] uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
[[nodiscard]] uint32 GetMinPlayersPerTeam() const
{
auto lowLevelsOverride = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS);
return (lowLevelsOverride && !isTemplate() && !isMaxLevel() && !isArena()) ? lowLevelsOverride : m_MinPlayersPerTeam;
}
[[nodiscard]] uint32 GetMinPlayersPerTeam() const;
[[nodiscard]] int32 GetStartDelayTime() const { return m_StartDelayTime; }
[[nodiscard]] uint8 GetArenaType() const { return m_ArenaType; }
@@ -14,7 +14,23 @@ uint32 GetMinPlayersPerTeam(Battleground* bg, PvPDifficultyEntry const* bracketE
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);
auto lowLevelsOverride = GetLowLevelsMinPlayersOverride(bg->GetBgTypeID());
return (lowLevelsOverride && !isMaxLevel) ? lowLevelsOverride : bg->GetMinPlayersPerTeam();
}
uint32 GetLowLevelsMinPlayersOverride(BattlegroundTypeId bgTypeId)
{
uint32 perBg = 0;
switch (bgTypeId)
{
case BATTLEGROUND_AV: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AV); break;
case BATTLEGROUND_WS: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_WS); break;
case BATTLEGROUND_AB: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AB); break;
case BATTLEGROUND_EY: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_EY); break;
case BATTLEGROUND_SA: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_SA); break;
case BATTLEGROUND_IC: perBg = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_IC); break;
default: break;
}
return perBg ? perBg : sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS);
}
@@ -5,4 +5,10 @@
uint32 GetMinPlayersPerTeam(Battleground* bg, PvPDifficultyEntry const* bracketEntry);
// Effective low-levels MinPlayersPerTeam override for a BG type:
// the per-BG config if set, else the global one. 0 = no override.
// BGs entered through the Random BG queue have BATTLEGROUND_RB as
// their type, so they always resolve through the global key.
uint32 GetLowLevelsMinPlayersOverride(BattlegroundTypeId bgTypeId);
#endif // BATTLEGROUNDUTILS_H
+6
View File
@@ -426,6 +426,12 @@ void WorldConfig::BuildConfigCache()
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_PREP_TIME, "Battleground.PrepTime", 120);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS, "Battleground.Override.LowLevels.MinPlayers", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AV, "Battleground.Override.LowLevels.MinPlayers.AV", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_WS, "Battleground.Override.LowLevels.MinPlayers.WS", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AB, "Battleground.Override.LowLevels.MinPlayers.AB", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_EY, "Battleground.Override.LowLevels.MinPlayers.EY", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_SA, "Battleground.Override.LowLevels.MinPlayers.SA", 0);
SetConfigValue<uint32>(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_IC, "Battleground.Override.LowLevels.MinPlayers.IC", 0);
SetConfigValue<bool>(CONFIG_BATTLEGROUND_DISABLE_QUEST_SHARE_IN_BG, "Battleground.DisableQuestShareInBG", false);
SetConfigValue<bool>(CONFIG_BATTLEGROUND_DISABLE_READY_CHECK_IN_BG, "Battleground.DisableReadyCheckInBG", false);
SetConfigValue<bool>(CONFIG_BATTLEGROUND_CAST_DESERTER, "Battleground.CastDeserter", true);
+6
View File
@@ -264,6 +264,12 @@ enum ServerConfigs
CONFIG_DISABLE_BREATHING,
CONFIG_BATTLEGROUND_PREP_TIME,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AV,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_WS,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_AB,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_EY,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_SA,
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS_IC,
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY,
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMER,
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,