2014-10-10 14:40:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Callbacks\Structures;
|
|
|
|
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
use ManiaControl\Players\Player;
|
|
|
|
|
2015-06-18 17:12:44 +02:00
|
|
|
/**
|
|
|
|
* Structure Class for the NearMiss Callback
|
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2016-05-04 09:57:31 +02:00
|
|
|
* @copyright 2014-2016 ManiaControl Team
|
2015-06-18 17:12:44 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
2014-10-10 14:40:00 +02:00
|
|
|
class NearMissStructure {
|
2014-10-24 20:20:12 +02:00
|
|
|
/*
|
|
|
|
* Private properties
|
|
|
|
*/
|
2014-10-10 14:40:00 +02:00
|
|
|
private $shooter;
|
|
|
|
private $victim;
|
|
|
|
private $distance;
|
|
|
|
private $weapon;
|
|
|
|
/** @var ManiaControl $maniaControl */
|
|
|
|
private $maniaControl;
|
|
|
|
|
2014-10-24 20:20:12 +02:00
|
|
|
/**
|
|
|
|
* Construct a new Near Miss Structure
|
|
|
|
*
|
|
|
|
* @param ManiaControl $maniaControl
|
|
|
|
* @param array $data
|
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl, array $data) {
|
2014-10-10 18:55:49 +02:00
|
|
|
$this->maniaControl = $maniaControl;
|
2014-10-24 20:20:12 +02:00
|
|
|
$this->shooter = $data[0];
|
|
|
|
$this->victim = $data[1];
|
|
|
|
$this->weapon = $data[2];
|
|
|
|
$this->distance = $data[3];
|
2014-10-10 14:40:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-24 20:20:12 +02:00
|
|
|
* Get the shooter
|
|
|
|
*
|
|
|
|
* @return Player
|
2014-10-10 14:40:00 +02:00
|
|
|
*/
|
|
|
|
public function getShooter() {
|
2014-10-24 20:20:12 +02:00
|
|
|
return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter);
|
2014-10-10 14:40:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-24 20:20:12 +02:00
|
|
|
* Get the victim
|
|
|
|
*
|
|
|
|
* @return Player
|
2014-10-10 14:40:00 +02:00
|
|
|
*/
|
|
|
|
public function getVictim() {
|
2014-10-24 20:20:12 +02:00
|
|
|
return $this->maniaControl->getPlayerManager()->getPlayer($this->victim);
|
2014-10-10 14:40:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-24 20:20:12 +02:00
|
|
|
* Get the distance
|
|
|
|
*
|
2014-12-21 23:21:59 +01:00
|
|
|
* @return double
|
2014-10-10 14:40:00 +02:00
|
|
|
*/
|
|
|
|
public function getDistance() {
|
2014-12-21 23:21:59 +01:00
|
|
|
return doubleval($this->distance);
|
2014-10-10 14:40:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-24 20:20:12 +02:00
|
|
|
* Get the weapon
|
|
|
|
*
|
|
|
|
* @return int
|
2014-10-10 14:40:00 +02:00
|
|
|
*/
|
|
|
|
public function getWeapon() {
|
|
|
|
return $this->weapon;
|
|
|
|
}
|
|
|
|
|
2014-10-24 20:20:12 +02:00
|
|
|
}
|