TrinityCore
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 GuildMgr(GuildMgr const&) = delete;
36 GuildMgr& operator=(GuildMgr const&) = delete;
37
38public:
39 static GuildMgr* instance();
40
41 Guild* GetGuildByLeader(ObjectGuid guid) const;
42 Guild* GetGuildById(ObjectGuid::LowType guildId) const;
43 Guild* GetGuildByGuid(ObjectGuid guid) const;
44 Guild* GetGuildByName(std::string_view guildName) const;
45 std::string GetGuildNameById(ObjectGuid::LowType guildId) const;
46
47 void LoadGuildRewards();
48
49 void LoadGuilds();
50 void AddGuild(Guild* guild);
51 void RemoveGuild(ObjectGuid::LowType guildId);
52
53 void SaveGuilds();
54
56
57 ObjectGuid::LowType GenerateGuildId();
58 void SetNextGuildId(ObjectGuid::LowType Id) { NextGuildId = Id; }
59
60 std::vector<GuildReward> const& GetGuildRewards() const { return GuildRewards; }
61
62 void ResetTimes(bool week);
63protected:
64 typedef std::unordered_map<ObjectGuid::LowType, Trinity::unique_trackable_ptr<Guild>> GuildContainer;
67 std::vector<GuildReward> GuildRewards;
68};
69
70#define sGuildMgr GuildMgr::instance()
71
72#endif
#define TC_GAME_API
Definition: Define.h:123
GuildContainer GuildStore
Definition: GuildMgr.h:66
std::vector< GuildReward > GuildRewards
Definition: GuildMgr.h:67
GuildMgr(GuildMgr const &)=delete
ObjectGuid::LowType NextGuildId
Definition: GuildMgr.h:65
std::unordered_map< ObjectGuid::LowType, Trinity::unique_trackable_ptr< Guild > > GuildContainer
Definition: GuildMgr.h:64
std::vector< GuildReward > const & GetGuildRewards() const
Definition: GuildMgr.h:60
void SetNextGuildId(ObjectGuid::LowType Id)
Definition: GuildMgr.h:58
void ResetReputationCaps()
GuildMgr & operator=(GuildMgr const &)=delete
Definition: Guild.h:329
uint64 LowType
Definition: ObjectGuid.h:278