diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2014-07-09 16:43:56 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-07-09 16:43:56 +0200 |
commit | 7a67d816d9ebaaa6749206bdfbf0f3f983bfb1a3 (patch) | |
tree | fb1c32e264e7466d572a32a484f9f43ce629581d /src/server/game/Battlegrounds/BattlegroundMgr.h | |
parent | 5f69fc9660e1510204a1a2ef608e26804f95c572 (diff) |
Core/Battleground:
* added a possibility to reload battleground templates
* cleaned up the template structure
* use mapids from BattlemasterList.dbc to calculate random bg
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundMgr.h')
-rw-r--r-- | src/server/game/Battlegrounds/BattlegroundMgr.h | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index b57efc045d8..20cd8e4f7be 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -33,28 +33,6 @@ typedef std::unordered_map<uint32, BattlegroundTypeId> BattleMastersMap; #define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day #define WS_ARENA_DISTRIBUTION_TIME 20001 // Custom worldstate -struct CreateBattlegroundData -{ - BattlegroundTypeId bgTypeId; - bool IsArena; - uint32 MinPlayersPerTeam; - uint32 MaxPlayersPerTeam; - uint32 LevelMin; - uint32 LevelMax; - char* BattlegroundName; - uint32 MapID; - float Team1StartLocX; - float Team1StartLocY; - float Team1StartLocZ; - float Team1StartLocO; - float Team2StartLocX; - float Team2StartLocY; - float Team2StartLocZ; - float Team2StartLocO; - float StartMaxDist; - uint32 scriptId; -}; - struct BattlegroundData { BattlegroundContainer m_Battlegrounds; @@ -62,6 +40,22 @@ struct BattlegroundData BGFreeSlotQueueContainer BGFreeSlotQueue; }; +struct BattlegroundTemplate +{ + BattlegroundTypeId Id; + uint16 MinPlayersPerTeam; + uint16 MaxPlayersPerTeam; + uint8 MinLevel; + uint8 MaxLevel; + Position StartLocation[BG_TEAMS_COUNT]; + float MaxStartDistSq; + uint8 Weight; + uint32 ScriptId; + BattlemasterListEntry const* BattlemasterEntry; + + bool IsArena() const { return BattlemasterEntry->type == MAP_ARENA; } +}; + class BattlegroundMgr { friend class ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>; @@ -95,7 +89,7 @@ class BattlegroundMgr void RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId); BGFreeSlotQueueContainer& GetBGFreeSlotQueueStore(BattlegroundTypeId bgTypeId); - void CreateInitialBattlegrounds(); + void LoadBattlegroundTemplates(); void DeleteAllBattlegrounds(); void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId); @@ -135,7 +129,7 @@ class BattlegroundMgr } private: - bool CreateBattleground(CreateBattlegroundData& data); + bool CreateBattleground(BattlegroundTemplate const* bgTemplate); uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id); static bool IsArenaType(BattlegroundTypeId bgTypeId); BattlegroundTypeId GetRandomBG(BattlegroundTypeId id); @@ -145,9 +139,6 @@ class BattlegroundMgr BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; - typedef std::map<BattlegroundTypeId, uint8> BattlegroundSelectionWeightMap; // TypeId and its selectionWeight - BattlegroundSelectionWeightMap m_ArenaSelectionWeights; - BattlegroundSelectionWeightMap m_BGSelectionWeights; std::vector<uint64> m_QueueUpdateScheduler; uint32 m_NextRatedArenaUpdate; time_t m_NextAutoDistributionTime; @@ -155,7 +146,31 @@ class BattlegroundMgr bool m_ArenaTesting; bool m_Testing; BattleMastersMap mBattleMastersMap; + + BattlegroundTemplate const* GetBattlegroundTemplateByTypeId(BattlegroundTypeId id) + { + BattlegroundTemplateMap::const_iterator itr = _battlegroundTemplates.find(id); + if (itr != _battlegroundTemplates.end()) + return &itr->second; + return nullptr; + } + + BattlegroundTemplate 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, BattlegroundTemplate> BattlegroundTemplateMap; + typedef std::map<uint32 /*mapId*/, BattlegroundTemplate*> BattlegroundMapTemplateContainer; + BattlegroundTemplateMap _battlegroundTemplates; + BattlegroundMapTemplateContainer _battlegroundMapTemplates; }; #define sBattlegroundMgr ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>::instance() -#endif + +#endif // __BATTLEGROUNDMGR_H |