diff --git a/core/Callbacks/Structures/TrackMania/Models/PlayerScore.php b/core/Callbacks/Structures/TrackMania/Models/PlayerScore.php index 300cfd51..678f3243 100644 --- a/core/Callbacks/Structures/TrackMania/Models/PlayerScore.php +++ b/core/Callbacks/Structures/TrackMania/Models/PlayerScore.php @@ -23,6 +23,10 @@ class PlayerScore extends CommonPlayerScore { private $bestRaceCheckpoints; private $bestLapRespawns; private $bestLapCheckpoints; + private $prevRaceTime; + private $prevRaceRespawns; + private $prevRaceCheckpoints; + private $prevStuntsScore; /** * Returns the Rank @@ -140,6 +144,7 @@ class PlayerScore extends CommonPlayerScore { } /** + * @api * @param mixed $bestLapRespawns */ public function setBestLapRespawns($bestLapRespawns) { @@ -162,5 +167,69 @@ class PlayerScore extends CommonPlayerScore { $this->bestLapCheckpoints = $bestLapCheckpoints; } + /** + * @api + * @return mixed + */ + public function getPrevRaceTime() { + return $this->prevRaceTime; + } + + /** + * @api + * @param mixed $prevRaceTime + */ + public function setPrevRaceTime($prevRaceTime) { + $this->prevRaceTime = $prevRaceTime; + } + + /** + * @api + * @return mixed + */ + public function getPrevRaceRespawns() { + return $this->prevRaceRespawns; + } + + /** + * @api + * @param mixed $prevRaceRespawns + */ + public function setPrevRaceRespawns($prevRaceRespawns) { + $this->prevRaceRespawns = $prevRaceRespawns; + } + + /** + * @api + * @return mixed + */ + public function getPrevRaceCheckpoints() { + return $this->prevRaceCheckpoints; + } + + /** + * @api + * @param mixed $prevRaceCheckpoints + */ + public function setPrevRaceCheckpoints($prevRaceCheckpoints) { + $this->prevRaceCheckpoints = $prevRaceCheckpoints; + } + + /** + * @api + * @return mixed + */ + public function getPrevStuntsScore() { + return $this->prevStuntsScore; + } + + /** + * @api + * @param mixed $prevStuntsScore + */ + public function setPrevStuntsScore($prevStuntsScore) { + $this->prevStuntsScore = $prevStuntsScore; + } + } \ No newline at end of file diff --git a/core/Callbacks/Structures/TrackMania/OnScoresStructure.php b/core/Callbacks/Structures/TrackMania/OnScoresStructure.php index a108ac8e..9408f42a 100644 --- a/core/Callbacks/Structures/TrackMania/OnScoresStructure.php +++ b/core/Callbacks/Structures/TrackMania/OnScoresStructure.php @@ -4,7 +4,6 @@ namespace ManiaControl\Callbacks\Structures\TrackMania; use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure; use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore; -use ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore; use ManiaControl\ManiaControl; /** @@ -43,6 +42,22 @@ class OnScoresStructure extends CommonScoresStructure { $playerScore->setBestRaceCheckpoints($jsonPlayer->bestracecheckpoints); $playerScore->setBestLapRespawns($jsonPlayer->bestlaprespawns); $playerScore->setBestLapCheckpoints($jsonPlayer->bestlapcheckpoints); + //New attributes in 2.5.0 + if (property_exists($jsonPlayer, 'prevracetime')) { + $playerScore->setPrevRaceTime($jsonPlayer->prevracetime); + } + + if (property_exists($jsonPlayer, 'prevracerespawns')) { + $playerScore->setPrevRaceRespawns($jsonPlayer->prevracerespawns); + } + + if (property_exists($jsonPlayer, 'prevracecheckpoints')) { + $playerScore->setPrevRaceCheckpoints($jsonPlayer->prevracecheckpoints); + } + + if (property_exists($jsonPlayer, 'prevstuntsscore')) { + $playerScore->setPrevStuntsScore($jsonPlayer->prevstuntsscore); + } $this->playerScores[$jsonPlayer->login] = $playerScore; } diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 763d219f..c1740814 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, /* * Constants */ - const VERSION = '0.228'; + const VERSION = '0.229'; const API_VERSION = '2013-04-16'; const MIN_DEDIVERSION = '2017-05-03_21_00'; const SCRIPT_TIMEOUT = 40; diff --git a/core/Script/ModeScriptEventManager.php b/core/Script/ModeScriptEventManager.php index 18b456d0..6f842598 100644 --- a/core/Script/ModeScriptEventManager.php +++ b/core/Script/ModeScriptEventManager.php @@ -23,7 +23,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; class ModeScriptEventManager implements UsageInformationAble { use UsageInformationTrait; - const API_VERSION = "2.3.0"; + const API_VERSION = "2.5.0"; /** @var ManiaControl $maniaControl */ private $maniaControl; @@ -281,6 +281,26 @@ class ModeScriptEventManager implements UsageInformationAble { $this->triggerModeScriptEvent('Maniaplanet.UI.SetAltScoresTableVisibility', array($login, "True")); } + /** + * Hides the Scoreboard + * + * @param \ManiaControl\Players\Player $player + */ + public function hideScoreBoard(Player $player) { + $login = Player::parseLogin($player); + $this->triggerModeScriptEvent('Maniaplanet.UI.SetScoresTableVisibility', array($login, "False")); + } + + /** + * Displays the Scoreboard + * + * @param \ManiaControl\Players\Player $player + */ + public function displayScoreBoard(Player $player) { + $login = Player::parseLogin($player); + $this->triggerModeScriptEvent('Maniaplanet.UI.SetScoresTableVisibility', array($login, "True")); + } + /** * Extend the duration of any ongoing warmup. *