Page 1 of 1

Allow Karma plugin to accept +++/--- votes

Posted: 10 Oct 2019, 18:40
by Nicklander
Lots of people are used to the tripple votes +++ and ---.
ManiaControl's MX Karma plugin only supports ++ and -- tho.
Is it possible to allow +++/--- like in TMNF ?
If yes, how ?
If not, then can I at least create +++/--- as an alias for ++/-- as a workaround ? So that voting +++ does the same as ++ ?

I'm not very familiar with how exactly this plugin works, maybe someone can help me to allow +++/--- votes.

Code: Select all

/**
	 * Handle PlayerChat callback
	 *
	 * @param array $chatCallback
	 */
	public function handlePlayerChat(array $chatCallback) {
		$login  = $chatCallback[1][1];
		$player = $this->maniaControl->getPlayerManager()->getPlayer($login);
		if (!$player) {
			return;
		}
		$message = $chatCallback[1][2];
		if ($chatCallback[1][3]) {
			$message = substr($message, 1);
		}
		if (preg_match('/[^+-]/', $message)) {
			return;
		}
		$countPositive = substr_count($message, '+');
		$countNegative = substr_count($message, '-');
		if ($countPositive <= 0 && $countNegative <= 0) {
			return;
		}
		$vote    = $countPositive - $countNegative;
		$success = $this->handleVote($player, $vote);
		if (!$success) {
			$this->maniaControl->getChat()->sendError('Error occurred.', $player->login);
			return;
		}
		$this->maniaControl->getChat()->sendSuccess('Vote updated!', $player->login);
	}

Re: Allow Karma plugin to accept +++/--- votes

Posted: 10 Oct 2019, 18:56
by undef.de
The +++ and --- (and ++, +, -- and -) votes come from the ManiaKarma plugin I made for XAseco(2) and UASECO, but for ManiaControl nobody did the plugin yet.

Re: Allow Karma plugin to accept +++/--- votes

Posted: 10 Oct 2019, 21:12
by Nicklander
undef.de wrote:
10 Oct 2019, 18:56
The +++ and --- (and ++, +, -- and -) votes come from the ManiaKarma plugin I made for XAseco(2) and UASECO, but for ManiaControl nobody did the plugin yet.
Well there's a KarmaPlugin that even syncs with MX, it works perfectly.
Could you add +++ and --- as an alias, so that it does the same as ++/-- ?

Re: Allow Karma plugin to accept +++/--- votes

Posted: 11 Oct 2019, 11:07
by undef.de
Nicklander wrote:
10 Oct 2019, 21:12
Well there's a KarmaPlugin that even syncs with MX, it works perfectly.
ManiaKarma != MXKarma 8-)
Nicklander wrote:
10 Oct 2019, 21:12
Could you add +++ and --- as an alias, so that it does the same as ++/-- ?
No sorry, I'm not familiar with the code of ManiaControl at all.

Re: Allow Karma plugin to accept +++/--- votes

Posted: 28 Oct 2019, 17:57
by ranig
Nicklander wrote:
10 Oct 2019, 21:12
undef.de wrote:
10 Oct 2019, 18:56
The +++ and --- (and ++, +, -- and -) votes come from the ManiaKarma plugin I made for XAseco(2) and UASECO, but for ManiaControl nobody did the plugin yet.
Well there's a KarmaPlugin that even syncs with MX, it works perfectly.
Could you add +++ and --- as an alias, so that it does the same as ++/-- ?
You just need to go in the settings of the KarmaPlugin and change the "Available Votes" setting to -3,3 and you will be able to vote +++ and --- (as well as any combination of + and - in between). You can do this in-game, no need to go in the code or the configuration files.