4 #include "../GbxRemote/Response/GbxResponse.h"
56 Player(std::map<std::string, GbxResponseParameter> serverStruct)
59 if(serverStruct.find(
"Login") != serverStruct.end())
70 void PlayerDetailed(std::map<std::string, GbxResponseParameter> serverStruct)
72 if(serverStruct.find(
"Language") != serverStruct.end())
94 void setBasicInfo(std::map<std::string, GbxResponseParameter> serverStruct)
96 PlayerId = atoi(serverStruct.find(
"PlayerId")->second.GetString().c_str());
97 TeamId = atoi(serverStruct.find(
"TeamId")->second.GetString().c_str());
99 Login = serverStruct.find(
"Login")->second.GetString();
100 NickName = serverStruct.find(
"NickName")->second.GetString();
102 SpectatorStatus = atoi(serverStruct.find(
"SpectatorStatus")->second.GetString().c_str());
103 Flags = atoi(serverStruct.find(
"Flags")->second.GetString().c_str());
105 LadderRanking = atoi(serverStruct.find(
"LadderRanking")->second.GetString().c_str());
115 IPAddress = serverStruct.find(
"IPAddress")->second.GetString();
116 DownloadRate = atoi(serverStruct.find(
"DownloadRate")->second.GetString().c_str());
117 UploadRate = atoi(serverStruct.find(
"UploadRate")->second.GetString().c_str());
119 Language = serverStruct.find(
"Language")->second.GetString();
121 std::istringstream(serverStruct.find(
"IsSpectator")->second.GetString()) >>
IsSpectator;
122 std::istringstream(serverStruct.find(
"IsInOfficialMode")->second.GetString()) >>
IsInOfficialMode;
124 ClientVersion = serverStruct.find(
"ClientVersion")->second.GetString();
125 ClubLink = serverStruct.find(
"ClubLink")->second.GetString();
127 std::string path = serverStruct.find(
"Path")->second.GetString().substr(6);
130 std::vector<std::string> continents = {
"Europe|",
"Africa|",
"Asia|",
"Middle East|",
"North America|",
"South America|",
"Oceania|" };
131 for(
int continentId = 0; continentId < continents.size(); continentId++)
133 std::string continent = continents.at(continentId);
134 std::string::size_type i = path.find(continent);
135 if (i != std::string::npos)
136 path.erase(i, continent.length());
int SpectatorStatus
Spectator status of player.
Definition: Player.h:23
int UploadRate
Upload rate in Kbps.
Definition: Player.h:31
bool IsInOfficialMode
Is in official mode?
Definition: Player.h:36
void PlayerDetailed(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Player.h:70
Player(std::map< std::string, GbxResponseParameter > serverStruct)
Formats a server response into a usable form.
Definition: Player.h:56
std::string Language
Application language.
Definition: Player.h:33
int LadderRanking
Current ladder ranking of the player.
Definition: Player.h:26
std::string ClientVersion
Client version (f.e. 'v2015-06-18_15_10 (3.3.0)').
Definition: Player.h:38
std::string Country
Path without continent.
Definition: Player.h:41
Contains all information about a player in easy-to-use format.
Definition: Player.h:10
std::string NickName
Player nickname.
Definition: Player.h:21
void setDetailedInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the detailed player information from the struct.
Definition: Player.h:113
std::string ClubLink
Club URL (website, entered by player).
Definition: Player.h:39
std::vector< int > CurrentCheckpoints
Checkpoint passes on current try.
Definition: Player.h:14
int DownloadRate
Download rate in Kbps.
Definition: Player.h:30
int Flags
Player flags.
Definition: Player.h:24
bool IsSpectator
Is in spectatormode?
Definition: Player.h:35
void SetId(int id)
Set database identifier value.
Definition: Player.h:83
std::string IPAddress
IP Address of the player.
Definition: Player.h:29
std::string Path
Player location without "world".
Definition: Player.h:40
std::string Login
Player login.
Definition: Player.h:20
void setBasicInfo(std::map< std::string, GbxResponseParameter > serverStruct)
Sets the basic player information from the struct.
Definition: Player.h:94
Player()
Constructs a Player object without input.
Definition: Player.h:46
int PlayerId
Player identifier (on server).
Definition: Player.h:17
int TeamId
Team identifier (on server).
Definition: Player.h:18
int Id
Player identifier (on database).
Definition: Player.h:13