feat(Core/Battlegrounds): Min level of selected random bg must be lower than pvp bracket level. (#10752)

This commit is contained in:
UltraNix
2022-02-21 06:36:48 +01:00
committed by GitHub
parent 74f84591ce
commit 400caec709
2 changed files with 8 additions and 5 deletions
@@ -259,7 +259,7 @@ uint32 BattlegroundMgr::GetNextClientVisibleInstanceId()
// create a new battleground that will really be used to play // create a new battleground that will really be used to play
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId originalBgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated) Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId originalBgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated)
{ {
BattlegroundTypeId bgTypeId = GetRandomBG(originalBgTypeId); BattlegroundTypeId bgTypeId = GetRandomBG(originalBgTypeId, minLevel);
if (originalBgTypeId == BATTLEGROUND_AA) if (originalBgTypeId == BATTLEGROUND_AA)
originalBgTypeId = bgTypeId; originalBgTypeId = bgTypeId;
@@ -769,7 +769,7 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId)); return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
} }
BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId) BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId, uint32 minLevel)
{ {
if (GetBattlegroundTemplateByTypeId(bgTypeId)) if (GetBattlegroundTemplateByTypeId(bgTypeId))
{ {
@@ -786,8 +786,11 @@ BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
if (CreateBattlegroundData const* bg = GetBattlegroundTemplateByMapId(mapId)) if (CreateBattlegroundData const* bg = GetBattlegroundTemplateByMapId(mapId))
{ {
ids.push_back(bg->bgTypeId); if (bg->LevelMin <= minLevel)
weights.push_back(bg->Weight); {
ids.push_back(bg->bgTypeId);
weights.push_back(bg->Weight);
}
} }
} }
@@ -134,7 +134,7 @@ public:
private: private:
bool CreateBattleground(CreateBattlegroundData& data); bool CreateBattleground(CreateBattlegroundData& data);
uint32 GetNextClientVisibleInstanceId(); uint32 GetNextClientVisibleInstanceId();
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id); BattlegroundTypeId GetRandomBG(BattlegroundTypeId id, uint32 minLevel);
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer; typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
BattlegroundTemplateContainer m_BattlegroundTemplates; BattlegroundTemplateContainer m_BattlegroundTemplates;