TrinityCore
LFGGroupData.cpp
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#include "LFG.h"
19#include "LFGGroupData.h"
20
21namespace lfg
22{
23
25 m_Leader(), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS), m_VoteKickActive(false)
26{ }
27
29{ }
30
32{
33 return m_OldState != LFG_STATE_NONE;
34}
35
37{
38 switch (state)
39 {
40 case LFG_STATE_NONE:
41 m_Dungeon = 0;
43 [[fallthrough]];
46 m_OldState = state;
47 [[fallthrough]];
48 default:
49 m_State = state;
50 }
51}
52
54{
56}
57
59{
60 m_Players.insert(guid);
61}
62
64{
65 GuidSet::iterator it = m_Players.find(guid);
66 if (it != m_Players.end())
67 m_Players.erase(it);
68 return uint8(m_Players.size());
69}
70
72{
73 m_Players.clear();
74}
75
77{
78 m_Leader = guid;
79}
80
82{
83 m_Dungeon = dungeon;
84}
85
87{
88 if (m_KicksLeft)
90}
91
93{
94 return m_State;
95}
96
98{
99 return m_OldState;
100}
101
103{
104 return m_Players;
105}
106
108{
109 return m_Players.size();
110}
111
113{
114 return m_Leader;
115}
116
117uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
118{
119 if (asId)
120 return (m_Dungeon & 0x00FFFFFF);
121 else
122 return m_Dungeon;
123}
124
126{
127 return m_KicksLeft;
128}
129
131{
132 m_VoteKickActive = active;
133}
134
136{
137 return m_VoteKickActive;
138}
139
140} // namespace lfg
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
uint32 GetDungeon(bool asId=true) const
uint8 m_KicksLeft
Number of kicks left.
Definition: LFGGroupData.h:81
bool IsVoteKickActive() const
void SetVoteKick(bool active)
uint8 RemovePlayer(ObjectGuid guid)
GuidSet const & GetPlayers() const
LfgState GetState() const
void AddPlayer(ObjectGuid guid)
uint32 m_Dungeon
Dungeon entry.
Definition: LFGGroupData.h:79
void SetDungeon(uint32 dungeon)
GuidSet m_Players
Players in group.
Definition: LFGGroupData.h:77
ObjectGuid m_Leader
Leader GUID.
Definition: LFGGroupData.h:76
void SetLeader(ObjectGuid guid)
LfgState m_State
State if group in LFG.
Definition: LFGGroupData.h:74
uint8 GetPlayerCount() const
void SetState(LfgState state)
uint8 GetKicksLeft() const
ObjectGuid GetLeader() const
LfgState GetOldState() const
LfgState m_OldState
Old State.
Definition: LFGGroupData.h:75
Definition: LFG.cpp:24
@ LFG_GROUP_MAX_KICKS
Definition: LFGGroupData.h:28
LfgState
Definition: LFG.h:74
@ LFG_STATE_FINISHED_DUNGEON
Definition: LFG.h:81
@ LFG_STATE_DUNGEON
Definition: LFG.h:80
@ LFG_STATE_NONE
Definition: LFG.h:75