Updated to XML-RCP Callbacks Version 2.5.0

This commit is contained in:
Jocy 2018-03-27 19:56:09 +02:00
parent a0b42964c2
commit 3d6fe73163
4 changed files with 107 additions and 3 deletions

View File

@ -23,6 +23,10 @@ class PlayerScore extends CommonPlayerScore {
private $bestRaceCheckpoints; private $bestRaceCheckpoints;
private $bestLapRespawns; private $bestLapRespawns;
private $bestLapCheckpoints; private $bestLapCheckpoints;
private $prevRaceTime;
private $prevRaceRespawns;
private $prevRaceCheckpoints;
private $prevStuntsScore;
/** /**
* Returns the Rank * Returns the Rank
@ -140,6 +144,7 @@ class PlayerScore extends CommonPlayerScore {
} }
/** /**
* @api
* @param mixed $bestLapRespawns * @param mixed $bestLapRespawns
*/ */
public function setBestLapRespawns($bestLapRespawns) { public function setBestLapRespawns($bestLapRespawns) {
@ -162,5 +167,69 @@ class PlayerScore extends CommonPlayerScore {
$this->bestLapCheckpoints = $bestLapCheckpoints; $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;
}
} }

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Callbacks\Structures\TrackMania;
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure; use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore; use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore;
use ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -43,6 +42,22 @@ class OnScoresStructure extends CommonScoresStructure {
$playerScore->setBestRaceCheckpoints($jsonPlayer->bestracecheckpoints); $playerScore->setBestRaceCheckpoints($jsonPlayer->bestracecheckpoints);
$playerScore->setBestLapRespawns($jsonPlayer->bestlaprespawns); $playerScore->setBestLapRespawns($jsonPlayer->bestlaprespawns);
$playerScore->setBestLapCheckpoints($jsonPlayer->bestlapcheckpoints); $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; $this->playerScores[$jsonPlayer->login] = $playerScore;
} }

View File

@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.228'; const VERSION = '0.229';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2017-05-03_21_00'; const MIN_DEDIVERSION = '2017-05-03_21_00';
const SCRIPT_TIMEOUT = 40; const SCRIPT_TIMEOUT = 40;

View File

@ -23,7 +23,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
class ModeScriptEventManager implements UsageInformationAble { class ModeScriptEventManager implements UsageInformationAble {
use UsageInformationTrait; use UsageInformationTrait;
const API_VERSION = "2.3.0"; const API_VERSION = "2.5.0";
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl; private $maniaControl;
@ -281,6 +281,26 @@ class ModeScriptEventManager implements UsageInformationAble {
$this->triggerModeScriptEvent('Maniaplanet.UI.SetAltScoresTableVisibility', array($login, "True")); $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. * Extend the duration of any ongoing warmup.
* *