Changed the CustomVotes slightly to complement more towards XAseco.

This commit is contained in:
Max Klaversma 2014-04-27 00:20:32 +02:00 committed by Steffen Schröder
parent a3040125e9
commit e6fdb070a1

View File

@ -132,9 +132,15 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->defineVote("teambalance", "Vote for Team Balance"); $this->defineVote("teambalance", "Vote for Team Balance");
$this->defineVote("skipmap", "Vote for Skip Map"); $this->defineVote("skipmap", "Vote for Skip Map");
$this->defineVote("nextmap", "Vote for Skip Map"); $this->defineVote("nextmap", "Vote for Skip Map");
$this->defineVote("skip", "Vote for Skip Map");
$this->defineVote("restartmap", "Vote for Restart Map"); $this->defineVote("restartmap", "Vote for Restart Map");
$this->defineVote("restart", "Vote for Restart Map");
$this->defineVote("pausegame", "Vote for Pause Game"); $this->defineVote("pausegame", "Vote for Pause Game");
foreach($this->voteCommands as $name => $voteCommand) {
$this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote');
}
/* Disable Standard Votes */ /* Disable Standard Votes */
$array["Command"] = VoteRatio::COMMAND_BAN; $array["Command"] = VoteRatio::COMMAND_BAN;
$array["Param"] = ""; $array["Param"] = "";
@ -308,20 +314,21 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
switch($voteName) { switch($voteName) {
case 'teambalance': case 'teambalance':
$this->maniaControl->client->autoTeamBalance(); $this->maniaControl->client->autoTeamBalance();
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Teams got Balanced!'); $this->maniaControl->chat->sendInformation('$s$f8fVote to $fffbalance the teams$f8f has been successfull!');
break; break;
case 'skipmap': case 'skipmap':
case 'skip':
case 'nextmap': case 'nextmap':
$this->maniaControl->client->nextMap(); $this->maniaControl->client->nextMap();
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map skipped!'); $this->maniaControl->chat->sendInformation('$s$f8fVote to $fffskip the map$f8f has been successfull!');
break; break;
case 'restartmap': case 'restartmap':
$this->maniaControl->client->restartMap(); $this->maniaControl->client->restartMap();
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map restarted!'); $this->maniaControl->chat->sendInformation('$s$f8fVote to $fffrestart the map$f8f has been successfull!');
break; break;
case 'pausegame': case 'pausegame':
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True)); $this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True));
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Current Game paused!'); $this->maniaControl->chat->sendInformation('$s$f8fVote to $fffpause the current game$f8f has been successfull!');
break; break;
} }
} else { } else {
@ -349,6 +356,16 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
} }
} }
public function handleChatVote(array $chat, Player $player) {
$chatCommand = explode(' ', $chat[1][2]);
$chatCommand = $chatCommand[0];
$chatCommand = str_replace('/', '', $chatCommand);
if (isset($this->voteCommands[$chatCommand])) {
$this->startVote($player, $chatCommand);
}
}
/** /**
* Defines a Vote * Defines a Vote
* *
@ -420,7 +437,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
if ($this->currentVote->voteCommand->startText != '') { if ($this->currentVote->voteCommand->startText != '') {
$message = $this->currentVote->voteCommand->startText; $message = $this->currentVote->voteCommand->startText;
} else { } else {
$message = '$<' . $player->nickname . '$>$s started a $<' . $this->currentVote->voteCommand->name . '$>!'; $message = '$fff$<' . $player->nickname . '$>$s$f8f started a $fff$<' . $this->currentVote->voteCommand->name . '$>$f8f!';
} }
$this->maniaControl->chat->sendSuccess($message); $this->maniaControl->chat->sendSuccess($message);
@ -592,8 +609,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$quad->setY($y); $quad->setY($y);
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig); $quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
$quad->setSize(5, 5); $quad->setSize(5, 5);
$quad->setAction(self::ACTION_NEGATIVE_VOTE); $quad->setAction(self::ACTION_POSITIVE_VOTE);
$quad->setActionKey($quad::ACTIONKEY_F7); $quad->setActionKey($quad::ACTIONKEY_F5);
$label = new Label_Button(); $label = new Label_Button();
$frame->add($label); $frame->add($label);
@ -603,20 +620,20 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$label->setStyle($labelStyle); $label->setStyle($labelStyle);
$label->setTextSize(1); $label->setTextSize(1);
$label->setSize(3, 3); $label->setSize(3, 3);
$label->setTextColor("F00"); $label->setTextColor("0F0");
$label->setText("F7"); $label->setText("F5");
$quad = clone $quad; $quad = clone $quad;
$frame->add($quad); $frame->add($quad);
$quad->setX($width / 2 - 6); $quad->setX($width / 2 - 6);
$quad->setAction(self::ACTION_POSITIVE_VOTE); $quad->setAction(self::ACTION_NEGATIVE_VOTE);
$quad->setActionKey($quad::ACTIONKEY_F8); $quad->setActionKey($quad::ACTIONKEY_F6);
$label = clone $label; $label = clone $label;
$frame->add($label); $frame->add($label);
$label->setX($width / 2 - 6); $label->setX($width / 2 - 6);
$label->setTextColor("0F0"); $label->setTextColor("F00");
$label->setText("F8"); $label->setText("F6");
// Send manialink // Send manialink
$this->maniaControl->manialinkManager->sendManialink($maniaLink); $this->maniaControl->manialinkManager->sendManialink($maniaLink);