added scores shootmania callback -> TODO implement players there in a good way, maybe a Object including these properties and a getPlayer() method with a reference to the player (setable without maniacontrol reference in the object itself)
This commit is contained in:
parent
970d54cc35
commit
4804e0ab55
14
core/Callbacks/Structures/ShootMania/Models/PlayerScore.php
Normal file
14
core/Callbacks/Structures/ShootMania/Models/PlayerScore.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Lukas
|
||||
* Date: 25. Mär. 2017
|
||||
* Time: 12:44
|
||||
*/
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
|
||||
class PlayerScore {
|
||||
|
||||
}
|
88
core/Callbacks/Structures/ShootMania/Models/TeamScore.php
Normal file
88
core/Callbacks/Structures/ShootMania/Models/TeamScore.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Lukas
|
||||
* Date: 25. Mär. 2017
|
||||
* Time: 12:43
|
||||
*/
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania\Models;
|
||||
|
||||
|
||||
class TeamScore {
|
||||
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;
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ use ManiaControl\Players\Player;
|
||||
class OnCaptureStructure extends BaseStructure {
|
||||
|
||||
public $time;
|
||||
public $landMark;
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
111
core/Callbacks/Structures/ShootMania/OnScoresStructure.php
Normal file
111
core/Callbacks/Structures/ShootMania/OnScoresStructure.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\ShootMania;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\Structures\BaseStructure;
|
||||
use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
|
||||
/**
|
||||
* 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 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user