TrinityCore
Loading...
Searching...
No Matches
QuestPools.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 TRINITY_QUESTPOOLS_H
19#define TRINITY_QUESTPOOLS_H
20
21#include "Define.h"
22#include <unordered_map>
23#include <unordered_set>
24#include <vector>
25
27{
28 using Member = std::vector<uint32>;
29 using Members = std::vector<Member>;
30
34 std::unordered_set<uint32> activeQuests;
35};
36
38{
39 private:
42
43 public:
44 QuestPoolMgr(QuestPoolMgr const&) = delete;
48
49 static QuestPoolMgr* instance();
50
51 void LoadFromDB();
52 void ChangeDailyQuests() { Regenerate(_dailyPools); }
53 void ChangeWeeklyQuests() { Regenerate(_weeklyPools); }
54 void ChangeMonthlyQuests() { Regenerate(_monthlyPools); }
55
56 QuestPool const* FindQuestPool(uint32 poolId) const;
57 bool IsQuestPooled(uint32 questId) const { return _poolLookup.find(questId) != _poolLookup.end(); }
58 bool IsQuestActive(uint32 questId) const;
59
60 private:
61 void Regenerate(std::vector<QuestPool>& pools);
62 std::vector<QuestPool> _dailyPools;
63 std::vector<QuestPool> _weeklyPools;
64 std::vector<QuestPool> _monthlyPools;
65 std::unordered_map<uint32, QuestPool*> _poolLookup; // questId -> pool
66};
67
68#define sQuestPoolMgr QuestPoolMgr::instance()
69
70#endif
#define TC_GAME_API
Definition Define.h:129
uint32_t uint32
Definition Define.h:154
QuestPoolMgr(QuestPoolMgr const &)=delete
std::vector< QuestPool > _dailyPools
Definition QuestPools.h:62
QuestPoolMgr & operator=(QuestPoolMgr &&)=delete
void ChangeMonthlyQuests()
Definition QuestPools.h:54
std::vector< QuestPool > _weeklyPools
Definition QuestPools.h:63
void ChangeDailyQuests()
Definition QuestPools.h:52
std::unordered_map< uint32, QuestPool * > _poolLookup
Definition QuestPools.h:65
std::vector< QuestPool > _monthlyPools
Definition QuestPools.h:64
QuestPoolMgr & operator=(QuestPoolMgr const &)=delete
QuestPoolMgr(QuestPoolMgr &&)=delete
bool IsQuestPooled(uint32 questId) const
Definition QuestPools.h:57
void ChangeWeeklyQuests()
Definition QuestPools.h:53
std::vector< Member > Members
Definition QuestPools.h:29
uint32 numActive
Definition QuestPools.h:32
std::unordered_set< uint32 > activeQuests
Definition QuestPools.h:34
std::vector< uint32 > Member
Definition QuestPools.h:28
uint32 poolId
Definition QuestPools.h:31
Members members
Definition QuestPools.h:33