force to spec / kick customvote
This commit is contained in:
parent
47b7d13a2b
commit
4385942d32
@ -332,7 +332,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$switchLabel->setText('»');
|
$switchLabel->setText('»');
|
||||||
$switchLabel->setTextColor('0f0');
|
$switchLabel->setTextColor('0f0');
|
||||||
|
|
||||||
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1) . '.' . $map->uid);
|
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
|
||||||
|
|
||||||
$script->addTooltip($switchLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Start Map-Switch vote: $<' . $map->name . '$>'));
|
$script->addTooltip($switchLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Start Map-Switch vote: $<' . $map->name . '$>'));
|
||||||
} else if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
} else if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
@ -528,8 +528,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN);
|
$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN);
|
||||||
$mapList = $this->maniaControl->mapManager->getMaps();
|
$mapList = $this->maniaControl->mapManager->getMaps();
|
||||||
$map = $mapList[$mapId];
|
$map = $mapList[$mapId];
|
||||||
|
|
||||||
|
$message = '$<' . $player->nickname . '$>$s started a vote to switch to $<' . $map->name . '$>!';
|
||||||
|
|
||||||
/** @var Map $map */
|
/** @var Map $map */
|
||||||
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true);
|
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message);
|
||||||
|
|
||||||
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) {
|
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) {
|
||||||
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map switched!');
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Map switched!');
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Players;
|
namespace ManiaControl\Players;
|
||||||
|
|
||||||
|
use CustomVotesPlugin;
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Labels\Label_Button;
|
use FML\Controls\Labels\Label_Button;
|
||||||
@ -35,6 +36,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
const ACTION_FORCE_RED = 'PlayerList.ForceRed';
|
const ACTION_FORCE_RED = 'PlayerList.ForceRed';
|
||||||
const ACTION_FORCE_BLUE = 'PlayerList.ForceBlue';
|
const ACTION_FORCE_BLUE = 'PlayerList.ForceBlue';
|
||||||
const ACTION_FORCE_SPEC = 'PlayerList.ForceSpec';
|
const ACTION_FORCE_SPEC = 'PlayerList.ForceSpec';
|
||||||
|
const ACTION_FORCE_SPEC_VOTE = 'PlayerList.ForceSpecVote';
|
||||||
const ACTION_FORCE_PLAY = 'PlayerList.ForcePlay';
|
const ACTION_FORCE_PLAY = 'PlayerList.ForcePlay';
|
||||||
const ACTION_PLAYER_ADV = 'PlayerList.PlayerAdvancedActions';
|
const ACTION_PLAYER_ADV = 'PlayerList.PlayerAdvancedActions';
|
||||||
const ACTION_CLOSE_PLAYER_ADV = 'PlayerList.ClosePlayerAdvWidget';
|
const ACTION_CLOSE_PLAYER_ADV = 'PlayerList.ClosePlayerAdvWidget';
|
||||||
@ -42,6 +44,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
const ACTION_UNMUTE_PLAYER = 'PlayerList.UnMutePlayer';
|
const ACTION_UNMUTE_PLAYER = 'PlayerList.UnMutePlayer';
|
||||||
const ACTION_WARN_PLAYER = 'PlayerList.WarnPlayer';
|
const ACTION_WARN_PLAYER = 'PlayerList.WarnPlayer';
|
||||||
const ACTION_KICK_PLAYER = 'PlayerList.KickPlayer';
|
const ACTION_KICK_PLAYER = 'PlayerList.KickPlayer';
|
||||||
|
const ACTION_KICK_PLAYER_VOTE = 'PlayerList.KickPlayerVote';
|
||||||
const ACTION_BAN_PLAYER = 'PlayerList.BanPlayer';
|
const ACTION_BAN_PLAYER = 'PlayerList.BanPlayer';
|
||||||
const ACTION_ADD_AS_MASTER = 'PlayerList.PlayerAddAsMaster';
|
const ACTION_ADD_AS_MASTER = 'PlayerList.PlayerAddAsMaster';
|
||||||
const ACTION_ADD_AS_ADMIN = 'PlayerList.PlayerAddAsAdmin';
|
const ACTION_ADD_AS_ADMIN = 'PlayerList.PlayerAddAsAdmin';
|
||||||
@ -49,6 +52,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
||||||
const ACTION_OPEN_PLAYER_DETAILED = 'PlayerList.OpenPlayerDetailed';
|
const ACTION_OPEN_PLAYER_DETAILED = 'PlayerList.OpenPlayerDetailed';
|
||||||
const ACTION_SPECTATE_PLAYER = 'PlayerList.SpectatePlayer';
|
const ACTION_SPECTATE_PLAYER = 'PlayerList.SpectatePlayer';
|
||||||
|
const DEFAULT_CUSTOM_VOTE_PLUGIN = 'CustomVotesPlugin';
|
||||||
const SHOWN_MAIN_WINDOW = -1;
|
const SHOWN_MAIN_WINDOW = -1;
|
||||||
const MAX_PLAYERS_PER_PAGE = 15;
|
const MAX_PLAYERS_PER_PAGE = 15;
|
||||||
|
|
||||||
@ -277,8 +281,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
|
|
||||||
// Description Label
|
// Description Label
|
||||||
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Advanced Player Actions on " . $listPlayer->nickname));
|
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Advanced Player Actions on " . $listPlayer->nickname));
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->server->isTeamMode()) {
|
if ($this->maniaControl->server->isTeamMode()) {
|
||||||
|
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
||||||
// Force to Red-Team Quad
|
// Force to Red-Team Quad
|
||||||
$redQuad = new Quad_Emblems();
|
$redQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($redQuad);
|
$playerFrame->add($redQuad);
|
||||||
@ -289,7 +295,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$redQuad->setAction(self::ACTION_FORCE_RED . "." . $listPlayer->login);
|
$redQuad->setAction(self::ACTION_FORCE_RED . "." . $listPlayer->login);
|
||||||
|
|
||||||
// Force to Red-Team Description Label
|
// Force to Red-Team Description Label
|
||||||
$script->addTooltip($redQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Red Team!'));
|
$script->addTooltip($redQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force $<" . $listPlayer->nickname . '$> to Red Team!'));
|
||||||
|
|
||||||
// Force to Blue-Team Quad
|
// Force to Blue-Team Quad
|
||||||
$blueQuad = new Quad_Emblems();
|
$blueQuad = new Quad_Emblems();
|
||||||
@ -301,8 +307,23 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." . $listPlayer->login);
|
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." . $listPlayer->login);
|
||||||
|
|
||||||
// Force to Blue-Team Description Label
|
// Force to Blue-Team Description Label
|
||||||
$script->addTooltip($blueQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Blue Team!'));
|
$script->addTooltip($blueQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force $<" . $listPlayer->nickname . '$> to Blue Team!'));
|
||||||
|
|
||||||
|
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
|
||||||
|
// Kick Player Vote
|
||||||
|
$kickQuad = new Quad_UIConstruction_Buttons();
|
||||||
|
$playerFrame->add($kickQuad);
|
||||||
|
$kickQuad->setX($x + 141);
|
||||||
|
$kickQuad->setZ(0.1);
|
||||||
|
$kickQuad->setSubStyle($kickQuad::SUBSTYLE_Validate_Step2);
|
||||||
|
$kickQuad->setSize(3.8, 3.8);
|
||||||
|
$kickQuad->setAction(self::ACTION_KICK_PLAYER_VOTE . "." . $listPlayer->login);
|
||||||
|
|
||||||
|
// Force to Spectator Description Label
|
||||||
|
$script->addTooltip($kickQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Vote a kick vote on $<" . $listPlayer->nickname . '$>!'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
|
||||||
// Force to Play
|
// Force to Play
|
||||||
$playQuad = new Quad_Emblems();
|
$playQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($playQuad);
|
$playerFrame->add($playQuad);
|
||||||
@ -315,7 +336,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Blue-Team Description Label
|
// Force to Blue-Team Description Label
|
||||||
$script->addTooltip($playQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Play!'));
|
$script->addTooltip($playQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Play!'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
|
||||||
// Force to Spectator Quad
|
// Force to Spectator Quad
|
||||||
$spectatorQuad = new Quad_BgRaceScore2();
|
$spectatorQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($spectatorQuad);
|
$playerFrame->add($spectatorQuad);
|
||||||
@ -327,7 +350,20 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
|
|
||||||
// Force to Spectator Description Label
|
// Force to Spectator Description Label
|
||||||
$script->addTooltip($spectatorQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Spectator!'));
|
$script->addTooltip($spectatorQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Spectator!'));
|
||||||
|
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
|
||||||
|
// Force to Spectator Quad
|
||||||
|
$spectatorQuad = new Quad_BgRaceScore2();
|
||||||
|
$playerFrame->add($spectatorQuad);
|
||||||
|
$spectatorQuad->setX($x + 137);
|
||||||
|
$spectatorQuad->setZ(0.1);
|
||||||
|
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
||||||
|
$spectatorQuad->setSize(3.8, 3.8);
|
||||||
|
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC_VOTE . "." . $listPlayer->login);
|
||||||
|
|
||||||
|
// Force to Spectator Description Label
|
||||||
|
$script->addTooltip($spectatorQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Vote for force " . $listPlayer->nickname . '$z to Spectator!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$i++;
|
$i++;
|
||||||
if ($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
if ($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
||||||
@ -667,6 +703,54 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
case self::ACTION_REVOKE_RIGHTS:
|
case self::ACTION_REVOKE_RIGHTS:
|
||||||
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin);
|
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin);
|
||||||
break;
|
break;
|
||||||
|
case self::ACTION_FORCE_SPEC_VOTE:
|
||||||
|
/** @var $votesPlugin CustomVotesPlugin */
|
||||||
|
$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN);
|
||||||
|
|
||||||
|
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
|
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||||
|
|
||||||
|
$startMessage = '$<' . $admin->nickname . '$>$s started a vote to force $<' . $target->nickname . '$> into spectator!';
|
||||||
|
|
||||||
|
$votesPlugin->defineVote('forcespec', "Force $<" . $target->nickname . "$> Spec", true, $startMessage);
|
||||||
|
|
||||||
|
$votesPlugin->startVote($admin, 'forcespec', function ($result) use (&$votesPlugin, &$target) {
|
||||||
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> Player $<' . $target->nickname . '$> forced to Spectator!');
|
||||||
|
$votesPlugin->undefineVote('forcespec');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
||||||
|
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case self::ACTION_KICK_PLAYER_VOTE:
|
||||||
|
/** @var $votesPlugin CustomVotesPlugin */
|
||||||
|
$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN);
|
||||||
|
|
||||||
|
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
|
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||||
|
|
||||||
|
$startMessage = '$<' . $admin->nickname . '$>$s started a vote to kick $<' . $target->nickname . '$>!';
|
||||||
|
|
||||||
|
|
||||||
|
$votesPlugin->defineVote('kick', "Kick $<" . $target->nickname . "$>", true, $startMessage);
|
||||||
|
|
||||||
|
$votesPlugin->startVote($admin, 'kick', function ($result) use (&$votesPlugin, &$target) {
|
||||||
|
$this->maniaControl->chat->sendInformation('$sVote Successfully -> $<' . $target->nickname . '$> got Kicked!');
|
||||||
|
$votesPlugin->undefineVote('kick');
|
||||||
|
|
||||||
|
$message = '$39F You got kicked due a Public vote!$z ';
|
||||||
|
try {
|
||||||
|
$this->maniaControl->client->kick($target->login, $message);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $target->login);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$msg = '$i$ff0 $<' . $player->nickname . '$>$s$39f chooses to boot back to the real world!';
|
$msg = '$i$ff0 $<' . $player->nickname . '$>$s$39f chooses to boot back to the real world!';
|
||||||
$this->maniaControl->chat->sendChat($msg, null, true);
|
$this->maniaControl->chat->sendChat($msg, null, true);
|
||||||
|
|
||||||
$message = '$39F Thanks for Playing, please come back soon!$z';
|
$message = '$39F Thanks for Playing, please come back soon!$z ';
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->kick($player->login, $message);
|
$this->maniaControl->client->kick($player->login, $message);
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
@ -327,7 +327,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$msg = '$i$ff0 $<' . $player->nickname . '$>$s$f00 said: "@"#!" and ragequitted!';
|
$msg = '$i$ff0 $<' . $player->nickname . '$>$s$f00 said: "@"#!" and ragequitted!';
|
||||||
$this->maniaControl->chat->sendChat($msg, null, true);
|
$this->maniaControl->chat->sendChat($msg, null, true);
|
||||||
|
|
||||||
$message = '$39F Thanks for Playing, please come back soon!$z';
|
$message = '$39F Thanks for Playing, please come back soon!$z ';
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->kick($player->login, $message);
|
$this->maniaControl->client->kick($player->login, $message);
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
|
@ -23,6 +23,7 @@ use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
|||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
|
use ManiaControl\Server\Server;
|
||||||
use ManiaControl\Server\ServerCommands;
|
use ManiaControl\Server\ServerCommands;
|
||||||
use Maniaplanet\DedicatedServer\Structures\VoteRatio;
|
use Maniaplanet\DedicatedServer\Structures\VoteRatio;
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished');
|
$this->maniaControl->callbackManager->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_STATUS_CHANGED, $this, 'constructMenu');
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.);
|
||||||
@ -264,12 +266,13 @@ 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 Mapskip');
|
$this->addVoteMenuItem($itemQuad, 15, 'Vote for a Mapskip');
|
||||||
|
|
||||||
|
if ($this->maniaControl->server->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);
|
||||||
$itemQuad->setAction(self::ACTION_START_VOTE . 'teambalance');
|
$itemQuad->setAction(self::ACTION_START_VOTE . 'teambalance');
|
||||||
$this->addVoteMenuItem($itemQuad, 20, 'Vote for Team-Balance');
|
$this->addVoteMenuItem($itemQuad, 20, 'Vote for Team-Balance');
|
||||||
|
}
|
||||||
//Show the Menu's icon
|
//Show the Menu's icon
|
||||||
$this->showIcon();
|
$this->showIcon();
|
||||||
}
|
}
|
||||||
@ -352,11 +355,13 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
* @param bool $idBased
|
* @param bool $idBased
|
||||||
* @param $neededRatio
|
* @param $neededRatio
|
||||||
*/
|
*/
|
||||||
public function defineVote($voteIndex, $voteName, $idBased = false, $neededRatio = -1) {
|
public function defineVote($voteIndex, $voteName, $idBased = false, $startText = '', $neededRatio = -1) {
|
||||||
if ($neededRatio == -1) {
|
if ($neededRatio == -1) {
|
||||||
$neededRatio = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DEFAULT_RATIO);
|
$neededRatio = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DEFAULT_RATIO);
|
||||||
}
|
}
|
||||||
$this->voteCommands[$voteIndex] = new VoteCommand($voteIndex, $voteName, $idBased, $neededRatio);
|
$voteCommand = new VoteCommand($voteIndex, $voteName, $idBased, $neededRatio);
|
||||||
|
$voteCommand->startText = $startText;
|
||||||
|
$this->voteCommands[$voteIndex] = $voteCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -410,7 +415,13 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->currentVote->neededPlayerRatio = floatval($this->maniaControl->settingManager->getSetting($this, self::SETTING_DEFAULT_PLAYER_RATIO));
|
$this->currentVote->neededPlayerRatio = floatval($this->maniaControl->settingManager->getSetting($this, self::SETTING_DEFAULT_PLAYER_RATIO));
|
||||||
$this->currentVote->function = $function;
|
$this->currentVote->function = $function;
|
||||||
|
|
||||||
$this->maniaControl->chat->sendSuccess('$<' . $player->nickname . '$>$s started a $<' . $this->currentVote->voteCommand->name . '$>!');
|
if ($this->currentVote->voteCommand->startText != '') {
|
||||||
|
$message = $this->currentVote->voteCommand->startText;
|
||||||
|
} else {
|
||||||
|
$message = '$<' . $player->nickname . '$>$s started a $<' . $this->currentVote->voteCommand->name . '$>!';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -506,7 +517,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($pos_x, $pos_y, 30);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -767,10 +778,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
* Vote Command Structure
|
* Vote Command Structure
|
||||||
*/
|
*/
|
||||||
class VoteCommand {
|
class VoteCommand {
|
||||||
public $index;
|
public $index = '';
|
||||||
public $name;
|
public $name = '';
|
||||||
public $neededRatio;
|
public $neededRatio = 0;
|
||||||
public $idBased;
|
public $idBased = false;
|
||||||
|
public $startText = '';
|
||||||
|
|
||||||
public function __construct($index, $name, $idBased, $neededRatio) {
|
public function __construct($index, $name, $idBased, $neededRatio) {
|
||||||
$this->index = $index;
|
$this->index = $index;
|
||||||
|
Loading…
Reference in New Issue
Block a user