TrackManiaControl/core/Callbacks/Structures/TrackMania/OnRespawnStructure.php

114 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2017-04-14 17:02:00 +02:00
<?php
namespace ManiaControl\Callbacks\Structures\TrackMania;
use ManiaControl\Callbacks\Models\RecordCallback;
use ManiaControl\Callbacks\Structures\Common\BasePlayerTimeStructure;
use ManiaControl\ManiaControl;
2017-04-14 17:02:00 +02:00
/**
* Structure Class for the On Respawn Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
2020-01-22 10:39:35 +01:00
* @copyright 2014-2020 ManiaControl Team
2017-04-14 17:02:00 +02:00
* @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();
2017-05-06 11:22:57 +02:00
$this->numberOfRespawns = (int) $jsonObj->nbrespawns;
2017-04-14 17:02:00 +02:00
$this->raceTime = (int) $jsonObj->racetime;
$this->lapTime = (int) $jsonObj->laptime;
2023-01-17 10:06:56 +01:00
if (isset($jsonObj->stuntsscore)) $this->stuntsScore = $jsonObj->stuntsscore;
2017-04-14 17:02:00 +02:00
$this->checkPointInRace = (int) $jsonObj->checkpointinrace;
$this->checkPointInLap = (int) $jsonObj->checkpointinlap;
$this->speed = $jsonObj->speed;
2023-01-17 10:06:56 +01:00
if (isset($jsonObj->distance)) $this->distance = $jsonObj->distance;
2017-04-14 17:02:00 +02:00
}
/**
* @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;
}
}