titleprefix fix

This commit is contained in:
kremsy 2014-03-12 13:07:02 +01:00 committed by Steffen Schröder
parent 49805f06b3
commit dbdc318bba
9 changed files with 36 additions and 43 deletions

View File

@ -170,12 +170,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$itemMarginFactorX = 1.3; $itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
// Get Title Id
$titleId = $this->maniaControl->server->titleId;
$titlePrefix = strtoupper(substr($titleId, 0, 2));
//If game is shootmania lower the icons position by 20 //If game is shootmania lower the icons position by 20
if($titlePrefix == 'SM') { if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }

View File

@ -190,9 +190,7 @@ class CallbackManager {
$callbackName = $callback[0]; $callbackName = $callback[0];
switch($callbackName) { switch($callbackName) {
case 'ManiaPlanet.BeginMatch': case 'ManiaPlanet.BeginMatch':
$titleId = $this->maniaControl->server->titleId; if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$titlePrefix = strtolower(substr($titleId, 0, 2));
if ($titlePrefix == "sm") {
$this->triggerCallback($callbackName, $callback); $this->triggerCallback($callbackName, $callback);
break; break;
} }
@ -201,9 +199,7 @@ class CallbackManager {
$this->triggerCallback($callbackName, $callback); $this->triggerCallback($callbackName, $callback);
break; break;
case 'ManiaPlanet.EndMatch': //TODO temporary fix case 'ManiaPlanet.EndMatch': //TODO temporary fix
$titleId = $this->maniaControl->server->titleId; if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$titlePrefix = strtolower(substr($titleId, 0, 2));
if ($titlePrefix == "sm") {
$this->triggerCallback($callbackName, $callback); $this->triggerCallback($callbackName, $callback);
break; break;
} }

View File

@ -180,9 +180,8 @@ class ManiaExchangeManager {
* @return bool * @return bool
*/ */
public function getMapInfo($id, $function) { public function getMapInfo($id, $function) {
// Get Title Id // Get Title Prefix
$titleId = $this->maniaControl->server->titleId; $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame();
$titlePrefix = strtolower(substr($titleId, 0, 2));
// 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;
@ -211,9 +210,8 @@ class ManiaExchangeManager {
* @return array|null * @return array|null
*/ */
public function getMaplistByMixedUidIdString($string) { public function getMaplistByMixedUidIdString($string) {
// Get Title Id // Get Title Prefix
$titleId = $this->maniaControl->server->titleId; $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame();
$titlePrefix = strtolower(substr($titleId, 0, 2));
// 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;
@ -269,7 +267,7 @@ class ManiaExchangeManager {
// Get Title Id // Get Title Id
$titleId = $this->maniaControl->server->titleId; $titleId = $this->maniaControl->server->titleId;
$titlePrefix = strtolower(substr($titleId, 0, 2)); $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame();
// compile search URL // compile search URL
$url = 'http://' . $titlePrefix . '.mania-exchange.com/tracksearch?api=on'; $url = 'http://' . $titlePrefix . '.mania-exchange.com/tracksearch?api=on';

View File

@ -50,7 +50,7 @@ class Map {
return; return;
} }
$this->name = FORMATTER::stripDirtyCodes($mpMap->name); $this->name = FORMATTER::stripDirtyCodes($mpMap->name);
$this->rawName = $mpMap->name; $this->rawName = $mpMap->name;
$this->uid = $mpMap->uId; $this->uid = $mpMap->uId;
$this->fileName = $mpMap->fileName; $this->fileName = $mpMap->fileName;
$this->authorLogin = $mpMap->author; $this->authorLogin = $mpMap->author;
@ -65,6 +65,24 @@ class Map {
$this->authorNick = $this->authorLogin; $this->authorNick = $this->authorLogin;
} }
/**
* Get's the gameType of the Current Map
*
* @return string
*/
public function getGame() {
switch($this->environment) {
case 'Storm':
return "sm";
case 'Canyon':
case 'Stadium':
case 'Valley':
return "tm";
default:
return "";
}
}
/** /**
* Checks if a map Update is available * Checks if a map Update is available
* *

View File

@ -641,12 +641,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$itemMarginFactorX = 1.3; $itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
// Get Title Id
$titleId = $this->maniaControl->server->titleId;
$titlePrefix = strtoupper(substr($titleId, 0, 2));
//If game is shootmania lower the icons position by 20 //If game is shootmania lower the icons position by 20
if ($titlePrefix == 'SM') { if($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }

View File

@ -98,7 +98,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
// Open session // Open session
$serverInfo = $this->maniaControl->server->getInfo(); $serverInfo = $this->maniaControl->server->getInfo();
$serverVersion = $this->maniaControl->client->getVersion(); $serverVersion = $this->maniaControl->client->getVersion();
$packMask = substr($this->maniaControl->server->titleId, 2); $packMask = $this->maniaControl->mapManager->getCurrentMap()->getGame();
$dedimaniaCode = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DEDIMANIA_CODE . $serverInfo->login . '$l'); $dedimaniaCode = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DEDIMANIA_CODE . $serverInfo->login . '$l');
if ($dedimaniaCode == '') { if ($dedimaniaCode == '') {
@ -955,7 +955,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
return $manialink; return $manialink;
} }
/** /**
* Decodes xml rpc response * Decodes xml rpc response
* *

View File

@ -199,12 +199,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$itemMarginFactorX = 1.3; $itemMarginFactorX = 1.3;
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
// Get Title Id
$titleId = $this->maniaControl->server->titleId;
$titlePrefix = strtoupper(substr($titleId, 0, 2));
//If game is shootmania lower the icons position by 20 //If game is shootmania lower the icons position by 20
if ($titlePrefix == 'SM') { if($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }

View File

@ -1,17 +1,16 @@
<?php <?php
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map;
use ManiaControl\Maps\MapManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
use ManiaControl\Statistics\StatisticCollector; use ManiaControl\Statistics\StatisticCollector;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Structures\AbstractStructure; use Maniaplanet\DedicatedServer\Structures\AbstractStructure;
use ManiaControl\Maps\MapManager;
use ManiaControl\Maps\Map;
class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
/** /**
@ -66,10 +65,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3); $maniaControl->settingManager->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3);
$maniaControl->settingManager->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50); $maniaControl->settingManager->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50);
$titleId = $this->maniaControl->server->titleId; if ($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'tm') {
$titlePrefix = strtolower(substr($titleId, 0, 2)); //TODO also add obstacle here as default
if ($titlePrefix == 'tm') { //TODO also add obstacle here as default
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RECORDS); $maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RECORDS);
} else if ($this->maniaControl->client->getScriptName()["CurrentValue"] == "InstaDM.Script.txt") { } else if ($this->maniaControl->client->getScriptName()["CurrentValue"] == "InstaDM.Script.txt") {
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RATIOS); $maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RATIOS);

View File

@ -381,12 +381,8 @@ class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswer
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
$posY += $width * $itemMarginFactorY; $posY += $width * $itemMarginFactorY;
// Get Title Id
$titleId = $this->maniaControl->server->titleId;
$titlePrefix = strtoupper(substr($titleId, 0, 2));
//If game is shootmania lower the icons position by 20 //If game is shootmania lower the icons position by 20
if ($titlePrefix == 'SM') { if($this->maniaControl->mapManager->getCurrentMap()->getGame() == 'sm') {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }