BF2MC-Matchmaker
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Battlefield::GameStat Class Reference

Represents game statistics. More...

#include <gamestat.h>

Public Types

enum class  VictoryState : uint8_t { Lost = 0 , Major = 1 , Minor = 2 , Draw = 3 }
 Enumerates the victory states for a game. More...
 
typedef bool(Battlefield::GameStat::* SetterFunc) (const std::string &)
 

Public Member Functions

int GetId () const
 
uint8_t GetGameType () const
 
std::string GetGameVersion () const
 
std::string GetHostName () const
 
uint8_t GetMapId () const
 
uint8_t GetNumPlayers () const
 
uint8_t GetPPlayers () const
 
uint16_t GetTimePlayed () const
 
int GetTeam1ClanId () const
 
int GetTeam2ClanId () const
 
uint8_t GetTeam1Country () const
 
uint8_t GetTeam2Country () const
 
uint8_t GetTeam1Victory () const
 
uint8_t GetTeam2Victory () const
 
VictoryState GetTeam1VictoryEnum () const
 
VictoryState GetTeam2VictoryEnum () const
 
int16_t GetTeam1Score () const
 
int16_t GetTeam2Score () const
 
std::string GetCreatedAt () const
 
GameStatPlayers GetPlayers () const
 
bool SetId (int id)
 
bool SetId (const std::string &str_id)
 
bool SetGameType (uint8_t gametype)
 
bool SetGameType (const std::string &str_gametype)
 
bool SetGameVersion (const std::string &gamver)
 
bool SetHostName (const std::string &hostname)
 
bool SetMapId (uint8_t mapid)
 
bool SetMapId (const std::string &str_mapid)
 
bool SetNumPlayers (uint8_t numplayers)
 
bool SetNumPlayers (const std::string &str_numplayers)
 
bool SetPPlayers (uint8_t pplayers)
 
bool SetPPlayers (const std::string &str_pplayers)
 
bool SetTimePlayed (uint16_t tplayed)
 
bool SetTimePlayed (const std::string &str_tplayed)
 
bool SetTeam1ClanId (int clanid_t0)
 
bool SetTeam1ClanId (const std::string &str_clanid_t0)
 
bool SetTeam2ClanId (int clanid_t1)
 
bool SetTeam2ClanId (const std::string &str_clanid_t1)
 
bool SetTeam1Country (uint8_t country_t0)
 
bool SetTeam1Country (const std::string &str_country_t0)
 
bool SetTeam2Country (uint8_t country_t1)
 
bool SetTeam2Country (const std::string &str_country_t1)
 
bool SetTeam1Victory (uint8_t victory_t0)
 
bool SetTeam1Victory (const std::string &str_victory_t0)
 
bool SetTeam2Victory (uint8_t victory_t1)
 
bool SetTeam2Victory (const std::string &str_victory_t1)
 
bool SetTeam1Score (int16_t score0)
 
bool SetTeam1Score (const std::string &str_score0)
 
bool SetTeam2Score (int16_t score1)
 
bool SetTeam2Score (const std::string &str_score1)
 
bool SetCreatedAt (MYSQL_TIME created_at)
 
void AddPlayer (const GameStatPlayer &gsplayer)
 
void disablePlayer (int profileid)
 
void UpdateClanStats ()
 
void Debug ()
 

Static Public Attributes

static std::unordered_map< std::string, SetterFunc > SetterMap
 

Private Attributes

int _id = -1
 
uint8_t _gametype = 0
 
std::string _gamver = ""
 
std::string _hostname = ""
 
uint8_t _mapid = 0
 
uint8_t _numplayers = 0
 
uint8_t _pplayers = 0
 
uint16_t _tplayed = 0
 
int _clanid_t0 = 0
 
int _clanid_t1 = 0
 
uint8_t _country_t0 = 0
 
uint8_t _country_t1 = 0
 
uint8_t _victory_t0 = 0
 
uint8_t _victory_t1 = 0
 
int16_t _score0 = 0
 
int16_t _score1 = 0
 
std::string _created_at = ""
 
GameStatPlayers _players
 

Detailed Description

Represents game statistics.

Definition at line 36 of file gamestat.h.

Member Enumeration Documentation

◆ VictoryState

enum Battlefield::GameStat::VictoryState : uint8_t
strong

Enumerates the victory states for a game.

Enumerator
Lost 

The game was lost.

Major 

Major victory.

Minor 

