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-16 14:43:13 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\XmlRpc\CallbackListStructure;
|
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-04-16 14:43:13 +02:00
|
|
|
$this->unBlockAllCallbacks();
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-16 14:43:13 +02:00
|
|
|
* UnBlocks All Callbacks
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
|
|
|
public function unBlockAllCallbacks() {
|
|
|
|
$this->getListOfDisabledCallbacks()->setCallable(function (CallbackListStructure $structure) {
|
|
|
|
$this->unBlockCallbacks($structure->getCallbacks());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide a Array of Callbacks you want to UnBlock
|
2017-04-07 17:34:57 +02:00
|
|
|
*
|
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-13 20:46:23 +02:00
|
|
|
* @param $seconds < the duration of the extension in seconds.
|
2017-04-07 17:34:57 +02:00
|
|
|
*/
|
2017-04-13 20:46:23 +02:00
|
|
|
public function extendManiaPlanetWarmup($seconds) {
|
2017-04-13 22:59:41 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Extend', array(strval($seconds * 1000)));
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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');
|
|
|
|
}
|
|
|
|
|
2017-04-13 16:12:10 +02:00
|
|
|
/**
|
|
|
|
* Blocks the End of the Warmup,
|
|
|
|
*
|
|
|
|
* @param int $time Timer before the end of the warmup when all players are ready. Use a negative value to prevent the warmup from ending even if all players are ready.
|
|
|
|
*/
|
|
|
|
public function blockEndWarmUp($time = -1) {
|
2017-04-13 22:59:41 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array("True", strval($time)));
|
2017-04-13 16:12:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Blocks the End of the Warmup,
|
|
|
|
*
|
|
|
|
* @param int $time Timer before the end of the warmup when all players are ready. Use a negative value to prevent the warmup from ending even if all players are ready.
|
|
|
|
*/
|
|
|
|
public function unBlockEndWarmUp($time = -1) {
|
2017-04-13 22:59:41 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array("False", strval($time)));
|
2017-04-13 16:12:10 +02:00
|
|
|
}
|
|
|
|
|
2017-04-07 17:34:57 +02:00
|
|
|
/**
|
|
|
|
* 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-13 16:12:10 +02:00
|
|
|
public function getPauseStatus() {
|
2017-04-07 18:30:48 +02:00
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.GetStatus', array($responseId));
|
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-13 16:12:10 +02:00
|
|
|
* Start a Pause 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-13 16:12:10 +02:00
|
|
|
public function startPause() {
|
2017-04-07 18:30:48 +02:00
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-13 22:59:41 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array("True", $responseId));
|
2017-04-13 16:12:10 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId);
|
2017-04-07 17:34:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-13 16:12:10 +02:00
|
|
|
* End a Pause 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-13 16:12:10 +02:00
|
|
|
public function endPause() {
|
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-13 22:59:41 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array("False", $responseId));
|
2017-04-13 16:12:10 +02:00
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if the GameMode is a TeamMode or not
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return \ManiaControl\Script\InvokeScriptCallback To get The TeamMode Status You can directly set a callable on it via setCallable()
|
|
|
|
*/
|
|
|
|
public function isTeamMode() {
|
2017-04-07 18:30:48 +02:00
|
|
|
$responseId = $this->generateResponseId();
|
2017-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Mode.GetUseTeams', array($responseId));
|
|
|
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_USES_TEAMMODE, $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
|
|
|
|
*/
|
2017-04-16 14:43:13 +02:00
|
|
|
public function siegeSetProgressionUIPosition($x, $y, $z) {
|
2017-04-07 17:34:57 +02:00
|
|
|
$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-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.UI.GetProperties', 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) {
|
2017-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent(' Shootmania.UI.SetProperties', array($properties));
|
2017-03-27 22:45:40 +02:00
|
|
|
}
|
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-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.UI.SetProperties', 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) {
|
2017-04-13 16:12:10 +02:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.UI.GetProperties', array($properties));
|
2017-03-31 22:39:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
}
|