4 #include "../GbxRemote/Response/GbxResponse.h"
5 #include "../Permissions/Permission.h"
59 Player(std::map<std::string, GbxResponseParameter> serverStruct)
62 if(serverStruct.find(
"Login") != serverStruct.end())
73 void SetBasic(std::map<std::string, GbxResponseParameter> serverStruct)
75 if(serverStruct.find(
"Login") != serverStruct.end())
86 void PlayerDetailed(std::map<std::string, GbxResponseParameter> serverStruct)
88 if(serverStruct.find(
"Language") != serverStruct.end())
110 void setBasicInfo(std::map<std::string, GbxResponseParameter> serverStruct)
112 PlayerId = atoi(serverStruct.find(
"PlayerId")->second.GetString().c_str());
113 TeamId = atoi(serverStruct.find(
"TeamId")->second.GetString().c_str());
115 Login = serverStruct.find(
"Login")->second.GetString();
116 NickName = serverStruct.find(
"NickName")->second.GetString();
118 SpectatorStatus = atoi(serverStruct.find(
"SpectatorStatus")->second.GetString().c_str());
119 Flags = atoi(serverStruct.find(
"Flags")->second.GetString().c_str());
121 LadderRanking = atoi(serverStruct.find(
"LadderRanking")->second.GetString().c_str());
131 IPAddress = serverStruct.find(
"IPAddress")->second.GetString();
132 DownloadRate = atoi(serverStruct.find(
"DownloadRate")->second.GetString().c_str());
133 UploadRate = atoi(serverStruct.find(
"UploadRate")->second.GetString().c_str());
135 Language = serverStruct.find(
"Language")->second.GetString();
137 std::istringstream(serverStruct.find(
"IsSpectator")->second.GetString()) >>
IsSpectator;
138 std::istringstream(serverStruct.find(
"IsInOfficialMode")->second.GetString()) >>
IsInOfficialMode;
140 ClientVersion = serverStruct.find(
"ClientVersion")->second.GetString();
141 ClubLink = serverStruct.find(
"ClubLink")->second.GetString();
143 std::string path = serverStruct.find(
"Path")->second.GetString().substr(6);
146 std::vector<std::string> continents = {
"Europe|",
"Africa|",
"Asia|",
"Middle East|",
"North America|",
"South America|",
"Oceania|" };
147 for(
int continentId = 0; continentId < continents.size(); continentId++)
149 std::string continent = continents.at(continentId);
150 std::string::size_type i = path.find(continent);
151 if (i != std::string::npos)
152 path.erase(i, continent.length());
int SpectatorStatus
Spectator status of player.
Definition: Player.h:26
int UploadRate
Upload rate in Kbps.
Definition: Player.h:34
bool IsInOfficialMode
Is in official mode?
Definition: Player.h:39
void PlayerDetailed(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Player.h:86
void SetBasic(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Player.h:73
Player(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Player.h:59
std::string Language
Application language.
Definition: Player.h:36
int LadderRanking
Current ladder ranking of the player.
Definition: Player.h:29
Permission AccessLevel
Permission level.
Definition: Player.h:17
std::string ClientVersion
Client version (f.e. 'v2015-06-18_15_10 (3.3.0)').
Definition: Player.h:41
std::string Country
Path without continent.
Definition: Player.h:44
Contains all information about a player in easy-to-use format.
Definition: Player.h:11
std::string NickName
Player nickname.
Definition: Player.h:24
void setDetailedInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the detailed player information from the struct.
Definition: Player.h:129
std::string ClubLink
Club URL (website, entered by player).
Definition: Player.h:42
std::vector< int > CurrentCheckpoints
Checkpoint passes on current try.
Definition: Player.h:15
int DownloadRate
Download rate in Kbps.
Definition: Player.h:33
int Flags
Player flags.
Definition: Player.h:27
bool IsSpectator
Is in spectatormode?
Definition: Player.h:38
void SetId(int id)
Set database identifier value.
Definition: Player.h:99
std::string IPAddress
IP Address of the player.
Definition: Player.h:32
time_t JoinedAt
The timestamp on join.
Definition: Player.h:16
std::string Path
Player location without "world".
Definition: Player.h:43
std::string Login
Player login.
Definition: Player.h:23
void setBasicInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the basic player information from the struct.
Definition: Player.h:110
Player()
Constructs a Player object without input.
Definition: Player.h:49
int PlayerId
Player identifier (on server).
Definition: Player.h:20
int TeamId
Team identifier (on server).
Definition: Player.h:21
int Id
Player identifier (on database).
Definition: Player.h:14