1 #include <atomizes.hpp>
10 #include <gpcm/client.h>
11 #include <battlefield/gamestat.h>
13 #include <webserver/client.h>
16 const Util::Url::Variables& url_variables)
18 Json::Value json_game_servers(Json::arrayValue);
19 Battlefield::GameServers game_servers;
26 Json::Value json_game_server;
32 json_game_server[
"id"] = game_server.GetId();
33 json_game_server[
"flag"] = game_server.GetFlag();
34 json_game_server[
"natneg"] = game_server.GetNatNeg();
35 json_game_server[
"gamename"] = game_server.GetGameName();
36 json_game_server[
"hostname"] = game_server.GetHostName();
37 json_game_server[
"gamever"] = game_server.GetGameVersion();
38 json_game_server[
"cl"] = game_server.GetClientVersion();
39 json_game_server[
"rv"] = game_server.GetRV();
40 json_game_server[
"map"] = game_server.GetMap();
41 json_game_server[
"mc"] = game_server.GetMapCycling();
42 json_game_server[
"mapname"] = game_server.GetMapName();
43 json_game_server[
"gc"] = game_server.GetGC();
44 json_game_server[
"gametype"] = game_server.GetGameType();
45 json_game_server[
"numplayers"] = game_server.GetNumPlayers();
46 json_game_server[
"maxplayers"] = game_server.GetMaxPlayers();
47 json_game_server[
"numteams"] = game_server.GetNumTeams();
48 json_game_server[
"gamemode"] = game_server.GetGameMode();
49 json_game_server[
"teamplay"] = game_server.GetTeamplay();
50 json_game_server[
"fraglimit"] = game_server.GetFlagLimit();
51 json_game_server[
"teamfraglimit"] = game_server.GetTeamFragLimit();
52 json_game_server[
"timelimit"] = game_server.GetTimeLimit();
53 json_game_server[
"timeelapsed"] = game_server.GetTimeElapsed();
54 json_game_server[
"password"] = game_server.GetPassword();
55 json_game_server[
"nr"] = game_server.GetMinRank();
56 json_game_server[
"xr"] = game_server.GetMaxRank();
57 json_game_server[
"ff"] = game_server.GetFriendlyFire();
58 json_game_server[
"sr"] = game_server.GetStatsTracking();
59 json_game_server[
"rc"] = game_server.GetReconfigurable();
60 json_game_server[
"ni"] = game_server.GetMinIpRange();
61 json_game_server[
"xi"] = game_server.GetMaxIpRange();
62 json_game_server[
"qm"] = game_server.GetQM();
63 json_game_server[
"region"] = game_server.GetRegion();
64 json_game_server[
"c0"] = game_server.GetClan1Id();
65 json_game_server[
"c1"] = game_server.GetClan2Id();
66 json_game_server[
"n0"] = game_server.GetClan1Name();
67 json_game_server[
"n1"] = game_server.GetClan2Name();
68 json_game_server[
"c0c"] = game_server.GetClan1Claimed();
69 json_game_server[
"c1c"] = game_server.GetClan2Claimed();
70 json_game_server[
"team0"] = game_server.GetTeam1Name();
71 json_game_server[
"team1"] = game_server.GetTeam2Name();
72 json_game_server[
"score0"] = game_server.GetTeam1Score();
73 json_game_server[
"score1"] = game_server.GetTeam2Score();
74 json_game_server[
"updated_at"] = game_server.GetUpdatedAt();
75 json_game_server[
"verified"] = game_server.isVerified();
76 json_game_server[
"is_alive"] = game_server.IsAlive();
86 Json::Value json_players(Json::arrayValue);
89 Json::Value json_player;
91 json_player[
"name"] = gsplayer.GetName();
92 json_player[
"score"] = gsplayer.GetScore();
93 json_player[
"skill"] = gsplayer.GetSkill();
94 json_player[
"ping"] = gsplayer.GetPing();
95 json_player[
"team"] = gsplayer.GetTeam();
96 json_player[
"deaths"] = gsplayer.GetDeaths();
97 json_player[
"profileid"] = gsplayer.GetProfileId();
99 json_players.append(json_player);
101 json_game_server[
"players"] = json_players;
103 json_game_servers.append(json_game_server);
106 this->
Send(json_game_servers);
112 const Util::Url::Variables& url_variables)
114 Json::Value json_game_stat;
118 auto it = url_variables.find(
"id");
119 if (it != url_variables.end())
121 game_stat.SetId(it->second);
131 json_game_stat[
"id"] = game_stat.GetId();
132 json_game_stat[
"gametype"] = game_stat.GetGameType();
133 json_game_stat[
"gamver"] = game_stat.GetGameVersion();
134 json_game_stat[
"hostname"] = game_stat.GetHostName();
135 json_game_stat[
"mapid"] = game_stat.GetMapId();
136 json_game_stat[
"numplayers"] = game_stat.GetNumPlayers();
137 json_game_stat[
"pplayers"] = game_stat.GetPPlayers();
138 json_game_stat[
"tplayed"] = game_stat.GetTimePlayed();
139 json_game_stat[
"clanid_t0"] = game_stat.GetTeam1ClanId();
140 json_game_stat[
"clanid_t1"] = game_stat.GetTeam2ClanId();
141 json_game_stat[
"country_t0"] = game_stat.GetTeam1Country();
142 json_game_stat[
"country_t1"] = game_stat.GetTeam2Country();
143 json_game_stat[
"victory_t0"] = game_stat.GetTeam1Victory();
144 json_game_stat[
"victory_t1"] = game_stat.GetTeam2Victory();
145 json_game_stat[
"created_at"] = game_stat.GetCreatedAt();
148 Json::Value json_players(Json::arrayValue);
151 Json::Value json_player;
153 json_player[
"id"] = gsplayer.GetId();
154 json_player[
"auth"] = gsplayer.GetAuth();
155 json_player[
"pid"] = gsplayer.GetProfileId();
156 json_player[
"team"] = gsplayer.GetTeam();
157 json_player[
"score"] = gsplayer.GetScore();
158 json_player[
"rank"] = gsplayer.GetRank();
159 json_player[
"pph"] = gsplayer.GetPPH();
160 json_player[
"kills"] = gsplayer.GetKills();
161 json_player[
"deaths"] = gsplayer.GetDeaths();
162 json_player[
"suicides"] = gsplayer.GetSuicides();
163 json_player[
"time"] = gsplayer.GetTime();
164 json_player[
"lavd"] = gsplayer.GetLAVsDestroyed();
165 json_player[
"mavd"] = gsplayer.GetMAVsDestroyed();
166 json_player[
"havd"] = gsplayer.GetHAVsDestroyed();
167 json_player[
"hed"] = gsplayer.GetHelicoptersDestroyed();
168 json_player[
"pld"] = gsplayer.GetPlanesDestroyed();
169 json_player[
"bod"] = gsplayer.GetBoatsDestroyed();
170 json_player[
"k1"] = gsplayer.GetKillsAssualtKit();
171 json_player[
"s1"] = gsplayer.GetSpawnsAssualtKit();
172 json_player[
"k2"] = gsplayer.GetKillsSniperKit();
173 json_player[
"s2"] = gsplayer.GetSpawnsSniperKit();
174 json_player[
"k3"] = gsplayer.GetKillsSpecialOpKit();
175 json_player[
"s3"] = gsplayer.GetSpawnsSpecialOpKit();
176 json_player[
"k4"] = gsplayer.GetKillsCombatEngineerKit();
177 json_player[
"s4"] = gsplayer.GetSpawnsCombatEngineerKit();
178 json_player[
"k5"] = gsplayer.GetKillsSupportKit();
179 json_player[
"s5"] = gsplayer.GetSpawnsSupportKit();
180 json_player[
"tk"] = gsplayer.GetTeamKills();
181 json_player[
"medals"] = gsplayer.GetMedals();
182 json_player[
"ttb"] = gsplayer.GetTotalTopPlayer();
183 json_player[
"mv"] = gsplayer.GetTotalVictories();
184 json_player[
"ngp"] = gsplayer.GetTotalGameSessions();
185 json_player[
"cflags"] = gsplayer.GetCapturedFlags();
186 json_player[
"nflags"] = gsplayer.GetNeutralizedFlags();
187 json_player[
"sflags"] = gsplayer.GetSavedFlags();
188 json_player[
"disable"] = gsplayer.IsDisabled();
190 json_players.append(json_player);
192 json_game_stat[
"players"] = json_players;
194 this->Send(json_game_stat);
196 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
200 const Util::Url::Variables& url_variables)
202 Json::Value json_game_stats(Json::arrayValue);
203 Battlefield::GameStats game_stats;
206 auto it = url_variables.find(
"date");
207 if (it != url_variables.end() && Util::isAscii(it->second))
209 std::string date = it->second;
217 json_game_stats.append(game_stat.GetId());
221 this->Send(json_game_stats);
223 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
227 const Util::Url::Variables& url_variables)
229 Json::Value json_player;
234 auto it = url_variables.find(
"profileid");
235 if (it != url_variables.end() && player.SetProfileId(it->second))
241 it = url_variables.find(
"uniquenick");
242 if (it != url_variables.end() && Util::isAscii(it->second))
244 player.SetUniquenick(it->second);
257 json_player[
"profileid"] = player.GetProfileId();
258 json_player[
"userid"] = player.GetUserId();
259 json_player[
"nick"] = player.GetNick();
260 json_player[
"uniquenick"] = player.GetUniquenick();
261 json_player[
"last_login"] = player.GetLastLogin();
262 json_player[
"created_at"] = player.GetCreatedAt();
270 json_player[
"score"] = player.GetScore();
271 json_player[
"ran"] = player.GetRank();
272 json_player[
"pph"] = player.GetPPH();
273 json_player[
"kills"] = player.GetKills();
274 json_player[
"deaths"] = player.GetDeaths();
275 json_player[
"suicides"] = player.GetSuicides();
276 json_player[
"time"] = player.GetTime();
277 json_player[
"vehicles"] = player.GetVehiclesDestroyed();
278 json_player[
"lavd"] = player.GetLAVsDestroyed();
279 json_player[
"mavd"] = player.GetMAVsDestroyed();
280 json_player[
"havd"] = player.GetHAVsDestroyed();
281 json_player[
"hed"] = player.GetHelicoptersDestroyed();
282 json_player[
"pld"] = player.GetPlanesDestroyed();
283 json_player[
"bod"] = player.GetBoatsDestroyed();
284 json_player[
"k1"] = player.GetKillsAssualtKit();
285 json_player[
"s1"] = player.GetSpawnsAssualtKit();
286 json_player[
"k2"] = player.GetKillsSniperKit();
287 json_player[
"s2"] = player.GetSpawnsSniperKit();
288 json_player[
"k3"] = player.GetKillsSpecialOpKit();
289 json_player[
"s3"] = player.GetSpawnsSpecialOpKit();
290 json_player[
"k4"] = player.GetKillsCombatEngineerKit();
291 json_player[
"s4"] = player.GetSpawnsCombatEngineerKit();
292 json_player[
"k5"] = player.GetKillsSupportKit();
293 json_player[
"s5"] = player.GetSpawnsSupportKit();
294 json_player[
"tk"] = player.GetTeamKills();
295 json_player[
"medals"] = player.GetMedals();
296 json_player[
"ttb"] = player.GetTotalTopPlayer();
297 json_player[
"mv"] = player.GetTotalVictories();
298 json_player[
"ngp"] = player.GetTotalGameSessions();
299 json_player[
"cflags"] = player.GetCapturedFlags();
300 json_player[
"nflags"] = player.GetNeutralizedFlags();
301 json_player[
"sflags"] = player.GetSavedFlags();
303 Json::Value json_clan;
305 json_clan[
"clanid"] = clan.GetClanId();
306 json_clan[
"name"] = clan.GetName();
307 json_clan[
"tag"] = clan.GetTag();
309 json_player[
"clan"] = json_clan;
311 this->Send(json_player);
313 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
317 const Util::Url::Variables& url_variables)
319 Json::Value json_clan;
323 auto it = url_variables.find(
"clanid");
324 if (it != url_variables.end() || !clan.SetClanId(it->second))
336 json_clan[
"clanid"] = clan.GetClanId();
337 json_clan[
"name"] = clan.GetName();
338 json_clan[
"tag"] = clan.GetTag();
339 json_clan[
"homepage"] = clan.GetHomepage();
340 json_clan[
"info"] = clan.GetInfo();
341 json_clan[
"region"] = clan.GetRegion();
342 json_clan[
"created_at"] = clan.GetCreatedAt();
351 Json::Value json_members(Json::arrayValue);
352 for (
const auto& pair : clan.GetRanks())
354 Json::Value json_member;
356 json_member[
"profileid"] = pair.first;
357 json_member[
"rank"] =
static_cast<uint8_t
>(pair.second);
359 json_members.append(json_member);
361 json_clan[
"members"] = json_members;
363 this->Send(json_clan);
365 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
369 const Util::Url::Variables& url_variables)
371 Json::Value json_leaderboard(Json::arrayValue);
372 std::string sort =
"";
376 auto it = url_variables.find(
"limit");
377 if (it != url_variables.end())
379 if(it->second ==
"25") limit = 25;
380 else if(it->second ==
"50") limit = 50;
381 else if(it->second ==
"75") limit = 75;
382 else if(it->second ==
"100") limit = 100;
385 it = url_variables.find(
"offset");
386 if (it != url_variables.end())
390 offset = std::stoul(it->second);
396 Battlefield::RankPlayers rank_players;
397 it = url_variables.find(
"sort");
398 if (it != url_variables.end())
403 else if(sort ==
"score") g_database->
queryLeaderboardType(rank_players,
"score", limit, offset);
410 else if(sort ==
"kills") g_database->
queryLeaderboardType(rank_players,
"kills", limit, offset);
416 else if(sort ==
"vehicles") g_database->
queryLeaderboardType(rank_players,
"vehicles", limit, offset);
417 else if(sort ==
"ratio_k1") g_database->
queryLeaderboardRatio(rank_players,
"k1",
"s1", limit, offset);
418 else if(sort ==
"ratio_k2") g_database->
queryLeaderboardRatio(rank_players,
"k2",
"s2", limit, offset);
419 else if(sort ==
"ratio_k3") g_database->
queryLeaderboardRatio(rank_players,
"k3",
"s3", limit, offset);
420 else if(sort ==
"ratio_k4") g_database->
queryLeaderboardRatio(rank_players,
"k4",
"s4", limit, offset);
421 else if(sort ==
"ratio_k5") g_database->
queryLeaderboardRatio(rank_players,
"k5",
"s5", limit, offset);
422 else if(sort ==
"ratio_kd") g_database->
queryLeaderboardRatio(rank_players,
"kills",
"deaths", limit, offset);
426 for (
const auto& pair : rank_players)
428 Json::Value json_player;
430 json_player[
"position"] = pair.first;
431 json_player[
"profileid"] = pair.second.GetProfileId();
432 json_player[
"uniquenick"] = pair.second.GetUniquenick();
436 json_player[
"rank"] = pair.second.GetRank();
443 player.SetProfileId(pair.second.GetProfileId());
447 json_player[
"rank"] = player.GetRank();
450 if(sort ==
"pph" || sort ==
"rank") json_player[
"pph"] = pair.second.GetPPH();
451 if(sort ==
"score" || sort ==
"rank") json_player[
"score"] = pair.second.GetScore();
453 if(sort ==
"k1") json_player[
"k1"] = pair.second.GetKillsAssualtKit();
454 else if(sort ==
"k2") json_player[
"k2"] = pair.second.GetKillsSniperKit();
455 else if(sort ==
"k3") json_player[
"k3"] = pair.second.GetKillsSpecialOpKit();
456 else if(sort ==
"k4") json_player[
"k4"] = pair.second.GetKillsCombatEngineerKit();
457 else if(sort ==
"k5") json_player[
"k5"] = pair.second.GetKillsSupportKit();
458 else if(sort ==
"kills") json_player[
"kills"] = pair.second.GetKills();
459 else if(sort ==
"lavd") json_player[
"lavd"] = pair.second.GetLAVsDestroyed();
460 else if(sort ==
"mavd") json_player[
"mavd"] = pair.second.GetMAVsDestroyed();
461 else if(sort ==
"havd") json_player[
"havd"] = pair.second.GetHAVsDestroyed();
462 else if(sort ==
"hed") json_player[
"hed"] = pair.second.GetHelicoptersDestroyed();
463 else if(sort ==
"bod") json_player[
"bod"] = pair.second.GetBoatsDestroyed();
464 else if(sort ==
"vehicles") json_player[
"vehicles"] = pair.second.GetVehiclesDestroyed();
465 else if(sort ==
"ratio_k1") json_player[
"ratio"] = pair.second.GetRatioAssualtKit();
466 else if(sort ==
"ratio_k2") json_player[
"ratio"] = pair.second.GetRatioSniperKit();
467 else if(sort ==
"ratio_k3") json_player[
"ratio"] = pair.second.GetRatioSpecialOpKit();
468 else if(sort ==
"ratio_k4") json_player[
"ratio"] = pair.second.GetRatioCombatEngineerKit();
469 else if(sort ==
"ratio_k5") json_player[
"ratio"] = pair.second.GetRatioSupportKit();
470 else if(sort ==
"ratio_kd") json_player[
"ratio"] = pair.second.GetRatio();
472 json_leaderboard.append(json_player);
475 this->Send(json_leaderboard);
477 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
481 const Util::Url::Variables& url_variables)
483 Json::Value json_leaderboard(Json::arrayValue);
487 auto it = url_variables.find(
"limit");
488 if (it != url_variables.end())
490 if(it->second ==
"25") limit = 25;
491 else if(it->second ==
"50") limit = 50;
492 else if(it->second ==
"75") limit = 75;
493 else if(it->second ==
"100") limit = 100;
496 it = url_variables.find(
"offset");
497 if (it != url_variables.end())
501 offset = std::stoul(it->second);
506 Battlefield::RankClans rank_clans;
509 for (
const auto& pair : rank_clans)
511 Json::Value json_clan;
513 json_clan[
"position"] = pair.first;
514 json_clan[
"clanid"] = pair.second.GetClanId();
515 json_clan[
"name"] = pair.second.GetName();
516 json_clan[
"tag"] = pair.second.GetTag();
517 json_clan[
"score"] = pair.second.GetScore();
518 json_clan[
"wins"] = pair.second.GetWins();
519 json_clan[
"losses"] = pair.second.GetLosses();
520 json_clan[
"draws"] = pair.second.GetDraws();
522 json_leaderboard.append(json_clan);
525 this->Send(json_leaderboard);
527 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
531 const Util::Url::Variables& url_variables)
533 Battlefield::Clans clans;
534 Json::Value json_results;
537 uint32_t total_clans = 2;
538 auto it = url_variables.find(
"total_clans");
539 if (it != url_variables.end())
543 total_clans = std::stoul(it->second);
552 uint32_t total_fights = 1;
553 it = url_variables.find(
"total_fights");
554 if (it != url_variables.end())
558 total_fights = std::stoul(it->second);
562 if(total_fights > 10000)
567 unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
568 std::default_random_engine generator(seed);
571 std::uniform_int_distribution<int> gen_random_clan_id(1, total_clans);
572 std::uniform_int_distribution<int> gen_random_team_win(0, 1);
573 std::uniform_int_distribution<int> gen_random_victory(1, 3);
576 for(
int i = 1; i <= total_clans; i++)
582 std::string clan_name(1,
static_cast<char>(0x40 + i));
583 clan_name =
"Clan " + clan_name;
584 clan.SetName(clan_name);
586 clans.push_back(clan);
592 Json::Value json_fights(Json::arrayValue);
593 Battlefield::GameStats game_stats;
595 for(
int i = 0; i < total_fights; i++)
597 Json::Value json_fight;
603 int clanid_t0 = gen_random_clan_id(generator);
609 clanid_t1 = gen_random_clan_id(generator);
611 while(clanid_t1 == clanid_t0);
614 game_stat.SetTeam1ClanId(clanid_t0);
615 game_stat.SetTeam2ClanId(clanid_t1);
617 int team_win = gen_random_team_win(generator);
618 int victory = gen_random_victory(generator);
622 game_stat.SetTeam1Victory(victory);
625 game_stat.SetTeam2Victory(3);
629 game_stat.SetTeam2Victory(victory);
632 game_stat.SetTeam1Victory(3);
634 game_stats.push_back(game_stat);
637 json_fight[
"clanid_t0"] = game_stat.GetTeam1ClanId();
638 json_fight[
"clanid_t1"] = game_stat.GetTeam2ClanId();
639 json_fight[
"victory_t0"] = game_stat.GetTeam1Victory();
640 json_fight[
"victory_t1"] = game_stat.GetTeam2Victory();
642 json_fights.append(json_fight);
644 json_results[
"fights"] = json_fights;
664 clan1->SetWins(clan1->GetWins() + 1);
669 clan1->SetWins(clan1->GetWins() + 1);
673 clan1->SetLosses(clan1->GetLosses() + 1);
677 clan1->SetDraws(clan1->GetDraws() + 1);
686 clan2->SetWins(clan2->GetWins() + 1);
691 clan2->SetWins(clan2->GetWins() + 1);
695 clan2->SetLosses(clan2->GetLosses() + 1);
699 clan2->SetDraws(clan2->GetDraws() + 1);
704 double diff1 =
static_cast<int64_t
>(clan2->GetScore()) -
static_cast<int64_t
>(clan1->GetScore());
705 double diff2 =
static_cast<int64_t
>(clan1->GetScore()) -
static_cast<int64_t
>(clan2->GetScore());
712 double score1 = K * (R1 - P1);
713 double score2 = K * (R2 - P2);
725 clan1->SetScore(std::max(0,
static_cast<int>(std::floor(score1) + clan1->GetScore())));
726 clan2->SetScore(std::max(0,
static_cast<int>(std::floor(score2) + clan2->GetScore())));
730 Json::Value json_clans(Json::arrayValue);
733 Json::Value json_clan;
735 json_clan[
"id"] = clan.GetClanId();
736 json_clan[
"name"] = clan.GetName();
737 json_clan[
"score"] = clan.GetScore();
738 json_clan[
"wins"] = clan.GetWins();
739 json_clan[
"losses"] = clan.GetLosses();
740 json_clan[
"draws"] = clan.GetDraws();
742 json_clans.append(json_clan);
744 json_results[
"clans"] = json_clans;
746 this->Send(json_results);
748 this->_LogTransaction(
"<--",
"HTTP/1.1 200 OK");
Represents a clan in the Battlefield game.
static const int ELO_MAX_RANGE
The maximum range for clan battles.
static const int ELO_WEIGHT
The Elo score weight for clan battles.
Represents a player in a game server.
Class representing game server information.
Represents a player's statistics in a game.
Represents game statistics.
VictoryState
Enumerates the victory states for a game.
Represents a player with extended statistics.
bool queryGameStatById(Battlefield::GameStat &game_stat)
Queries a game statistic by its ID.
bool queryGameServerPlayers(Battlefield::GameServer &game_server)
Queries the players connected to a game server.
bool queryGameServers(Battlefield::GameServers &game_servers)
Queries all game servers from the database.
bool queryPlayerByProfileId(Battlefield::Player &player)
Queries a player by their profile ID.
bool queryClanByClanId(Battlefield::Clan &clan)
Queries a clan by its clan ID.
bool queryGameStatsByDate(Battlefield::GameStats &game_stats, const std::string &date)
Queries game statistics by date.
bool queryLeaderboardRatio(Battlefield::RankPlayers &rank_players, const std::string &k, const std::string &s, uint32_t limit=10, uint32_t offset=0)
Queries the leaderboard rank of players by kills-to-spawns ratio.
bool queryClanRanksByClanId(Battlefield::Clan &clan)
Queries the ranks of a clan by its clan ID.
bool queryGameStatPlayers(Battlefield::GameStat &game_stat)
Queries the players associated with a game statistic.
bool queryPlayerByUniquenick(Battlefield::Player &player)
Queries a player by their unique nickname.
bool queryLeaderboardClan(Battlefield::RankClans &rank_clans, uint32_t limit=10, uint32_t offset=0)
Queries clan leaderboard.
bool queryPlayerStatsByProfileId(Battlefield::Player &player)
Queries the statistics of a player by their profile ID.
bool queryLeaderboardRank(Battlefield::RankPlayers &rank_players, uint32_t limit=10, uint32_t offset=0)
Queries the leaderboard rank of players.
bool queryClanByProfileId(Battlefield::Clan &clan, const Battlefield::Player &player)
Queries a clan by a player's profile ID.
bool queryLeaderboardType(Battlefield::RankPlayers &rank_players, const std::string &type, uint32_t limit=10, uint32_t offset=0)
Queries the leaderboard rank of players by player stat type.
void requestAPIClanSimulation(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for clan simulation through the API.
void requestAPIPlayer(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for a specific player through the API.
void requestAPILeaderboardClan(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for the clan leaderboard through the API.
void Send(const atomizes::HTTPMessage &http_response) const
Send an HTTP response.
void requestAPIServersLive(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for live servers through the API.
void requestAPIGame(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for a specific game through the API.
void _LogTransaction(const std::string &direction, const std::string &response) const
Log a transaction.
void requestAPIClan(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for a specific clan through the API.
void requestAPILeaderboard(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for the leaderboard through the API.
void requestAPIGames(const atomizes::HTTPMessage &http_request, const std::string &url_base, const Util::Url::Variables &url_variables)
Handle a request for multiple games through the API.