TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GuildMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 "Guild.h"
22 
24 {
25 private:
26  GuildMgr();
27  ~GuildMgr();
28 
29 public:
30  static GuildMgr* instance();
31 
32  Guild* GetGuildByLeader(ObjectGuid guid) const;
33  Guild* GetGuildById(ObjectGuid::LowType guildId) const;
34  Guild* GetGuildByGuid(ObjectGuid guid) const;
35  Guild* GetGuildByName(std::string const& guildName) const;
36  std::string GetGuildNameById(ObjectGuid::LowType guildId) const;
37 
38  void LoadGuildRewards();
39 
40  void LoadGuilds();
41  void AddGuild(Guild* guild);
42  void RemoveGuild(ObjectGuid::LowType guildId);
43 
44  void SaveGuilds();
45 
46  void ResetReputationCaps();
47 
48  ObjectGuid::LowType GenerateGuildId();
49  void SetNextGuildId(ObjectGuid::LowType Id) { NextGuildId = Id; }
50 
51  std::vector<GuildReward> const& GetGuildRewards() const { return GuildRewards; }
52 
53  void ResetTimes(bool week);
54 protected:
55  typedef std::unordered_map<ObjectGuid::LowType, Guild*> GuildContainer;
57  GuildContainer GuildStore;
58  std::vector<GuildReward> GuildRewards;
59 };
60 
61 #define sGuildMgr GuildMgr::instance()
62 
63 #endif
std::unordered_map< ObjectGuid::LowType, Guild * > GuildContainer
Definition: GuildMgr.h:55
Definition: GuildMgr.h:23
uint64 LowType
Definition: ObjectGuid.h:199
GuildContainer GuildStore
Definition: GuildMgr.h:57
std::vector< GuildReward > GuildRewards
Definition: GuildMgr.h:58
#define TC_GAME_API
Definition: Define.h:134
void SetNextGuildId(ObjectGuid::LowType Id)
Definition: GuildMgr.h:49
std::vector< GuildReward > const & GetGuildRewards() const
Definition: GuildMgr.h:51
Definition: ObjectGuid.h:189
Definition: Guild.h:320
ObjectGuid::LowType NextGuildId
Definition: GuildMgr.h:56