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

Represents a clan in the Battlefield game. More...

#include <clan.h>

Public Types

enum class  Regions : uint8_t { America = 0x1 , Europe = 0x2 , Asia = 0x3 , Unknown = 0xf }
 Represents the regions associated with clans. More...
 
enum class  Ranks { Leader = 0x0 , Co_Leader = 0x1 , Member = 0x2 , Unknown = 0xf }
 Represents the ranks within a clan. More...
 
typedef bool(Battlefield::Clan::* SetterFunc) (const std::string &)
 

Public Member Functions

int GetClanId () const
 
std::string GetName () const
 
std::string GetTag () const
 
std::string GetHomepage () const
 
std::string GetInfo () const
 
uint8_t GetRegion () const
 
Regions GetRegionEnum () const
 
uint32_t GetScore () const
 
uint32_t GetWins () const
 
uint32_t GetLosses () const
 
uint32_t GetDraws () const
 
std::string GetCreatedAt () const
 
bool IsDisabled () const
 
const std::map< int, RanksGetRanks () const
 
bool SetClanId (int clanid)
 
bool SetClanId (const std::string &clanid)
 
bool SetName (const std::string &name)
 
bool SetTag (const std::string &tag)
 
bool SetHomepage (const std::string &homepage)
 
bool SetInfo (const std::string &info)
 
bool SetRegion (Battlefield::Clan::Regions region)
 
bool SetRegion (uint8_t int_region)
 
bool SetRegion (const std::string &region)
 
bool SetScore (uint32_t score)
 
bool SetWins (uint32_t wins)
 
bool SetLosses (uint32_t losses)
 
bool SetDraws (uint32_t draws)
 
bool SetCreatedAt (MYSQL_TIME created_at)
 
bool SetDisable (bool disable)
 
bool SetDisable (uint8_t disable)
 
void AddRank (int profileid, Ranks rank)
 
void AddRank (int profileid, uint8_t int_rank)
 
Ranks GetRank (int profileid) const
 
void useExample ()
 Performs an example operation using the Clan class. More...
 

Static Public Member Functions

static Ranks convertRank (const std::string &rank)
 Converts a string representation of a rank to its corresponding enum value. More...
 
static Ranks convertRank (uint8_t int_rank)
 Converts an integer representation of a rank to its corresponding enum value. More...
 
static Regions convertRegion (const std::string &str_region)
 Converts a string representation of a region to its corresponding enum value. More...
 
static Regions convertRegion (uint8_t int_region)
 Converts an integer representation of a region to its corresponding enum value. More...
 

Static Public Attributes

static const int ELO_WEIGHT = 25
 The Elo score weight for clan battles. More...
 
static const int ELO_MAX_RANGE = 1000
 The maximum range for clan battles. More...
 
static std::unordered_map< std::string, SetterFunc > SetterMap
 

Private Attributes

int _clanid = -1
 
std::string _name = ""
 
std::string _tag = ""
 
std::string _homepage = ""
 
std::string _info = ""
 
Regions _region = Regions::America
 
uint32_t _score = 0
 
uint32_t _wins = 0
 
uint32_t _losses = 0
 
uint32_t _draws = 0
 
std::string _created_at = ""
 
bool _disable = false
 
std::map< int, Ranks_ranks
 

Detailed Description

Represents a clan in the Battlefield game.

This class encapsulates data and behavior related to a clan in the Battlefield game.

Definition at line 53 of file clan.h.

Member Enumeration Documentation

◆ Ranks

Represents the ranks within a clan.

This enum class defines different ranks within a clan. Each rank corresponds to a specific position or role within the clan hierarchy.

Enumerator
Leader 

The leader of the clan.

Co_Leader 

A co-leader within the clan.

Member 

A regular member of the clan.

Unknown 

Unknown rank.

Definition at line 76 of file clan.h.

◆ Regions

enum Battlefield::Clan::Regions : uint8_t
strong

Represents the regions associated with clans.

This enum class defines different regions associated with clans. Each region corresponds to a specific geographical area.

Enumerator
America 

The Americas region.

Europe 

The Europe region.

Asia 

The Asia region.

Unknown 

Unknown region.

Definition at line 62 of file clan.h.

Member Function Documentation

◆ convertRank() [1/2]

Battlefield::Clan::Ranks Battlefield::Clan::convertRank ( const std::string &  rank)
static

Converts a string representation of a rank to its corresponding enum value.

This static member function converts a string representation of a rank to its corresponding enum value of the Ranks enumeration.

Parameters
rankA string representing the rank.
Returns
The enum value representing the rank.

