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;
28
30{
31private:
32 GuildMgr();
34 GuildMgr(GuildMgr const&) = delete;
35 GuildMgr& operator=(GuildMgr const&) = delete;
36
37public:
38 static GuildMgr* instance();
39
40 Guild* GetGuildByLeader(ObjectGuid guid) const;
41 Guild* GetGuildById(ObjectGuid::LowType guildId) const;
42 Guild* GetGuildByName(std::string_view guildName) const;
43 std::string GetGuildNameById(ObjectGuid::LowType guildId) const;
44
45 void LoadGuilds();
46 void AddGuild(Guild* guild);
47 void RemoveGuild(ObjectGuid::LowType guildId);
48
49 ObjectGuid::LowType GenerateGuildId();
50 void SetNextGuildId(ObjectGuid::LowType Id) { NextGuildId = Id; }
51
52 void ResetTimes();
53protected:
54 typedef std::unordered_map<ObjectGuid::LowType, Trinity::unique_trackable_ptr<Guild>> GuildContainer;
57};
58
59#define sGuildMgr GuildMgr::instance()
60
61#endif
#define TC_GAME_API
Definition Define.h:114
GuildContainer GuildStore
Definition GuildMgr.h:56
GuildMgr(GuildMgr const &)=delete
ObjectGuid::LowType NextGuildId
Definition GuildMgr.h:55
std::unordered_map< ObjectGuid::LowType, Trinity::unique_trackable_ptr< Guild > > GuildContainer
Definition GuildMgr.h:54
void SetNextGuildId(ObjectGuid::LowType Id)
Definition GuildMgr.h:50
GuildMgr & operator=(GuildMgr const &)=delete
Definition Guild.h:284
uint32 LowType
Definition ObjectGuid.h:142