2017-03-22 17:57:21 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Manager for Mode Script Events
|
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
|
|
|
* @copyright 2014-2017 ManiaControl Team
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
|
2017-03-24 22:08:51 +01:00
|
|
|
namespace ManiaControl\Script;
|
2017-03-22 17:57:21 +01:00
|
|
|
|
2017-03-26 19:44:55 +02:00
|
|
|
use ManiaControl\General\UsageInformationAble;
|
|
|
|
use ManiaControl\General\UsageInformationTrait;
|
2017-03-22 17:57:21 +01:00
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
2017-03-26 19:44:55 +02:00
|
|
|
class ModeScriptEventManager implements UsageInformationAble {
|
|
|
|
use UsageInformationTrait;
|
|
|
|
|
2017-03-23 20:39:32 +01:00
|
|
|
const API_VERSION = "2.0.0";
|
|
|
|
|
2017-03-22 17:57:21 +01:00
|
|
|
/** @var ManiaControl $maniaControl */
|
|
|
|
private $maniaControl;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new ranking manager instance
|
|
|
|
*
|
|
|
|
* @param ManiaControl $maniaControl
|
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables XmlRpc Callbacks
|
|
|
|
*/
|
|
|
|
public function enableCallbacks() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true'));
|
2017-03-22 18:21:33 +01:00
|
|
|
|
2017-03-23 20:39:32 +01:00
|
|
|
$this->setApiVersion(self::API_VERSION);
|
2017-03-22 18:21:33 +01:00
|
|
|
|
|
|
|
$this->getAllApiVersions();
|
|
|
|
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->getCallbacksList();
|
2017-03-22 17:57:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disables XmlRpc Callbacks
|
|
|
|
*/
|
|
|
|
public function disableCallbacks() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('false'));
|
|
|
|
}
|
2017-03-22 18:21:33 +01:00
|
|
|
|
|
|
|
/**
|
2017-03-27 22:45:40 +02:00
|
|
|
* Request a list of all available callbacks. This method will trigger the "XmlRpc.CallbacksList" callback.
|
|
|
|
*
|
2017-03-22 18:21:33 +01:00
|
|
|
* @param string $responseId
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
public function getCallbacksList($responseId = "DefaultResponseId") {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId));
|
|
|
|
}
|
|
|
|
|
2017-03-27 22:45:40 +02:00
|
|
|
/**
|
|
|
|
* Request a list of all enabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getListOfEnabledCallbacks($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Enabled', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request a list of all disabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getListOfDisabledCallbacks($responseId) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Disabled', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description: Request help about a callback. This method will trigger the "XmlRpc.CallbackHelp" callback.
|
|
|
|
*
|
|
|
|
* @param $callbackName
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getCallbackHelp($callbackName, $responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbackHelp', array($callbackName, $responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request a list of all available methods. This method will trigger the "XmlRpc.MethodsList" callback.s
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getMethodsList($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodsList', array($responseId));
|
|
|
|
}
|
|
|
|
|
2017-03-22 18:21:33 +01:00
|
|
|
/**
|
|
|
|
* Sets the Api Version
|
2017-03-26 19:44:55 +02:00
|
|
|
*
|
2017-03-22 18:21:33 +01:00
|
|
|
* @param string $version
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
public function setApiVersion($version = self::API_VERSION) {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version));
|
|
|
|
}
|
|
|
|
|
2017-03-27 22:45:40 +02:00
|
|
|
/**
|
|
|
|
* Gets the Api Version
|
|
|
|
*
|
|
|
|
* @param string $version
|
|
|
|
*/
|
|
|
|
public function getApiVersion($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetApiVersion', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request help about a method. This method will trigger the "XmlRpc.MethodHelp" callback.
|
|
|
|
*
|
|
|
|
* @param $callbackName
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getMethodHelp($methodName, $responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodHelp', array($methodName, $responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current game mode xmlrpc callbacks and methods documentation. This method will trigger the "XmlRpc.Documentation" callback.
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getDocumentation($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetDocumentation', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a List of All Api Version
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
public function getAllApiVersions($responseId = "DefaultResponseId") {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId));
|
|
|
|
}
|
2017-03-27 22:45:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current scores. This method will trigger the "Shootmania.Scores" callback.
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getShootmaniaScores($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetScores', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current ui properties. This method will trigger the "Shootmania.UIProperties" callback.
|
|
|
|
*
|
|
|
|
* @param string $responseId
|
|
|
|
*/
|
|
|
|
public function getShootmaniaUIProperties($responseId = "DefaultResponseId") {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the ui properties.
|
|
|
|
*
|
|
|
|
* @param string Json-Encoded Xml UI Property String
|
|
|
|
*/
|
|
|
|
public function setShootmaniaUIProperties($properties) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($properties));
|
|
|
|
}
|
2017-03-22 17:57:21 +01:00
|
|
|
}
|