TrackManiaControl/core/Callbacks/Structures/NearMissStructure.php

79 lines
1.5 KiB
PHP
Raw Normal View History

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>
2017-02-04 11:49:23 +01:00
* @copyright 2014-2017 ManiaControl Team
2015-06-18 17:12:44 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*
* @deprecated see OnNearMissStructure
2015-06-18 17:12:44 +02:00
*/
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
}