TrinityCore
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 static QuestPoolMgr* instance();
45
46 void LoadFromDB();
47 void ChangeDailyQuests() { Regenerate(_dailyPools); }
48 void ChangeWeeklyQuests() { Regenerate(_weeklyPools); }
49 void ChangeMonthlyQuests() { Regenerate(_monthlyPools); }
50
51 QuestPool const* FindQuestPool(uint32 poolId) const;
52 bool IsQuestPooled(uint32 questId) const { return _poolLookup.find(questId) != _poolLookup.end(); }
53 bool IsQuestActive(uint32 questId) const;
54
55 private:
56 void Regenerate(std::vector<QuestPool>& pools);
57 std::vector<QuestPool> _dailyPools;
58 std::vector<QuestPool> _weeklyPools;
59 std::vector<QuestPool> _monthlyPools;
60 std::unordered_map<uint32, QuestPool*> _poolLookup; // questId -> pool
61};
62
63#define sQuestPoolMgr QuestPoolMgr::instance()
64
65#endif
#define TC_GAME_API
Definition: Define.h:123
uint32_t uint32
Definition: Define.h:142
std::vector< QuestPool > _dailyPools
Definition: QuestPools.h:57
void ChangeMonthlyQuests()
Definition: QuestPools.h:49
std::vector< QuestPool > _weeklyPools
Definition: QuestPools.h:58
void ChangeDailyQuests()
Definition: QuestPools.h:47
std::unordered_map< uint32, QuestPool * > _poolLookup
Definition: QuestPools.h:60
std::vector< QuestPool > _monthlyPools
Definition: QuestPools.h:59
bool IsQuestPooled(uint32 questId) const
Definition: QuestPools.h:52
void ChangeWeeklyQuests()
Definition: QuestPools.h:48
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