TrinityCore
Loading...
Searching...
No Matches
LFGQueue.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 _LFGQUEUE_H
19#define _LFGQUEUE_H
20
21#include "LFG.h"
22
23namespace lfg
24{
25
39
50
53{
55
56 LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
58 dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
59 { }
60
61 time_t joinTime;
67 std::string bestCompatible;
68};
69
76
77typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
78typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer;
79typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer;
80
85{
86 public:
87
88 // Add/Remove from queue
89 std::string GetDetailedMatchRoles(GuidList const& check) const;
90 void AddToQueue(ObjectGuid guid, bool reAdd = false);
91 void RemoveFromQueue(ObjectGuid guid);
92 void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
93 void RemoveQueueData(ObjectGuid guid);
94
95 // Update Timers (when proposal success)
96 void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
97 void UpdateWaitTimeTank(int32 waitTime, uint32 dungeonId);
98 void UpdateWaitTimeHealer(int32 waitTime, uint32 dungeonId);
99 void UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId);
100
101 // Update Queue timers
102 void UpdateQueueTimers(time_t currTime);
103 time_t GetJoinTime(ObjectGuid guid) const;
104
105 // Find new group
106 uint8 FindGroups();
107
108 // Just for debugging purposes
109 std::string DumpQueueInfo() const;
110 std::string DumpCompatibleInfo(bool full = false) const;
111
112 private:
113 void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
114
115 void AddToNewQueue(ObjectGuid guid);
116 void AddToCurrentQueue(ObjectGuid guid);
117 void AddToFrontCurrentQueue(ObjectGuid guid);
118 void RemoveFromNewQueue(ObjectGuid guid);
119 void RemoveFromCurrentQueue(ObjectGuid guid);
120
121 void SetCompatibles(std::string const& key, LfgCompatibility compatibles);
122 LfgCompatibility GetCompatibles(std::string const& key);
123 void RemoveFromCompatibles(ObjectGuid guid);
124
125 void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles);
126 LfgCompatibilityData* GetCompatibilityData(std::string const& key);
127 void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
128 void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
129
130 LfgCompatibility FindNewGroups(GuidList& check, GuidList& all);
131 LfgCompatibility CheckCompatibility(GuidList check);
132
133 // Queue
136
143};
144
145} // namespace lfg
146
147#endif
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:261
LfgQueueDataContainer QueueDataStore
Queued groups.
Definition LFGQueue.h:134
LfgCompatibleContainer CompatibleMapStore
Compatible dungeons.
Definition LFGQueue.h:135
LfgWaitTimesContainer waitTimesTankStore
Average wait time to find a group queuing as tank.
Definition LFGQueue.h:138
LfgWaitTimesContainer waitTimesAvgStore
Average wait time to find a group queuing as multiple roles.
Definition LFGQueue.h:137
GuidList currentQueueStore
Ordered list. Used to find groups.
Definition LFGQueue.h:141
GuidList newToQueueStore
New groups to add to queue.
Definition LFGQueue.h:142
LfgWaitTimesContainer waitTimesDpsStore
Average wait time to find a group queuing as dps.
Definition LFGQueue.h:140
LfgWaitTimesContainer waitTimesHealerStore
Average wait time to find a group queuing as healer.
Definition LFGQueue.h:139
void SetQueueUpdateData(std::string const &strGuids, LfgRolesMap const &proposalRoles)
Definition LFG.cpp:24
std::map< std::string, LfgCompatibilityData > LfgCompatibleContainer
Definition LFGQueue.h:78
@ LFG_HEALERS_NEEDED
Definition LFG.h:33
@ LFG_TANKS_NEEDED
Definition LFG.h:32
@ LFG_DPS_NEEDED
Definition LFG.h:34
std::map< ObjectGuid, uint8 > LfgRolesMap
Definition LFG.h:105
LfgCompatibility
Definition LFGQueue.h:27
@ LFG_COMPATIBLES_WITH_LESS_PLAYERS
Definition LFGQueue.h:35
@ LFG_INCOMPATIBLES_HAS_IGNORES
Definition LFGQueue.h:32
@ LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS
Definition LFGQueue.h:31
@ LFG_INCOMPATIBLES_NO_DUNGEONS
Definition LFGQueue.h:34
@ LFG_COMPATIBILITY_PENDING
Definition LFGQueue.h:28
@ LFG_COMPATIBLES_MATCH
Definition LFGQueue.h:37
@ LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS
Definition LFGQueue.h:30
@ LFG_INCOMPATIBLES_WRONG_GROUP_SIZE
Definition LFGQueue.h:29
@ LFG_INCOMPATIBLES_NO_ROLES
Definition LFGQueue.h:33
@ LFG_COMPATIBLES_BAD_STATES
Definition LFGQueue.h:36
std::map< uint32, LfgWaitTime > LfgWaitTimesContainer
Definition LFGQueue.h:77
std::set< uint32 > LfgDungeonSet
Definition LFG.h:102
std::map< ObjectGuid, LfgQueueData > LfgQueueDataContainer
Definition LFGQueue.h:79
LfgCompatibility compatibility
Definition LFGQueue.h:47
LfgCompatibilityData(LfgCompatibility _compatibility, LfgRolesMap const &_roles)
Definition LFGQueue.h:44
LfgCompatibilityData(LfgCompatibility _compatibility)
Definition LFGQueue.h:43
Stores player or group queue info.
Definition LFGQueue.h:53
LfgRolesMap roles
Selected Player Role/s.
Definition LFGQueue.h:66
time_t joinTime
Player queue join time (to calculate wait times)
Definition LFGQueue.h:61
std::string bestCompatible
Best compatible combination of people queued.
Definition LFGQueue.h:67
uint8 tanks
Tanks needed.
Definition LFGQueue.h:62
LfgDungeonSet dungeons
Selected Player/Group Dungeon/s.
Definition LFGQueue.h:65
uint8 healers
Healers needed.
Definition LFGQueue.h:63
LfgQueueData(time_t _joinTime, LfgDungeonSet const &_dungeons, LfgRolesMap const &_roles)
Definition LFGQueue.h:56
uint8 dps
Dps needed.
Definition LFGQueue.h:64
int32 time
Wait time.
Definition LFGQueue.h:73
uint32 number
Number of people used to get that wait time.
Definition LFGQueue.h:74