2017-03-22 17:57:21 +01:00
|
|
|
<?php
|
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-04-07 18:30:48 +02:00
|
|
|
use ManiaControl\Callbacks\Callbacks;
|
2017-04-07 23:03:56 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\XmlRpc\DocumentationStructure;
|
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-04-07 17:34:57 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
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 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-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-22 18:21:33 +01:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getCallbacksList() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_CALLBACKSLIST, $responseId);
|
2017-03-22 18:21:33 +01:00
|
|
|
}
|
|
|
|
|
2017-04-07 17:34:57 +02:00
|
|
|
/**
|
|
|
|
* Provide a Array of Callbacks you want to Block
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param array $callbackNames
|
|
|
|
*/
|
|
|
|
public function blockCallbacks($callbackNames) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.BlockCallbacks', $callbackNames);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Block a Single Callback
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param $callbackName
|
|
|
|
*/
|
|
|
|
public function blockCallback($callbackName) {
|
|
|
|
$this->blockCallbacks(array($callbackName));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide a Array of Callbacks you want to Block
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param array $callbackNames
|
|
|
|
*/
|
|
|
|
public function unBlockCallbacks($callbackNames) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.UnblockCallbacks', $callbackNames);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Block a Single Callback
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param $callbackName
|
|
|
|
*/
|
|
|
|
public function unBlockCallback($callbackName) {
|
|
|
|
$this->unBlockCallbacks(array($callbackName));
|
|
|
|
}
|
|
|
|
|
2017-03-27 22:45:40 +02:00
|
|
|
/**
|
|
|
|
* Request a list of all enabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
|
|
|
*
|
2017-04-07 18:37:36 +02:00
|
|
|
* @api
|
2017-04-07 18:30:48 +02:00
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getListOfEnabledCallbacks() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Enabled', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_ENABLEDCALLBACKS, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request a list of all disabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getListOfDisabledCallbacks() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Disabled', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_DISABLEDCALLBACKS, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description: Request help about a callback. This method will trigger the "XmlRpc.CallbackHelp" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-27 22:45:40 +02:00
|
|
|
* @param $callbackName
|
2017-04-07 18:30:48 +02:00
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getCallbackHelp($callbackName) {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbackHelp', array($callbackName, $responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_CALLBACKHELP, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request a list of all available methods. This method will trigger the "XmlRpc.MethodsList" callback.s
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getMethodsList() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodsList', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_METHODSLIST, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getApiVersion() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetApiVersion', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_APIVERSION, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request help about a method. This method will trigger the "XmlRpc.MethodHelp" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @param $methodName
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getMethodHelp($methodName) {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodHelp', array($methodName, $responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_METHODHELP, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current game mode xmlrpc callbacks and methods documentation. This method will trigger the "XmlRpc.Documentation" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getDocumentation() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetDocumentation', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_DOCUMENTATION, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a List of All Api Version
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getAllApiVersions() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_ALLAPIVERSIONS, $responseId);
|
2017-03-22 18:21:33 +01:00
|
|
|
}
|
2017-03-27 22:45:40 +02:00
|
|
|
|
2017-04-07 17:34:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Extend the duration of any ongoing warmup.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param $milisec < the duration of the extension in milliseconds.
|
|
|
|
*/
|
|
|
|
public function extendManiaPlanetWarmup($milisec) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Extend', array($milisec));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop any ongoing warmup.
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
|
|
|
public function stopManiaPlanetWarmup() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Stop');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the status of the warmup.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getWarmupStatus() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-07 17:34:57 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.GetStatus', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_WARMUP_STATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the status of the pause.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getComboPauseStatus() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-07 17:34:57 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.GetPause', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-07 18:30:48 +02:00
|
|
|
* Start a Pause in Combo and triggers a Callback for the Pause Status
|
2017-04-07 17:34:57 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback To get The Pause Status You can directly set a callable on it via setCallable()
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function startComboPause() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-07 17:34:57 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.SetPause', array(true, $responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-07 18:30:48 +02:00
|
|
|
* End a Pause in Combo and triggers a Callback for the Pause Status
|
2017-04-07 17:34:57 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback To get The Pause Status You can directly set a callable on it via setCallable()
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function endComboPause() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-07 17:34:57 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.SetPause', array(false, $responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the spectators' timers UI.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param $x
|
|
|
|
* @param $y
|
|
|
|
* @param $z
|
|
|
|
*/
|
|
|
|
public function comboSetTimerPosition($x, $y, $z) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.SetTimersPosition', array(strval(floatval($x)), strval(floatval($y)), strval(floatval($z))));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the progression UI.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-04-07 17:34:57 +02:00
|
|
|
* @param $x
|
|
|
|
* @param $y
|
|
|
|
* @param $z
|
|
|
|
*/
|
|
|
|
public function suegeSetProgressionUIPosition($x, $y, $z) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Siege.SetProgressionUIPosition', array(strval(floatval($x)), strval(floatval($y)), strval(floatval($z))));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-27 22:45:40 +02:00
|
|
|
/**
|
|
|
|
* Request the current scores. This method will trigger the "Shootmania.Scores" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getShootmaniaScores() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetScores', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_SCORES, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current ui properties. This method will trigger the "Shootmania.UIProperties" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-27 22:45:40 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getShootmaniaUIProperties() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-27 22:45:40 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_UIPROPERTIES, $responseId);
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the ui properties.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-27 22:45:40 +02:00
|
|
|
* @param string Json-Encoded Xml UI Property String
|
|
|
|
*/
|
|
|
|
public function setShootmaniaUIProperties($properties) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($properties));
|
|
|
|
}
|
2017-03-31 22:39:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current scores. This method will trigger the "Trackmania.Scores" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getTrackmaniaScores() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-31 22:39:35 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetScores', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_SCORES, $responseId);
|
2017-03-31 22:39:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current points repartition. This method will trigger the "Trackmania.PointsRepartition" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getTrackmaniaPointsRepartition() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-31 22:39:35 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetPointsRepartition', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_POINTSREPARTITION, $responseId);
|
2017-03-31 22:39:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the points repartition.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-31 22:39:35 +02:00
|
|
|
* @param array String Array of Points
|
|
|
|
*/
|
|
|
|
public function setTrackmaniaPointsRepartition($pointArray) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetPointsRepartition', array($pointArray));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the current ui properties. This method will trigger the "Shootmania.UIProperties" callback.
|
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
2017-04-07 18:30:48 +02:00
|
|
|
public function getTrackmaniaUIProperties() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-03-31 22:39:35 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetUIProperties', array($responseId));
|
2017-04-07 18:30:48 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_SCORES, $responseId);
|
2017-03-31 22:39:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the ui properties.
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-31 22:39:35 +02:00
|
|
|
* @param string Json-Encoded Xml UI Property String
|
|
|
|
*/
|
|
|
|
public function setTrackmaniaUIProperties($properties) {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($properties));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the whole warm up sequence.
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
|
|
|
public function stopTrackmaniaWarmup() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.WarmUp.Stop');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the current warm up round.
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
|
|
|
public function stopTrackmaniaRound() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.WarmUp.StopRound');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop the current round. Only available in Cup, Rounds and Team modes.
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @api
|
2017-03-31 22:39:35 +02:00
|
|
|
*/
|
|
|
|
public function forceTrackmaniaRoundEnd() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.ForceEndRound');
|
|
|
|
}
|
2017-04-07 18:30:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates the needed Unique ResponseId
|
2017-04-07 18:37:36 +02:00
|
|
|
*
|
2017-04-07 18:30:48 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
private function generateResponseId() {
|
|
|
|
return uniqid("ManiaControl.");
|
|
|
|
}
|
2017-03-22 17:57:21 +01:00
|
|
|
}
|