TrinityCore
Loading...
Searching...
No Matches
GarrisonMgr.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef GarrisonMgr_h__
19#define GarrisonMgr_h__
20
21#include "Define.h"
22#include "Hash.h"
23#include "Position.h"
24#include <list>
25#include <set>
26#include <unordered_map>
27#include <unordered_set>
28#include <vector>
29
30struct GameObjectsEntry;
31struct GarrAbilityEntry;
35
45
47{
48 std::unordered_set<GarrAbilityEntry const*> Counters;
49 std::unordered_set<GarrAbilityEntry const*> Traits;
50};
51
53{
54public:
56 GarrisonMgr(GarrisonMgr const&) = delete;
61
62 static GarrisonMgr& Instance();
63
64 void Initialize();
65
66 GarrSiteLevelEntry const* GetGarrSiteLevelEntry(uint32 garrSiteId, uint32 level) const;
67 std::vector<GarrSiteLevelPlotInstEntry const*> const* GetGarrPlotInstForSiteLevel(uint32 garrSiteLevelId) const;
68 GameObjectsEntry const* GetPlotGameObject(uint32 mapId, uint32 garrPlotInstanceId) const;
69 bool IsPlotMatchingBuilding(uint32 garrPlotId, uint32 garrBuildingId) const;
70 uint32 GetGarrBuildingPlotInst(uint32 garrBuildingId, uint32 garrSiteLevelPlotInstId) const;
71 uint32 GetPreviousLevelBuildingId(uint32 buildingType, uint32 currentLevel) const;
72 FinalizeGarrisonPlotGOInfo const* GetPlotFinalizeGOInfo(uint32 garrPlotInstanceID) const;
73 uint64 GenerateFollowerDbId();
74 std::list<GarrAbilityEntry const*> RollFollowerAbilities(uint32 garrFollowerId, GarrFollowerEntry const* follower, uint32 quality, uint32 faction, bool initial) const;
75 std::list<GarrAbilityEntry const*> GetClassSpecAbilities(GarrFollowerEntry const* follower, uint32 faction) const;
76
77private:
78 void InitializeDbIdSequences();
79 void LoadPlotFinalizeGOInfo();
80 void LoadFollowerClassSpecAbilities();
81
82 std::unordered_map<uint32 /*garrSiteId*/, std::vector<GarrSiteLevelPlotInstEntry const*>> _garrisonPlotInstBySiteLevel;
83 std::unordered_map<uint32 /*mapId*/, std::unordered_map<uint32 /*garrPlotId*/, GameObjectsEntry const*>> _garrisonPlots;
84 std::unordered_map<uint32 /*garrPlotId*/, std::unordered_set<uint32/*garrBuildingId*/>> _garrisonBuildingsByPlot;
85 std::unordered_map<std::pair<uint32 /*garrBuildingId*/, uint32 /*garrSiteLevelPlotInstId*/>, uint32 /*garrBuildingPlotInstId*/> _garrisonBuildingPlotInstances;
86 std::unordered_map<uint32 /*buildingType*/, std::vector<uint32>> _garrisonBuildingsByType;
87 std::unordered_map<uint32 /*garrPlotInstanceId*/, FinalizeGarrisonPlotGOInfo> _finalizePlotGOInfo;
88 std::unordered_map<uint32 /*garrFollowerId*/, GarrAbilities> _garrisonFollowerAbilities[2];
89 std::unordered_map<uint32 /*classSpecId*/, std::list<GarrAbilityEntry const*>> _garrisonFollowerClassSpecAbilities;
90 std::set<GarrAbilityEntry const*> _garrisonFollowerRandomTraits;
91
92 uint64 _followerDbIdGenerator = UI64LIT(1);
93};
94
95#define sGarrisonMgr GarrisonMgr::Instance()
96
97#endif // GarrisonMgr_h__
#define TC_GAME_API
Definition Define.h:129
uint64_t uint64
Definition Define.h:153
#define UI64LIT(N)
Definition Define.h:139
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
GarrisonMgr(GarrisonMgr &&)=delete
std::unordered_map< uint32, std::vector< uint32 > > _garrisonBuildingsByType
Definition GarrisonMgr.h:86
std::set< GarrAbilityEntry const * > _garrisonFollowerRandomTraits
Definition GarrisonMgr.h:90
std::unordered_map< uint32, FinalizeGarrisonPlotGOInfo > _finalizePlotGOInfo
Definition GarrisonMgr.h:87
GarrisonMgr & operator=(GarrisonMgr &&)=delete
std::unordered_map< uint32, std::unordered_map< uint32, GameObjectsEntry const * > > _garrisonPlots
Definition GarrisonMgr.h:83
GarrisonMgr(GarrisonMgr const &)=delete
std::unordered_map< uint32, std::list< GarrAbilityEntry const * > > _garrisonFollowerClassSpecAbilities
Definition GarrisonMgr.h:89
std::unordered_map< uint32, std::unordered_set< uint32 > > _garrisonBuildingsByPlot
Definition GarrisonMgr.h:84
GarrisonMgr & operator=(GarrisonMgr const &)=delete
std::unordered_map< uint32, std::vector< GarrSiteLevelPlotInstEntry const * > > _garrisonPlotInstBySiteLevel
Definition GarrisonMgr.h:82
std::unordered_map< std::pair< uint32, uint32 >, uint32 > _garrisonBuildingPlotInstances
Definition GarrisonMgr.h:85
struct FinalizeGarrisonPlotGOInfo::@269 FactionInfo[2]
std::unordered_set< GarrAbilityEntry const * > Traits
Definition GarrisonMgr.h:49
std::unordered_set< GarrAbilityEntry const * > Counters
Definition GarrisonMgr.h:48