diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 0fc0f2b4..457c5b63 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -253,8 +253,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $eraseQuad->setZ(0.2); $eraseQuad->setSize(4,4); $eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase); - $eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1)); - //TODO bestätigung? + $eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid); //Description Label $descriptionLabel = new Label(); @@ -276,7 +275,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $switchToQuad->setSize(4, 4); $switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext); $switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1)); - //TODO bestätigung? $descriptionLabel = new Label(); $frame->add($descriptionLabel); @@ -358,12 +356,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $actionArray = explode(".", $actionId); - if($addMap){ //TODO log and chat message - $this->maniaControl->mapManager->addMapFromMx($actionArray[2],$callback[1][1]); - }else if($eraseMap){ + $player = $this->maniaControl->playerManager->getPlayer($callback[1][1]); + if($addMap){ //TODO log and chat message + $this->maniaControl->mapManager->addMapFromMx($actionArray[2],$callback[1][1]); //TODO bestätigung + }else if($eraseMap){ //TODO log and chat message + $this->maniaControl->mapManager->eraseMap(intval($actionArray[2]), $actionArray[3]); //TODO bestätigung + $this->showMapList($player); }else if($switchMap){ //TODO log and chat message - $this->maniaControl->client->query('JumpToMapIndex', intval($actionArray[2])); + $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? + $this->maniaControl->log('Skipped to $z$<' . $mapList[$actionArray[2]]->name . '$>!'); } } diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 2e02ec11..5c6de8d1 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -126,6 +126,21 @@ class MapManager implements CallbackListener { return true; } + + /** + * Erases a Map + * @param $id + * @param $uid + */ + public function eraseMap($id, $uid) { + $map = $this->mapListUids[$uid]; + $this->maniaControl->client->query('RemoveMap', $map->fileName); + $this->maniaControl->chat->sendSuccess('Map $<' . $map->name . '$> removed!'); //TODO specified message, who done it? + $this->maniaControl->log('Map $<' . $map->name . '$> removed!'); + unset($this->mapListUids[$uid]); + unset($this->mapList[$id]); + } + /** * Updates the full Map list, needed on Init, addMap and on ShuffleMaps * @return null