Add TeamId from OnScoresStructure

This commit is contained in:
Beu 2023-07-12 17:26:49 +02:00
parent 13965aef03
commit 129053e951
2 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,7 @@ use ManiaControl\Callbacks\Structures\Common\Models\CommonPlayerScore;
*/
class PlayerScore extends CommonPlayerScore {
private $teamid;
private $bestRaceTime;
private $bestLapTime;
private $stuntScore;
@ -28,6 +29,26 @@ class PlayerScore extends CommonPlayerScore {
private $prevRaceCheckpoints;
private $prevStuntsScore;
/**
* Returns the TeamId
*
* @api
* @return int
*/
public function getTeamId() {
return $this->teamid;
}
/**
* Sets the TeamId
*
* @api
* @param int $teamid
*/
public function setTeamId($teamid) {
$this->teamid = $teamid;
}
/**
* Returns the Rank
*

View File

@ -70,6 +70,13 @@ class OnScoresStructure extends CommonScoresStructure {
$playerScore->setPrevStuntsScore($jsonPlayer->prevstuntsscore);
}
// New attribute added in TM2020
if (property_exists($jsonPlayer, 'team')) {
// player->teamid can be wrong if the mode forced the team, so this is the best value
$player->teamId = $jsonPlayer->team;
$playerScore->setTeamId($jsonPlayer->team);
}
$this->playerScores[$jsonPlayer->login] = $playerScore;
}
}