mc plugin increase
This commit is contained in:
		@@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
 | 
			
		||||
	/*
 | 
			
		||||
	 * Constants
 | 
			
		||||
	 */
 | 
			
		||||
	const VERSION                     = '0.217';
 | 
			
		||||
	const VERSION                     = '0.218';
 | 
			
		||||
	const API_VERSION                 = '2013-04-16';
 | 
			
		||||
	const MIN_DEDIVERSION             = '2017-05-03_21_00';
 | 
			
		||||
	const SCRIPT_TIMEOUT              = 40;
 | 
			
		||||
 
 | 
			
		||||
@@ -129,7 +129,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$this->getMXMapsAndShowList($player, $author, $environment, $searchString);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -142,6 +141,17 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
 | 
			
		||||
	 * @param string                       $searchString
 | 
			
		||||
	 */
 | 
			
		||||
	private function getMXMapsAndShowList(Player $player, $author = '', $environment = '', $searchString = '') {
 | 
			
		||||
		//TODO do more clean solution
 | 
			
		||||
		if($environment == ""){
 | 
			
		||||
			$titleId           = $this->maniaControl->getServer()->titleId;
 | 
			
		||||
			//Set Environments on Trackmania
 | 
			
		||||
			$game      = explode('@', $titleId);
 | 
			
		||||
			$envNumber = ManiaExchangeMapSearch::getEnvironment($game[0]); //TODO enviroment as constant
 | 
			
		||||
			if ($envNumber > -1) {
 | 
			
		||||
				$environment = $envNumber;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Search the Maps
 | 
			
		||||
		$mxSearch = new ManiaExchangeMapSearch($this->maniaControl);
 | 
			
		||||
		$mxSearch->setAuthorName($author);
 | 
			
		||||
 
 | 
			
		||||
@@ -100,8 +100,6 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
 | 
			
		||||
	public function __construct(ManiaControl $maniaControl) {
 | 
			
		||||
		$this->maniaControl = $maniaControl;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		$titleId           = $this->maniaControl->getServer()->titleId;
 | 
			
		||||
		$this->titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()->getGame();
 | 
			
		||||
 | 
			
		||||
		$this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';
 | 
			
		||||
@@ -129,12 +127,6 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
 | 
			
		||||
		} catch (GameModeException $e) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Set Environments on Trackmania
 | 
			
		||||
		$game      = explode('@', $titleId);
 | 
			
		||||
		$envNumber = $this->getEnvironment($game[0]); //TODO enviroment as constant
 | 
			
		||||
		if ($envNumber > -1) {
 | 
			
		||||
			$this->environments = $envNumber;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -186,7 +178,7 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
 | 
			
		||||
			$parameters .= "&secord=" . $this->secondaryOrder;
 | 
			
		||||
		}
 | 
			
		||||
		if ($this->environments) {
 | 
			
		||||
			$parameters .= "&environemtns=" . $this->environments;
 | 
			
		||||
			$parameters .= "&environments=" . $this->environments;
 | 
			
		||||
		}
 | 
			
		||||
		if ($this->vehicles) {
 | 
			
		||||
			$parameters .= "&vehicles=" . $this->vehicles;
 | 
			
		||||
@@ -270,7 +262,7 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
 | 
			
		||||
	 * @param string $env
 | 
			
		||||
	 * @return int
 | 
			
		||||
	 */
 | 
			
		||||
	private function getEnvironment($env) {
 | 
			
		||||
	public static function getEnvironment($env) {
 | 
			
		||||
		switch ($env) {
 | 
			
		||||
			case 'TMCanyon':
 | 
			
		||||
				return 1;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user