callback improvements
This commit is contained in:
52
core/Callbacks/Structures/EliteBeginTurnStructure.php
Normal file
52
core/Callbacks/Structures/EliteBeginTurnStructure.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures;
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
|
||||
class EliteBeginTurnStructure {
|
||||
/*
|
||||
* Private properties
|
||||
*/
|
||||
private $attackerLogin;
|
||||
private $defenderLogins;
|
||||
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl;
|
||||
|
||||
/**
|
||||
* Construct a new Elite BeginTurnStructure
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, array $data) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
$this->attackerLogin = $data[0];
|
||||
$this->defenderLogins = $data[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attacker
|
||||
*
|
||||
* @return Player
|
||||
*/
|
||||
public function getAttacker() {
|
||||
return $this->maniaControl->getPlayerManager()->getPlayer($this->attackerLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the defenders as an Player Array
|
||||
*
|
||||
* @return Player[]
|
||||
*/
|
||||
public function getDefenders() {
|
||||
$defenders = array();
|
||||
foreach (explode(";", $this->defenderLogins) as $defenderLogin) {
|
||||
$defenders[] = $this->maniaControl->getPlayerManager()->getPlayer($defenderLogin);
|
||||
}
|
||||
|
||||
return $defenders;
|
||||
}
|
||||
}
|
17
core/Callbacks/Structures/VictoryTypes.php
Normal file
17
core/Callbacks/Structures/VictoryTypes.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures;
|
||||
|
||||
/**
|
||||
* VictoryTypes Interface (only available in Elite atm)
|
||||
*
|
||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||
* @copyright 2014 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
interface VictoryTypes {
|
||||
const TIME_LIMIT = 1;
|
||||
const CAPTURE = 2;
|
||||
const ATTACKER_ELIMINATED = 3;
|
||||
const DEFENDERS_ELIMINATED = 4;
|
||||
}
|
Reference in New Issue
Block a user