TrackManiaControl/application/core/Maps/MapList.php

500 lines
16 KiB
PHP
Raw Normal View History

2013-12-14 22:00:59 +01:00
<?php
namespace ManiaControl\Maps;
use FML\Controls\Control;
2013-12-29 19:21:29 +01:00
use FML\Controls\Gauge;
2013-12-14 22:00:59 +01:00
use FML\Controls\Label;
2013-12-31 02:27:40 +01:00
use FML\Controls\Labels\Label_Button;
use FML\Controls\Labels\Label_Text;
2013-12-31 02:27:40 +01:00
use FML\Controls\Quads\Quad_Bgs1;
use FML\Controls\Quads\Quad_BgsPlayerCard;
2013-12-28 23:35:40 +01:00
use FML\Controls\Quads\Quad_Icons128x128_1;
2013-12-14 22:00:59 +01:00
use FML\Controls\Quads\Quad_Icons64x64_1;
2013-12-16 12:16:33 +01:00
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
2013-12-15 15:13:56 +01:00
use FML\Script\Script;
use FML\Script\Tooltips;
2013-12-30 16:58:35 +01:00
use KarmaPlugin;
use ManiaControl\Admin\AuthenticationManager;
2013-12-15 15:13:56 +01:00
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
2013-12-29 19:21:29 +01:00
use ManiaControl\ColorUtil;
2013-12-31 11:39:54 +01:00
use ManiaControl\Formatter;
use ManiaControl\Manialinks\ManialinkManager;
2013-12-14 22:00:59 +01:00
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use FML\Controls\Frame;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\ManiaLink;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use MXInfoSearcher;
2013-12-14 22:00:59 +01:00
2013-12-24 13:09:39 +01:00
/**
* MapList Widget Class
*
* @author steeffeen & kremsy
*/
2013-12-15 15:13:56 +01:00
class MapList implements ManialinkPageAnswerListener, CallbackListener {
2013-12-18 15:48:33 +01:00
/**
* Constants
*/
2013-12-15 15:13:56 +01:00
const ACTION_ADD_MAP = 'MapList.AddMap';
2013-12-16 12:41:14 +01:00
const ACTION_ERASE_MAP = 'MapList.EraseMap';
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
2013-12-28 22:43:57 +01:00
const ACTION_JUKE_MAP = 'MapList.JukeMap';
2013-12-15 12:34:35 +01:00
const MAX_MAPS_PER_PAGE = 15;
2013-12-28 23:24:54 +01:00
const SHOW_MX_LIST = 1;
const SHOW_MAP_LIST = 2;
2013-12-15 15:13:56 +01:00
2013-12-29 19:21:29 +01:00
const DEFAULT_KARMA_PLUGIN = 'KarmaPlugin';
2013-12-14 22:00:59 +01:00
/**
* Private properties
*/
private $maniaControl = null;
2013-12-28 23:24:54 +01:00
private $mapListShown = array();
private $width;
private $height;
private $quadStyle;
private $quadSubstyle;
2013-12-14 22:00:59 +01:00
/**
* Create a new server commands instance
*
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
2013-12-29 22:52:07 +01:00
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this,'closeWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,'handleManialinkPageAnswer');
2013-12-14 22:00:59 +01:00
2013-12-29 19:21:29 +01:00
//Update Widget actions
2013-12-31 12:25:03 +01:00
$this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget');
2013-12-28 23:24:54 +01:00
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPLIST_UPDATED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'updateWidget'); //TODO not working yet
2013-12-29 19:21:29 +01:00
//TODO update on Karma Update
2013-12-28 23:24:54 +01:00
//settings
2013-12-29 10:03:58 +01:00
$this->width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
2013-12-29 15:52:01 +01:00
/** @var just a test $itemQuad
$itemQuad = new Quad();
$itemQuad->setStyles('Icons128x32_1', Quad_Icons128x128_1::SUBSTYLE_Create);
$itemQuad->setAction(self::ACTION_ADD_MAP);
$this->maniaControl->adminMenu->addMenuItem($itemQuad, 4);*/
2013-12-14 22:00:59 +01:00
}
2013-12-15 12:34:35 +01:00
/**
* Displays the Mania Exchange List
* @param array $chatCallback
* @param Player $player
*/
public function showManiaExchangeList(array $chatCallback, Player $player){
2013-12-28 23:24:54 +01:00
$this->mapListShown[$player->login] = self::SHOW_MX_LIST;
$params = explode(' ', $chatCallback[1][2]);
$serverInfo = $this->maniaControl->server->getSystemInfo();
$title = strtoupper(substr($serverInfo['TitleId'], 0, 2));
$mapName = '';
$author = '';
$environment = ''; //TODO also get actual environment
$recent = true;
if(count($params) > 1){
foreach($params as $param){
if($param == '/xlist')
continue;
if (strtolower(substr($param, 0, 5)) == 'auth:') {
$author = substr($param, 5);
} elseif (strtolower(substr($param, 0, 4)) == 'env:') {
$environment = substr($param, 4);
} else {
if ($mapName == '')
$mapName = $param;
else // concatenate words in name
$mapName .= '%20' . $param;
}
}
$recent = false;
}
2013-12-14 22:00:59 +01:00
// search for matching maps
$maps = new MXInfoSearcher($title, $mapName, $author, $environment, $recent);
//check if there are any results
if(!$maps->valid()){
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
if($maps->error != '')
trigger_error($maps->error, E_USER_WARNING);
return;
}
2013-12-29 19:21:29 +01:00
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$frame = $this->buildMainFrame();
2013-12-15 12:34:35 +01:00
$maniaLink->add($frame);
2013-12-15 15:13:56 +01:00
// Create script and features
$script = new Script();
$maniaLink->setScript($script);
2013-12-15 12:34:35 +01:00
//Start offsets
$x = -$this->width / 2;
$y = $this->height / 2;
//Headline
$headFrame = new Frame();
$frame->add($headFrame);
2013-12-26 17:27:21 +01:00
$headFrame->setY($y - 5);
2013-12-18 15:48:33 +01:00
$array = array("Id" => $x + 5, "Name" => $x + 17, "Author" => $x + 65, "Mood" => $x + 100, "Type" => $x + 115);
2013-12-15 12:34:35 +01:00
$this->maniaControl->manialinkManager->labelLine($headFrame,$array);
2013-12-14 22:00:59 +01:00
2013-12-15 12:34:35 +01:00
$i = 0;
$y -= 10;
foreach($maps as $map){
$mapFrame = new Frame();
$frame->add($mapFrame);
2013-12-18 15:48:33 +01:00
$array = array($map->id => $x + 5, $map->name => $x + 17, $map->author => $x + 65, $map->mood => $x + 100, $map->maptype => $x + 115);
2013-12-15 12:34:35 +01:00
$this->maniaControl->manialinkManager->labelLine($mapFrame,$array);
$mapFrame->setY($y);
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //todoSET as setting who can add maps
//Add-Map-Button
$addQuad = new Quad_Icons64x64_1();
$mapFrame->add($addQuad);
$addQuad->setX($x + 15);
$addQuad->setZ(-0.1);
$addQuad->setSubStyle($addQuad::SUBSTYLE_Add);
$addQuad->setSize(4,4);
$addQuad->setAction(self::ACTION_ADD_MAP . "." .$map->id);
//Description Label
$descriptionLabel = new Label();
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Add-Map: {$map->name}");
2013-12-31 11:18:12 +01:00
$script->addTooltip($addQuad, $descriptionLabel);
2013-12-29 12:01:13 +01:00
}
2013-12-15 15:13:56 +01:00
$y -= 4;
2013-12-15 12:34:35 +01:00
$i++;
if($i == self::MAX_MAPS_PER_PAGE)
break;
}
//TODO add MX info screen
2013-12-14 22:00:59 +01:00
//render and display xml
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
}
/**
* Builds the mainFrame
* @return Frame $frame
*/
public function buildMainFrame(){
2013-12-14 22:00:59 +01:00
//mainframe
$frame = new Frame();
$frame->setSize($this->width,$this->height);
2013-12-14 22:00:59 +01:00
$frame->setPosition(0, 0);
//Background Quad
$backgroundQuad = new Quad();
$frame->add($backgroundQuad);
$backgroundQuad->setSize($this->width,$this->height);
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
// Add Close Quad (X)
$closeQuad = new Quad_Icons64x64_1();
$frame->add($closeQuad);
$closeQuad->setPosition($this->width * 0.483, $this->height * 0.467, 3);
$closeQuad->setSize(6, 6);
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
2013-12-24 13:09:39 +01:00
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
return $frame;
}
/**
* Displayes a MapList on the screen
* @param Player $player
*/
public function showMapList(Player $player){
2013-12-29 15:52:01 +01:00
2013-12-28 23:24:54 +01:00
$this->mapListShown[$player->login] = self::SHOW_MAP_LIST;
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$frame = $this->buildMainFrame();
$maniaLink->add($frame);
2013-12-14 22:00:59 +01:00
2013-12-16 12:16:33 +01:00
// Create script and features
$script = new Script();
$maniaLink->setScript($script);
2013-12-15 11:55:44 +01:00
//Headline
$headFrame = new Frame();
$frame->add($headFrame);
2013-12-26 17:27:21 +01:00
$headFrame->setY($this->height / 2 - 5);
2013-12-15 11:55:44 +01:00
$x = -$this->width / 2;
2013-12-30 23:53:42 +01:00
$array = array("Id" => $x + 5, "Mx ID" => $x + 10, "MapName" => $x + 20, "Author" => $x + 68, "Karma" => $x + 115, "Actions" => $this->width / 2 - 15);
2013-12-15 11:55:44 +01:00
$this->maniaControl->manialinkManager->labelLine($headFrame,$array);
//Get Maplist
2013-12-14 22:00:59 +01:00
$mapList = $this->maniaControl->mapManager->getMapList();
2013-12-15 12:34:35 +01:00
//TODO add pages
2013-12-31 12:25:03 +01:00
$jukedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking();
2013-12-30 16:58:35 +01:00
/** @var KarmaPlugin $karmaPlugin */
2013-12-29 19:21:29 +01:00
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN);
2013-12-14 22:00:59 +01:00
$id = 1;
$y = $this->height / 2 - 10;
2013-12-30 16:58:35 +01:00
/** @var Map $map */
2013-12-14 22:00:59 +01:00
foreach($mapList as $map){
2013-12-30 16:58:35 +01:00
//Map Frame
2013-12-14 22:00:59 +01:00
$mapFrame = new Frame();
$frame->add($mapFrame);
2013-12-30 16:58:35 +01:00
$mapFrame->setZ(0.1);
2013-12-14 22:00:59 +01:00
$mapFrame->setY($y);
2013-12-16 12:16:33 +01:00
2013-12-31 02:27:40 +01:00
if($id % 2 != 0){
$lineQuad = new Quad_BgsPlayerCard();
$mapFrame->add($lineQuad);
$lineQuad->setSize($this->width, 4);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setZ(0.001);
}
2013-12-30 16:58:35 +01:00
if($this->maniaControl->mapManager->getCurrentMap() === $map){
$currentQuad = new Quad_Icons64x64_1();
2013-12-30 20:15:38 +01:00
$mapFrame->add($currentQuad);
2013-12-30 16:58:35 +01:00
$currentQuad->setX($x + 3.5);
$currentQuad->setZ(0.2);
$currentQuad->setSize(4, 4);
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
}
$mxId = '-';
if(isset($map->mx->id))
$mxId = $map->mx->id;
//Display Maps
2013-12-30 23:53:42 +01:00
$array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 68);
2013-12-30 16:58:35 +01:00
$this->maniaControl->manialinkManager->labelLine($mapFrame,$array);
//TODO detailed mx info page with link to mxo
//TODO action detailed map info
//TODO side switch
2013-12-28 23:57:02 +01:00
//Jukebox Description Label
$descriptionLabel = new Label();
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
//Juke-Map-Label
if(isset($jukedMaps[$map->uid])){
$jukeLabel = new Label_Text();
$mapFrame->add($jukeLabel);
2013-12-28 23:57:02 +01:00
$jukeLabel->setX($this->width/2 - 15);
$jukeLabel->setAlign(Control::CENTER,Control::CENTER);
$jukeLabel->setZ(0.2);
$jukeLabel->setTextSize(1.5);
$jukeLabel->setText($jukedMaps[$map->uid]);
$jukeLabel->setTextColor("FFF");
2013-12-28 23:57:02 +01:00
$descriptionLabel->setText("{$map->name} \$zis on Jukebox Position: {$jukedMaps[$map->uid]}");
2013-12-31 10:05:38 +01:00
//$tooltips->add($jukeLabel, $descriptionLabel);
2013-12-28 23:57:02 +01:00
}else{
//Juke-Map-Button
2013-12-31 02:27:40 +01:00
//$jukeQuad = new Quad_Icons128x128_1();
$jukeQuad = new Label_Button();
2013-12-28 23:57:02 +01:00
$mapFrame->add($jukeQuad);
$jukeQuad->setX($this->width/2 - 15);
$jukeQuad->setZ(0.2);
2013-12-31 02:27:40 +01:00
$jukeQuad->setSize(3,3);
// $jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load);
2013-12-28 23:57:02 +01:00
$jukeQuad->setAction(self::ACTION_JUKE_MAP . "." . $map->uid);
2013-12-31 02:27:40 +01:00
$jukeQuad->setText("+");
$jukeQuad->setTextColor("09F");
2013-12-31 11:18:12 +01:00
2013-12-28 23:57:02 +01:00
$descriptionLabel->setText("Add Map to Jukebox: {$map->name}");
2013-12-31 10:40:03 +01:00
$script->addTooltip($jukeQuad, $descriptionLabel);
2013-12-28 23:57:02 +01:00
}
2013-12-28 22:43:57 +01:00
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps
2013-12-16 12:41:14 +01:00
//erase map quad
2013-12-31 02:27:40 +01:00
//$eraseQuad = new Quad_UIConstruction_Buttons();
$eraseQuad = new Label_Button(); //TODO change name to label
2013-12-16 12:41:14 +01:00
$mapFrame->add($eraseQuad);
$eraseQuad->setX($this->width/2 - 5);
$eraseQuad->setZ(0.2);
2013-12-31 02:27:40 +01:00
$eraseQuad->setSize(3,3);
$eraseQuad->setTextSize(1);
$eraseQuad->setText("x");
$eraseQuad->setTextColor("A00");
//$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
2013-12-16 13:14:26 +01:00
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
2013-12-16 12:41:14 +01:00
//Description Label
$descriptionLabel = new Label();
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Remove Map: {$map->name}");
2013-12-31 10:40:03 +01:00
$script->addTooltip($eraseQuad, $descriptionLabel);
2013-12-16 12:41:14 +01:00
}
2013-12-28 22:43:57 +01:00
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){ //TODO SET as setting who can add maps
2013-12-16 12:41:14 +01:00
//switch to map quad
2013-12-31 02:27:40 +01:00
//$switchToQuad = new Quad_Icons64x64_1(); //TODO change name to label
$switchToQuad = new Label_Button();
2013-12-16 12:41:14 +01:00
$mapFrame->add($switchToQuad);
$switchToQuad->setX($this->width/2 - 10);
$switchToQuad->setZ(0.2);
2013-12-31 02:27:40 +01:00
$switchToQuad->setSize(3, 3);
//$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext);
$switchToQuad->setText("»");
$switchToQuad->setTextColor("0F0");
2013-12-16 12:41:14 +01:00
$switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1));
2013-12-16 12:16:33 +01:00
2013-12-16 12:41:14 +01:00
$descriptionLabel = new Label();
$frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Switch Directly to Map: {$map->name}");
2013-12-31 10:40:03 +01:00
$script->addTooltip($switchToQuad, $descriptionLabel);
2013-12-16 12:41:14 +01:00
}
2013-12-29 12:01:13 +01:00
2013-12-29 19:21:29 +01:00
//Display Karma bar
if($karmaPlugin != null){
$karma = $karmaPlugin->getMapKarma($map);
$votes = $karmaPlugin->getMapVotes($map);
if(is_numeric($karma)){
$karmaGauge = new Gauge();
$mapFrame->add($karmaGauge);
2013-12-31 02:27:40 +01:00
$karmaGauge->setZ(2);
2013-12-30 23:53:42 +01:00
$karmaGauge->setX($x + 120);
2013-12-29 19:21:29 +01:00
$karmaGauge->setSize(20, 9);
$karmaGauge->setDrawBg(false);
$karma = floatval($karma);
$karmaGauge->setRatio($karma + 0.15 - $karma * 0.15);
$karmaColor = ColorUtil::floatToStatusColor($karma);
$karmaGauge->setColor($karmaColor . '9');
$karmaLabel = new Label();
$mapFrame->add($karmaLabel);
2013-12-31 02:27:40 +01:00
$karmaLabel->setZ(2);
2013-12-30 23:53:42 +01:00
$karmaLabel->setX($x + 120);
2013-12-29 19:21:29 +01:00
$karmaLabel->setSize(20 * 0.9, 5);
$karmaLabel->setTextSize(0.9);
$karmaLabel->setTextColor("000");
$karmaLabel->setAlign(Control::CENTER, Control::CENTER);
$karmaLabel->setText(' ' . round($karma * 100.) . '% (' . $votes['count'] . ')');
}
}
2013-12-29 12:01:13 +01:00
2013-12-14 22:00:59 +01:00
$y -= 4;
$id++;
2013-12-16 14:21:30 +01:00
if($id == self::MAX_MAPS_PER_PAGE + 1)
2013-12-15 12:34:35 +01:00
break;
2013-12-14 22:00:59 +01:00
}
//TODO pages
2013-12-14 22:00:59 +01:00
//render and display xml
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
2013-12-14 22:00:59 +01:00
}
/**
* Closes the widget
* @param array $callback
*/
2013-12-29 22:52:07 +01:00
public function closeWidget(array $callback) {
$player = $callback[1];
2013-12-28 23:24:54 +01:00
unset($this->mapListShown[$player->login]);
2013-12-14 22:00:59 +01:00
}
2013-12-15 15:13:56 +01:00
/**
* @param array $callback
*/
public function handleManialinkPageAnswer(array $callback){
$actionId = $callback[1][2];
$addMap = (strpos($actionId, self::ACTION_ADD_MAP) === 0);
2013-12-16 12:41:14 +01:00
$eraseMap = (strpos($actionId, self::ACTION_ERASE_MAP) === 0);
$switchMap = (strpos($actionId, self::ACTION_SWITCH_MAP) === 0);
2013-12-28 22:43:57 +01:00
$jukeMap = (strpos($actionId, self::ACTION_JUKE_MAP) === 0);
2013-12-16 12:41:14 +01:00
2013-12-28 22:43:57 +01:00
if(!$addMap && !$eraseMap && !$switchMap && !$jukeMap)
2013-12-15 15:13:56 +01:00
return;
$actionArray = explode(".", $actionId);
2013-12-16 12:41:14 +01:00
2013-12-16 13:14:26 +01:00
$player = $this->maniaControl->playerManager->getPlayer($callback[1][1]);
2013-12-16 12:41:14 +01:00
2013-12-16 13:14:26 +01:00
if($addMap){ //TODO log and chat message
2013-12-16 14:21:30 +01:00
$this->maniaControl->mapManager->addMapFromMx(intval($actionArray[2]),$callback[1][1]); //TODO bestätigung
2013-12-16 13:14:26 +01:00
}else if($eraseMap){ //TODO log and chat message
$this->maniaControl->mapManager->eraseMap(intval($actionArray[2]), $actionArray[3]); //TODO bestätigung
$this->showMapList($player);
2013-12-16 12:41:14 +01:00
}else if($switchMap){ //TODO log and chat message
2013-12-16 13:14:26 +01:00
$this->maniaControl->client->query('JumpToMapIndex', intval($actionArray[2])); //TODO bestätigung
$mapList = $this->maniaControl->mapManager->getMapList();
$this->maniaControl->chat->sendSuccess('Map switched to $z$<' . $mapList[$actionArray[2]]->name . '$>!'); //TODO specified message, who done it?
2013-12-31 11:39:54 +01:00
$this->maniaControl->log(Formatter::stripCodes('Skipped to $z$<' . $mapList[$actionArray[2]]->name . '$>!'));
2013-12-28 22:43:57 +01:00
}else if($jukeMap){
$this->maniaControl->mapManager->jukebox->addMapToJukebox($callback[1][1], $actionArray[2]);
2013-12-16 12:41:14 +01:00
}
2013-12-15 15:13:56 +01:00
}
2013-12-28 23:24:54 +01:00
/**
* Reopen the widget on Map Begin, MapListChanged
* @param array $callback
*/
public function updateWidget(array $callback){
foreach($this->mapListShown as $login => $shown){
if($shown){
$player = $this->maniaControl->playerManager->getPlayer($login);
if($player != null){
if($shown == self::SHOW_MX_LIST){
//TODO
}else if($shown == self::SHOW_MAP_LIST){
$this->showMapList($player);
}
}else{
unset($this->mapListShown[$login]);
}
}
}
}
2013-12-14 22:00:59 +01:00
}