2014-10-10 14:40:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Callbacks\Structures;
|
|
|
|
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
use ManiaControl\Players\Player;
|
|
|
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
* @return float
|
2014-10-10 14:40:00 +02:00
|
|
|
*/
|
|
|
|
public function getDistance() {
|
|
|
|
return $this->distance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
}
|