mc plugin increase

This commit is contained in:
kremsy 2017-05-19 18:35:33 +02:00
parent 2991675094
commit 6193787ee5
3 changed files with 14 additions and 12 deletions

View File

@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.217'; const VERSION = '0.218';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2017-05-03_21_00'; const MIN_DEDIVERSION = '2017-05-03_21_00';
const SCRIPT_TIMEOUT = 40; const SCRIPT_TIMEOUT = 40;

View File

@ -129,7 +129,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
} }
} }
} }
$this->getMXMapsAndShowList($player, $author, $environment, $searchString); $this->getMXMapsAndShowList($player, $author, $environment, $searchString);
} }
@ -142,6 +141,17 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
* @param string $searchString * @param string $searchString
*/ */
private function getMXMapsAndShowList(Player $player, $author = '', $environment = '', $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 //Search the Maps
$mxSearch = new ManiaExchangeMapSearch($this->maniaControl); $mxSearch = new ManiaExchangeMapSearch($this->maniaControl);
$mxSearch->setAuthorName($author); $mxSearch->setAuthorName($author);

View File

@ -100,8 +100,6 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$titleId = $this->maniaControl->getServer()->titleId;
$this->titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()->getGame(); $this->titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()->getGame();
$this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on'; $this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';
@ -129,12 +127,6 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
} catch (GameModeException $e) { } 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; $parameters .= "&secord=" . $this->secondaryOrder;
} }
if ($this->environments) { if ($this->environments) {
$parameters .= "&environemtns=" . $this->environments; $parameters .= "&environments=" . $this->environments;
} }
if ($this->vehicles) { if ($this->vehicles) {
$parameters .= "&vehicles=" . $this->vehicles; $parameters .= "&vehicles=" . $this->vehicles;
@ -270,7 +262,7 @@ class ManiaExchangeMapSearch implements UsageInformationAble {
* @param string $env * @param string $env
* @return int * @return int
*/ */
private function getEnvironment($env) { public static function getEnvironment($env) {
switch ($env) { switch ($env) {
case 'TMCanyon': case 'TMCanyon':
return 1; return 1;