From a90b307bac71aa8e5eee40c37efe354f59990725 Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 27 Mar 2017 22:45:40 +0200 Subject: [PATCH] implements all shootmania and common methods --- core/Callbacks/ShootManiaCallbacks.php | 5 ++ core/Script/ModeScriptEventManager.php | 103 ++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/core/Callbacks/ShootManiaCallbacks.php b/core/Callbacks/ShootManiaCallbacks.php index 3062f4db..73db33ed 100644 --- a/core/Callbacks/ShootManiaCallbacks.php +++ b/core/Callbacks/ShootManiaCallbacks.php @@ -14,6 +14,7 @@ use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerObjectStructure; use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerRequestActionChange; use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerRequestRespawnStructure; use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerTriggersSectorStructure; +use ManiaControl\Callbacks\Structures\ShootMania\OnScoresStructure; use ManiaControl\Callbacks\Structures\ShootMania\OnShootStructure; use ManiaControl\Callbacks\Structures\ShootMania\OnShotDenyStructure; use ManiaControl\ManiaControl; @@ -65,6 +66,10 @@ class ShootManiaCallbacks implements CallbackListener { } switch ($name) { //MP4 New Callbacks + case Callbacks::SM_SCORES: + $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_SCORES, new OnScoresStructure($this->maniaControl, $data)); + break; + //TODO UI Properties Later case Callbacks::SM_ONEVENTDEFAULT: $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONEVENTDEFAULT, new OnDefaultEventStructure($this->maniaControl, $data)); break; diff --git a/core/Script/ModeScriptEventManager.php b/core/Script/ModeScriptEventManager.php index 898d541f..3b6d60fa 100644 --- a/core/Script/ModeScriptEventManager.php +++ b/core/Script/ModeScriptEventManager.php @@ -40,7 +40,7 @@ class ModeScriptEventManager implements UsageInformationAble { $this->getAllApiVersions(); - $this->getCallbacksList(); //TODO verify why this does not work + $this->getCallbacksList(); } /** @@ -51,13 +51,52 @@ class ModeScriptEventManager implements UsageInformationAble { } /** + * Request a list of all available callbacks. This method will trigger the "XmlRpc.CallbacksList" callback. + * * @param string $responseId - * Triggers a Callback List Callback */ public function getCallbacksList($responseId = "DefaultResponseId") { $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId)); } + /** + * 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)); + } + /** * Sets the Api Version * @@ -67,7 +106,67 @@ class ModeScriptEventManager implements UsageInformationAble { $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version)); } + /** + * 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 + */ public function getAllApiVersions($responseId = "DefaultResponseId") { $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId)); } + + /** + * 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)); + } } \ No newline at end of file