fixed leftover maniascript logging

This commit is contained in:
Steffen Schröder 2014-04-28 18:42:50 +02:00
parent 2442177166
commit 2cdb00131a
3 changed files with 41 additions and 22 deletions

View File

@ -254,7 +254,6 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
PageFound = True; PageFound = True;
} }
} }
log(Now^PageFound^CurrentPage^_Pages);
if (!PageFound && _BrowseAction != 0) { if (!PageFound && _BrowseAction != 0) {
declare Text ChunkAction; declare Text ChunkAction;
if (_BrowseAction < 0) { if (_BrowseAction < 0) {
@ -265,7 +264,6 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
if (_ChunkActionAppendPageNumber) { if (_ChunkActionAppendPageNumber) {
ChunkAction ^= CurrentPage; ChunkAction ^= CurrentPage;
} }
log(Now^ChunkAction);
TriggerPageAction(ChunkAction); TriggerPageAction(ChunkAction);
} }
if (_PageLabelId == \"\") return; if (_PageLabelId == \"\") return;

View File

@ -158,6 +158,23 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
} }
} }
/**
* Hide the Manialink with the given Id
*
* @param mixed $manialinkId
* @param mixed $logins
*/
public function hideManialink($manialinkId, $logins = null) {
if (is_array($manialinkId)) {
foreach ($manialinkId as $mlId) {
$this->hideManialink($mlId, $logins);
}
} else {
$emptyManialink = new ManiaLink($manialinkId);
$this->sendManialink($emptyManialink, $logins);
}
}
/** /**
* Send the given manialink to players * Send the given manialink to players
* *

View File

@ -21,7 +21,7 @@ use ManiaControl\Settings\SettingManager;
/** /**
* ManiaControl Karma Plugin * ManiaControl Karma Plugin
* *
* @author kremsy and steeffeen * @author kremsy and steeffeen
* @copyright ManiaControl Copyright © 2014 ManiaControl Team * @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
@ -68,13 +68,14 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
private $maniaControl = null; private $maniaControl = null;
private $updateManialink = false; private $updateManialink = false;
/** /**
*
* @var ManiaLink $manialink * @var ManiaLink $manialink
*/ */
private $manialink = null; private $manialink = null;
private $mxKarma = array(); private $mxKarma = array();
/** /**
* *
* @see \ManiaControl\Plugins\Plugin * @see \ManiaControl\Plugins\Plugin
*/ */
public static function prepare(ManiaControl $maniaControl) { public static function prepare(ManiaControl $maniaControl) {
@ -126,6 +127,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
// Open MX-Karma Session // Open MX-Karma Session
$this->mxKarmaOpenSession(); $this->mxKarmaOpenSession();
$this->mxKarma['startTime'] = time(); $this->mxKarma['startTime'] = time();
return true; return true;
} }
@ -134,8 +136,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
* @see \ManiaControl\Plugins\Plugin::unload() * @see \ManiaControl\Plugins\Plugin::unload()
*/ */
public function unload() { public function unload() {
$emptyManialink = new ManiaLink(self::MLID_KARMA); $this->maniaControl->manialinkManager->hideManialink(self::MLID_KARMA);
$this->maniaControl->manialinkManager->sendManialink($emptyManialink);
$this->maniaControl->callbackManager->unregisterCallbackListener($this); $this->maniaControl->callbackManager->unregisterCallbackListener($this);
$this->maniaControl->timerManager->unregisterTimerListenings($this); $this->maniaControl->timerManager->unregisterTimerListenings($this);
unset($this->maniaControl); unset($this->maniaControl);
@ -183,7 +184,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Handle ManiaControl 1 Second callback * Handle ManiaControl 1 Second callback
* *
* @param $time * @param $time
*/ */
public function handle1Second($time) { public function handle1Second($time) {
@ -220,10 +221,12 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
// Update karma gauge & label // Update karma gauge & label
/** /**
*
* @var Gauge $karmaGauge * @var Gauge $karmaGauge
*/ */
$karmaGauge = $this->manialink->karmaGauge; $karmaGauge = $this->manialink->karmaGauge;
/** /**
*
* @var Label $karmaLabel * @var Label $karmaLabel
*/ */
$karmaLabel = $this->manialink->karmaLabel; $karmaLabel = $this->manialink->karmaLabel;
@ -256,7 +259,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Handle BeginMap ManiaControl callback * Handle BeginMap ManiaControl callback
* *
* @param Map $map * @param Map $map
*/ */
public function handleBeginMap(Map $map) { public function handleBeginMap(Map $map) {
@ -281,7 +284,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Handle PlayerConnect callback * Handle PlayerConnect callback
* *
* @param \ManiaControl\Players\Player $player * @param \ManiaControl\Players\Player $player
*/ */
public function handlePlayerConnect(Player $player) { public function handlePlayerConnect(Player $player) {
@ -296,7 +299,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Handle PlayerChat callback * Handle PlayerChat callback
* *
* @param array $chatCallback * @param array $chatCallback
*/ */
public function handlePlayerChat(array $chatCallback) { public function handlePlayerChat(array $chatCallback) {
@ -328,7 +331,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Handle a vote done by a player * Handle a vote done by a player
* *
* @param Player $player * @param Player $player
* @param int $vote * @param int $vote
* @return bool * @return bool
@ -390,7 +393,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Query the player to update the manialink * Query the player to update the manialink
* *
* @param Player $player * @param Player $player
*/ */
private function queryManialinkUpdateFor(Player $player) { private function queryManialinkUpdateFor(Player $player) {
@ -448,7 +451,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Save the vote of the player for the map * Save the vote of the player for the map
* *
* @param Player $player * @param Player $player
* @param Map $map * @param Map $map
* @param float $vote * @param float $vote
@ -477,7 +480,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Get the current vote of the player for the map * Get the current vote of the player for the map
* *
* @param Player $player * @param Player $player
* @param Map $map * @param Map $map
* @return int * @return int
@ -505,7 +508,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Get the current karma of the map * Get the current karma of the map
* *
* @param Map $map * @param Map $map
* @return float | bool * @return float | bool
*/ */
@ -534,7 +537,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Get the current Votes for the Map * Get the current Votes for the Map
* *
* @param Map $map * @param Map $map
* @return array * @return array
*/ */
@ -562,7 +565,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Build karma voting manialink if necessary * Build karma voting manialink if necessary
* *
* @param bool $forceBuild * @param bool $forceBuild
*/ */
private function buildManialink($forceBuild = false) { private function buildManialink($forceBuild = false) {
@ -624,7 +627,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Update Settings * Update Settings
* *
* @param $class * @param $class
* @param $settingName * @param $settingName
* @param $value * @param $value
@ -702,7 +705,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Activates the MX-Karma Session * Activates the MX-Karma Session
* *
* @param $mxKarmaCode * @param $mxKarmaCode
*/ */
private function activateSession($mxKarmaCode) { private function activateSession($mxKarmaCode) {
@ -775,6 +778,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$properties['playerlogins'] = array(); $properties['playerlogins'] = array();
foreach ($this->maniaControl->playerManager->getPlayers() as $plyr) { foreach ($this->maniaControl->playerManager->getPlayers() as $plyr) {
/** /**
*
* @var Player $player * @var Player $player
*/ */
$properties['playerlogins'][] = $plyr->login; $properties['playerlogins'][] = $plyr->login;
@ -822,7 +826,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Import old Karma votes to Mania-Exchange Karma * Import old Karma votes to Mania-Exchange Karma
* *
* @param Map $map * @param Map $map
*/ */
public function importMxKarmaVotes(Map $map) { public function importMxKarmaVotes(Map $map) {
@ -903,7 +907,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Post the Karma votes to MX-Karma * Post the Karma votes to MX-Karma
* *
* @param Map $map * @param Map $map
* @param array $votes * @param array $votes
* @param bool $import * @param bool $import
@ -968,7 +972,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Builds a sha512 activation Hash for the MX-Karma * Builds a sha512 activation Hash for the MX-Karma
* *
* @param $sessionSeed * @param $sessionSeed
* @param $mxKey * @param $mxKey
* @return string * @return string