refactored Scores Structure
This commit is contained in:
parent
ee2facb427
commit
e9ed9d910c
119
core/Callbacks/Structures/Common/CommonScoresStructure.php
Normal file
119
core/Callbacks/Structures/Common/CommonScoresStructure.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\Common;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\Common\Models\CommonPlayerScore;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnScores Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class CommonScoresStructure extends BaseStructure {
|
||||
protected $responseId;
|
||||
protected $section;
|
||||
protected $useTeams;
|
||||
protected $winnerTeam;
|
||||
protected $winnerPlayer;
|
||||
protected $teamScores = array();
|
||||
protected $playerScores = array();
|
||||
|
||||
//TODO test
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
$this->responseId = $jsonObj->responseId;
|
||||
$this->section = $jsonObj->section;
|
||||
$this->useTeams = $jsonObj->useTeams;
|
||||
$this->winnerTeam = $jsonObj->winnerTeam;
|
||||
|
||||
$this->winnerPlayer = $this->maniaControl->getPlayerManager()->getPlayer($jsonObj->winnerplayer);
|
||||
|
||||
foreach ($jsonObj->teams as $team) {
|
||||
if ($this instanceof \ManiaControl\Callbacks\Structures\TrackMania\OnScoresStructure) {
|
||||
$teamScore = new \ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore();
|
||||
} else {
|
||||
$teamScore = new \ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore();
|
||||
}
|
||||
|
||||
$teamScore->setId($team->id);
|
||||
$teamScore->setName($team->name);
|
||||
$teamScore->setRoundPoints($team->roundpoints);
|
||||
$teamScore->setMatchPoints($team->matchpoints);
|
||||
$teamScore->setMapPoints($team->mappoints);
|
||||
|
||||
$this->teamScores[$team->id] = $teamScore; //TODO verify that different teams have different ids
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Player Object
|
||||
*
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getWinnerPlayer() {
|
||||
return $this->winnerPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* < Current progress of the match. Can be "" | "EndRound" | "EndMap" | "EndMatch"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSection() {
|
||||
return $this->section;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the GameMode uses Teams or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseTeams() {
|
||||
return $this->useTeams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Team Id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWinnerTeamId() {
|
||||
return $this->winnerTeam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TeamScores
|
||||
*
|
||||
* @return TeamScore[]
|
||||
*/
|
||||
public function getTeamScores() {
|
||||
return $this->teamScores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Player Scores
|
||||
*
|
||||
* @return CommonPlayerScore[]
|
||||
*/
|
||||
public function getPlayerScores() {
|
||||
return $this->playerScores;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\Common\Models;
|
||||
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Players\Player;
|
||||
|
||||
class CommonPlayerScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
protected $player;
|
||||
protected $rank;
|
||||
protected $roundPoints;
|
||||
protected $mapPoints;
|
||||
|
||||
/**
|
||||
* Returns the Player
|
||||
*
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ManiaControl\Players\Player $player
|
||||
*/
|
||||
public function setPlayer(Player $player) {
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Rank
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRank() {
|
||||
return $this->rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Rank
|
||||
*
|
||||
* @param int $rank
|
||||
*/
|
||||
public function setRank($rank) {
|
||||
$this->rank = $rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Round Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the RoundPoints
|
||||
*
|
||||
* @param int $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Map Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Map Points
|
||||
*
|
||||
* @param int $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
}
|
93
core/Callbacks/Structures/Common/Models/CommonTeamScore.php
Normal file
93
core/Callbacks/Structures/Common/Models/CommonTeamScore.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\Common\Models;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
|
||||
/**
|
||||
* TeamScore Model
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class CommonTeamScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
private $id;
|
||||
private $name;
|
||||
private $roundPoints;
|
||||
private $mapPoints;
|
||||
private $matchPoints;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMatchPoints() {
|
||||
return $this->matchPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $matchPoints
|
||||
*/
|
||||
public function setMatchPoints($matchPoints) {
|
||||
$this->matchPoints = $matchPoints;
|
||||
}
|
||||
}
|
@ -2,9 +2,8 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Callbacks\Structures\Common\Models\CommonPlayerScore;
|
||||
|
||||
|
||||
/**
|
||||
* PlayerScore Model
|
||||
@ -13,81 +12,6 @@ use ManiaControl\Players\Player;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class PlayerScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
class PlayerScore extends CommonPlayerScore {
|
||||
|
||||
private $player;
|
||||
private $rank;
|
||||
private $roundPoints;
|
||||
private $mapPoints;
|
||||
|
||||
/**
|
||||
* Returns the Player
|
||||
*
|
||||
* @return Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ManiaControl\Players\Player $player
|
||||
*/
|
||||
public function setPlayer(Player $player) {
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Rank
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRank() {
|
||||
return $this->rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Rank
|
||||
*
|
||||
* @param int $rank
|
||||
*/
|
||||
public function setRank($rank) {
|
||||
$this->rank = $rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Round Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the RoundPoints
|
||||
*
|
||||
* @param int $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Map Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Map Points
|
||||
*
|
||||
* @param int $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
}
|
@ -2,92 +2,14 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Callbacks\Structures\Common\Models\CommonTeamScore;
|
||||
|
||||
/**
|
||||
* TeamScore Model
|
||||
* Shootmania TeamScore Model
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class TeamScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
private $id;
|
||||
private $name;
|
||||
private $roundPoints;
|
||||
private $mapPoints;
|
||||
private $matchPoints;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMatchPoints() {
|
||||
return $this->matchPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $matchPoints
|
||||
*/
|
||||
public function setMatchPoints($matchPoints) {
|
||||
$this->matchPoints = $matchPoints;
|
||||
}
|
||||
class TeamScore extends CommonTeamScore {
|
||||
}
|
@ -3,41 +3,28 @@
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\Models\PlayerScore;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
|
||||
/**
|
||||
* Structure Class for the OnScores Structure Callback
|
||||
* Structure Class for the Shootmania OnScores Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnScoresStructure extends BaseStructure {
|
||||
private $responseId;
|
||||
private $section;
|
||||
private $useTeams;
|
||||
private $winnerTeam;
|
||||
private $winnerPlayer;
|
||||
private $teamScores = array();
|
||||
private $playerScores = array();
|
||||
class OnScoresStructure extends CommonScoresStructure {
|
||||
|
||||
//TODO test
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
$this->responseId = $jsonObj->responseId;
|
||||
$this->section = $jsonObj->section;
|
||||
$this->useTeams = $jsonObj->useTeams;
|
||||
$this->winnerTeam = $jsonObj->winnerTeam;
|
||||
|
||||
$this->winnerPlayer = $this->maniaControl->getPlayerManager()->getPlayer($jsonObj->winnerplayer);
|
||||
|
||||
foreach ($jsonObj->teams as $team) {
|
||||
//if($this instanceof OnScoresStructure)
|
||||
$teamScore = new TeamScore();
|
||||
$teamScore->setId($team->id);
|
||||
$teamScore->setName($team->name);
|
||||
@ -59,67 +46,4 @@ class OnScoresStructure extends BaseStructure {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Player Object
|
||||
*
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getWinnerPlayer() {
|
||||
return $this->winnerPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* < Current progress of the match. Can be "" | "EndRound" | "EndMap" | "EndMatch"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSection() {
|
||||
return $this->section;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the GameMode uses Teams or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseTeams() {
|
||||
return $this->useTeams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Team Id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWinnerTeamId() {
|
||||
return $this->winnerTeam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TeamScores
|
||||
*
|
||||
* @return TeamScore[]
|
||||
*/
|
||||
public function getTeamScores() {
|
||||
return $this->teamScores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Player Scores
|
||||
*
|
||||
* @return PlayerScore[]
|
||||
*/
|
||||
public function getPlayerScores() {
|
||||
return $this->playerScores;
|
||||
}
|
||||
}
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\TrackMania\Models;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Callbacks\Structures\Common\Models\CommonPlayerScore;
|
||||
|
||||
use ManiaControl\Players\Player;
|
||||
//TODO proper return descriptions on getter methods
|
||||
//TODO proper return descriptions on getter methods -> use autogenerate for setter/getter + docs
|
||||
/**
|
||||
* PlayerScore Model
|
||||
*
|
||||
@ -13,33 +13,12 @@ use ManiaControl\Players\Player;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class PlayerScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
class PlayerScore extends CommonPlayerScore {
|
||||
|
||||
private $player;
|
||||
private $rank;
|
||||
private $roundPoints;
|
||||
private $mapPoints;
|
||||
private $matchPoints;
|
||||
private $bestraceTime;
|
||||
private $bestlapTime;
|
||||
private $bestRaceTime;
|
||||
private $bestLapTime;
|
||||
private $stuntScore;
|
||||
|
||||
/**
|
||||
* Returns the Player
|
||||
*
|
||||
* @return Player
|
||||
*/
|
||||
public function getPlayer() {
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ManiaControl\Players\Player $player
|
||||
*/
|
||||
public function setPlayer(Player $player) {
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Rank
|
||||
@ -59,68 +38,24 @@ class PlayerScore implements UsageInformationAble {
|
||||
$this->rank = $rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Round Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the RoundPoints
|
||||
*
|
||||
* @param int $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Map Points
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Map Points
|
||||
*
|
||||
* @param int $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bestRaceTime
|
||||
*
|
||||
* @param int $bestraceTime
|
||||
*/
|
||||
public function getbestraceTime(){
|
||||
return $this->bestraceTime;
|
||||
public function getBestraceTime(){
|
||||
return $this->bestRaceTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the MapPoints
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMatchPoints(){
|
||||
return $this->matchPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bestlapTime
|
||||
*
|
||||
* @param int $bestlapTime
|
||||
*/
|
||||
public function getbestlapTime(){
|
||||
return $this->bestlapTime;
|
||||
public function getBestlapTime(){
|
||||
return $this->bestLapTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +63,29 @@ class PlayerScore implements UsageInformationAble {
|
||||
*
|
||||
* @param int $bestraceTime
|
||||
*/
|
||||
public function getstuntScore(){
|
||||
public function getStuntScore(){
|
||||
return $this->stuntScore;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $bestRaceTime
|
||||
*/
|
||||
public function setBestRaceTime($bestRaceTime) {
|
||||
$this->bestRaceTime = $bestRaceTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $bestLapTime
|
||||
*/
|
||||
public function setBestLapTime($bestLapTime) {
|
||||
$this->bestLapTime = $bestLapTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $stuntScore
|
||||
*/
|
||||
public function setStuntScore($stuntScore) {
|
||||
$this->stuntScore = $stuntScore;
|
||||
}
|
||||
|
||||
}
|
@ -2,92 +2,14 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\TrackMania\Models;
|
||||
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\Callbacks\Structures\Common\Models\CommonTeamScore;
|
||||
|
||||
/**
|
||||
* TeamScore Model
|
||||
* Shootmania TeamScore Model
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class TeamScore implements UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
private $id;
|
||||
private $name;
|
||||
private $roundPoints;
|
||||
private $mapPoints;
|
||||
private $matchPoints;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoundPoints() {
|
||||
return $this->roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $roundPoints
|
||||
*/
|
||||
public function setRoundPoints($roundPoints) {
|
||||
$this->roundPoints = $roundPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMapPoints() {
|
||||
return $this->mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mapPoints
|
||||
*/
|
||||
public function setMapPoints($mapPoints) {
|
||||
$this->mapPoints = $mapPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMatchPoints() {
|
||||
return $this->matchPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $matchPoints
|
||||
*/
|
||||
public function setMatchPoints($matchPoints) {
|
||||
$this->matchPoints = $matchPoints;
|
||||
}
|
||||
class TeamScore extends CommonTeamScore {
|
||||
}
|
@ -2,41 +2,25 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\TrackMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore;
|
||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Structure Class for the OnScores Structure Callback
|
||||
* Structure Class for the Trackmania OnScores Structure Callback
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class OnScoresStructure extends BaseStructure {
|
||||
private $responseId;
|
||||
private $section;
|
||||
private $useTeams;
|
||||
private $winnerTeam;
|
||||
private $winnerPlayer;
|
||||
private $teamScores = array();
|
||||
private $playerScores = array();
|
||||
class OnScoresStructure extends CommonScoresStructure {
|
||||
|
||||
//TODO test
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
$this->responseId = $jsonObj->responseid;
|
||||
$this->section = $jsonObj->section;
|
||||
$this->useTeams = $jsonObj->useteams;
|
||||
$this->winnerTeam = $jsonObj->winnerteam;
|
||||
|
||||
$this->winnerPlayer = $this->maniaControl->getPlayerManager()->getPlayer($jsonObj->winnerplayer);
|
||||
|
||||
foreach ($jsonObj->teams as $team) {
|
||||
$teamScore = new TeamScore();
|
||||
$teamScore->setId($team->id);
|
||||
@ -54,72 +38,14 @@ class OnScoresStructure extends BaseStructure {
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setBestRaceTime($jsonPlayer->bestracetime);
|
||||
$playerScore->setBestLapTime($jsonPlayer->bestlaptime);
|
||||
$playerScore->setStuntScore($jsonPlayer->stuntscore);
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Player Object
|
||||
*
|
||||
* @return \ManiaControl\Players\Player
|
||||
*/
|
||||
public function getWinnerPlayer() {
|
||||
return $this->winnerPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* < Current progress of the match. Can be "" | "EndRound" | "EndMap" | "EndMatch"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSection() {
|
||||
return $this->section;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the GameMode uses Teams or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseTeams() {
|
||||
return $this->useTeams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Winner Team Id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWinnerTeamId() {
|
||||
return $this->winnerTeam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TeamScores
|
||||
*
|
||||
* @return TeamScore[]
|
||||
*/
|
||||
public function getTeamScores() {
|
||||
return $this->teamScores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Player Scores
|
||||
*
|
||||
* @return PlayerScore[]
|
||||
*/
|
||||
public function getPlayerScores() {
|
||||
return $this->playerScores;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user