fix(Core/Battlegrounds) Rewrite RandomBG and enabling bg/arenas weights (#2516)
This commit is contained in:
@@ -40,24 +40,11 @@ struct CreateBattlegroundData
|
||||
float Team2StartLocO;
|
||||
float StartMaxDist;
|
||||
uint32 scriptId;
|
||||
uint8 Weight;
|
||||
};
|
||||
|
||||
struct GroupQueueInfo;
|
||||
|
||||
// pussywizard
|
||||
class RandomBattlegroundSystem
|
||||
{
|
||||
public:
|
||||
RandomBattlegroundSystem();
|
||||
void Update(uint32 diff);
|
||||
BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; }
|
||||
void BattlegroundCreated(BattlegroundTypeId bgTypeId);
|
||||
private:
|
||||
BattlegroundTypeId m_CurrentRandomBg;
|
||||
uint32 m_SwitchTimer;
|
||||
std::vector<BattlegroundTypeId> m_BgOrder;
|
||||
};
|
||||
|
||||
class BattlegroundMgr
|
||||
{
|
||||
private:
|
||||
@@ -117,8 +104,6 @@ class BattlegroundMgr
|
||||
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
|
||||
|
||||
PvPDifficultyEntry randomBgDifficultyEntry;
|
||||
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void LoadBattleMastersEntry();
|
||||
@@ -132,7 +117,6 @@ class BattlegroundMgr
|
||||
}
|
||||
|
||||
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
|
||||
RandomBattlegroundSystem RandomSystem; // pussywizard
|
||||
|
||||
static std::unordered_map<int, BattlegroundQueueTypeId> bgToQueue; // BattlegroundTypeId -> BattlegroundQueueTypeId
|
||||
static std::unordered_map<int, BattlegroundTypeId> queueToBg; // BattlegroundQueueTypeId -> BattlegroundTypeId
|
||||
@@ -142,6 +126,7 @@ class BattlegroundMgr
|
||||
private:
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 GetNextClientVisibleInstanceId();
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
|
||||
|
||||
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
@@ -157,6 +142,29 @@ class BattlegroundMgr
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
|
||||
{
|
||||
BattlegroundTemplateMap::const_iterator itr = _battlegroundTemplates.find(id);
|
||||
if (itr != _battlegroundTemplates.end())
|
||||
return &itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreateBattlegroundData const* GetBattlegroundTemplateByMapId(uint32 mapId)
|
||||
{
|
||||
BattlegroundMapTemplateContainer::const_iterator itr = _battlegroundMapTemplates.find(mapId);
|
||||
if (itr != _battlegroundMapTemplates.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
typedef std::map<BattlegroundTypeId, uint8 /*weight*/> BattlegroundSelectionWeightMap;
|
||||
|
||||
typedef std::map<BattlegroundTypeId, CreateBattlegroundData> BattlegroundTemplateMap;
|
||||
typedef std::map<uint32 /*mapId*/, CreateBattlegroundData*> BattlegroundMapTemplateContainer;
|
||||
BattlegroundTemplateMap _battlegroundTemplates;
|
||||
BattlegroundMapTemplateContainer _battlegroundMapTemplates;
|
||||
};
|
||||
|
||||
#define sBattlegroundMgr BattlegroundMgr::instance()
|
||||
|
||||
Reference in New Issue
Block a user