TrinityCore
Loading...
Searching...
No Matches
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
28LfgGroupData::LfgGroupData(LfgGroupData&& other) noexcept = default;
29LfgGroupData& LfgGroupData::operator=(LfgGroupData&& right) noexcept = default;
31
36
38{
39 switch (state)
40 {
41 case LFG_STATE_NONE:
42 m_Dungeon = 0;
44 [[fallthrough]];
47 m_OldState = state;
48 [[fallthrough]];
49 default:
50 m_State = state;
51 }
52}
53
58
60{
61 m_Players.insert(guid);
62}
63
65{
66 GuidSet::iterator it = m_Players.find(guid);
67 if (it != m_Players.end())
68 m_Players.erase(it);
69 return uint8(m_Players.size());
70}
71
73{
74 m_Players.clear();
75}
76
78{
79 m_Leader = guid;
80}
81
83{
84 m_Dungeon = dungeon;
85}
86
92
94{
95 return m_State;
96}
97
99{
100 return m_OldState;
101}
102
104{
105 return m_Players;
106}
107
109{
110 return m_Players.size();
111}
112
114{
115 return m_Leader;
116}
117
118uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
119{
120 if (asId)
121 return (m_Dungeon & 0x00FFFFFF);
122 else
123 return m_Dungeon;
124}
125
127{
128 return m_KicksLeft;
129}
130
132{
133 m_VoteKickActive = active;
134}
135
137{
138 return m_VoteKickActive;
139}
140
141} // namespace lfg
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:432
uint32 GetDungeon(bool asId=true) const
uint8 m_KicksLeft
Number of kicks left.
bool IsVoteKickActive() const
void SetVoteKick(bool active)
uint8 RemovePlayer(ObjectGuid guid)
LfgGroupData & operator=(LfgGroupData const &)=delete
GuidSet const & GetPlayers() const
LfgState GetState() const
void AddPlayer(ObjectGuid guid)
uint32 m_Dungeon
Dungeon entry.
void SetDungeon(uint32 dungeon)
GuidSet m_Players
Players in group.
ObjectGuid m_Leader
Leader GUID.
void SetLeader(ObjectGuid guid)
LfgState m_State
State if group in LFG.
uint8 GetPlayerCount() const
void SetState(LfgState state)
uint8 GetKicksLeft() const
ObjectGuid GetLeader() const
LfgState GetOldState() const
LfgState m_OldState
Old State.
Definition LFG.cpp:24
@ LFG_GROUP_MAX_KICKS
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