mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Core/BG): allow MinPlayersPerTeam override for low-levels (#20083)
This commit is contained in:
@@ -3675,6 +3675,13 @@ Battleground.BerserkingBuffRespawn = 120
|
||||
|
||||
Battleground.SpeedBuffRespawn = 150
|
||||
|
||||
#
|
||||
# Battleground.Override.LowLevels.MinPlayers
|
||||
# Description: Overrides the minimum number of required players per team for all levels < MaxPlayerLevel
|
||||
# Default: 0 (Disabled)
|
||||
|
||||
Battleground.Override.LowLevels.MinPlayers = 0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ Battleground::Battleground()
|
||||
m_LastResurrectTime = 0;
|
||||
m_ArenaType = 0;
|
||||
m_IsArena = false;
|
||||
m_IsTemplate = true;
|
||||
m_WinnerId = PVP_TEAM_NEUTRAL;
|
||||
m_StartTime = 0;
|
||||
m_ResetStatTimer = 0;
|
||||
@@ -1822,6 +1823,7 @@ GraveyardStruct const* Battleground::GetClosestGraveyard(Player* player)
|
||||
|
||||
void Battleground::SetBracket(PvPDifficultyEntry const* bracketEntry)
|
||||
{
|
||||
m_IsTemplate = false;
|
||||
m_BracketId = bracketEntry->GetBracketId();
|
||||
SetLevelRange(bracketEntry->minLevel, bracketEntry->maxLevel);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "DBCEnums.h"
|
||||
#include "GameObject.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "World.h"
|
||||
|
||||
class Creature;
|
||||
class GameObject;
|
||||
@@ -337,8 +338,20 @@ public:
|
||||
[[nodiscard]] uint32 GetMinLevel() const { return m_LevelMin; }
|
||||
[[nodiscard]] uint32 GetMaxLevel() const { return m_LevelMax; }
|
||||
|
||||
[[nodiscard]] bool isTemplate() const { return m_IsTemplate; }
|
||||
[[nodiscard]] bool isMaxLevel() const
|
||||
{
|
||||
// NOTE: this only works when the BG is not a template but the real BG
|
||||
auto maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
return GetMinLevel() <= maxPlayerLevel && maxPlayerLevel <= GetMaxLevel();
|
||||
}
|
||||
|
||||
[[nodiscard]] uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
|
||||
[[nodiscard]] uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
|
||||
[[nodiscard]] uint32 GetMinPlayersPerTeam() const
|
||||
{
|
||||
auto lowLevelsOverride = sWorld->getIntConfig(CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS);
|
||||
return (lowLevelsOverride && !isTemplate() && !isMaxLevel() && !isArena()) ? lowLevelsOverride : m_MinPlayersPerTeam;
|
||||
}
|
||||
|
||||
[[nodiscard]] int32 GetStartDelayTime() const { return m_StartDelayTime; }
|
||||
[[nodiscard]] uint8 GetArenaType() const { return m_ArenaType; }
|
||||
@@ -658,6 +671,7 @@ private:
|
||||
bool _InBGFreeSlotQueue{ false }; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
bool m_IsArena;
|
||||
bool m_IsTemplate;
|
||||
PvPTeamId m_WinnerId;
|
||||
int32 m_StartDelayTime;
|
||||
bool m_IsRated; // is this battle rated?
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include <unordered_map>
|
||||
|
||||
#include "BattlegroundUtils.h"
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
/*********************************************************/
|
||||
@@ -760,7 +762,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
|
||||
}
|
||||
|
||||
// get min and max players per team
|
||||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||
uint32 MinPlayersPerTeam = GetMinPlayersPerTeam(bg_template, bracketEntry);
|
||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||
|
||||
if (bg_template->isArena())
|
||||
@@ -996,7 +998,7 @@ void BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(uint32 diff, Battlegrou
|
||||
_queueAnnouncementTimer[bracket_id] = -1;
|
||||
|
||||
auto bgName = bg_template->GetName();
|
||||
uint32 MaxPlayers = bg_template->GetMinPlayersPerTeam() * 2;
|
||||
uint32 MaxPlayers = GetMinPlayersPerTeam(bg_template, bracketEntry) * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32) 80);
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32) 80);
|
||||
|
||||
@@ -1047,7 +1049,7 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
|
||||
|
||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
auto bgName = bg->GetName();
|
||||
uint32 MinPlayers = bg->GetMinPlayersPerTeam();
|
||||
uint32 MinPlayers = GetMinPlayersPerTeam(bg, bracketEntry);
|
||||
uint32 MaxPlayers = MinPlayers * 2;
|
||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||
|
||||
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();
|
||||
}
|
||||
8
src/server/game/Battlegrounds/BattlegroundUtils.h
Normal file
8
src/server/game/Battlegrounds/BattlegroundUtils.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef BATTLEGROUNDUTILS_H
|
||||
#define BATTLEGROUNDUTILS_H
|
||||
|
||||
#include "Battleground.h"
|
||||
|
||||
uint32 GetMinPlayersPerTeam(Battleground* bg, PvPDifficultyEntry const* bracketEntry);
|
||||
|
||||
#endif // BATTLEGROUNDUTILS_H
|
||||
@@ -309,6 +309,7 @@ enum WorldIntConfigs
|
||||
CONFIG_DEATH_SICKNESS_LEVEL,
|
||||
CONFIG_INSTANT_LOGOUT,
|
||||
CONFIG_DISABLE_BREATHING,
|
||||
CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS,
|
||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_SPAM_DELAY,
|
||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_TIMER,
|
||||
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,
|
||||
|
||||
@@ -1112,6 +1112,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
_float_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfigMgr->GetOption<float>("ListenRange.TextEmote", 25.0f);
|
||||
_float_configs[CONFIG_LISTEN_RANGE_YELL] = sConfigMgr->GetOption<float>("ListenRange.Yell", 300.0f);
|
||||
|
||||
_int_configs[CONFIG_BATTLEGROUND_OVERRIDE_LOWLEVELS_MINPLAYERS] = sConfigMgr->GetOption<uint32>("Battleground.Override.LowLevels.MinPlayers", 0);
|
||||
_bool_configs[CONFIG_BATTLEGROUND_DISABLE_QUEST_SHARE_IN_BG] = sConfigMgr->GetOption<bool>("Battleground.DisableQuestShareInBG", false);
|
||||
_bool_configs[CONFIG_BATTLEGROUND_DISABLE_READY_CHECK_IN_BG] = sConfigMgr->GetOption<bool>("Battleground.DisableReadyCheckInBG", false);
|
||||
_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetOption<bool>("Battleground.CastDeserter", true);
|
||||
|
||||
Reference in New Issue
Block a user