2017-03-25 12:55:09 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
|
|
|
|
|
|
|
|
2017-03-30 19:39:23 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
2017-03-27 22:21:59 +02:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\Models\PlayerScore;
|
2017-03-25 12:55:09 +01:00
|
|
|
use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore;
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
2017-03-30 19:39:23 +02:00
|
|
|
|
2017-03-25 12:55:09 +01:00
|
|
|
/**
|
2017-03-30 19:39:23 +02:00
|
|
|
* Structure Class for the Shootmania OnScores Structure Callback
|
2017-04-07 23:26:35 +02:00
|
|
|
* @api
|
2017-03-25 12:55:09 +01:00
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
|
|
|
* @copyright 2014-2017 ManiaControl Team
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
2017-03-30 19:39:23 +02:00
|
|
|
class OnScoresStructure extends CommonScoresStructure {
|
2017-03-25 12:55:09 +01:00
|
|
|
|
2017-04-07 23:26:35 +02:00
|
|
|
/**
|
|
|
|
* OnScoresStructure constructor.
|
|
|
|
*
|
|
|
|
* @param \ManiaControl\ManiaControl $maniaControl
|
|
|
|
* @param $data
|
|
|
|
*/
|
2017-03-25 12:55:09 +01:00
|
|
|
public function __construct(ManiaControl $maniaControl, $data) {
|
|
|
|
parent::__construct($maniaControl, $data);
|
|
|
|
|
|
|
|
$jsonObj = $this->getPlainJsonObject();
|
|
|
|
|
2017-03-27 22:21:59 +02:00
|
|
|
foreach ($jsonObj->players as $jsonPlayer) {
|
2017-05-09 19:11:19 +02:00
|
|
|
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
|
|
|
|
if($player){
|
|
|
|
$playerScore = new PlayerScore();
|
|
|
|
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
|
|
|
|
|
|
|
$playerScore->setRank($jsonPlayer->rank);
|
|
|
|
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
|
|
|
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
|
|
|
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
|
|
|
|
|
|
|
|
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
|
|
|
}
|
2017-03-27 22:21:59 +02:00
|
|
|
}
|
2017-03-25 12:55:09 +01:00
|
|
|
}
|
|
|
|
}
|