Minor victory.

Draw 

The game ended in a draw.

Definition at line 42 of file gamestat.h.

Member Data Documentation

◆ _clanid_t0

int Battlefield::GameStat::_clanid_t0 = 0
private

The clan ID for team 1.

Definition at line 59 of file gamestat.h.

◆ _clanid_t1

int Battlefield::GameStat::_clanid_t1 = 0
private

The clan ID for team 2.

Definition at line 60 of file gamestat.h.

◆ _country_t0

uint8_t Battlefield::GameStat::_country_t0 = 0
private

The country ID for team 1.

Definition at line 61 of file gamestat.h.

◆ _country_t1

uint8_t Battlefield::GameStat::_country_t1 = 0
private

The country ID for team 2.

Definition at line 62 of file gamestat.h.

◆ _created_at

std::string Battlefield::GameStat::_created_at = ""
private

The datetime when the game statistics were created.

Definition at line 68 of file gamestat.h.

◆ _gametype

uint8_t Battlefield::GameStat::_gametype = 0
private

The type of game (see: enum Battlefield::GameType).

Definition at line 52 of file gamestat.h.

◆ _gamver

std::string Battlefield::GameStat::_gamver = ""
private

The game version.

Definition at line 53 of file gamestat.h.

◆ _hostname

std::string Battlefield::GameStat::_hostname = ""
private

The hostname of the game server.

Definition at line 54 of file gamestat.h.

◆ _id

int Battlefield::GameStat::_id = -1
private

The unique identifier for the game statistics.

Definition at line 51 of file gamestat.h.

◆ _mapid

uint8_t Battlefield::GameStat::_mapid = 0
private

The ID of the map.

Definition at line 55 of file gamestat.h.

◆ _numplayers

uint8_t Battlefield::GameStat::_numplayers = 0
private

The total number of players in the game.

Definition at line 56 of file gamestat.h.

◆ _players

GameStatPlayers Battlefield::GameStat::_players
private

The list of players involved in the game.

Definition at line 69 of file gamestat.h.

◆ _pplayers

uint8_t Battlefield::GameStat::_pplayers = 0
private

The number of present players at the end of the game.

Definition at line 57 of file gamestat.h.

◆ _score0

int16_t Battlefield::GameStat::_score0 = 0
private

Score of team 1.

Definition at line 65 of file gamestat.h.

◆ _score1

int16_t Battlefield::GameStat::_score1 = 0
private

Score of team 2.

Definition at line 66 of file gamestat.h.

◆ _tplayed

uint16_t Battlefield::GameStat::_tplayed = 0
private

The total time played in seconds.

Definition at line 58 of file gamestat.h.

◆ _victory_t0

uint8_t Battlefield::GameStat::_victory_t0 = 0
private

The victory state for team 1 (see: enum Battlefield::GameStat::VictoryState).

Definition at line 63 of file gamestat.h.

◆ _victory_t1

uint8_t Battlefield::GameStat::_victory_t1 = 0
private

The victory state for team 2 (see: enum Battlefield::GameStat::VictoryState).

Definition at line 64 of file gamestat.h.

◆ SetterMap

std::unordered_map< std::string, Battlefield::GameStat::SetterFunc > Battlefield::GameStat::SetterMap
static
Initial value:
= {
{"gametype", &Battlefield::GameStat::SetGameType },
{"gamver", &Battlefield::GameStat::SetGameVersion },
{"hostname", &Battlefield::GameStat::SetHostName },
{"mapid", &Battlefield::GameStat::SetMapId },
{"numplayers", &Battlefield::GameStat::SetNumPlayers },
{"pplayers", &Battlefield::GameStat::SetPPlayers },
{"tplayed", &Battlefield::GameStat::SetTimePlayed },
{"clanid_t0", &Battlefield::GameStat::SetTeam1ClanId },
{"clanid_t1", &Battlefield::GameStat::SetTeam2ClanId },
{"country_t0", &Battlefield::GameStat::SetTeam1Country },
{"country_t1", &Battlefield::GameStat::SetTeam2Country },
{"victory_t0", &Battlefield::GameStat::SetTeam1Victory },
{"victory_t1", &Battlefield::GameStat::SetTeam2Victory },
{"score0", &Battlefield::GameStat::SetTeam1Score },
{"score1", &Battlefield::GameStat::SetTeam2Score },
}

Definition at line 74 of file gamestat.h.


The documentation for this class was generated from the following files: