Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
LFGGroupData.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "LFG.h"
7#include "LFGGroupData.h"
8
9namespace lfg
10{
11 namespace
12 {
13 LfgGroupQueueData const& EmptyGroupQueueData()
14 {
15 static LfgGroupQueueData empty;
16 return empty;
17 }
18 }
19
22
26
29
31 {
32 return GetOldState() != LFG_STATE_NONE;
33 }
34
36 {
38
39 switch (state)
40 {
41 case LFG_STATE_NONE:
42 data.State = LFG_STATE_NONE;
44 data.Dungeon = 0;
48 return;
51 data.OldState = state;
52 // No break on purpose
53 default:
54 data.State = state;
55 }
56 }
57
59 {
61 data.State = data.OldState;
62 }
63
65 {
66 m_Players.insert(guid);
67 }
68
70 {
71 LfgGuidSet::iterator it = m_Players.find(guid);
72 if (it != m_Players.end())
73 m_Players.erase(it);
74 return uint8(m_Players.size());
75 }
76
78 {
79 m_Players.clear();
80 }
81
83 {
84 m_Leader = guid;
85 }
86
88 {
89 m_ActiveQueueId = queueId;
91 }
92
94 {
95 GetActiveQueueData().Dungeon = dungeon;
96 }
97
99 {
100 if (m_KicksLeft)
101 --m_KicksLeft;
102 }
103
105 {
106 return GetActiveQueueData().State;
107 }
108
113
115 {
116 return m_Players;
117 }
118
120 {
121 return m_Players.size();
122 }
123
125 {
126 return m_Leader;
127 }
128
130 {
131 return m_ActiveQueueId;
132 }
133
135 {
136 return m_Queues;
137 }
138
139 uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
140 {
142 if (asId)
143 return (dungeon & 0x00FFFFFF);
144 else
145 return dungeon;
146 }
147
149 {
150 return m_KicksLeft;
151 }
152
154 {
155 m_VoteKickActive = active;
156 }
158 {
159 return m_VoteKickActive;
160 }
161
166
168 {
169 LfgGroupQueueDataContainer::const_iterator itr = m_Queues.find(m_ActiveQueueId);
170 if (itr != m_Queues.end())
171 return itr->second;
172
173 return EmptyGroupQueueData();
174 }
175
176} // namespace lfg
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
uint32 GetDungeon(bool asId=true) const
uint8 m_KicksLeft
Number of kicks left.
bool IsVoteKickActive() const
uint64 GetLeader() const
uint8 RemovePlayer(uint64 guid)
bool IsLfgGroup() const
void SetVoteKick(bool active)
uint8 m_ActiveQueueId
Active queue data owner.
LfgState GetState() const
void SetActiveQueueId(uint8 queueId)
void SetDungeon(uint32 dungeon)
LfgGroupQueueData & GetActiveQueueData()
LfgGroupQueueDataContainer m_Queues
Queue-scoped group data.
uint64 m_Leader
Leader GUID.
uint8 GetPlayerCount() const
void SetState(LfgState state)
uint8 GetActiveQueueId() const
uint8 GetKicksLeft() const
LfgGuidSet m_Players
Players in group.
void SetLeader(uint64 guid)
LfgGuidSet const & GetPlayers() const
LfgState GetOldState() const
LfgGroupQueueDataContainer const & GetQueues() const
void AddPlayer(uint64 guid)
Definition LFG.cpp:11
std::map< uint8, LfgGroupQueueData > LfgGroupQueueDataContainer
LfgState
Definition LFG.h:61
@ LFG_STATE_FINISHED_DUNGEON
Definition LFG.h:68
@ LFG_STATE_DUNGEON
Definition LFG.h:67
@ LFG_STATE_NONE
Definition LFG.h:62
@ LFG_GROUP_MAX_KICKS
std::set< uint64 > LfgGuidSet
Definition LFG.h:110
uint32 Dungeon
Dungeon entry.
LfgState OldState
Old state.
LfgState State
Current state in this queue.