From 5ee5f698abd59659a386ef9c38cd55f206424f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 27 Jul 2014 21:07:42 +0200 Subject: [PATCH] added utility method from api --- application/core/Server/VoteRatiosMenu.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/application/core/Server/VoteRatiosMenu.php b/application/core/Server/VoteRatiosMenu.php index 754233ec..0448ceeb 100644 --- a/application/core/Server/VoteRatiosMenu.php +++ b/application/core/Server/VoteRatiosMenu.php @@ -56,15 +56,13 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene * @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() */ public function getMenu($width, $height, Script $script, Player $player) { - $voteRatioCommands = VoteRatio::getCommands(); - $voteRatios = $this->maniaControl->client->getCallVoteRatios(); - - $frame = new Frame(); - + $frame = new Frame(); $posY = $height * 0.41; $lineHeight = 5.; $index = 0; + $voteRatioCommands = $this->getVoteCommands(); + $voteRatios = $this->maniaControl->client->getCallVoteRatios(); foreach ($voteRatioCommands as $voteRatioCommand => $voteRatioDescription) { $voteRatioFrame = new Frame(); $frame->add($voteRatioFrame); @@ -102,6 +100,15 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene return $frame; } + /** + * Get the list of available vote commands + * + * @return string[] + */ + private function getVoteCommands() { + return array(VoteRatio::COMMAND_DEFAULT => 'Default', VoteRatio::COMMAND_RESTART_MAP => 'Restart Map', VoteRatio::COMMAND_NEXT_MAP => 'Skip Map', VoteRatio::COMMAND_SET_NEXT_MAP => 'Set next Map', VoteRatio::COMMAND_JUMP_MAP => 'Jump to Map', VoteRatio::COMMAND_TEAM_BALANCE => 'Balance Teams', VoteRatio::COMMAND_SCRIPT_SETTINGS => 'Change Script Settings and Commands', VoteRatio::COMMAND_KICK => 'Kick Players', VoteRatio::COMMAND_BAN => 'Ban Players'); + } + /** * Return the vote ratio for the given command *