added pause vote for chase / (and combo?)

This commit is contained in:
kremsy 2015-08-26 18:06:43 +02:00
parent 35bb8a1a37
commit 1b719f0972

View File

@ -79,8 +79,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
* Private properties * Private properties
*/ */
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl = null; private $maniaControl = null;
private $voteCommands = array(); private $voteCommands = array();
private $voteMenuItems = array(); private $voteMenuItems = array();
/** @var CurrentVote $currentVote */ /** @var CurrentVote $currentVote */
private $currentVote = null; private $currentVote = null;
@ -229,7 +229,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$pauseExists = false; $pauseExists = false;
foreach ($scriptInfos->commandDescs as $param) { foreach ($scriptInfos->commandDescs as $param) {
if ($param->name === "Command_ForceWarmUp") { if ($param->name === "Command_ForceWarmUp" || $param->name === "Command_SetPause") {
$pauseExists = true; $pauseExists = true;
break; break;
} }
@ -251,8 +251,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$itemQuad->setAction(self::ACTION_START_VOTE . 'skipmap'); $itemQuad->setAction(self::ACTION_START_VOTE . 'skipmap');
$this->addVoteMenuItem($itemQuad, 15, 'Vote for a Map Skip'); $this->addVoteMenuItem($itemQuad, 15, 'Vote for a Map Skip');
if ($this->maniaControl->getServer()->isTeamMode() if ($this->maniaControl->getServer()->isTeamMode()) {
) {
//Menu TeamBalance //Menu TeamBalance
$itemQuad = new Quad_Icons128x32_1(); $itemQuad = new Quad_Icons128x32_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team);
@ -295,8 +294,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
//If game is shootmania lower the icons position by 20 //If game is shootmania lower the icons position by 20
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm' if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
) {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }
@ -544,10 +542,21 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
break; break;
case 'pausegame': case 'pausegame':
try { try {
//Gamemodes like Elite, Speedball
$this->maniaControl->getClient()->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); $this->maniaControl->getClient()->sendModeScriptCommands(array('Command_ForceWarmUp' => true));
$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!'); $this->maniaControl->getChat()->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!');
} catch (GameModeException $ex) { } catch (GameModeException $ex) {
} }
try {
//Chase and Combo?
$this->maniaControl->getClient()->sendModeScriptCommands(array('Command_SetPause' => true));
$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!');
//Especially for chase, force end of the round to reach a draw
$this->maniaControl->getClient()->sendModeScriptCommands(array('Command_ForceEndRound' => true));
} catch (GameModeException $ex) {
}
break; break;
case 'replay': case 'replay':
$this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->getMapManager()->getCurrentMap()); $this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->getMapManager()->getCurrentMap());
@ -808,11 +817,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
*/ */
// TODO: extract classes to own files // TODO: extract classes to own files
class VoteCommand { class VoteCommand {
public $index = ''; public $index = '';
public $name = ''; public $name = '';
public $neededRatio = 0; public $neededRatio = 0;
public $idBased = false; public $idBased = false;
public $startText = ''; public $startText = '';
private $stopCallback = ''; private $stopCallback = '';
@ -858,16 +867,16 @@ class CurrentVote {
const VOTE_FOR_ACTION = '1'; const VOTE_FOR_ACTION = '1';
const VOTE_AGAINST_ACTION = '-1'; const VOTE_AGAINST_ACTION = '-1';
public $voteCommand = null; public $voteCommand = null;
public $expireTime = 0; public $expireTime = 0;
public $positiveVotes = 0; public $positiveVotes = 0;
public $neededRatio = 0; public $neededRatio = 0;
public $neededPlayerRatio = 0; public $neededPlayerRatio = 0;
public $voter = null; public $voter = null;
public $map = null; public $map = null;
public $player = null; public $player = null;
public $function = null; public $function = null;
public $stopCallback = ""; public $stopCallback = "";
private $playersVoted = array(); private $playersVoted = array();