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) | |
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. | |
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... | |
Private Attributes | |
GbxRemote * | server |
Pointer to GbxRemote. | |
std::map< std::string, Player > * | playerList |
Pointer to the playerlist. | |
Contains all server methods and returns usable data types.
Constructor with link to server connection.
serverPtr | Pointer to server connection. |
playerListPtr | Pointer to the playerlist. |
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::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). |
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.
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.
ServerVersion Methods::GetVersion | ( | ) |
Returns server version information.
Returns empty struct if no information could be retrieved.
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. |
std::vector< std::string > Methods::ListMethods | ( | ) |
Returns list of available server methods.
Returns empty vector if no methods could be retrieved.
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::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. |