Definition at line 199 of file battlefield/clan.cpp.

◆ convertRank() [2/2]

Battlefield::Clan::Ranks Battlefield::Clan::convertRank ( uint8_t  int_rank)
static

Converts an integer representation of a rank to its corresponding enum value.

This static member function converts an integer representation of a rank to its corresponding enum value of the Ranks enumeration.

Parameters
int_rankAn integer representing the rank.
Returns
The enum value representing the rank.

Definition at line 212 of file battlefield/clan.cpp.

◆ convertRegion() [1/2]

Battlefield::Clan::Regions Battlefield::Clan::convertRegion ( const std::string &  str_region)
static

Converts a string representation of a region to its corresponding enum value.

This static member function converts a string representation of a region to its corresponding enum value of the Regions enumeration.

Parameters
str_regionA string representing the region.
Returns
The enum value representing the region.

Definition at line 222 of file battlefield/clan.cpp.

◆ convertRegion() [2/2]

Battlefield::Clan::Regions Battlefield::Clan::convertRegion ( uint8_t  int_region)
static

Converts an integer representation of a region to its corresponding enum value.

This static member function converts an integer representation of a region to its corresponding enum value of the Regions enumeration.

Parameters
int_regionAn integer representing the region.
Returns
The enum value representing the region.

Definition at line 235 of file battlefield/clan.cpp.

◆ useExample()

void Battlefield::Clan::useExample ( )

Performs an example operation using the Clan class.

This member function demonstrates an example operation using the Clan class. It serves as a placeholder for illustrating the usage of the Clan class.

Note
This is just an example function and does not perform any meaningful operation.

Definition at line 15 of file battlefield/clan.cpp.

Member Data Documentation

◆ _clanid

int Battlefield::Clan::_clanid = -1
private

The unique identifier of the clan.

Definition at line 85 of file clan.h.

◆ _created_at

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

The creation timestamp of the clan.

Definition at line 95 of file clan.h.

◆ _disable

bool Battlefield::Clan::_disable = false
private

Disable option to not let player progress stats.

Definition at line 96 of file clan.h.

◆ _draws

uint32_t Battlefield::Clan::_draws = 0
private

The number of draws of the clan.

Definition at line 94 of file clan.h.

◆ _homepage

std::string Battlefield::Clan::_homepage = ""
private

The homepage URL of the clan.

Definition at line 88 of file clan.h.

◆ _info

std::string Battlefield::Clan::_info = ""
private

Additional information about the clan.

Definition at line 89 of file clan.h.

◆ _losses

uint32_t Battlefield::Clan::_losses = 0
private

The number of losses of the clan.

Definition at line 93 of file clan.h.

◆ _name

std::string Battlefield::Clan::_name = ""
private

The name of the clan.

Definition at line 86 of file clan.h.

◆ _ranks

std::map<int, Ranks> Battlefield::Clan::_ranks
private

The map of member IDs to ranks within the clan.

Definition at line 97 of file clan.h.

◆ _region

Regions Battlefield::Clan::_region = Regions::America
private

The region associated with the clan.

Definition at line 90 of file clan.h.

◆ _score

uint32_t Battlefield::Clan::_score = 0
private

The score of the clan.

Definition at line 91 of file clan.h.

◆ _tag

std::string Battlefield::Clan::_tag = ""
private

The tag of the clan.

Definition at line 87 of file clan.h.

◆ _wins

uint32_t Battlefield::Clan::_wins = 0
private

The number of wins of the clan.

Definition at line 92 of file clan.h.

◆ ELO_MAX_RANGE

const int Battlefield::Clan::ELO_MAX_RANGE = 1000
static

The maximum range for clan battles.

This static constant represents the maximum distance between clans allowed to fight each other. It defines the range within which clan battles can occur.

Definition at line 115 of file clan.h.

◆ ELO_WEIGHT

const int Battlefield::Clan::ELO_WEIGHT = 25
static

The Elo score weight for clan battles.

This static constant represents the Elo score weight used for calculating the outcome of clan battles. It determines the impact of a draw on the Elo score, with multipliers applied for different victory levels.

Definition at line 107 of file clan.h.

◆ SetterMap

std::unordered_map< std::string, Battlefield::Clan::SetterFunc > Battlefield::Clan::SetterMap
static
Initial value:
= {
{"name", &Battlefield::Clan::SetName },
{"tag", &Battlefield::Clan::SetTag },
{"homepage", &Battlefield::Clan::SetHomepage },
{"info", &Battlefield::Clan::SetInfo },
{"region", &Battlefield::Clan::SetRegion },
}

Definition at line 119 of file clan.h.


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