diff --git a/core/Callbacks/Structures/ShootMania/Models/PlayerScore.php b/core/Callbacks/Structures/ShootMania/Models/PlayerScore.php new file mode 100644 index 00000000..3fc4ea08 --- /dev/null +++ b/core/Callbacks/Structures/ShootMania/Models/PlayerScore.php @@ -0,0 +1,14 @@ +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; + } +} \ No newline at end of file diff --git a/core/Callbacks/Structures/ShootMania/OnCaptureStructure.php b/core/Callbacks/Structures/ShootMania/OnCaptureStructure.php index 7e640513..0e73f889 100644 --- a/core/Callbacks/Structures/ShootMania/OnCaptureStructure.php +++ b/core/Callbacks/Structures/ShootMania/OnCaptureStructure.php @@ -18,8 +18,8 @@ use ManiaControl\Players\Player; */ class OnCaptureStructure extends BaseStructure { - public $time; - public $landMark; + public $time; + private $landMark; private $playerArray = array(); @@ -46,6 +46,11 @@ class OnCaptureStructure extends BaseStructure { $this->shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->shooter); } + /** Dumps the Object with some Information */ + public function dump() { + var_dump($this->landMark); + parent::dump(); + } /** * Get the logins diff --git a/core/Callbacks/Structures/ShootMania/OnHitNearMissArmorEmptyStructure.php b/core/Callbacks/Structures/ShootMania/OnHitNearMissArmorEmptyStructure.php index 00e6bf28..475ccef0 100644 --- a/core/Callbacks/Structures/ShootMania/OnHitNearMissArmorEmptyStructure.php +++ b/core/Callbacks/Structures/ShootMania/OnHitNearMissArmorEmptyStructure.php @@ -20,10 +20,10 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { public $time; public $weapon; public $damage; - public $shooterPosition; - public $victimPosition; public $distance = 0; //Note no distance on the OnHit and ArmorEmpty yet + private $shooterPosition; + private $victimPosition; protected $shooter; protected $victim; @@ -40,10 +40,10 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { public function __construct(ManiaControl $maniaControl, $data) { parent::__construct($maniaControl, $data); - $jsonObj = $this->getPlainJsonObject(); - $this->time = $jsonObj->time; - $this->weapon = $jsonObj->weapon; - $this->damage = $jsonObj->damage; + $jsonObj = $this->getPlainJsonObject(); + $this->time = $jsonObj->time; + $this->weapon = $jsonObj->weapon; + $this->damage = $jsonObj->damage; $this->shooterPosition = new Position(); $this->shooterPosition->setX($jsonObj->shooterposition->x); @@ -63,6 +63,17 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { $this->victim = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->victim); } + /** Dumps the Object with some Information */ + public function dump() { + var_dump("Dump of property Shooter Position"); + var_dump($this->shooterPosition); + var_dump("Dump of property Victim Position"); + var_dump($this->victimPosition); + parent::dump(); + var_dump("With getShooter() you get a Player Object"); + var_dump("With getVictim() you get a Player Object"); + } + /** * @return int */ @@ -123,10 +134,4 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { return $this->distance; } - /** Dumps the Object with some Information */ - public function dump() { - parent::dump(); - var_dump("With getShooter() you get a Player Object"); - var_dump("With getVictim() you get a Player Object"); - } } \ No newline at end of file diff --git a/core/Callbacks/Structures/ShootMania/OnScoresStructure.php b/core/Callbacks/Structures/ShootMania/OnScoresStructure.php new file mode 100644 index 00000000..b6c043a2 --- /dev/null +++ b/core/Callbacks/Structures/ShootMania/OnScoresStructure.php @@ -0,0 +1,111 @@ + + * @copyright 2014-2017 ManiaControl Team + * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 + */ +class OnScoresStructure extends BaseStructure { + public $responseId; + public $section; + public $useTeams; + public $winnerTeam; + public $winnerPlayer; + private $teamScores = array(); + public $players; //TODO implement + + //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); + $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 + } + + //TODO implement player + } + + /** Dumps the Object with some Information */ + public function dump() { + parent::dump(); + var_dump("With getWinnerPlayer() you get a Player Object"); + var_dump($this->teamScores); + } + + + /** + * @return Player + */ + public function getWinnerPlayer() { + return $this->winnerPlayer; + } + + /** + * @return mixed + */ + public function getResponseId() { + return $this->responseId; + } + + /** + * @return mixed + */ + public function getSection() { + return $this->section; + } + + /** + * @return boolean + */ + public function getUseTeams() { + return $this->useTeams; + } + + /** + * @return int + */ + public function getWinnerTeam() { + return $this->winnerTeam; + } + + /** + * @return TeamScore[] + */ + public function getTeamScores() { + return $this->teamScores; + } + + /** + * @return mixed + */ + public function getPlayers() { + //TODO proper implementation + return $this->players; + } +} \ No newline at end of file