Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
LFGPlayerData.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 "LFGPlayerData.h"
7
8namespace lfg
9{
10 namespace
11 {
12 LfgPlayerQueueData const& EmptyPlayerQueueData()
13 {
14 static LfgPlayerQueueData empty;
15 return empty;
16 }
17 }
18
19 LfgReturnLocation::LfgReturnLocation() : IsSet(false), MapId(0), X(0.0f), Y(0.0f), Z(0.0f), O(0.0f)
20 { }
21
25
28
30
32 {
34
35 switch (state)
36 {
37 case LFG_STATE_NONE:
38 data.State = LFG_STATE_NONE;
42 return;
44 data.Roles = 0;
45 data.SelectedDungeons.clear();
46 data.Comment.clear();
47 // No break on purpose
49 data.OldState = state;
50 // No break on purpose
51 default:
52 data.State = state;
53 }
54 }
55
57 {
59
60 if (data.OldState == LFG_STATE_NONE)
61 {
62 data.SelectedDungeons.clear();
63 data.Roles = 0;
64 }
65
66 data.State = data.OldState;
67 }
68
70 {
71 m_Team = team;
72 }
73
75 {
76 m_Group = group;
77 }
78
80 {
81 m_ActiveQueueId = queueId;
83 }
84
86 {
87 GetActiveQueueData().Roles = roles;
88 }
89
90 void LfgPlayerData::SetComment(std::string const& comment)
91 {
92 GetActiveQueueData().Comment = comment;
93 }
94
99
100 void LfgPlayerData::SetReturnLocation(uint32 mapId, float x, float y, float z, float o)
101 {
103 location.IsSet = true;
104 location.MapId = mapId;
105 location.X = x;
106 location.Y = y;
107 location.Z = z;
108 location.O = o;
109 }
110
112 {
113 LfgPlayerQueueDataContainer::iterator itr = m_Queues.find(m_ActiveQueueId);
114 if (itr != m_Queues.end())
115 itr->second.ReturnLocation = LfgReturnLocation();
116 }
117
119 {
120 return GetActiveQueueData().State;
121 }
122
127
129 {
130 return m_Team;
131 }
132
134 {
135 return m_Group;
136 }
137
142
144 {
145 return m_Queues;
146 }
147
149 {
150 return GetActiveQueueData().Roles;
151 }
152
153 std::string const& LfgPlayerData::GetComment() const
154 {
156 }
157
162
167
172
174 {
175 LfgPlayerQueueDataContainer::const_iterator itr = m_Queues.find(m_ActiveQueueId);
176 if (itr != m_Queues.end())
177 return itr->second;
178
179 return EmptyPlayerQueueData();
180 }
181
182} // 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
uint8 m_Team
Player team - determines the queue to join.
LfgReturnLocation const & GetReturnLocation() const
LfgPlayerQueueData & GetActiveQueueData()
uint8 m_ActiveQueueId
Active queue data owner.
LfgState GetOldState() const
LfgPlayerQueueDataContainer const & GetQueues() const
std::string const & GetComment() const
void SetState(LfgState state)
uint64 m_Group
Original group of player when joined LFG.
void SetSelectedDungeons(const LfgDungeonSet &dungeons)
void SetGroup(uint64 group)
void SetTeam(uint8 team)
uint8 GetTeam() const
void SetReturnLocation(uint32 mapId, float x, float y, float z, float o)
uint8 GetActiveQueueId() const
LfgPlayerQueueDataContainer m_Queues
Queue-scoped player data.
uint8 GetRoles() const
LfgState GetState() const
void SetRoles(uint8 roles)
uint64 GetGroup() const
void SetActiveQueueId(uint8 queueId)
void SetComment(std::string const &comment)
LfgDungeonSet const & GetSelectedDungeons() const
Definition LFG.cpp:11
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
std::set< uint32 > LfgDungeonSet
Definition LFG.h:107
std::map< uint8, LfgPlayerQueueData > LfgPlayerQueueDataContainer
LfgReturnLocation ReturnLocation
Player location before teleporting into LFG.
std::string Comment
Player comment used when joined LFG.
LfgState State
Current state in this queue.
LfgState OldState
Old state for rolecheck/proposal restore.
LfgDungeonSet SelectedDungeons
Selected dungeons when joined LFG.
uint8 Roles
Roles the player selected when joined LFG.