mx request remove mp3 setting

This commit is contained in:
kremsy 2014-04-29 21:06:38 +02:00 committed by Steffen Schröder
parent dcf150567c
commit b9475833f5
2 changed files with 22 additions and 27 deletions

View File

@ -5,7 +5,7 @@ namespace ManiaControl\ManiaExchange;
use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map;
use ManiaControl\Maps\MapManager;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
/**
* Mania Exchange Info Searcher Class
@ -14,7 +14,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ManiaExchangeManager{
class ManiaExchangeManager {
/*
* Constants
*/
@ -40,8 +40,7 @@ class ManiaExchangeManager{
//Maximum Maps per request
const MAPS_PER_MX_FETCH = 50;
//Beta Testing Activated
const SETTING_MP3_BETA_TESTING = 'Activate MP3 Beta Testing';
const MIN_EXE_BUILD = "2014-04-01_00_00";
/*
* Private Properties
@ -56,8 +55,6 @@ class ManiaExchangeManager{
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MP3_BETA_TESTING, false);
}
@ -194,9 +191,8 @@ class ManiaExchangeManager{
// compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $id;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
}
return $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$mxMapInfo = null;
@ -227,9 +223,7 @@ class ManiaExchangeManager{
// compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
}
$thisRef = $this;
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) {
@ -304,25 +298,21 @@ class ManiaExchangeManager{
$url .= '&priord=' . $searchOrder;
$url .= '&limit=' . $maxMapsReturned;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){
$url .= '&minexebuild=' . self::MIN_EXE_BUILD;
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
if($titlePrefix == "tm"){
if ($titlePrefix == "tm") {
$url .= '&mapgroup=17';
}else{
} else {
$url .= '&mapgroup=1';
}
}
// Get MapTypes
try {
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$mapTypes = $scriptInfos->compatibleMapTypes;
$url .= '&mtype=' . $mapTypes;
} catch(Exception $e) {
if ($e->getMessage() != 'Not in script mode.') {
throw $e;
}
//dont append map type
} catch(NotInScriptModeException $e) {
}
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {

View File

@ -132,6 +132,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5);
$this->displayWidgets();
return true;
}
@ -156,6 +157,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
private function displayWidgets() {
// Display Map Widget
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
$this->displayMapWidget();
}
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) {
@ -243,6 +245,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
* @param bool $login
*/
public function displayClockWidget($login = false) {
$this->maniaControl->client->triggerModeScriptEventArray("Siege_SetProgressionLayerPosition", array("0.", "0.", "0."));
$pos_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_POSX);
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_POSY);
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_WIDTH);