BF2MC-Matchmaker
player.h
1 #ifndef BATTLEFIELD_PLAYER_H
2 #define BATTLEFIELD_PLAYER_H
3 
4 #include <string>
5 #include <vector>
6 #include <map>
7 
8 #include <battlefield/playerstats.h>
9 
18 struct MYSQL_TIME;
19 
20 namespace Battlefield
21 {
25  class Player; // Forward declaration of the Player class within the Battlefield namespace
26 
30  typedef std::vector<Player> Players; // Alias for a vector of Player objects, named Players
31  typedef std::map<int, Player> RankPlayers; // Alias for a map with integer keys and Player values, named RankPlayers
32 
33 
37  class Player : public PlayerStats
38  {
39  private:
40  int _profileid = -1;
41  int _userid = -1;
42  std::string _nick = "";
43  std::string _uniquenick = "";
44  std::string _email = "";
45  std::string _password = "";
46  std::string _last_login = "";
47  std::string _last_login_ip = "";
48  std::string _created_at = "";
49  bool _verified = false;
50  bool _restricted = false;
51  std::vector<int> _friends;
53  public:
54  int GetProfileId() const { return this->_profileid; }
55  int GetUserId() const { return this->_userid; }
56  std::string GetNick() const { return this->_nick; }
57  std::string GetUniquenick() const { return this->_uniquenick; }
58  std::string GetEmail() const { return this->_email; }
59  std::string GetPassword() const { return this->_password; }
60  std::string GetLastLogin() const { return this->_last_login; }
61  std::string GetLastLoginIp() const { return this->_last_login_ip; }
62  std::string GetCreatedAt() const { return this->_created_at; }
63  std::vector<int> GetFriends() const { return this->_friends; }
64  bool isVerified() const { return this->_verified; }
65  bool isRestricted() const { return this->_restricted; }
66 
67  bool SetProfileId(int profileid);
68  bool SetProfileId(const std::string& str_profileid);
69  bool SetUserId(int userid);
70  bool SetUserId(const std::string& str_userid);
71  bool SetNick(const std::string& nick);
72  bool SetUniquenick(const std::string& uniquenick);
73  bool SetUniquenickWithoutClanTag(const std::string& uniquenick);
74  bool SetEmail(const std::string& email);
75  bool SetPassword(const std::string& password);
76  bool SetMD5Password(const std::string& password);
77  bool SetLastLogin(MYSQL_TIME last_login);
78  bool SetLastLoginIp(const std::string& last_login_ip);
79  bool SetCreatedAt(MYSQL_TIME created_at);
80  bool SetVerified(bool verified);
81  bool SetVerified(uint8_t verified);
82  bool SetRestricted(bool restricted);
83  bool SetRestricted(uint8_t restricted);
84 
85  bool AddFriend(int profileid);
86 
95  void useExample();
96  };
97 }
98 
99 #endif // BATTLEFIELD_PLAYER_H
Contains player status information.
Definition: playerstats.h:17
Represents a player with extended statistics.
Definition: player.h:38
std::string _nick
Definition: player.h:42
std::string _last_login
Definition: player.h:46
std::string _created_at
Definition: player.h:48
std::string _email
Definition: player.h:44
std::string _last_login_ip
Definition: player.h:47
void useExample()
Performs an example operation using the Player class.
std::string _uniquenick
Definition: player.h:43
std::vector< int > _friends
Definition: player.h:51
std::string _password
Definition: player.h:45