diff --git a/application/core/Chat.php b/application/core/Chat.php index 7ae9a2dd..5a1822f9 100644 --- a/application/core/Chat.php +++ b/application/core/Chat.php @@ -72,7 +72,7 @@ class Chat { if (!$this->maniaControl->client) { return false; } - $chatMessage = '$z$<' . $this->getPrefix($prefix) . $message . '$>$z'; + $chatMessage = '$z$s$<' . $this->getPrefix($prefix) . $message . '$>$z$s'; if (!$login) { $this->maniaControl->client->chatSendServerMessage($chatMessage); } else { diff --git a/application/core/Commands/HelpManager.php b/application/core/Commands/HelpManager.php index 8972b477..d53d7c32 100644 --- a/application/core/Commands/HelpManager.php +++ b/application/core/Commands/HelpManager.php @@ -51,7 +51,7 @@ class HelpManager implements CommandListener, CallbackListener { */ public function command_adminHelp(array $chat, Player $player) { //TODO only show first command in command arrays - $message = '$sSupported Admin Commands: '; + $message = 'Supported Admin Commands: '; foreach(array_reverse($this->adminCommands) as $command) { $message .= $command['Name'] . ','; } @@ -67,7 +67,7 @@ class HelpManager implements CommandListener, CallbackListener { */ public function command_playerHelp(array $chat, Player $player) { //TODO only show first command in command arrays - $message = '$sSupported Player Commands: '; + $message = 'Supported Player Commands: '; foreach(array_reverse($this->playerCommands) as $command) { $message .= $command['Name'] . ','; } diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 474c196d..4cef8917 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -52,8 +52,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { /* * Private Properties */ - private $maniaControl = null; - private $mapListShown = array(); + private $maniaControl = null; + private $mapListShown = array(); + private $mapsInListShown = array(); /** * Create a new MapList Instance @@ -67,7 +68,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); $this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); - $this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget'); + $this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidgetQueue'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'updateWidget'); @@ -107,14 +108,24 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * * @param Player $player */ - public function showMapList(Player $player) { + public function showMapList(Player $player, $maps = null) { $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); $this->mapListShown[$player->login] = true; // Get Maps - $mapList = $this->maniaControl->mapManager->getMaps(); + if(is_null($maps) && $maps != 'redirect') { + $mapList = $this->maniaControl->mapManager->getMaps(); + } else { + if(array_key_exists($player->login, $this->mapsInListShown) && $maps == 'redirect') { + $mapList = $this->mapsInListShown[$player->login]; + } else { + $mapList = $maps; + } + } + + $this->mapsInListShown[$player->login] = $mapList; $pagesId = ''; if (count($mapList) > self::MAX_MAPS_PER_PAGE) { @@ -563,9 +574,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { break; case self::ACTION_QUEUED_MAP: $this->maniaControl->mapManager->mapQueue->addMapToMapQueue($callback[1][1], $actionArray[2]); + $this->showMapList($player, 'redirect'); break; case self::ACTION_UNQUEUE_MAP: $this->maniaControl->mapManager->mapQueue->removeFromMapQueue($player, $actionArray[2]); + $this->showMapList($player, 'redirect'); break; } } @@ -585,4 +598,20 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { } } } + + /** + * Reopen the widget on MapQueue changed + */ + public function updateWidgetQueue() { + foreach($this->mapListShown as $login => $shown) { + if ($shown) { + $player = $this->maniaControl->playerManager->getPlayer($login); + if ($player) { + $this->showMapList($player, 'redirect'); + } else { + unset($this->mapListShown[$login]); + } + } + } + } } \ No newline at end of file