minor things
This commit is contained in:
parent
6f69ab30a0
commit
7b3d0d7420
@ -75,6 +75,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
* @param Player $player
|
||||
*/
|
||||
public function showManiaExchangeList(array $chatCallback, Player $player){
|
||||
$this->maniaControl->manialinkManager->closeWidget($player);
|
||||
|
||||
$params = explode(' ', $chatCallback[1][2]);
|
||||
|
||||
$serverInfo = $this->maniaControl->server->getSystemInfo();
|
||||
@ -212,6 +214,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
* @param Player $player
|
||||
*/
|
||||
public function showMapList(Player $player){
|
||||
$this->maniaControl->manialinkManager->closeWidget($player);
|
||||
|
||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||
$frame = $this->buildMainFrame();
|
||||
@ -288,7 +291,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
$y -= 4;
|
||||
$id++;
|
||||
if($id == self::MAX_MAPS_PER_PAGE - 1)
|
||||
if($id == self::MAX_MAPS_PER_PAGE + 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -317,7 +320,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
|
||||
}
|
||||
|
||||
$mxId = '';
|
||||
$mxId = '-';
|
||||
if(isset($map->mx->id))
|
||||
$mxId = $map->mx->id;
|
||||
|
||||
@ -359,7 +362,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$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
|
||||
$this->maniaControl->mapManager->addMapFromMx(intval($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);
|
||||
|
@ -48,6 +48,7 @@ class MapManager implements CallbackListener {
|
||||
// Register for callbacks
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapListModified');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,7 +221,13 @@ class MapManager implements CallbackListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MapList modified by other controller or web panels
|
||||
* @param array $callback
|
||||
*/
|
||||
public function mapListModified(array $callback){
|
||||
$this->updateFullMapList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
@ -262,8 +269,9 @@ class MapManager implements CallbackListener {
|
||||
// Load from MX
|
||||
$serverInfo = $this->maniaControl->server->getSystemInfo();
|
||||
$title = strtolower(substr($serverInfo['TitleId'], 0, 2));
|
||||
|
||||
// Check if map exists
|
||||
$url = "http://{$title}.mania-exchange.com/api/tracks/get_track_info/id/{$mapId}?format=json";
|
||||
$url = "http://api.mania-exchange.com/{$title}/maps/{$mapId}?format=json";
|
||||
$mapInfo = FileUtil::loadFile($url);
|
||||
if (!$mapInfo || strlen($mapInfo) <= 0) {
|
||||
// Invalid id
|
||||
@ -300,7 +308,7 @@ class MapManager implements CallbackListener {
|
||||
return;
|
||||
}
|
||||
// Add map to map list
|
||||
if (!$this->maniaControl->client->query('InsertMap', $mapFileName)) {
|
||||
if (!$this->maniaControl->client->query('InsertMap', $mapFileName)) { //TODO irgentein bug?
|
||||
$this->maniaControl->chat->sendError("Couldn't add map to match settings!", $login);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user