implemented all new shootmania callbacks + some refactors
This commit is contained in:
parent
287e6316d6
commit
31054d7502
@ -8,7 +8,8 @@ use ManiaControl\Callbacks\Structures\ManiaPlanet\StartEndStructure;
|
||||
use ManiaControl\Callbacks\Structures\ManiaPlanet\StartServerStructure;
|
||||
use ManiaControl\Callbacks\Structures\NearMissStructure;
|
||||
use ManiaControl\Callbacks\Structures\PlayerHitStructure;
|
||||
use ManiaControl\Callbacks\Structures\XmlRpc\CallbacksListStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\StatusCallbackStructure;
|
||||
use ManiaControl\Callbacks\Structures\XmlRpc\ListStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -50,13 +51,13 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
switch ($name) {
|
||||
//New callbacks
|
||||
case Callbacks::XMLRPC_CALLBACKSLIST:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new CallbacksListStructure($this->maniaControl, $data));
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new ListStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::XMLRPC_ENABLEDCALLBACKS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_ENABLEDCALLBACKS, new ListStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::XMLRPC_DISABLEDCALLBACKS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_DISABLEDCALLBACKS, new ListStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::XMLRPC_APIVERSION:
|
||||
//TODO
|
||||
@ -68,7 +69,7 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_METHODSLIST:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_METHODSLIST, new ListStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::XMLRPC_METHODHELP:
|
||||
//TODO
|
||||
@ -170,7 +171,7 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_WARMUP_END);
|
||||
break;
|
||||
case Callbacks::MP_WARMUP_STATUS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_WARMUP_STATUS, new StatusCallbackStructure($this->maniaControl, $data));
|
||||
break;
|
||||
|
||||
//OLD Callbacks
|
||||
|
@ -10,15 +10,24 @@ use ManiaControl\Callbacks\Structures\ShootMania\OnArmorEmptyStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnCaptureStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnCommandStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnDefaultEventStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnEliteEndTurnStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnEliteStartTurnStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnHitStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustReloadStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustRoundResultsStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnJoustSelectedPlayersStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnNearMissStructure;
|
||||
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\OnRoyalPlayerSpawnStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnRoyalPointsStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnRoyalRoundWinnerStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnScoresStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnShootStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\OnShotDenyStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\StatusCallbackStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -120,31 +129,31 @@ class ShootManiaCallbacks implements CallbackListener {
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE, new OnPlayerRequestActionChange($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_COMBO_PAUSESTATUS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_COMBO_PAUSESTATUS, new StatusCallbackStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_ELITE_STARTTURN:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ELITE_STARTTURN, new OnEliteStartTurnStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_ELITE_ENDTURN:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ELITE_ENDTURN, new OnEliteEndTurnStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_JOUST_ONRELOAD:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_ONRELOAD, new OnJoustReloadStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_JOUST_SELECTEDPLAYERS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_SELECTEDPLAYERS, new OnJoustSelectedPlayersStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_JOUST_ROUNDRESULT:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_ROUNDRESULT, new OnJoustRoundResultsStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_ROYAL_POINTS:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_POINTS, new OnRoyalPointsStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_ROYAL_PLAYERSPAWN:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_PLAYERSPAWN, new OnRoyalPlayerSpawnStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_ROYAL_ROUNDWINNER:
|
||||
//TODO
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_ROUNDWINNER, new OnRoyalRoundWinnerStructure($this->maniaControl, $data));
|
||||
break;
|
||||
|
||||
//Old Callbacks
|
||||
|
@ -25,5 +25,7 @@ class BaseResponseStructure extends BaseStructure {
|
||||
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->responseId = $this->getPlainJsonObject()->responseid;
|
||||
}
|
||||
}
|
@ -30,7 +30,6 @@ class CommonScoresStructure extends BaseResponseStructure {
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
$this->responseId = $jsonObj->responseid;
|
||||
$this->section = $jsonObj->section;
|
||||
$this->useTeams = $jsonObj->useteams;
|
||||
$this->winnerTeam = $jsonObj->winnerteam;
|
||||
|
40
core/Callbacks/Structures/Common/StatusCallbackStructure.php
Normal file
40
core/Callbacks/Structures/Common/StatusCallbackStructure.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the StatusCallback Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class StatusCallbackStructure extends BaseResponseStructure {
|
||||
protected $active;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->active = $this->getPlainJsonObject()->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the Status (Like Combo Pause or Warmup) is Ongoing
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActive() {
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
}
|
69
core/Callbacks/Structures/ShootMania/Models/JoustScore.php
Normal file
69
core/Callbacks/Structures/ShootMania/Models/JoustScore.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Lukas
|
||||
* Date: 07. Apr. 2017
|
||||
* Time: 22:01
|
||||
*/
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
|
||||
/**
|
||||
* JoustScore Model
|
||||
*
|
||||
* @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 JoustScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
/** @var \ManiaControl\Players\Player $player */
|
||||
private $player;
|
||||
private $score;
|
||||
|
||||
/**
|
||||
* Gets the Player
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Player
|
||||
*
|
||||
* @api
|
||||
* @param \ManiaControl\Players\Player $player
|
||||
*/
|
||||
public function setPlayer($player) {
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Score
|
||||
*
|
||||
* @api
|
||||
* @return int
|
||||
*/
|
||||
public function getScore() {
|
||||
return $this->score;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Score
|
||||
*
|
||||
* @api
|
||||
* @param mixed int
|
||||
*/
|
||||
public function setScore($score) {
|
||||
$this->score = $score;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
/**
|
||||
* RoyalPointTypes Interface
|
||||
*
|
||||
* @api
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
interface RoyalPointTypes {
|
||||
const POLE = "Pole";
|
||||
const HIT = "Hit";
|
||||
const SURVIVAL = "Survival";
|
||||
}
|
18
core/Callbacks/Structures/ShootMania/Models/VictoryTypes.php
Normal file
18
core/Callbacks/Structures/ShootMania/Models/VictoryTypes.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
/**
|
||||
* VictoryTypes Interface (only available in Elite atm)
|
||||
*
|
||||
* @api
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
interface VictoryTypes {
|
||||
const TIME_LIMIT = 1;
|
||||
const CAPTURE = 2;
|
||||
const ATTACKER_ELIMINATED = 3;
|
||||
const DEFENDERS_ELIMINATED = 4;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnEliteEndTurn Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnEliteEndTurnStructure extends BaseStructure {
|
||||
protected $victoryType;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->victoryType = $this->getPlainJsonObject()->victorytype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Victory Type
|
||||
*
|
||||
* @api
|
||||
* @see \ManiaControl\Callbacks\Structures\ShootMania\Models\VictoryTypes
|
||||
* @return int VictoryType
|
||||
*/
|
||||
public function getVictoryType() {
|
||||
return $this->victoryType;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnEliteStartTurn Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnEliteStartTurnStructure extends BaseStructure {
|
||||
protected $attacker;
|
||||
protected $defenderArray;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
$this->attacker = $this->maniaControl->getPlayerManager()->getPlayer($jsonObj->attacker);
|
||||
$this->defenderArray = $jsonObj->defenders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getAttacker() {
|
||||
return $this->attacker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Login Array of the defenders
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefenderLogins() {
|
||||
return $this->defenderArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an Array of the Players
|
||||
*
|
||||
* @return \ManiaControl\Players\Player[]
|
||||
*/
|
||||
public function getDefenders() {
|
||||
$defenders = array();
|
||||
foreach ($this->defenderArray as $login) {
|
||||
$player = $this->maniaControl->getPlayerManager()->getPlayer($login);
|
||||
if ($player) {
|
||||
$defenders[$login] = $player;
|
||||
}
|
||||
}
|
||||
return $defenders;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnJoustReload Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnJoustReloadStructure extends BaseStructure {
|
||||
protected $player;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->player = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Player
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Players\Player Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\Models\JoustScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
|
||||
/**
|
||||
* Structure Class for the OnJoustRoundResults 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 OnJoustRoundResultsStructure extends BaseStructure {
|
||||
|
||||
/** @var \ManiaControl\Callbacks\Structures\ShootMania\Models\JoustScore $playerScores */
|
||||
private $playerScores = array();
|
||||
|
||||
/**
|
||||
* OnJoustRoundResultsStructure constructor.
|
||||
*
|
||||
* @param \ManiaControl\ManiaControl $maniaControl
|
||||
* @param $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
foreach ($jsonObj->players as $jsonPlayer) {
|
||||
$playerScore = new JoustScore();
|
||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||
$playerScore->setScore($jsonPlayer->score);
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Player Scores
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Callbacks\Structures\ShootMania\Models\JoustScore
|
||||
*/
|
||||
public function getPlayerScores() {
|
||||
return $this->playerScores;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnJoustSelectedPlayers Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnJoustSelectedPlayersStructure extends BaseStructure {
|
||||
protected $playerArray;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->playerArray = $this->getPlainJsonObject()->players;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Login Array of the Players
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPlayerLogins() {
|
||||
return $this->playerArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an Array of the Players
|
||||
*
|
||||
* @return \ManiaControl\Players\Player[]
|
||||
*/
|
||||
public function getPlayers() {
|
||||
$players = array();
|
||||
foreach ($this->playerArray as $login) {
|
||||
$player = $this->maniaControl->getPlayerManager()->getPlayer($login);
|
||||
if ($player) {
|
||||
$players[$login] = $player;
|
||||
}
|
||||
}
|
||||
return $players;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnRoyalPlayerSpawn 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 OnRoyalPlayerSpawnStructure extends BaseStructure {
|
||||
protected $player;
|
||||
protected $respawn;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->player = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->login);
|
||||
$this->respawn = $this->getPlainJsonObject()->respawn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Player
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Players\Player Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @return boolean < false if it is the initial player spawn in the round. true if it is a respawn.
|
||||
*/
|
||||
public function getRespawn() {
|
||||
return $this->respawn;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnRoyalPoints Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnRoyalPointsStructure extends BaseStructure {
|
||||
protected $playerLogin;
|
||||
protected $type;
|
||||
protected $points;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->playerLogin = $this->getPlainJsonObject()->login;
|
||||
$this->type = $this->getPlainJsonObject()->type;
|
||||
$this->points = $this->getPlainJsonObject()->points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Player
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Players\Player Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->maniaControl->getPlayerManager()->getPlayer($this->playerLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Type of Points
|
||||
*
|
||||
* @api
|
||||
* @see \ManiaControl\Callbacks\Structures\ShootMania\Models\RoyalPointTypes
|
||||
* @return mixed
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of points scored
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPoints() {
|
||||
return intval($this->points);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnRoyalRoundWinner 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 OnRoyalRoundWinnerStructure extends BaseStructure {
|
||||
protected $player;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->player = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->login);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Player
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Players\Player Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
}
|
@ -20,19 +20,20 @@ class OnShootStructure extends BaseStructure {
|
||||
/**
|
||||
* @var Player $shooter
|
||||
*/
|
||||
private $shooter;
|
||||
private $shooterLogin;
|
||||
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->time = $this->getPlainJsonObject()->time;
|
||||
$this->weapon = $this->getPlainJsonObject()->weapon;
|
||||
|
||||
$this->shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->shooter);
|
||||
|
||||
$this->time = $this->getPlainJsonObject()->time;
|
||||
$this->weapon = $this->getPlainJsonObject()->weapon;
|
||||
$this->shooterLogin = $this->getPlainJsonObject()->shooter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Time the event Happened
|
||||
*
|
||||
* @api
|
||||
* @return int
|
||||
*/
|
||||
public function getTime() {
|
||||
@ -40,6 +41,10 @@ class OnShootStructure extends BaseStructure {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Weapon
|
||||
*
|
||||
* @api
|
||||
* @see \ManiaControl\Callbacks\Structures\ShootMania\Models\Weapons
|
||||
* @return int
|
||||
*/
|
||||
public function getWeapon() {
|
||||
@ -47,15 +52,12 @@ class OnShootStructure extends BaseStructure {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Shooter
|
||||
*
|
||||
* @api
|
||||
* @return Player
|
||||
*/
|
||||
public function getShooter() {
|
||||
return $this->shooter;
|
||||
}
|
||||
|
||||
/** Dumps the Object with some Information */
|
||||
public function dump() {
|
||||
parent::dump();
|
||||
var_dump("With getShooter() you get a Player Object");
|
||||
return $this->maniaControl->getPlayerManager()->getPlayer($this->shooterLogin);
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ namespace ManiaControl\Callbacks\Structures;
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @deprecated
|
||||
* @deprecated see ManiaControl\Callbacks\Structures\ShootMania\Models\VictoryTypes
|
||||
*/
|
||||
interface VictoryTypes {
|
||||
const TIME_LIMIT = 1;
|
||||
|
@ -13,7 +13,7 @@ use ManiaControl\ManiaControl;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class CallbacksListStructure extends BaseResponseStructure {
|
||||
class ListStructure extends BaseResponseStructure {
|
||||
/** @var array $callbacks */
|
||||
private $callbacks;
|
||||
|
||||
@ -26,7 +26,6 @@ class CallbacksListStructure extends BaseResponseStructure {
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->responseId = $this->getPlainJsonObject()->responseid;
|
||||
$this->callbacks = $this->getPlainJsonObject()->callbacks;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user