2014-03-19 21:58:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Callbacks;
|
|
|
|
|
2017-04-13 19:14:23 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure;
|
2017-04-14 17:02:00 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\Common\UIPropertiesBaseStructure;
|
2017-03-27 22:21:59 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnActionCustomEventStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnActionEvent;
|
2017-06-21 19:25:58 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnAFKProperties;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnAFKPropertiesStructure;
|
2017-03-30 19:02:18 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnArmorEmptyStructure;
|
2017-06-21 19:25:58 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnBasePlayerObjectTimeStructure;
|
2017-03-25 11:53:55 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnCaptureStructure;
|
2017-03-25 20:19:45 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnCommandStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnDefaultEventStructure;
|
2017-04-07 22:30:55 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnEliteEndTurnStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnEliteStartTurnStructure;
|
2017-03-30 19:02:18 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnHitStructure;
|
2017-04-07 22:30:55 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustReloadStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustRoundResultsStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustSelectedPlayersStructure;
|
2017-03-30 19:02:18 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnNearMissStructure;
|
2017-03-27 22:21:59 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerRequestActionChange;
|
2017-03-25 20:19:45 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerRequestRespawnStructure;
|
2017-06-21 19:25:58 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnPlayersAFKStructure;
|
2017-03-27 22:21:59 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnPlayerTriggersSectorStructure;
|
2017-04-07 22:30:55 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnRoyalPlayerSpawnStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnRoyalPointsStructure;
|
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnRoyalRoundWinnerStructure;
|
2017-03-27 22:45:40 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnScoresStructure;
|
2017-03-24 22:49:43 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnShootStructure;
|
2017-03-25 20:19:45 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\OnShotDenyStructure;
|
2014-03-19 21:58:11 +01:00
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class handling and parsing ShootMania Callbacks
|
|
|
|
*
|
2014-05-02 17:50:30 +02:00
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2019-01-05 21:02:24 +01:00
|
|
|
* @copyright 2014-2019 ManiaControl Team
|
2014-04-24 21:55:47 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-03-19 21:58:11 +01:00
|
|
|
*/
|
|
|
|
class ShootManiaCallbacks implements CallbackListener {
|
|
|
|
/*
|
|
|
|
* Constants
|
|
|
|
*/
|
2014-05-24 17:22:48 +02:00
|
|
|
const CB_TIMEATTACK_ONSTART = 'TimeAttack_OnStart';
|
|
|
|
const CB_TIMEATTACK_ONRESTART = 'TimeAttack_OnRestart';
|
|
|
|
const CB_TIMEATTACK_ONCHECKPOINT = 'TimeAttack_OnCheckpoint';
|
|
|
|
const CB_TIMEATTACK_ONFINISH = 'TimeAttack_OnFinish';
|
2014-04-24 21:55:47 +02:00
|
|
|
|
2014-03-19 21:58:11 +01:00
|
|
|
/*
|
2014-08-02 22:31:46 +02:00
|
|
|
* Private properties
|
2014-03-19 21:58:11 +01:00
|
|
|
*/
|
2014-08-02 22:31:46 +02:00
|
|
|
/** @var ManiaControl $maniaControl */
|
2014-03-19 21:58:11 +01:00
|
|
|
private $maniaControl = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new ShootMania Callbacks Instance
|
|
|
|
*
|
2014-05-02 17:50:30 +02:00
|
|
|
* @param ManiaControl $maniaControl
|
2014-05-02 16:13:45 +02:00
|
|
|
* @param CallbackManager $callbackManager
|
2014-03-19 21:58:11 +01:00
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
2014-04-24 21:55:47 +02:00
|
|
|
|
2014-03-19 21:58:11 +01:00
|
|
|
// Register for script callbacks
|
2014-04-24 23:11:09 +02:00
|
|
|
$callbackManager->registerCallbackListener(Callbacks::SCRIPTCALLBACK, $this, 'handleScriptCallbacks');
|
2014-03-19 21:58:11 +01:00
|
|
|
}
|
|
|
|
|
2014-04-24 23:11:09 +02:00
|
|
|
/**
|
|
|
|
* Handle Script Callbacks
|
|
|
|
*
|
2017-04-07 23:26:35 +02:00
|
|
|
* @internal
|
2014-05-02 17:50:30 +02:00
|
|
|
* @param string $name
|
2014-05-13 01:18:47 +02:00
|
|
|
* @param mixed $data
|
2014-04-24 23:11:09 +02:00
|
|
|
*/
|
|
|
|
public function handleScriptCallbacks($name, $data) {
|
2017-03-25 13:40:37 +01:00
|
|
|
if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
|
2017-05-10 11:07:45 +02:00
|
|
|
return; //Leave that disabled while testing/implementing Callbacks
|
2017-03-25 13:40:37 +01:00
|
|
|
}
|
2014-05-02 17:50:30 +02:00
|
|
|
switch ($name) {
|
2017-03-24 22:49:43 +01:00
|
|
|
//MP4 New Callbacks
|
2017-03-27 22:45:40 +02:00
|
|
|
case Callbacks::SM_SCORES:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data));
|
2017-03-27 22:45:40 +02:00
|
|
|
break;
|
2017-04-07 18:30:48 +02:00
|
|
|
case Callbacks::SM_UIPROPERTIES:
|
2017-04-14 17:02:00 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new UIPropertiesBaseStructure($this->maniaControl, $data));
|
2017-04-07 18:30:48 +02:00
|
|
|
break;
|
2017-03-25 20:19:45 +01:00
|
|
|
case Callbacks::SM_ONEVENTDEFAULT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data));
|
2017-03-24 22:49:43 +01:00
|
|
|
break;
|
2017-04-13 19:14:23 +02:00
|
|
|
case Callbacks::SM_ONPLAYERADDED:
|
|
|
|
case Callbacks::SM_ONPLAYERREMOVED:
|
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new BasePlayerTimeStructure($this->maniaControl, $data));
|
|
|
|
break;
|
2017-03-24 22:49:43 +01:00
|
|
|
case Callbacks::SM_ONSHOOT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnShootStructure($this->maniaControl, $data));
|
2017-03-24 22:49:43 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONHIT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnHitStructure($this->maniaControl, $data));
|
2017-03-25 11:53:55 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONNEARMISS:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnNearMissStructure($this->maniaControl, $data));
|
2017-03-25 11:53:55 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONARMOREMPTY:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnArmorEmptyStructure($this->maniaControl, $data));
|
2017-03-25 11:53:55 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONCAPTURE:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCaptureStructure($this->maniaControl, $data));
|
2017-03-25 11:53:55 +01:00
|
|
|
break;
|
2017-03-25 20:19:45 +01:00
|
|
|
case Callbacks::SM_ONSHOTDENY:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnShotDenyStructure($this->maniaControl, $data));
|
2017-03-25 20:19:45 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONCOMMAND:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCommandStructure($this->maniaControl, $data));
|
2017-03-25 20:19:45 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONPLAYERREQUESTRESPAWN:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerRequestRespawnStructure($this->maniaControl, $data));
|
2017-03-25 20:19:45 +01:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONACTIONCUSTOMEVENT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnActionCustomEventStructure($this->maniaControl, $data));
|
2017-03-27 22:21:59 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONACTIONEVENT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnActionEvent($this->maniaControl, $data));
|
2017-03-27 22:21:59 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONPLAYERTOUCHESOBJECT:
|
2017-04-13 19:14:23 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnBasePlayerObjectTimeStructure($this->maniaControl, $data));
|
2017-03-27 22:21:59 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONPLAYERTRIGGERSSECTOR:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerTriggersSectorStructure($this->maniaControl, $data));
|
2017-03-27 22:21:59 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONPLAYERTHROWSOBJECT:
|
2017-04-13 19:14:23 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnBasePlayerObjectTimeStructure($this->maniaControl, $data));
|
2017-03-27 22:21:59 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerRequestActionChange($this->maniaControl, $data));
|
2017-03-25 20:19:45 +01:00
|
|
|
break;
|
2017-04-07 17:28:04 +02:00
|
|
|
case Callbacks::SM_ELITE_STARTTURN:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEliteStartTurnStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ELITE_ENDTURN:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEliteEndTurnStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_JOUST_ONRELOAD:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustReloadStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_JOUST_SELECTEDPLAYERS:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustSelectedPlayersStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_JOUST_ROUNDRESULT:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustRoundResultsStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ROYAL_POINTS:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalPointsStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ROYAL_PLAYERSPAWN:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalPlayerSpawnStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
|
|
|
case Callbacks::SM_ROYAL_ROUNDWINNER:
|
2017-04-07 23:03:56 +02:00
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalRoundWinnerStructure($this->maniaControl, $data));
|
2017-04-07 17:28:04 +02:00
|
|
|
break;
|
2017-06-21 19:25:58 +02:00
|
|
|
case Callbacks::SM_AFKPROPERTIES:
|
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnAFKPropertiesStructure($this->maniaControl, $data));
|
|
|
|
break;
|
|
|
|
case Callbacks::SM_PLAYERSAFK:
|
|
|
|
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayersAFKStructure($this->maniaControl, $data));
|
|
|
|
break;
|
2014-04-24 23:11:09 +02:00
|
|
|
}
|
|
|
|
}
|
2014-03-19 21:58:11 +01:00
|
|
|
}
|