Contains all server methods and returns usable data types. More...
#include <Methods.h>
Public Member Functions | |
Methods (GbxRemote *serverPtr, std::map< std::string, Player > *playerListPtr, ServerInfo *serverInfoPtr) | |
Constructor with link to server connection. More... | |
GbxError | GetCurrentError () |
Returns the current server error (from GbxRemote). | |
bool | Authenticate (std::string username, std::string password) |
Authenticates with the server. Returns whether authentication was successful. More... | |
bool | ChangeAuthPassword (std::string username, std::string password) |
Changes authentication passwordd. Returns whether change was successful. More... | |
bool | EnableCallbacks (bool enable) |
Enables/disables callbacks. Returns whether change was successful. More... | |
bool | SetApiVersion (std::string version) |
Sets the API version of the server. Returns whether change was successful. More... | |
std::vector< std::string > | ListMethods () |
Returns list of available server methods. More... | |
ServerVersion | GetVersion () |
Returns server version information. More... | |
SystemInfo | GetSystemInfo () |
Returns system information. More... | |
bool | SetConnectionRates (int downloadRate, int uploadRate) |
Sets the server connection rates. More... | |
ServerStatus | GetStatus () |
Returns server status. More... | |
bool | QuitGame () |
Quit the server. | |
bool | ChatSendServerMessage (std::string text) |
Send chat message to all players. More... | |
bool | ChatSendServerMessageToLogin (std::string text, std::string login) |
Send chat message to player login. More... | |
bool | ChatSendServerMessageToPlayer (std::string text, Player player) |
Send chat message to player. More... | |
std::vector< std::string > | GetChatLines () |
Get latest chat lines. | |
bool | ChatEnableManualRouting (bool enable, bool autoForward) |
Enable/disable manual chat routing. More... | |
bool | ChatForwardToLogin (std::string text, std::string sender, std::string destination="") |
Forwards chat message to player. More... | |
bool | SendNotice (std::string text, std::string avatarLogin="", int variant=0) |
Send notice to all players. More... | |
bool | SendNoticeToLogin (std::string login, std::string text, std::string avatarLogin="", int variant=0) |
Send notice to player login. More... | |
bool | SendOpenLinkToLogin (std::string login, std::string link, int linkType) |
Send link to player login. More... | |
bool | CallVote (std::string xmlRequest) |
Start callvote. More... | |
bool | CallVoteEx (std::string xmlRequest, double ratio, int timeout, int whoVotes) |
Start callvote. More... | |
bool | CancelVote () |
Cancels the current callvote. | |
CurrentCallVote | GetCurrentCallVote () |
Returns the current callvote. | |
bool | SetCallVoteTimeOut (int timeout) |
Sets the default callvote timeout. More... | |
CurrentNextValue | GetCallVoteTimeOut () |
Gets the default callvote timeout. | |
bool | SetCallVoteRatio (double ratio) |
Sets the default callvote ratio. More... | |
double | GetCallVoteRatio () |
Gets the default callvote ratio. | |
bool | SetCallVoteRatios (std::vector< CallVoteRatio > ratios) |
Sets the callvote ratios. More... | |
std::vector< CallVoteRatio > | GetCallVoteRatios () |
Gets the callvote ratios. | |
bool | SetCallVoteRatiosEx (bool replaceAll, std::vector< ExtendedCallVoteRatio > ratios) |
Sets the callvote ratios. More... | |
std::vector < ExtendedCallVoteRatio > | GetCallVoteRatiosEx () |
Gets the callvote ratios. | |
bool | SendDisplayManialinkPage (std::string page, int timeout, bool hideOnClick) |
Displays ManiaLink page to all players. More... | |
bool | SendDisplayManialinkPageToLogin (std::string login, std::string page, int timeout, bool hideOnClick) |
Displays ManiaLink page to a player. More... | |
bool | SendHideManialinkPage () |
Hides all ManiaLink pages for all players. | |
bool | SendHideManialinkPageToLogin (std::string login) |
Hides all ManiaLink pages for a player. More... | |
std::vector< ManiaLinkPageAnswer > | GetManialinkPageAnswers () |
Returns the latest results from the current ManiaLink page. | |
bool | SetServerName (std::string name) |
Sets the server name. More... | |
std::string | GetServerName () |
Returns the current server name. | |
bool | SetServerComment (std::string comment) |
Sets the server comment. More... | |
std::string | GetServerComment () |
Returns the current server comment. | |
bool | SetHideServer (int setting) |
Sets the hide setting of the server. More... | |
int | GetHideServer () |
Gets the hide setting of the server (0 = visible, 1 = always hidden, 2 = hidden from nations). | |
bool | IsRelayServer () |
Returns whether the server is a relay server. | |
bool | SetServerPassword (std::string password) |
Sets the server password. More... | |
std::string | GetServerPassword () |
Gets the server password. | |
bool | SetServerPasswordForSpectator (std::string password) |
Sets the spectator password. More... | |
std::string | GetServerPasswordForSpectator () |
Gets the spectator password. | |
bool | SetMaxPlayers (int limit) |
Sets the playerlimit. More... | |
CurrentNextValue | GetMaxPlayers () |
Gets the playerlimit. | |
bool | SetMaxSpectators (int limit) |
Sets the spectatorlimit. More... | |
bool | SetGameMode (GameMode mode) |
Sets the game mode (0 = Script, 1 = Rounds, 2 = TimeAttack, 3 = Team, 4 = Laps, 5 = Cup, 6 = Stunts). More... | |
GameMode | GetGameMode () |
Get the game mode (0 = Script, 1 = Rounds, 2 = TimeAttack, 3 = Team, 4 = Laps, 5 = Cup, 6 = Stunts). | |
CurrentNextValue | GetMaxSpectators () |
Gets the spectatorlimit. | |
Map | GetNextMapInfo () |
Provides a map object for the map being played next on the server. | |
Map | GetCurrentMapInfo () |
Provides a map object for the map currently being played on the server. More... | |
Map | GetMapInfo (std::string fileName) |
Provides a map object for the map with the specified file name. More... | |
bool | CheckMapForCurrentServerParams (std::string fileName) |
Checks if the map matches the current server settings. More... | |
std::vector< Map > | GetMapList (int limit, int index) |
Gets the maplist from the server. More... | |
bool | AddMap (std::string fileName) |
Add the map with the specified filename at the end of the current selection. More... | |
int | AddMapList (std::vector< std::string > fileNames) |
Add the list of maps with the specified filenames at the end of the current selection. More... | |
bool | RemoveMap (std::string fileName) |
Remove the map with the specified filename from the current selection. More... | |
int | RemoveMapList (std::vector< std::string > fileNames) |
Remove the list of maps with the specified filenames from the current selection. More... | |
bool | InsertMap (std::string fileName) |
Insert the map with the specified filename after the current map. More... | |
int | InsertMapList (std::vector< std::string > fileNames) |
Insert the list of maps with the specified filenames after the current map. More... | |
bool | ChooseNextMap (std::string fileName) |
Set as next map the one with the specified filename, if it is present in the selection. More... | |
int | ChooseNextMapList (std::vector< std::string > fileNames) |
Set as next maps the list of maps with the specified filenames, if they are present in the selection. More... | |
std::string | GetValidationReplay (std::string login) |
Retrieve validation replay by player login. More... | |
std::string | GetGhostReplay (std::string login, std::string fileName) |
Retrieve ghost replay by player login. More... | |
std::string | GameDataDirectory () |
Retrieve the location of the GameData directory. | |
std::string | GetMapsDirectory () |
Retrieve the location of the maps directory. | |
std::string | GetSkinsDirectory () |
Retrieve the location of the skins directory. | |
bool | Kick (std::string login, std::string message="") |
Kick a player from the server. More... | |
bool | Ban (std::string login, std::string message="") |
Ban a player from the server. More... | |
bool | BanAndBlackList (std::string login, std::string message, bool save=false) |
Ban and blacklist a player from the server. More... | |
bool | UnBan (std::string login) |
Unban a player from the server. More... | |
bool | CleanBanList () |
Clear the banlist. | |
std::vector< BannedPlayer > | GetBanList (int amount, int index) |
Retrieve the banlist. More... | |
bool | BlackList (std::string login) |
Blacklist a player from the server. More... | |
bool | UnBlackList (std::string login) |
Unblacklist a player from the server. More... | |
bool | CleanBlackList () |
Clear the blacklist. | |
std::vector< std::string > | GetBlackList (int amount, int index) |
Retrieve the blacklist. More... | |
bool | LoadBlackList (std::string file) |
Load the blacklist to the server. More... | |
bool | SaveBlackList (std::string file) |
Save the blacklist from the server. More... | |
bool | AddGuest (std::string login) |
Add a player as guest on the server. More... | |
bool | RemoveGuest (std::string login) |
Remove a player as guest on the server. More... | |
bool | CleanGuestList () |
Clear the guestlist. | |
std::vector< std::string > | GetGuestList (int amount, int index) |
Retrieve the guestlist. More... | |
bool | LoadGuestList (std::string file) |
Load the guestlist to the server. More... | |
bool | SaveGuestList (std::string file) |
Save the guestlist from the server. More... | |
bool | Ignore (std::string login) |
Ignore a player on the server. More... | |
bool | UnIgnore (std::string login) |
Unignore a player on the server. More... | |
bool | CleanIgnoreList () |
Clear the ignorelist. | |
std::vector< std::string > | GetIgnoreList (int amount, int index) |
Retrieve the ignorelist. More... | |
Private Attributes | |
GbxRemote * | server |
Pointer to GbxRemote. | |
std::map< std::string, Player > * | playerList |
Pointer to the playerlist. | |
ServerInfo * | serverInfo |
Pointer to the server information. | |
Contains all server methods and returns usable data types.
Methods::Methods | ( | GbxRemote * | serverPtr, |
std::map< std::string, Player > * | playerListPtr, | ||
ServerInfo * | serverInfoPtr | ||
) |
Constructor with link to server connection.
serverPtr | Pointer to server connection. |
playerListPtr | Pointer to the playerlist. |
serverInfoPtr | Pointer to the server information |
bool Methods::AddGuest | ( | std::string | login | ) |
Add a player as guest on the server.
login | Player login. |
bool Methods::AddMap | ( | std::string | fileName | ) |
Add the map with the specified filename at the end of the current selection.
fileName | Filename of the map. |
int Methods::AddMapList | ( | std::vector< std::string > | fileNames | ) |
Add the list of maps with the specified filenames at the end of the current selection.
fileNames | List of map filenames. |
bool Methods::Authenticate | ( | std::string | username, |
std::string | password | ||
) |
Authenticates with the server. Returns whether authentication was successful.
username | Server username (f.e. SuperAdmin). |
password | Server password. |
bool Methods::Ban | ( | std::string | login, |
std::string | message = "" |
||
) |
Ban a player from the server.
login | Player login. |
message | Optional ban message. |
bool Methods::BanAndBlackList | ( | std::string | login, |
std::string | message, | ||
bool | save = false |
||
) |
Ban and blacklist a player from the server.
login | Player login. |
message | Ban message. |
save | Save the blacklist. |
bool Methods::BlackList | ( | std::string | login | ) |
Blacklist a player from the server.
login | Player login. |
bool Methods::CallVote | ( | std::string | xmlRequest | ) |
Start callvote.
xmlRequest | Callvote request. |
bool Methods::CallVoteEx | ( | std::string | xmlRequest, |
double | ratio, | ||
int | timeout, | ||
int | whoVotes | ||
) |
Start callvote.
xmlRequest | Callvote request. |
ratio | Passing ratio (between 0 and 1, -1 = default). |
timeout | Timeout for the callvote (0 = default, 1 = indefinite). |
whoVotes | Who votes for the callvote (0 = active players, 1 = all players, 2 = everyone, including spectators). |
bool Methods::ChangeAuthPassword | ( | std::string | username, |
std::string | password | ||
) |
Changes authentication passwordd. Returns whether change was successful.
username | Server username (f.e. SuperAdmin). |
password | New password for user. |
bool Methods::ChatEnableManualRouting | ( | bool | enable, |
bool | autoForward | ||
) |
Enable/disable manual chat routing.
enable | Enable routing? |
autoForward | Autoforward? |
bool Methods::ChatForwardToLogin | ( | std::string | text, |
std::string | sender, | ||
std::string | destination = "" |
||
) |
Forwards chat message to player.
text | Chat message. |
sender | Sending login. |
destination | Destination login (empty for all players). |
bool Methods::ChatSendServerMessage | ( | std::string | text | ) |
Send chat message to all players.
text | Chat message. |
bool Methods::ChatSendServerMessageToLogin | ( | std::string | text, |
std::string | login | ||
) |
Send chat message to player login.
text | Chat message. |
login | Player login to which the message should be send. |
bool Methods::ChatSendServerMessageToPlayer | ( | std::string | text, |
Player | player | ||
) |
Send chat message to player.
text | Chat message. |
player | Player object to which the message should be send. |
bool Methods::CheckMapForCurrentServerParams | ( | std::string | fileName | ) |
Checks if the map matches the current server settings.
fileName | File name of the map. |
bool Methods::ChooseNextMap | ( | std::string | fileName | ) |
Set as next map the one with the specified filename, if it is present in the selection.
fileName | Filename of the map. |
int Methods::ChooseNextMapList | ( | std::vector< std::string > | fileNames | ) |
Set as next maps the list of maps with the specified filenames, if they are present in the selection.
fileNames | List of map filenames. |
bool Methods::EnableCallbacks | ( | bool | enable | ) |
Enables/disables callbacks. Returns whether change was successful.
enable | Enable (true) or disable (false). |
std::vector< BannedPlayer > Methods::GetBanList | ( | int | amount, |
int | index | ||
) |
Retrieve the banlist.
amount | Amount of players from the banlist to be retrieved. |
index | Starting index. |
std::vector< std::string > Methods::GetBlackList | ( | int | amount, |
int | index | ||
) |
Retrieve the blacklist.
amount | Amount of players from the blacklist to be retrieved. |
index | Starting index. |
Map Methods::GetCurrentMapInfo | ( | ) |
Provides a map object for the map currently being played on the server.
This is mainly meant for the start-up of the controller. The current map can always be request via the Current property of MapList.
std::string Methods::GetGhostReplay | ( | std::string | login, |
std::string | fileName | ||
) |
Retrieve ghost replay by player login.
login | Player login. |
fileName | File to store the replay in. |
std::vector< std::string > Methods::GetGuestList | ( | int | amount, |
int | index | ||
) |
Retrieve the guestlist.
amount | Amount of players from the guestlist to be retrieved. |
index | Starting index. |
std::vector< std::string > Methods::GetIgnoreList | ( | int | amount, |
int | index | ||
) |
Retrieve the ignorelist.
amount | Amount of players from the ignorelist to be retrieved. |
index | Starting index. |
Map Methods::GetMapInfo | ( | std::string | fileName | ) |
Provides a map object for the map with the specified file name.
fileName | File name of the map. |
std::vector< Map > Methods::GetMapList | ( | int | limit, |
int | index | ||
) |
Gets the maplist from the server.
limit | Maximum amount of maps to be retrieved. |
index | Map index on which to start the retrieval. |
ServerStatus Methods::GetStatus | ( | ) |
Returns server status.
Returns empty struct if no information could be retrieved.
SystemInfo Methods::GetSystemInfo | ( | ) |
Returns system information.
Returns empty struct if no information could be retrieved.
std::string Methods::GetValidationReplay | ( | std::string | login | ) |
Retrieve validation replay by player login.
login | Player login. |
ServerVersion Methods::GetVersion | ( | ) |
Returns server version information.
Returns empty struct if no information could be retrieved.
bool Methods::Ignore | ( | std::string | login | ) |
Ignore a player on the server.
login | Player login. |
bool Methods::InsertMap | ( | std::string | fileName | ) |
Insert the map with the specified filename after the current map.
fileName | Filename of the map. |
int Methods::InsertMapList | ( | std::vector< std::string > | fileNames | ) |
Insert the list of maps with the specified filenames after the current map.
fileNames | List of map filenames. |
bool Methods::Kick | ( | std::string | login, |
std::string | message = "" |
||
) |
Kick a player from the server.
login | Player login. |
message | Optional kick message. |
std::vector< std::string > Methods::ListMethods | ( | ) |
Returns list of available server methods.
Returns empty vector if no methods could be retrieved.
bool Methods::LoadBlackList | ( | std::string | file | ) |
Load the blacklist to the server.
file | Filename to load the blacklist from. |
bool Methods::LoadGuestList | ( | std::string | file | ) |
Load the guestlist to the server.
file | Filename to load the guestlist from. |
bool Methods::RemoveGuest | ( | std::string | login | ) |
Remove a player as guest on the server.
login | Player login. |
bool Methods::RemoveMap | ( | std::string | fileName | ) |
Remove the map with the specified filename from the current selection.
fileName | Filename of the map. |
int Methods::RemoveMapList | ( | std::vector< std::string > | fileNames | ) |
Remove the list of maps with the specified filenames from the current selection.
fileNames | List of map filenames. |
bool Methods::SaveBlackList | ( | std::string | file | ) |
Save the blacklist from the server.
file | Filename to save the blacklist to. |
bool Methods::SaveGuestList | ( | std::string | file | ) |
Save the guestlist from the server.
file | Filename to save the guestlist to. |
bool Methods::SendDisplayManialinkPage | ( | std::string | page, |
int | timeout, | ||
bool | hideOnClick | ||
) |
Displays ManiaLink page to all players.
page | XML page to be displayed. |
timeout | Timeout to autohide (0 = permanent). |
hideOnClick | Hide the page if a page option is clicked. |
bool Methods::SendDisplayManialinkPageToLogin | ( | std::string | login, |
std::string | page, | ||
int | timeout, | ||
bool | hideOnClick | ||
) |
Displays ManiaLink page to a player.
login | Player login. |
page | XML page to be displayed. |
timeout | Timeout to autohide (0 = permanent). |
hideOnClick | Hide the page if a page option is clicked. |
bool Methods::SendHideManialinkPageToLogin | ( | std::string | login | ) |
Hides all ManiaLink pages for a player.
login | Player login. |
bool Methods::SendNotice | ( | std::string | text, |
std::string | avatarLogin = "" , |
||
int | variant = 0 |
||
) |
Send notice to all players.
text | Chat message. |
avatarLogin | Avatar login. |
variant | Notice variant (0 = normal, 1 = sad, 2 = happy). |
bool Methods::SendNoticeToLogin | ( | std::string | login, |
std::string | text, | ||
std::string | avatarLogin = "" , |
||
int | variant = 0 |
||
) |
Send notice to player login.
login | Player login. |
text | Chat message. |
avatarLogin | Avatar login. |
variant | Notice variant (0 = normal, 1 = sad, 2 = happy). |
bool Methods::SendOpenLinkToLogin | ( | std::string | login, |
std::string | link, | ||
int | linkType | ||
) |
Send link to player login.
login | Player login. |
link | Link address. |
linkType | Link type (0 = external, 1 = ManiaLink). |
bool Methods::SetApiVersion | ( | std::string | version | ) |
Sets the API version of the server. Returns whether change was successful.
version | API version. |
bool Methods::SetCallVoteRatio | ( | double | ratio | ) |
Sets the default callvote ratio.
ratio | Default timeout. |
bool Methods::SetCallVoteRatios | ( | std::vector< CallVoteRatio > | ratios | ) |
Sets the callvote ratios.
ratios | List of callvote ratios. |
bool Methods::SetCallVoteRatiosEx | ( | bool | replaceAll, |
std::vector< ExtendedCallVoteRatio > | ratios | ||
) |
Sets the callvote ratios.
replaceAll | Replace all current callvote ratios? |
ratios | List of callvote ratios. |
bool Methods::SetCallVoteTimeOut | ( | int | timeout | ) |
Sets the default callvote timeout.
timeout | Default timeout. |
bool Methods::SetConnectionRates | ( | int | downloadRate, |
int | uploadRate | ||
) |
Sets the server connection rates.
downloadRate | New download rate. |
uploadRate | New upload rate. |
bool Methods::SetGameMode | ( | GameMode | mode | ) |
Sets the game mode (0 = Script, 1 = Rounds, 2 = TimeAttack, 3 = Team, 4 = Laps, 5 = Cup, 6 = Stunts).
mode | New game mode. |
bool Methods::SetHideServer | ( | int | setting | ) |
Sets the hide setting of the server.
setting | New hide setting (0 = visible, 1 = always hidden, 2 = hidden from nations). |
bool Methods::SetMaxPlayers | ( | int | limit | ) |
Sets the playerlimit.
limit | New playerlimit. |
bool Methods::SetMaxSpectators | ( | int | limit | ) |
Sets the spectatorlimit.
limit | New spectatorlimit. |
bool Methods::SetServerComment | ( | std::string | comment | ) |
Sets the server comment.
comment | New server comment. |
bool Methods::SetServerName | ( | std::string | name | ) |
Sets the server name.
name | New server name. |
bool Methods::SetServerPassword | ( | std::string | password | ) |
Sets the server password.
password | New server password. |
bool Methods::SetServerPasswordForSpectator | ( | std::string | password | ) |
Sets the spectator password.
password | New spectator password. |
bool Methods::UnBan | ( | std::string | login | ) |
Unban a player from the server.
login | Player login. |
bool Methods::UnBlackList | ( | std::string | login | ) |
Unblacklist a player from the server.
login | Player login. |
bool Methods::UnIgnore | ( | std::string | login | ) |
Unignore a player on the server.
login | Player login. |