implemented all trackmania callbacks

This commit is contained in:
kremsy
2017-04-14 17:02:00 +02:00
parent 91d09ec8dc
commit 3aab01b98b
16 changed files with 458 additions and 431 deletions

View File

@ -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;
}
}

View 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;
}
}

View File

@ -13,5 +13,5 @@ use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure;
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class OnEventStartLineStructure extends BasePlayerTimeStructure {
class OnStartLineEventStructure extends BasePlayerTimeStructure {
}

View 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;
}
}

View File

@ -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;
}
}

View File

@ -16,7 +16,7 @@ use ManiaControl\Utils\Formatter;
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class OnEventWayPointStructure extends BasePlayerTimeStructure {
class OnWayPointEventStructure extends BasePlayerTimeStructure {
private $raceTime;
private $lapTime;
private $stuntsScore;
@ -29,7 +29,7 @@ class OnEventWayPointStructure extends BasePlayerTimeStructure {
private $distance;
/**
* OnEventWayPointStructure constructor.
* OnWayPointEventStructure constructor.
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param $data