callbacks update https://github.com/maniaplanet/script-xmlrpc/releases
to have this mc version working you need to update the dedicated server scripts
This commit is contained in:
39
core/Callbacks/Structures/Common/BaseTimeStructure.php
Normal file
39
core/Callbacks/Structures/Common/BaseTimeStructure.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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 BaseTimeStructure extends BaseStructure {
|
||||
protected $time;
|
||||
|
||||
/**
|
||||
* BaseResponseStructure constructor.
|
||||
*
|
||||
* @param \ManiaControl\ManiaControl $maniaControl
|
||||
* @param $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->time = $this->getPlainJsonObject()->time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Server Time the Callback was sent
|
||||
*
|
||||
* @api
|
||||
* @return int Time since Serverstart
|
||||
*/
|
||||
public function getTime() {
|
||||
return $this->time;
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ class CommonPlayerScore implements UsageInformationAble, JsonSerializable {
|
||||
protected $rank;
|
||||
protected $roundPoints;
|
||||
protected $mapPoints;
|
||||
protected $matchPoints;
|
||||
|
||||
/**
|
||||
* Returns the Player
|
||||
@ -105,4 +106,24 @@ class CommonPlayerScore implements UsageInformationAble, JsonSerializable {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Match Points
|
||||
*
|
||||
* @api
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMatchPoints() {
|
||||
return $this->matchPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Match Points
|
||||
*
|
||||
* @api
|
||||
* @param mixed $matchPoints
|
||||
*/
|
||||
public function setMatchPoints($matchPoints) {
|
||||
$this->matchPoints = $matchPoints;
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
namespace ManiaControl\Callbacks\Structures\Common;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -16,6 +15,7 @@ use ManiaControl\ManiaControl;
|
||||
*/
|
||||
class StatusCallbackStructure extends BaseResponseStructure {
|
||||
protected $active;
|
||||
protected $available;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
@ -26,7 +26,8 @@ class StatusCallbackStructure extends BaseResponseStructure {
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->active = $this->getPlainJsonObject()->active;
|
||||
$this->active = $this->getPlainJsonObject()->active;
|
||||
$this->available = $this->getPlainJsonObject()->available;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,4 +40,14 @@ class StatusCallbackStructure extends BaseResponseStructure {
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Mode uses Warmup or not
|
||||
*
|
||||
* @api
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAvailable() {
|
||||
return $this->available;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ManiaPlanet;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseTimeStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the Loading Map End and UnloadingMap Begin Callbacks
|
||||
*
|
||||
* @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 LoadingUnloadingMapStructure extends BaseTimeStructure {
|
||||
private $restarted;
|
||||
|
||||
/**
|
||||
* StartServerStructure constructor.
|
||||
*
|
||||
* @param \ManiaControl\ManiaControl $maniaControl
|
||||
* @param $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag if the Server got Restarted
|
||||
*
|
||||
* @api
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRestarted() {
|
||||
return $this->restarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Map
|
||||
*
|
||||
* @api
|
||||
* @return \ManiaControl\Maps\Map
|
||||
*/
|
||||
public function getMap() {
|
||||
return $this->maniaControl->getMapManager()->getMapByUid($this->getPlainJsonObject()->map->uid);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ManiaPlanet;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the Mode use Teams 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 ModeUseTeamsStructure extends BaseResponseStructure {
|
||||
private $teams;
|
||||
|
||||
/**
|
||||
* StartServerStructure constructor.
|
||||
*
|
||||
* @param \ManiaControl\ManiaControl $maniaControl
|
||||
* @param $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->teams = $this->getPlainJsonObject()->teams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the Mode is using Teams
|
||||
*
|
||||
* @api
|
||||
* @return boolean < true if the game mode uses teams, false otherwise
|
||||
*/
|
||||
public function modeIsUsingTeams() {
|
||||
return $this->teams;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks\Structures\ManiaPlanet;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseTimeStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -14,7 +15,7 @@ use ManiaControl\ManiaControl;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class StartEndStructure extends BaseStructure {
|
||||
class StartEndStructure extends BaseTimeStructure {
|
||||
private $count;
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnArmorEmpty Structure Callback
|
||||
*
|
||||
@ -11,5 +13,4 @@ namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnArmorEmptyStructure extends OnHitNearMissArmorEmptyBaseStructure {
|
||||
|
||||
}
|
@ -26,9 +26,7 @@ class OnHitNearMissArmorEmptyBaseStructure extends BaseStructure {
|
||||
private $shooter;
|
||||
private $victim;
|
||||
|
||||
//private $shooterPoints; (was in mp3)
|
||||
//private $hitDistance; (was in mp3)
|
||||
|
||||
private $distance;
|
||||
|
||||
/**
|
||||
* Construct a new On Hit Structure
|
||||
@ -39,9 +37,10 @@ class OnHitNearMissArmorEmptyBaseStructure extends BaseStructure {
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
$this->time = $jsonObj->time;
|
||||
$this->weapon = $jsonObj->weapon;
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
$this->time = $jsonObj->time;
|
||||
$this->weapon = $jsonObj->weapon;
|
||||
$this->distance = $jsonObj->distance;
|
||||
|
||||
$this->shooterPosition = new Position();
|
||||
$this->shooterPosition->setX($jsonObj->shooterposition->x);
|
||||
@ -117,4 +116,14 @@ class OnHitNearMissArmorEmptyBaseStructure extends BaseStructure {
|
||||
public function getVictim() {
|
||||
return $this->victim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Distance Between Shooter and Victim at the time of the Event
|
||||
*
|
||||
* @api
|
||||
* @return float
|
||||
*/
|
||||
public function getDistance() {
|
||||
return $this->distance;
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ use ManiaControl\ManiaControl;
|
||||
*/
|
||||
class OnHitStructure extends OnHitNearMissArmorEmptyBaseStructure {
|
||||
private $damage;
|
||||
|
||||
private $shooterPoints;
|
||||
|
||||
/**
|
||||
* OnHitStructure constructor.
|
||||
@ -26,7 +26,8 @@ class OnHitStructure extends OnHitNearMissArmorEmptyBaseStructure {
|
||||
public function __construct(ManiaControl $maniaControl, array $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->damage = $this->getPlainJsonObject()->damage;
|
||||
$this->damage = $this->getPlainJsonObject()->damage;
|
||||
$this->shooterPoints = $this->getPlainJsonObject()->points;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,4 +39,15 @@ class OnHitStructure extends OnHitNearMissArmorEmptyBaseStructure {
|
||||
public function getDamage() {
|
||||
return $this->damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of points scored by the shooter
|
||||
*
|
||||
* @api
|
||||
* @return int
|
||||
*/
|
||||
public function getShooterPoints() {
|
||||
return $this->shooterPoints;
|
||||
}
|
||||
|
||||
}
|
@ -14,22 +14,4 @@ use ManiaControl\ManiaControl;
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnNearMissStructure extends OnHitNearMissArmorEmptyBaseStructure {
|
||||
private $distance;
|
||||
|
||||
public function __construct(ManiaControl $maniaControl, array $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$this->distance = $this->getPlainJsonObject()->distance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the distance
|
||||
*
|
||||
*
|
||||
* @api
|
||||
* @return float
|
||||
*/
|
||||
public function getDistance() {
|
||||
return $this->distance;
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ class OnScoresStructure extends CommonScoresStructure {
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
}
|
||||
|
Reference in New Issue
Block a user