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\ManiaControl;
use ManiaControl\Maps\Map; use ManiaControl\Maps\Map;
use ManiaControl\Maps\MapManager; use ManiaControl\Maps\MapManager;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
/** /**
* Mania Exchange Info Searcher Class * Mania Exchange Info Searcher Class
@ -14,7 +14,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
* @copyright ManiaControl Copyright © 2014 ManiaControl Team * @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaExchangeManager{ class ManiaExchangeManager {
/* /*
* Constants * Constants
*/ */
@ -40,8 +40,7 @@ class ManiaExchangeManager{
//Maximum Maps per request //Maximum Maps per request
const MAPS_PER_MX_FETCH = 50; const MAPS_PER_MX_FETCH = 50;
//Beta Testing Activated const MIN_EXE_BUILD = "2014-04-01_00_00";
const SETTING_MP3_BETA_TESTING = 'Activate MP3 Beta Testing';
/* /*
* Private Properties * Private Properties
@ -56,8 +55,6 @@ class ManiaExchangeManager{
*/ */
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->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 // compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $id; $url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $id;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw'; $url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
}
return $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) { return $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$mxMapInfo = null; $mxMapInfo = null;
@ -227,9 +223,7 @@ class ManiaExchangeManager{
// compile search URL // compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string; $url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw'; $url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
}
$thisRef = $this; $thisRef = $this;
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) { $success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) {
@ -304,25 +298,21 @@ class ManiaExchangeManager{
$url .= '&priord=' . $searchOrder; $url .= '&priord=' . $searchOrder;
$url .= '&limit=' . $maxMapsReturned; $url .= '&limit=' . $maxMapsReturned;
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_MP3_BETA_TESTING)){ $url .= '&minexebuild=' . self::MIN_EXE_BUILD;
$url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw'; $url .= '&key=t42kEMjzH7xpAjBFHAvEkC7rqAlw';
if($titlePrefix == "tm"){ if ($titlePrefix == "tm") {
$url .= '&mapgroup=17'; $url .= '&mapgroup=17';
}else{ } else {
$url .= '&mapgroup=1'; $url .= '&mapgroup=1';
} }
}
// Get MapTypes // Get MapTypes
try { try {
$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$mapTypes = $scriptInfos->compatibleMapTypes; $mapTypes = $scriptInfos->compatibleMapTypes;
$url .= '&mtype=' . $mapTypes; $url .= '&mtype=' . $mapTypes;
} catch(Exception $e) { } catch(NotInScriptModeException $e) {
if ($e->getMessage() != 'Not in script mode.') {
throw $e;
}
//dont append map type
} }
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) { $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->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5);
$this->displayWidgets(); $this->displayWidgets();
return true; return true;
} }
@ -156,6 +157,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
private function displayWidgets() { private function displayWidgets() {
// Display Map Widget // Display Map Widget
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
$this->displayMapWidget(); $this->displayMapWidget();
} }
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) {
@ -243,6 +245,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
* @param bool $login * @param bool $login
*/ */
public function displayClockWidget($login = false) { 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_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_POSX);
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_POSY); $pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_POSY);
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_WIDTH); $width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_CLOCK_WIDGET_WIDTH);