1 #ifndef BATTLEFIELD_GAMESERVER_H
2 #define BATTLEFIELD_GAMESERVER_H
7 #include <unordered_map>
39 class GameServerPlayer;
47 typedef std::vector<GameServer> GameServers;
55 typedef std::vector<GameServerPlayer> GameServerPlayers;
192 static std::unordered_map<std::string, SetterFunc> SetterMap;
195 int GetId()
const {
return this->
_id; }
196 std::string GetIp()
const {
return this->
_ip; }
197 void GetIpArray(uint8_t* ip)
const;
198 uint16_t GetPort()
const {
return this->
_port; }
199 uint8_t GetFlag()
const {
return this->
_flag; }
200 std::string GetLocalIp()
const {
return this->
_localip0; }
201 uint16_t GetLocalPort()
const {
return this->
_localport; }
202 uint8_t GetNatNeg()
const {
return this->
_natneg; }
203 std::string GetGameName()
const {
return this->
_gamename; }
204 std::string GetHostName()
const {
return this->
_hostname; }
205 uint16_t GetHostPort()
const {
return this->
_hostport; }
206 std::string GetGameVersion()
const {
return this->
_gamever; }
207 std::string GetClientVersion()
const {
return this->
_cl; }
208 std::string GetRV()
const {
return this->
_rv; }
209 std::string GetMap()
const {
return this->
_map; }
210 uint8_t GetMapCycling()
const {
return this->
_mc; }
211 uint8_t GetMapName()
const {
return this->
_mapname; }
212 uint8_t GetGC()
const {
return this->
_gc; }
213 std::string GetGameType()
const {
return this->
_gametype; }
214 std::string GetGameVariant()
const {
return this->
_gamevariant; }
215 uint8_t GetNumPlayers()
const {
return this->
_numplayers; }
216 uint8_t GetMaxPlayers()
const {
return this->
_maxplayers; }
217 uint8_t GetNumTeams()
const {
return this->
_numteams; }
218 std::string GetGameMode()
const {
return this->
_gamemode; }
219 uint8_t GetTeamplay()
const {
return this->
_teamplay; }
220 uint8_t GetFlagLimit()
const {
return this->
_fraglimit; }
222 uint16_t GetTimeLimit()
const {
return this->
_timelimit; }
223 uint16_t GetTimeElapsed()
const {
return this->
_timeelapsed; }
224 uint8_t GetPassword()
const {
return this->
_password; }
225 uint8_t GetMinRank()
const {
return this->
_nr; }
226 uint8_t GetMaxRank()
const {
return this->
_xr; }
227 uint8_t GetFriendlyFire()
const {
return this->
_ff; }
228 uint8_t GetStatsTracking()
const {
return this->
_sr; }
229 uint8_t GetReconfigurable()
const {
return this->
_rc; }
230 int64_t GetMinIpRange()
const {
return this->
_ni; }
231 int64_t GetMaxIpRange()
const {
return this->
_xi; }
232 uint8_t GetQM()
const {
return this->
_qm; }
233 uint64_t GetRegion()
const {
return this->
_region; }
235 int GetClan1Id()
const {
return this->
_c0; }
236 int GetClan2Id()
const {
return this->
_c1; }
237 std::string GetClan1Name()
const {
return this->
_n0; }
238 std::string GetClan2Name()
const {
return this->
_n1; }
239 uint8_t GetClan1Claimed()
const {
return this->
_c0c; }
240 uint8_t GetClan2Claimed()
const {
return this->
_c1c; }
242 std::string GetTeam1Name()
const {
return this->
_team0; }
243 std::string GetTeam2Name()
const {
return this->
_team1; }
244 int16_t GetTeam1Score()
const {
return this->
_score0; }
245 int16_t GetTeam2Score()
const {
return this->
_score1; }
247 std::string GetUpdatedAt()
const {
return this->
_updated_at; }
248 bool isVerified()
const {
return this->
_verified; }
250 GameServerPlayers GetPlayers()
const {
return this->
_players; }
253 bool SetIp(
const std::string& ip);
254 bool SetPort(uint16_t port);
255 bool SetFlag(uint8_t flag);
256 bool SetLocalIp(
const std::string& localip);
257 bool SetLocalPort(uint16_t localport);
258 bool SetLocalPort(
const std::string& str_localport);
259 bool SetNatNeg(uint8_t natneg);
260 bool SetNatNeg(
const std::string& str_natneg);
261 bool SetGameName(
const std::string& gamename);
262 bool SetHostName(
const std::string& hostname);
263 bool SetHostPort(uint16_t hostport);
264 bool SetHostPort(
const std::string& str_hostport);
265 bool SetGameVersion(
const std::string& gamever);
266 bool SetClientVersion(
const std::string& clientver);
267 bool SetRV(
const std::string& rv);
268 bool SetMap(
const std::string& map);
269 bool SetMapCycling(uint8_t mc);
270 bool SetMapCycling(
const std::string& str_mc);
271 bool SetMapName(uint8_t mapname);
272 bool SetMapName(
const std::string& str_mapname);
273 bool SetGC(uint8_t gc);
274 bool SetGC(
const std::string& str_gc);
275 bool SetGameType(
const std::string& gametype);
276 bool SetGameVariant(
const std::string& gamevariant);
277 bool SetNumPlayers(uint8_t numplayers);
278 bool SetNumPlayers(
const std::string& str_numplayers);
279 bool SetMaxPlayers(uint8_t maxplayers);
280 bool SetMaxPlayers(
const std::string& str_maxplayers);
281 bool SetNumTeams(uint8_t numteams);
282 bool SetNumTeams(
const std::string& str_numteams);
283 bool SetGameMode(
const std::string& gamemode);
284 bool SetTeamplay(uint8_t teamplay);
285 bool SetTeamplay(
const std::string& str_teamplay);
286 bool SetFlagLimit(uint8_t fraglimit);
287 bool SetFlagLimit(
const std::string& str_fraglimit);
288 bool SetTeamFragLimit(uint8_t teamfraglimit);
289 bool SetTeamFragLimit(
const std::string& str_teamfraglimit);
290 bool SetTimeLimit(uint16_t timelimit);
291 bool SetTimeLimit(
const std::string& str_timelimit);
292 bool SetTimeElapsed(uint16_t timeelapsed);
293 bool SetTimeElapsed(
const std::string& str_timeelapsed);
294 bool SetPassword(uint8_t password);
295 bool SetPassword(
const std::string& str_password);
296 bool SetMinRank(uint8_t nr);
297 bool SetMinRank(
const std::string& str_nr);
298 bool SetMaxRank(uint8_t xr);
299 bool SetMaxRank(
const std::string& str_xr);
300 bool SetFriendlyFire(uint8_t ff);
301 bool SetFriendlyFire(
const std::string& str_ff);
302 bool SetStatsTracking(uint8_t sr);
303 bool SetStatsTracking(
const std::string& str_sr);
304 bool SetReconfigurable(uint8_t rc);
305 bool SetReconfigurable(
const std::string& str_rc);
306 bool SetMinIpRange(int64_t ni);
307 bool SetMinIpRange(
const std::string& str_ni);
308 bool SetMaxIpRange(int64_t xi);
309 bool SetMaxIpRange(
const std::string& str_xi);
310 bool SetQM(uint8_t qm);
311 bool SetQM(
const std::string& str_qm);
312 bool SetRegion(uint64_t region);
313 bool SetRegion(
const std::string& str_region);
316 bool SetClan1Id(
int c0);
317 bool SetClan1Id(
const std::string& str_c0);
318 bool SetClan2Id(
int c1);
319 bool SetClan2Id(
const std::string& str_c1);
320 bool SetClan1Name(
const std::string& n0);
321 bool SetClan2Name(
const std::string& n1);
322 bool SetClan1Claimed(uint8_t c0c);
323 bool SetClan1Claimed(
const std::string& str_c0c);
324 bool SetClan2Claimed(uint8_t c1c);
325 bool SetClan2Claimed(
const std::string& str_c1c);
328 bool SetTeam1Name(
const std::string& team0);
329 bool SetTeam2Name(
const std::string& team1);
330 bool SetTeam1Score(int16_t score0);
331 bool SetTeam1Score(
const std::string& str_score0);
332 bool SetTeam2Score(int16_t score1);
333 bool SetTeam2Score(
const std::string& str_score1);
335 bool SetUpdatedAt(MYSQL_TIME updated_at);
336 bool SetVerified(
bool verified);
337 bool SetVerified(uint8_t verified);
344 void AddPlayer(
const GameServerPlayer& gsplayer);
397 int GetId()
const {
return this->
_id; }
398 std::string GetName()
const {
return this->
_name; }
399 int16_t GetScore()
const {
return this->
_score; }
400 std::string GetSkill()
const {
return this->
_skill; }
401 uint8_t GetPing()
const {
return this->
_ping; }
402 uint8_t GetTeam()
const {
return this->
_team; }
403 uint16_t GetDeaths()
const {
return this->
_deaths; }
404 int GetProfileId()
const {
return this->
_profileid; }
407 bool SetName(
const std::string& name);
408 bool SetScore(int16_t score);
409 bool SetScore(
const std::string& str_score);
410 bool SetSkill(
const std::string& skill);
411 bool SetPing(uint8_t ping);
412 bool SetPing(
const std::string& str_ping);
413 bool SetTeam(uint8_t team);
414 bool SetTeam(
const std::string& str_team);
415 bool SetDeaths(uint16_t deaths);
416 bool SetDeaths(
const std::string& str_deaths);
417 bool SetProfileId(
int profileid);
418 bool SetProfileId(
const std::string& str_profileid);
Represents a player in a game server.
Class representing game server information.
void useExample()
Performs an example operation using the GameServer class.
std::vector< GameServerPlayer > _players
bool IsAlive()
Checks if the game server is alive.
void AddPlayer(const GameServerPlayer &gsplayer)
Adds a player to the game server.
Regions
Enumeration defining regions where a game server can be located.
MapCyclingOptions
Enumeration defining the map cycling options.