TrinityCore
Loading...
Searching...
No Matches
GuildMgr.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 _GUILDMGR_H
19#define _GUILDMGR_H
20
21#include "Define.h"
22#include "ObjectGuid.h"
23#include "UniqueTrackablePtr.h"
24#include <unordered_map>
25#include <vector>
26
27class Guild;
28struct GuildReward;
29
31{
32private:
33 GuildMgr();
35
36public:
37 typedef std::unordered_map<ObjectGuid::LowType, Trinity::unique_trackable_ptr<Guild>> GuildContainer;
38
39 GuildMgr(GuildMgr const&) = delete;
40 GuildMgr(GuildMgr&&) = delete;
41 GuildMgr& operator=(GuildMgr const&) = delete;
43
44 static GuildMgr* instance();
45
46 Guild* GetGuildByLeader(ObjectGuid guid) const;
47 Guild* GetGuildById(ObjectGuid::LowType guildId) const;
48 Guild* GetGuildByGuid(ObjectGuid guid) const;
49 Guild* GetGuildByName(std::string_view guildName) const;
50 std::string GetGuildNameById(ObjectGuid::LowType guildId) const;
51
52 GuildContainer const& GetGuildStore() const { return GuildStore; }
53
54 void LoadGuildRewards();
55
56 void LoadGuilds();
57 void AddGuild(Guild* guild);
58 void RemoveGuild(ObjectGuid::LowType guildId);
59
60 void SaveGuilds();
61
63
64 ObjectGuid::LowType GenerateGuildId();
65 void SetNextGuildId(ObjectGuid::LowType Id) { NextGuildId = Id; }
66
67 std::vector<GuildReward> const& GetGuildRewards() const { return GuildRewards; }
68
69 void ResetTimes(bool week);
70protected:
73 std::vector<GuildReward> GuildRewards;
74};
75
76#define sGuildMgr GuildMgr::instance()
77
78#endif
#define TC_GAME_API
Definition Define.h:129
GuildContainer GuildStore
Definition GuildMgr.h:72
std::vector< GuildReward > GuildRewards
Definition GuildMgr.h:73
GuildMgr(GuildMgr const &)=delete
ObjectGuid::LowType NextGuildId
Definition GuildMgr.h:71
std::unordered_map< ObjectGuid::LowType, Trinity::unique_trackable_ptr< Guild > > GuildContainer
Definition GuildMgr.h:37
GuildMgr & operator=(GuildMgr &&)=delete
GuildContainer const & GetGuildStore() const
Definition GuildMgr.h:52
GuildMgr(GuildMgr &&)=delete
std::vector< GuildReward > const & GetGuildRewards() const
Definition GuildMgr.h:67
void SetNextGuildId(ObjectGuid::LowType Id)
Definition GuildMgr.h:65
void ResetReputationCaps()
GuildMgr & operator=(GuildMgr const &)=delete
Definition Guild.h:329
uint64 LowType
Definition ObjectGuid.h:321