TrinityCore
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
37{
38 struct
39 {
44};
45
47{
48 std::unordered_set<GarrAbilityEntry const*> Counters;
49 std::unordered_set<GarrAbilityEntry const*> Traits;
50};
51
53{
54public:
55 static GarrisonMgr& Instance();
56
57 void Initialize();
58
59 GarrSiteLevelEntry const* GetGarrSiteLevelEntry(uint32 garrSiteId, uint32 level) const;
60 std::vector<GarrSiteLevelPlotInstEntry const*> const* GetGarrPlotInstForSiteLevel(uint32 garrSiteLevelId) const;
61 GameObjectsEntry const* GetPlotGameObject(uint32 mapId, uint32 garrPlotInstanceId) const;
62 bool IsPlotMatchingBuilding(uint32 garrPlotId, uint32 garrBuildingId) const;
63 uint32 GetGarrBuildingPlotInst(uint32 garrBuildingId, uint32 garrSiteLevelPlotInstId) const;
64 uint32 GetPreviousLevelBuildingId(uint32 buildingType, uint32 currentLevel) const;
65 FinalizeGarrisonPlotGOInfo const* GetPlotFinalizeGOInfo(uint32 garrPlotInstanceID) const;
66 uint64 GenerateFollowerDbId();
67 std::list<GarrAbilityEntry const*> RollFollowerAbilities(uint32 garrFollowerId, GarrFollowerEntry const* follower, uint32 quality, uint32 faction, bool initial) const;
68 std::list<GarrAbilityEntry const*> GetClassSpecAbilities(GarrFollowerEntry const* follower, uint32 faction) const;
69
70private:
71 void InitializeDbIdSequences();
72 void LoadPlotFinalizeGOInfo();
73 void LoadFollowerClassSpecAbilities();
74
75 std::unordered_map<uint32 /*garrSiteId*/, std::vector<GarrSiteLevelPlotInstEntry const*>> _garrisonPlotInstBySiteLevel;
76 std::unordered_map<uint32 /*mapId*/, std::unordered_map<uint32 /*garrPlotId*/, GameObjectsEntry const*>> _garrisonPlots;
77 std::unordered_map<uint32 /*garrPlotId*/, std::unordered_set<uint32/*garrBuildingId*/>> _garrisonBuildingsByPlot;
78 std::unordered_map<std::pair<uint32 /*garrBuildingId*/, uint32 /*garrSiteLevelPlotInstId*/>, uint32 /*garrBuildingPlotInstId*/> _garrisonBuildingPlotInstances;
79 std::unordered_map<uint32 /*buildingType*/, std::vector<uint32>> _garrisonBuildingsByType;
80 std::unordered_map<uint32 /*garrPlotInstanceId*/, FinalizeGarrisonPlotGOInfo> _finalizePlotGOInfo;
81 std::unordered_map<uint32 /*garrFollowerId*/, GarrAbilities> _garrisonFollowerAbilities[2];
82 std::unordered_map<uint32 /*classSpecId*/, std::list<GarrAbilityEntry const*>> _garrisonFollowerClassSpecAbilities;
83 std::set<GarrAbilityEntry const*> _garrisonFollowerRandomTraits;
84
85 uint64 _followerDbIdGenerator = UI64LIT(1);
86};
87
88#define sGarrisonMgr GarrisonMgr::Instance()
89
90#endif // GarrisonMgr_h__
#define TC_GAME_API
Definition: Define.h:123
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::unordered_map< uint32, std::vector< uint32 > > _garrisonBuildingsByType
Definition: GarrisonMgr.h:79
std::set< GarrAbilityEntry const * > _garrisonFollowerRandomTraits
Definition: GarrisonMgr.h:83
std::unordered_map< uint32, FinalizeGarrisonPlotGOInfo > _finalizePlotGOInfo
Definition: GarrisonMgr.h:80
std::unordered_map< uint32, std::unordered_map< uint32, GameObjectsEntry const * > > _garrisonPlots
Definition: GarrisonMgr.h:76
std::unordered_map< uint32, std::list< GarrAbilityEntry const * > > _garrisonFollowerClassSpecAbilities
Definition: GarrisonMgr.h:82
std::unordered_map< uint32, std::unordered_set< uint32 > > _garrisonBuildingsByPlot
Definition: GarrisonMgr.h:77
std::unordered_map< uint32, std::vector< GarrSiteLevelPlotInstEntry const * > > _garrisonPlotInstBySiteLevel
Definition: GarrisonMgr.h:75
std::unordered_map< std::pair< uint32, uint32 >, uint32 > _garrisonBuildingPlotInstances
Definition: GarrisonMgr.h:78
struct FinalizeGarrisonPlotGOInfo::@283 FactionInfo[2]
std::unordered_set< GarrAbilityEntry const * > Traits
Definition: GarrisonMgr.h:49
std::unordered_set< GarrAbilityEntry const * > Counters
Definition: GarrisonMgr.h:48