implemented all trackmania callbacks
This commit is contained in:
		| @@ -73,9 +73,8 @@ interface Callbacks { | |||||||
| 	const MP_USES_TEAMMODE = 'Maniaplanet.Mode.UseTeams'; | 	const MP_USES_TEAMMODE = 'Maniaplanet.Mode.UseTeams'; | ||||||
| 	const MP_PAUSE_STATUS  = 'Maniaplanet.Pause.Status'; | 	const MP_PAUSE_STATUS  = 'Maniaplanet.Pause.Status'; | ||||||
|  |  | ||||||
| 	const SM_UIPROPERTIES = 'Shootmania.UI.Properties'; | 	const SM_UIPROPERTIES   = 'Shootmania.UI.Properties'; | ||||||
| 	const SM_SCORES       = "Shootmania.Scores"; | 	const SM_SCORES         = "Shootmania.Scores"; | ||||||
|  |  | ||||||
| 	const SM_ONEVENTDEFAULT = "Shootmania.Event.Default"; | 	const SM_ONEVENTDEFAULT = "Shootmania.Event.Default"; | ||||||
| 	const SM_ONSHOOT        = "Shootmania.Event.OnShoot"; | 	const SM_ONSHOOT        = "Shootmania.Event.OnShoot"; | ||||||
| 	const SM_ONHIT          = "Shootmania.Event.OnHit"; | 	const SM_ONHIT          = "Shootmania.Event.OnHit"; | ||||||
| @@ -135,21 +134,18 @@ interface Callbacks { | |||||||
| 	 * | 	 * | ||||||
| 	 * @see \ManiaControl\Players\PlayerManager::CB_PLAYERDISCONNECT | 	 * @see \ManiaControl\Players\PlayerManager::CB_PLAYERDISCONNECT | ||||||
| 	 */ | 	 */ | ||||||
| 	const TM_ONPLAYERREMOVED = "Trackmania.Event.OnPlayerRemoved"; | 	const TM_ONPLAYERREMOVED   = "Trackmania.Event.OnPlayerRemoved"; | ||||||
|  | 	const TM_ONWAYPOINT        = "Trackmania.Event.WayPoint"; | ||||||
| 	const TM_ONWAYPOINT       = "Trackmania.Event.WayPoint"; | 	const TM_ONGIVEUP          = "Trackmania.Event.GiveUp"; | ||||||
| 	const TM_ONGIVEUP         = "Trackmania.Event.GiveUp"; | 	const TM_ONRESPAWN         = "Trackmania.Event.Respawn"; | ||||||
| 	const TM_ONRESPAWN        = "Trackmania.Event.Respawn"; | 	const TM_ONSTUNT           = "Trackmania.Event.Stunt"; | ||||||
| 	const TM_ONSTUNT          = "Trackmania.Event.Stunt"; | 	const TM_ONSTARTCOUNTDOWN  = "Trackmania.Event.StartCountdown"; | ||||||
| 	const TM_ONSTARTCOUNTDOWN = "Trackmania.Event.StartCountdown"; | 	const TM_SCORES            = "Trackmania.Scores"; | ||||||
| 	const TM_SCORES           = "Trackmania.Scores"; | 	const TM_WARMUPSTART       = "Trackmania.WarmUp.Start"; | ||||||
| 	const TM_WARMUPSTART      = "Trackmania.WarmUp.Start"; | 	const TM_WARMUPSTARTROUND  = "Trackmania.WarmUp.StartRound"; | ||||||
| 	const TM_WARMUPSTARTROUND = "Trackmania.WarmUp.StartRound"; | 	const TM_WARMUPENDROUND    = "Trackmania.WarmUp.EndRound"; | ||||||
| 	const TM_WARMUPENDROUND   = "Trackmania.WarmUp.EndRound"; | 	const TM_WARMUPEND         = "Trackmania.WarmUp.End"; | ||||||
| 	const TM_WARMUPEND        = "Trackmania.WarmUp.End"; | 	const TM_UIPROPERTIES      = 'Trackmania.UI.Properties'; | ||||||
|  |  | ||||||
| 	const TM_UIPROPERTIES = 'Trackmania.UI.Properties'; |  | ||||||
|  |  | ||||||
| 	const TM_POINTSREPARTITION = 'Trackmania.PointsRepartition'; | 	const TM_POINTSREPARTITION = 'Trackmania.PointsRepartition'; | ||||||
|  |  | ||||||
| 	//ManiaControl Callbacks | 	//ManiaControl Callbacks | ||||||
| @@ -301,38 +297,7 @@ interface Callbacks { | |||||||
| 	 * @deprecated | 	 * @deprecated | ||||||
| 	 */ | 	 */ | ||||||
| 	const AFKSTATUS = 'Callbacks.AfkStatus'; | 	const AFKSTATUS = 'Callbacks.AfkStatus'; | ||||||
| 	/** Returns if the GameMode has Warmup activated, returned after  param1 Scores |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const WARMUPSTATUS = 'Callbacks.WarmupStatus'; |  | ||||||
|  |  | ||||||
| 	/** OnShoot Callback: Player, WeaponNumber (see Weapons Structure) |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const ONSHOOT = 'Callbacks.OnShoot'; |  | ||||||
|  |  | ||||||
| 	/** OnHit Callback: PlayerHitStructure |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const ONHIT = 'Callbacks.OnHit'; |  | ||||||
| 	/** OnNearMiss Callback: NearMissStructure |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const ONNEARMISS = 'Callbacks.OnNearMiss'; |  | ||||||
| 	/** OnArmorEmpty Callback: ArmorEmptyStructure |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const ONARMOREMPTY = 'Callbacks.OnArmorEmpty'; |  | ||||||
| 	/** OnCapture Callback: CaptureStructure |  | ||||||
| 	 * |  | ||||||
| 	 * @deprecated |  | ||||||
| 	 */ |  | ||||||
| 	const ONCAPTURE = 'Callbacks.OnCapture'; |  | ||||||
| 	/** OnPlayerRequestRespawn Callback: Player | 	/** OnPlayerRequestRespawn Callback: Player | ||||||
| 	 * | 	 * | ||||||
| 	 * @deprecated | 	 * @deprecated | ||||||
|   | |||||||
| @@ -231,22 +231,6 @@ class LibXmlRpcCallbacks implements CallbackListener { | |||||||
| 			case 'LibXmlRpc_OnStunt': | 			case 'LibXmlRpc_OnStunt': | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTUNT, $data); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTUNT, $data); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnShoot': |  | ||||||
| 				$player = $this->maniaControl->getPlayerManager()->getPlayer($data[0]); |  | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSHOOT, $player, $data[1]); |  | ||||||
| 				break; |  | ||||||
| 			case 'LibXmlRpc_OnHit': |  | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONHIT, new PlayerHitStructure($this->maniaControl, $data)); |  | ||||||
| 				break; |  | ||||||
| 			case 'LibXmlRpc_OnNearMiss': |  | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONNEARMISS, new NearMissStructure($this->maniaControl, $data)); |  | ||||||
| 				break; |  | ||||||
| 			case 'LibXmlRpc_OnArmorEmpty': |  | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONARMOREMPTY, new ArmorEmptyStructure($this->maniaControl, $data)); |  | ||||||
| 				break; |  | ||||||
| 			case 'LibXmlRpc_OnCapture': |  | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONCAPTURE, new CaptureStructure($this->maniaControl, $data)); |  | ||||||
| 				break; |  | ||||||
| 			case 'LibXmlRpc_OnPlayerRequestRespawn': | 			case 'LibXmlRpc_OnPlayerRequestRespawn': | ||||||
| 				$player = $this->maniaControl->getPlayerManager()->getPlayer($data[0]); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($data[0]); | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONPLAYERREQUESTRESPAWN, $player); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONPLAYERREQUESTRESPAWN, $player); | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks; | |||||||
|  |  | ||||||
| use ManiaControl\Callbacks\Models\RecordCallback; | use ManiaControl\Callbacks\Models\RecordCallback; | ||||||
| use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\UIPropertiesBaseStructure; | ||||||
| use ManiaControl\Callbacks\Structures\ShootMania\OnActionCustomEventStructure; | use ManiaControl\Callbacks\Structures\ShootMania\OnActionCustomEventStructure; | ||||||
| use ManiaControl\Callbacks\Structures\ShootMania\OnActionEvent; | use ManiaControl\Callbacks\Structures\ShootMania\OnActionEvent; | ||||||
| use ManiaControl\Callbacks\Structures\ShootMania\OnArmorEmptyStructure; | use ManiaControl\Callbacks\Structures\ShootMania\OnArmorEmptyStructure; | ||||||
| @@ -81,8 +82,7 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::SM_UIPROPERTIES: | 			case Callbacks::SM_UIPROPERTIES: | ||||||
| 				//TODO structure, but wait for further update | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new UIPropertiesBaseStructure($this->maniaControl, $data)); | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, $data); |  | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::SM_ONEVENTDEFAULT: | 			case Callbacks::SM_ONEVENTDEFAULT: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data)); | ||||||
|   | |||||||
| @@ -1,88 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| namespace ManiaControl\Callbacks\Structures; |  | ||||||
|  |  | ||||||
| use ManiaControl\ManiaControl; |  | ||||||
| use ManiaControl\Players\Player; |  | ||||||
| /** |  | ||||||
|  * Structure Class for the ArmorEmpty Callback |  | ||||||
|  * |  | ||||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> |  | ||||||
|  * @copyright 2014-2017 ManiaControl Team |  | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  | ||||||
|  * |  | ||||||
|  * @deprecated see OnArmorEmptyStructure |  | ||||||
|  */ |  | ||||||
| class ArmorEmptyStructure { |  | ||||||
| 	/* |  | ||||||
| 	 * Private properties |  | ||||||
| 	 */ |  | ||||||
| 	private $shooter; |  | ||||||
| 	private $victim; |  | ||||||
| 	private $damage; |  | ||||||
| 	private $shooterPoints; |  | ||||||
| 	private $weapon; |  | ||||||
| 	/** @var ManiaControl $maniaControl */ |  | ||||||
| 	private $maniaControl; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Construct a new Armor Empty Structure |  | ||||||
| 	 * |  | ||||||
| 	 * @param ManiaControl $maniaControl |  | ||||||
| 	 * @param array        $data |  | ||||||
| 	 */ |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, array $data) { |  | ||||||
| 		$this->maniaControl  = $maniaControl; |  | ||||||
| 		$this->shooter       = $data[0]; |  | ||||||
| 		$this->victim        = $data[1]; |  | ||||||
| 		$this->damage        = $data[2]; |  | ||||||
| 		$this->weapon        = $data[3]; |  | ||||||
| 		$this->shooterPoints = $data[4]; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the shooter |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getShooter() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the victim |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getVictim() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->victim); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the damage |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getDamage() { |  | ||||||
| 		return $this->damage; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the shooter points |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getShooterPoints() { |  | ||||||
| 		return $this->shooterPoints; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the weapon |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getWeapon() { |  | ||||||
| 		// TODO: any way of returning type "Weapon?" |  | ||||||
| 		return $this->weapon; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -1,60 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| namespace ManiaControl\Callbacks\Structures; |  | ||||||
|  |  | ||||||
| use ManiaControl\ManiaControl; |  | ||||||
| use ManiaControl\Players\Player; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Structure Class for the Capture Callback |  | ||||||
|  * |  | ||||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> |  | ||||||
|  * @copyright 2014-2017 ManiaControl Team |  | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  | ||||||
|  * |  | ||||||
|  * @deprecated see Capture Structure |  | ||||||
|  */ |  | ||||||
| class CaptureStructure { |  | ||||||
| 	/* |  | ||||||
| 	 * Private properties |  | ||||||
| 	 */ |  | ||||||
| 	private $playerArray; |  | ||||||
| 	/** @var ManiaControl $maniaControl */ |  | ||||||
| 	private $maniaControl; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Construct a new Capture Structure |  | ||||||
| 	 * |  | ||||||
| 	 * @param ManiaControl $maniaControl |  | ||||||
| 	 * @param array        $data |  | ||||||
| 	 */ |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, array $data) { |  | ||||||
| 		$this->maniaControl = $maniaControl; |  | ||||||
| 		$this->playerArray  = $data; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the logins |  | ||||||
| 	 * |  | ||||||
| 	 * @return array |  | ||||||
| 	 */ |  | ||||||
| 	public function getLoginArray() { |  | ||||||
| 		return $this->playerArray; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the players |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player[] |  | ||||||
| 	 */ |  | ||||||
| 	public function getPlayerArray() { |  | ||||||
| 		$playerArray = array(); |  | ||||||
| 		foreach ($this->playerArray as $login) { |  | ||||||
| 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); |  | ||||||
| 			if ($player) { |  | ||||||
| 				$playerArray[$login] = $player; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		return $playerArray; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -0,0 +1,59 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl\Callbacks\Structures\Common; | ||||||
|  |  | ||||||
|  | use ManiaControl\ManiaControl; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Base Structure Class for all Callbacks using a Timestamp | ||||||
|  |  * | ||||||
|  |  * @api | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  |  */ | ||||||
|  | class UIPropertiesBaseStructure extends BaseResponseStructure { | ||||||
|  | 	private $uiPropertiesXML; | ||||||
|  | 	private $uiPropertiesJson; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * BaseResponseStructure constructor. | ||||||
|  | 	 * | ||||||
|  | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
|  | 	 * @param                            $data | ||||||
|  | 	 */ | ||||||
|  | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
|  | 		parent::__construct($maniaControl, $data); | ||||||
|  |  | ||||||
|  | 		$this->time             = $this->getPlainJsonObject()->time; | ||||||
|  | 		$this->uiPropertiesXML  = $data[1]; | ||||||
|  | 		$this->uiPropertiesJson = $data[2]; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Gets the UI Properties as XML | ||||||
|  | 	 * | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getUiPropertiesXML() { | ||||||
|  | 		return $this->uiPropertiesXML; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Gets the UI Properties as Json | ||||||
|  | 	 * | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getUiPropertiesJson() { | ||||||
|  | 		return $this->uiPropertiesJson; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Gets the UI Properties as JSON Decoded Object | ||||||
|  | 	 * | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getUiPropertiesObject() { | ||||||
|  | 		return json_decode($this->uiPropertiesJson); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -1,78 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| namespace ManiaControl\Callbacks\Structures; |  | ||||||
|  |  | ||||||
| use ManiaControl\ManiaControl; |  | ||||||
| use ManiaControl\Players\Player; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Structure Class for the NearMiss Callback |  | ||||||
|  * |  | ||||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> |  | ||||||
|  * @copyright 2014-2017 ManiaControl Team |  | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  | ||||||
|  * |  | ||||||
|  * @deprecated see OnNearMissStructure |  | ||||||
|  */ |  | ||||||
| class NearMissStructure { |  | ||||||
| 	/* |  | ||||||
| 	 * Private properties |  | ||||||
| 	 */ |  | ||||||
| 	private $shooter; |  | ||||||
| 	private $victim; |  | ||||||
| 	private $distance; |  | ||||||
| 	private $weapon; |  | ||||||
| 	/** @var ManiaControl $maniaControl */ |  | ||||||
| 	private $maniaControl; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Construct a new Near Miss Structure |  | ||||||
| 	 * |  | ||||||
| 	 * @param ManiaControl $maniaControl |  | ||||||
| 	 * @param array        $data |  | ||||||
| 	 */ |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, array $data) { |  | ||||||
| 		$this->maniaControl = $maniaControl; |  | ||||||
| 		$this->shooter      = $data[0]; |  | ||||||
| 		$this->victim       = $data[1]; |  | ||||||
| 		$this->weapon       = $data[2]; |  | ||||||
| 		$this->distance     = $data[3]; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the shooter |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getShooter() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the victim |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getVictim() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->victim); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the distance |  | ||||||
| 	 * |  | ||||||
| 	 * @return double |  | ||||||
| 	 */ |  | ||||||
| 	public function getDistance() { |  | ||||||
| 		return doubleval($this->distance); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the weapon |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getWeapon() { |  | ||||||
| 		return $this->weapon; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -1,122 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| namespace ManiaControl\Callbacks\Structures; |  | ||||||
|  |  | ||||||
| use ManiaControl\ManiaControl; |  | ||||||
| use ManiaControl\Players\Player; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Structure Class for the Player Hit Callback |  | ||||||
|  * |  | ||||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> |  | ||||||
|  * @copyright 2014-2017 ManiaControl Team |  | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  | ||||||
|  * |  | ||||||
|  * @deprecated see OnPlayerHitStructure |  | ||||||
|  */ |  | ||||||
| class PlayerHitStructure { |  | ||||||
| 	/* |  | ||||||
| 	 * Private properties |  | ||||||
| 	 */ |  | ||||||
| 	private $shooter; |  | ||||||
| 	private $victim; |  | ||||||
| 	private $damage; |  | ||||||
| 	private $shooterPoints; |  | ||||||
| 	private $weapon; |  | ||||||
| 	private $hitDistance; |  | ||||||
| 	private $shooterPosition     = 0; |  | ||||||
| 	private $victimPosition      = 0; |  | ||||||
| 	private $shooterAimDirection = 0; |  | ||||||
| 	private $victimAimDirection  = 0; |  | ||||||
|  |  | ||||||
| 	/** @var ManiaControl $maniaControl */ |  | ||||||
| 	private $maniaControl; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Construct new Player Hit Structure |  | ||||||
| 	 * |  | ||||||
| 	 * @param ManiaControl $maniaControl |  | ||||||
| 	 * @param array        $data |  | ||||||
| 	 */ |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, array $data) { |  | ||||||
| 		$this->maniaControl  = $maniaControl; |  | ||||||
| 		$this->shooter       = $data[0]; |  | ||||||
| 		$this->victim        = $data[1]; |  | ||||||
| 		$this->damage        = $data[2]; |  | ||||||
| 		$this->weapon        = $data[3]; |  | ||||||
| 		$this->shooterPoints = $data[4]; |  | ||||||
| 		$this->hitDistance   = $data[5]; |  | ||||||
|  |  | ||||||
| 		//TODO remove key check in some months (got implemented 2015-05-03) |  | ||||||
| 		if (array_key_exists(6, $data)) { |  | ||||||
| 			$this->shooterPosition = $data[6]; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if (array_key_exists(7, $data)) { |  | ||||||
| 			$this->victimPosition = $data[7]; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if (array_key_exists(8, $data)) { |  | ||||||
| 			$this->shooterAimDirection = $data[8]; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if (array_key_exists(9, $data)) { |  | ||||||
| 			$this->victimAimDirection = $data[9]; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the shooter |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getShooter() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the victim |  | ||||||
| 	 * |  | ||||||
| 	 * @return Player |  | ||||||
| 	 */ |  | ||||||
| 	public function getVictim() { |  | ||||||
| 		return $this->maniaControl->getPlayerManager()->getPlayer($this->victim); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the damage |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getDamage() { |  | ||||||
| 		return intval($this->damage); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the shooter points |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getShooterPoints() { |  | ||||||
| 		return intval($this->shooterPoints); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get the weapon |  | ||||||
| 	 * |  | ||||||
| 	 * @return int |  | ||||||
| 	 */ |  | ||||||
| 	public function getWeapon() { |  | ||||||
| 		// TODO: any way of returning type "Weapon?" |  | ||||||
| 		return $this->weapon; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Get The Hit Distance |  | ||||||
| 	 * |  | ||||||
| 	 * @return double |  | ||||||
| 	 */ |  | ||||||
| 	public function getHitDistance() { |  | ||||||
| 		return doubleval($this->hitDistance); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -0,0 +1,41 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl\Callbacks\Structures\TrackMania; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure; | ||||||
|  | use ManiaControl\ManiaControl; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Structure Class for the On Points Repartition Structure Callback | ||||||
|  |  * | ||||||
|  |  * @api | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  |  */ | ||||||
|  | class OnPointsRepartitionStructure extends BaseResponseStructure { | ||||||
|  | 	private $pointsRepartition = array(); | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * OnWayPointEventStructure constructor. | ||||||
|  | 	 * | ||||||
|  | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
|  | 	 * @param                            $data | ||||||
|  | 	 */ | ||||||
|  | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
|  | 		parent::__construct($maniaControl, $data); | ||||||
|  |  | ||||||
|  | 		$this->pointsRepartition = $this->getPlainJsonObject()->pointsrepartition; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return array | ||||||
|  | 	 */ | ||||||
|  | 	public function getPointsRepartition() { | ||||||
|  | 		return $this->pointsRepartition; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										114
									
								
								core/Callbacks/Structures/TrackMania/OnRespawnStructure.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								core/Callbacks/Structures/TrackMania/OnRespawnStructure.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl\Callbacks\Structures\TrackMania; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | use ManiaControl\Callbacks\Models\RecordCallback; | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | ||||||
|  | use ManiaControl\ManiaControl; | ||||||
|  | use ManiaControl\Utils\Formatter; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Structure Class for the On Respawn Structure Callback | ||||||
|  |  * | ||||||
|  |  * @api | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  |  */ | ||||||
|  | class OnRespawnStructure extends BasePlayerTimeStructure { | ||||||
|  | 	private $numberOfRespawns; | ||||||
|  | 	private $raceTime; | ||||||
|  | 	private $lapTime; | ||||||
|  | 	private $stuntsScore; | ||||||
|  | 	private $checkPointInRace; | ||||||
|  | 	private $checkPointInLap; | ||||||
|  | 	private $speed; | ||||||
|  | 	private $distance; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * OnWayPointEventStructure constructor. | ||||||
|  | 	 * | ||||||
|  | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
|  | 	 * @param                            $data | ||||||
|  | 	 */ | ||||||
|  | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
|  | 		parent::__construct($maniaControl, $data); | ||||||
|  |  | ||||||
|  | 		$jsonObj = $this->getPlainJsonObject(); | ||||||
|  |  | ||||||
|  | 		$this->numberOfRespawns = (int) $jsonObj->numberOfRespawns; | ||||||
|  | 		$this->raceTime         = (int) $jsonObj->racetime; | ||||||
|  | 		$this->lapTime          = (int) $jsonObj->laptime; | ||||||
|  | 		$this->stuntsScore      = $jsonObj->stuntsscore; | ||||||
|  | 		$this->checkPointInRace = (int) $jsonObj->checkpointinrace; | ||||||
|  | 		$this->checkPointInLap  = (int) $jsonObj->checkpointinlap; | ||||||
|  | 		$this->speed            = $jsonObj->speed; | ||||||
|  | 		$this->distance         = $jsonObj->distance; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getRaceTime() { | ||||||
|  | 		return $this->raceTime; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getLapTime() { | ||||||
|  | 		return $this->lapTime; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getStuntsScore() { | ||||||
|  | 		return $this->stuntsScore; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getCheckPointInRace() { | ||||||
|  | 		return $this->checkPointInRace; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getCheckPointInLap() { | ||||||
|  | 		return $this->checkPointInLap; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getSpeed() { | ||||||
|  | 		return $this->speed; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getDistance() { | ||||||
|  | 		return $this->distance; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getNumberOfRespawns() { | ||||||
|  | 		return $this->numberOfRespawns; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -13,5 +13,5 @@ use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | |||||||
|  * @copyright 2014-2017 ManiaControl Team |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnEventStartLineStructure extends BasePlayerTimeStructure { | class OnStartLineEventStructure extends BasePlayerTimeStructure { | ||||||
| } | } | ||||||
							
								
								
									
										152
									
								
								core/Callbacks/Structures/TrackMania/OnStuntEventStructure.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								core/Callbacks/Structures/TrackMania/OnStuntEventStructure.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,152 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl\Callbacks\Structures\TrackMania; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | ||||||
|  | use ManiaControl\ManiaControl; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Structure Class for the Stunt Event Structure Callback | ||||||
|  |  * | ||||||
|  |  * @api | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  |  */ | ||||||
|  | class OnStuntEventStructure extends BasePlayerTimeStructure { | ||||||
|  | 	private $numberOfRespawns; | ||||||
|  | 	private $raceTime; | ||||||
|  | 	private $lapTime; | ||||||
|  | 	private $stuntsScore; | ||||||
|  | 	private $figureName; | ||||||
|  | 	private $angle; | ||||||
|  | 	private $points; | ||||||
|  | 	private $combo; | ||||||
|  | 	private $isStraight; | ||||||
|  | 	private $isReverse; | ||||||
|  | 	private $isMasterJump; | ||||||
|  | 	private $factor; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * OnWayPointEventStructure constructor. | ||||||
|  | 	 * | ||||||
|  | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
|  | 	 * @param                            $data | ||||||
|  | 	 */ | ||||||
|  | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
|  | 		parent::__construct($maniaControl, $data); | ||||||
|  |  | ||||||
|  | 		$jsonObj = $this->getPlainJsonObject(); | ||||||
|  |  | ||||||
|  | 		$this->numberOfRespawns = (int) $jsonObj->numberOfRespawns; | ||||||
|  | 		$this->raceTime         = (int) $jsonObj->racetime; | ||||||
|  | 		$this->lapTime          = (int) $jsonObj->laptime; | ||||||
|  | 		$this->stuntsScore      = $jsonObj->stuntsscore; | ||||||
|  | 		$this->figureName       = $jsonObj->figure; | ||||||
|  | 		$this->angle            = $jsonObj->angle; | ||||||
|  | 		$this->points           = $jsonObj->points; | ||||||
|  | 		$this->combo            = $jsonObj->combo; | ||||||
|  | 		$this->isStraight       = $jsonObj->isstraight; | ||||||
|  | 		$this->isReverse        = $jsonObj->isreverse; | ||||||
|  | 		$this->isMasterJump     = $jsonObj->ismasterjump; | ||||||
|  | 		$this->factor           = $jsonObj->factor; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getRaceTime() { | ||||||
|  | 		return $this->raceTime; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getLapTime() { | ||||||
|  | 		return $this->lapTime; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getStuntsScore() { | ||||||
|  | 		return $this->stuntsScore; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getNumberOfRespawns() { | ||||||
|  | 		return $this->numberOfRespawns; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getFigureName() { | ||||||
|  | 		return $this->figureName; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getAngle() { | ||||||
|  | 		return $this->angle; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getPoints() { | ||||||
|  | 		return $this->points; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getCombo() { | ||||||
|  | 		return $this->combo; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getIsStraight() { | ||||||
|  | 		return $this->isStraight; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getIsReverse() { | ||||||
|  | 		return $this->isReverse; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed | ||||||
|  | 	 */ | ||||||
|  | 	public function getIsMasterJump() { | ||||||
|  | 		return $this->isMasterJump; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return mixed Points multiplier | ||||||
|  | 	 */ | ||||||
|  | 	public function getFactor() { | ||||||
|  | 		return $this->factor; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -0,0 +1,53 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl\Callbacks\Structures\TrackMania; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\BaseStructure; | ||||||
|  | use ManiaControl\ManiaControl; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Structure Class for the On Warmup Start and End Round Callback Structure | ||||||
|  |  * | ||||||
|  |  * @api | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  |  */ | ||||||
|  | class OnWarmupStartEndRoundStructure extends BaseStructure { | ||||||
|  | 	private $current; | ||||||
|  | 	private $total; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * OnWayPointEventStructure constructor. | ||||||
|  | 	 * | ||||||
|  | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
|  | 	 * @param                            $data | ||||||
|  | 	 */ | ||||||
|  | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
|  | 		parent::__construct($maniaControl, $data); | ||||||
|  |  | ||||||
|  | 		$this->current = (int) $this->getPlainJsonObject()->current; | ||||||
|  | 		$this->total   = (int) $this->getPlainJsonObject()->total; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Gets the number of the current round | ||||||
|  | 	 * | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getCurrent() { | ||||||
|  | 		return $this->current; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Gets the number of the warmup rounds | ||||||
|  | 	 * | ||||||
|  | 	 * @api | ||||||
|  | 	 * @return int | ||||||
|  | 	 */ | ||||||
|  | 	public function getTotal() { | ||||||
|  | 		return $this->total; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -16,7 +16,7 @@ use ManiaControl\Utils\Formatter; | |||||||
|  * @copyright 2014-2017 ManiaControl Team |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnEventWayPointStructure extends BasePlayerTimeStructure { | class OnWayPointEventStructure extends BasePlayerTimeStructure { | ||||||
| 	private $raceTime; | 	private $raceTime; | ||||||
| 	private $lapTime; | 	private $lapTime; | ||||||
| 	private $stuntsScore; | 	private $stuntsScore; | ||||||
| @@ -29,7 +29,7 @@ class OnEventWayPointStructure extends BasePlayerTimeStructure { | |||||||
| 	private $distance; | 	private $distance; | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * OnEventWayPointStructure constructor. | 	 * OnWayPointEventStructure constructor. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param \ManiaControl\ManiaControl $maniaControl | 	 * @param \ManiaControl\ManiaControl $maniaControl | ||||||
| 	 * @param                            $data | 	 * @param                            $data | ||||||
| @@ -4,11 +4,16 @@ namespace ManiaControl\Callbacks; | |||||||
|  |  | ||||||
| use ManiaControl\Callbacks\Models\RecordCallback; | use ManiaControl\Callbacks\Models\RecordCallback; | ||||||
| use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\Common\UIPropertiesBaseStructure; | ||||||
| use ManiaControl\Callbacks\Structures\TrackMania\OnCommandStructure; | use ManiaControl\Callbacks\Structures\TrackMania\OnCommandStructure; | ||||||
| use ManiaControl\Callbacks\Structures\TrackMania\OnDefaultEventStructure; | use ManiaControl\Callbacks\Structures\TrackMania\OnDefaultEventStructure; | ||||||
| use ManiaControl\Callbacks\Structures\TrackMania\OnEventStartLineStructure; | use ManiaControl\Callbacks\Structures\TrackMania\OnPointsRepartitionStructure; | ||||||
| use ManiaControl\Callbacks\Structures\TrackMania\OnEventWayPointStructure; | use ManiaControl\Callbacks\Structures\TrackMania\OnRespawnStructure; | ||||||
| use ManiaControl\Callbacks\Structures\TrackMania\OnScoresStructure; | use ManiaControl\Callbacks\Structures\TrackMania\OnScoresStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\TrackMania\OnStartLineEventStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\TrackMania\OnStuntEventStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\TrackMania\OnWarmupStartEndRoundStructure; | ||||||
|  | use ManiaControl\Callbacks\Structures\TrackMania\OnWayPointEventStructure; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Utils\Formatter; | use ManiaControl\Utils\Formatter; | ||||||
|  |  | ||||||
| @@ -51,7 +56,6 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 			//return; //Leave that disabled while testing/implementing Callbacks | 			//return; //Leave that disabled while testing/implementing Callbacks | ||||||
| 		} | 		} | ||||||
| 		switch ($name) { | 		switch ($name) { | ||||||
| 			//MP4 New Callbacks |  | ||||||
| 			case Callbacks::TM_SCORES: | 			case Callbacks::TM_SCORES: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| @@ -59,37 +63,39 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONEVENTSTARTLINE: | 			case Callbacks::TM_ONEVENTSTARTLINE: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEventStartLineStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnStartLineEventStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONCOMMAND: | 			case Callbacks::TM_ONCOMMAND: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCommandStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCommandStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONPLAYERADDED: | 			case Callbacks::TM_ONPLAYERADDED: | ||||||
| 			case Callbacks::TM_ONPLAYERREMOVED: | 			case Callbacks::TM_ONPLAYERREMOVED: | ||||||
|  | 			case Callbacks::TM_ONGIVEUP: | ||||||
|  | 			case Callbacks::TM_ONSTARTCOUNTDOWN: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new BasePlayerTimeStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new BasePlayerTimeStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONWAYPOINT: | 			case Callbacks::TM_ONWAYPOINT: | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEventWayPointStructure($this->maniaControl, $data)); | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnWayPointEventStructure($this->maniaControl, $data)); | ||||||
| 				break; |  | ||||||
| 			case Callbacks:: TM_ONGIVEUP: |  | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONRESPAWN: | 			case Callbacks::TM_ONRESPAWN: | ||||||
|  | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRespawnStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_ONSTUNT: | 			case Callbacks::TM_ONSTUNT: | ||||||
| 				break; | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnStuntEventStructure($this->maniaControl, $data)); | ||||||
| 			case Callbacks::TM_ONSTARTCOUNTDOWN: |  | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_WARMUPSTART: | 			case Callbacks::TM_WARMUPSTART: | ||||||
|  | 			case Callbacks::TM_WARMUPEND: | ||||||
|  | 				$this->maniaControl->getCallbackManager()->triggerCallback($name); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_WARMUPSTARTROUND: | 			case Callbacks::TM_WARMUPSTARTROUND: | ||||||
| 				break; |  | ||||||
| 			case Callbacks::TM_WARMUPENDROUND: | 			case Callbacks::TM_WARMUPENDROUND: | ||||||
|  | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnWarmupStartEndRoundStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_WARMUPEND: | 			case Callbacks::TM_POINTSREPARTITION: | ||||||
|  | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPointsRepartitionStructure($this->maniaControl, $data)); | ||||||
| 				break; | 				break; | ||||||
| 			case Callbacks::TM_UIPROPERTIES: | 			case Callbacks::TM_UIPROPERTIES: | ||||||
| 				//TODO structure, but wait for further update | 				$this->maniaControl->getCallbackManager()->triggerCallback($name, new UIPropertiesBaseStructure($this->maniaControl, $data)); | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback($name, $data); |  | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | |||||||
| /** | /** | ||||||
|  * Class managing Rankings |  * Class managing Rankings | ||||||
|  * |  * | ||||||
|  |  * @deprecated | ||||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  * @copyright 2014-2017 ManiaControl Team |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user