code refactoring
- variable names - unused parameters
This commit is contained in:
parent
b1663303b0
commit
ff0dfc4ae7
@ -93,8 +93,8 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
//Predefine description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -103,28 +103,28 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Actions" => $x + 120);
|
$array = array("Id" => $posX + 5, "Nickname" => $posX + 18, "Login" => $posX + 70, "Actions" => $posX + 120);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$y = $y - 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($admins as $admin) {
|
foreach ($admins as $admin) {
|
||||||
if ($i % self::MAX_PLAYERS_PER_PAGE === 1) {
|
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
|
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($posY);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -132,21 +132,21 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$lineQuad->setZ(0.001);
|
$lineQuad->setZ(0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
$array = array($i => $x + 5, $admin->nickname => $x + 18, $admin->login => $x + 70);
|
$array = array($index => $posX + 5, $admin->nickname => $posX + 18, $admin->login => $posX + 70);
|
||||||
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
|
|
||||||
// Level Quad
|
// Level Quad
|
||||||
$rightQuad = new Quad_BgRaceScore2();
|
$rightQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($rightQuad);
|
$playerFrame->add($rightQuad);
|
||||||
$rightQuad->setX($x + 13);
|
$rightQuad->setX($posX + 13);
|
||||||
$rightQuad->setZ(5);
|
$rightQuad->setZ(5);
|
||||||
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
||||||
$rightQuad->setSize(7, 3.5);
|
$rightQuad->setSize(7, 3.5);
|
||||||
|
|
||||||
$rightLabel = new Label_Text();
|
$rightLabel = new Label_Text();
|
||||||
$playerFrame->add($rightLabel);
|
$playerFrame->add($rightLabel);
|
||||||
$rightLabel->setX($x + 13.9);
|
$rightLabel->setX($posX + 13.9);
|
||||||
$rightLabel->setTextSize(0.8);
|
$rightLabel->setTextSize(0.8);
|
||||||
$rightLabel->setZ(10);
|
$rightLabel->setZ(10);
|
||||||
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin));
|
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin));
|
||||||
@ -165,7 +165,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($quad);
|
$playerFrame->add($quad);
|
||||||
$quad->setZ(11);
|
$quad->setZ(11);
|
||||||
$quad->setX($x + 130);
|
$quad->setX($posX + 130);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, $quadHeight);
|
$quad->setSize($quadWidth, $quadHeight);
|
||||||
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $admin->login);
|
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $admin->login);
|
||||||
@ -173,7 +173,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
//Label
|
//Label
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$playerFrame->add($label);
|
$playerFrame->add($label);
|
||||||
$label->setX($x + 130);
|
$label->setX($posX + 130);
|
||||||
$quad->setZ(12);
|
$quad->setZ(12);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
$label->setTextSize(1);
|
$label->setTextSize(1);
|
||||||
@ -181,8 +181,8 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setText("Revoke Rights");
|
$label->setText("Revoke Rights");
|
||||||
}
|
}
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render and display xml
|
// Render and display xml
|
||||||
|
@ -70,7 +70,7 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
|||||||
break;
|
break;
|
||||||
case 'EndMap':
|
case 'EndMap':
|
||||||
case 'LibXmlRpc_EndMap':
|
case 'LibXmlRpc_EndMap':
|
||||||
$this->maniaControl->mapManager->handleScriptEndMap($data[1]);
|
$this->maniaControl->mapManager->handleScriptEndMap();
|
||||||
break;
|
break;
|
||||||
case 'LibXmlRpc_BeginPodium':
|
case 'LibXmlRpc_BeginPodium':
|
||||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINPODIUM);
|
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINPODIUM);
|
||||||
|
@ -19,6 +19,7 @@ use ManiaControl\Players\Player;
|
|||||||
* @copyright 2014 ManiaControl Team
|
* @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
|
||||||
*/
|
*/
|
||||||
|
// TODO: refactor code - i see duplicated code all over the place..
|
||||||
class HelpManager implements CommandListener, CallbackListener {
|
class HelpManager implements CommandListener, CallbackListener {
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
@ -69,8 +70,8 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($showCommands, function ($a, $b) {
|
usort($showCommands, function ($commandA, $commandB) {
|
||||||
return strcmp($a["Name"], $b["Name"]);
|
return strcmp($commandA['Name'], $commandB['Name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$message = 'Supported Admin Commands: ';
|
$message = 'Supported Admin Commands: ';
|
||||||
@ -100,8 +101,8 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($showCommands, function ($a, $b) {
|
usort($showCommands, function ($commandA, $commandB) {
|
||||||
return strcmp($a["Name"], $b["Name"]);
|
return strcmp($commandA['Name'], $commandB['Name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$message = 'Supported Player Commands: ';
|
$message = 'Supported Player Commands: ';
|
||||||
@ -146,8 +147,8 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($showCommands, function ($a, $b) {
|
usort($showCommands, function ($commandA, $commandB) {
|
||||||
return strcmp($a["Name"], $b["Name"]);
|
return strcmp($commandA['Name'], $commandB['Name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->showHelpAllList($showCommands, $player);
|
$this->showHelpAllList($showCommands, $player);
|
||||||
@ -174,8 +175,8 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
//Predefine description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -184,27 +185,27 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array("Command" => $x + 5, "Description" => $x + 50);
|
$array = array('Command' => $posX + 5, 'Description' => $posX + 50);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$y = $y - 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
if ($i % 15 === 1) {
|
if ($index % 15 === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($posY);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -212,14 +213,14 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
$lineQuad->setZ(0.001);
|
$lineQuad->setZ(0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
$array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50);
|
$array = array($command['Name'] => $posX + 5, $command['Description'] => $posX + 50);
|
||||||
$labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
$labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
$label = $labels[0];
|
$label = $labels[0];
|
||||||
$label->setWidth(40);
|
$label->setWidth(40);
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render and display xml
|
// Render and display xml
|
||||||
|
@ -334,13 +334,13 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getMenuId($title) {
|
public function getMenuId($title) {
|
||||||
$i = 0;
|
$index = 0;
|
||||||
foreach ($this->menus as $menu) {
|
foreach ($this->menus as $menu) {
|
||||||
/** @var ConfiguratorMenu $menu */
|
/** @var ConfiguratorMenu $menu */
|
||||||
if ($menu === $title || $menu->getTitle() === $title) {
|
if ($menu === $title || $menu->getTitle() === $title) {
|
||||||
return $i;
|
return $index;
|
||||||
}
|
}
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
$pageMaxCount = 13;
|
$pageMaxCount = 13;
|
||||||
$y = 0;
|
$posY = 0;
|
||||||
|
|
||||||
// Pagers
|
// Pagers
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
@ -254,7 +254,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
if ($index % $pageMaxCount === 0) {
|
if ($index % $pageMaxCount === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height * 0.41;
|
$posY = $height * 0.41;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
$pageFrame->add($classLabel);
|
$pageFrame->add($classLabel);
|
||||||
$classLabel->setHAlign($classLabel::LEFT);
|
$classLabel->setHAlign($classLabel::LEFT);
|
||||||
$classLabel->setPosition($width * -0.45, $y);
|
$classLabel->setPosition($width * -0.45, $posY);
|
||||||
$classLabel->setSize($width * 0.9, $settingHeight * 0.9);
|
$classLabel->setSize($width * 0.9, $settingHeight * 0.9);
|
||||||
$classLabel->setStyle($classLabel::STYLE_TextCardSmall);
|
$classLabel->setStyle($classLabel::STYLE_TextCardSmall);
|
||||||
$classLabel->setTextSize(2);
|
$classLabel->setTextSize(2);
|
||||||
@ -277,7 +277,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$classLabel->setTextColor('fff');
|
$classLabel->setTextColor('fff');
|
||||||
$classLabel->setAction(self::ACTION_PREFIX_SETTINGCLASS . $settingClass);
|
$classLabel->setAction(self::ACTION_PREFIX_SETTINGCLASS . $settingClass);
|
||||||
|
|
||||||
$y -= $settingHeight;
|
$posY -= $settingHeight;
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Maps\Map;
|
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||||
@ -144,11 +143,9 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnBegin Map Callback
|
* Handle Begin Map Callback
|
||||||
*
|
|
||||||
* @param Map $map
|
|
||||||
*/
|
*/
|
||||||
public function onBeginMap(Map $map) {
|
public function onBeginMap() {
|
||||||
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
|
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
|
||||||
$this->loadSettingsFromDatabase();
|
$this->loadSettingsFromDatabase();
|
||||||
}
|
}
|
||||||
@ -210,7 +207,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
// Setting pages
|
// Setting pages
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
$y = 0.;
|
$posY = 0.;
|
||||||
|
|
||||||
foreach ($scriptParams as $index => $scriptParam) {
|
foreach ($scriptParams as $index => $scriptParam) {
|
||||||
/** @var \Maniaplanet\DedicatedServer\Structures\ScriptSettings $scriptParam */
|
/** @var \Maniaplanet\DedicatedServer\Structures\ScriptSettings $scriptParam */
|
||||||
@ -223,13 +220,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
if ($index % 13 === 0) {
|
if ($index % 13 === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height * 0.41;
|
$posY = $height * 0.41;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$settingFrame = new Frame();
|
$settingFrame = new Frame();
|
||||||
$pageFrame->add($settingFrame);
|
$pageFrame->add($settingFrame);
|
||||||
$settingFrame->setY($y);
|
$settingFrame->setY($posY);
|
||||||
|
|
||||||
$nameLabel = new Label_Text();
|
$nameLabel = new Label_Text();
|
||||||
$settingFrame->add($nameLabel);
|
$settingFrame->add($nameLabel);
|
||||||
@ -278,7 +275,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$descriptionLabel->setText($scriptParam->desc);
|
$descriptionLabel->setText($scriptParam->desc);
|
||||||
$nameLabel->addTooltipFeature($descriptionLabel);
|
$nameLabel->addTooltipFeature($descriptionLabel);
|
||||||
|
|
||||||
$y -= $settingHeight;
|
$posY -= $settingHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $frame;
|
return $frame;
|
||||||
|
@ -16,6 +16,11 @@ use ManiaControl\ManiaControl;
|
|||||||
* @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 AsynchronousFileReader {
|
class AsynchronousFileReader {
|
||||||
|
/*
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const CONTENT_TYPE_JSON = 'application/json';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
@ -52,7 +57,7 @@ class AsynchronousFileReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a remote file
|
* Load a Remote File
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param callable $function
|
* @param callable $function
|
||||||
@ -60,37 +65,31 @@ class AsynchronousFileReader {
|
|||||||
* @param int $keepAlive
|
* @param int $keepAlive
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function loadFile($url, $function, $contentType = 'UTF-8', $keepAlive = 0) {
|
public function loadFile($url, callable $function, $contentType = 'UTF-8', $keepAlive = 0) {
|
||||||
if (!is_callable($function)) {
|
|
||||||
$this->maniaControl->log("Function is not callable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
$this->maniaControl->log("Url is empty");
|
$this->maniaControl->log('Missing URL!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$headers = array('Content-Type: ' . $contentType);
|
||||||
if ($keepAlive) {
|
if ($keepAlive) {
|
||||||
$header = array("Content-Type: " . $contentType, "Keep-Alive: " . $keepAlive, "Connection: Keep-Alive");
|
array_push($headers, 'Keep-Alive: ' . $keepAlive);
|
||||||
} else {
|
array_push($headers, 'Connection: Keep-Alive');
|
||||||
$header = array("Content-Type: " . $contentType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request($url);
|
$request = new Request($url);
|
||||||
|
$request->getOptions() // request options
|
||||||
$request->getOptions()->set(CURLOPT_TIMEOUT, 10) //
|
->set(CURLOPT_TIMEOUT, 10) // timeout
|
||||||
->set(CURLOPT_HEADER, false) // don't display response header
|
->set(CURLOPT_HEADER, false) // don't display response header
|
||||||
->set(CURLOPT_CRLF, true) // linux linefeed
|
->set(CURLOPT_CRLF, true) // linux linefeed
|
||||||
->set(CURLOPT_ENCODING, '') // accept encoding
|
->set(CURLOPT_ENCODING, '') // accept encoding
|
||||||
->set(CURLOPT_AUTOREFERER, true) // accept link reference
|
->set(CURLOPT_AUTOREFERER, true) // accept link reference
|
||||||
->set(CURLOPT_HTTPHEADER, $header) //
|
->set(CURLOPT_HTTPHEADER, $headers) // headers
|
||||||
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) //
|
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent
|
||||||
->set(CURLOPT_RETURNTRANSFER, true);
|
->set(CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
$request->addListener('complete', function (Event $event) use (&$function) {
|
$request->addListener('complete', function (Event $event) use (&$function) {
|
||||||
$response = $event->response;
|
$response = $event->response;
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
$content = null;
|
$content = null;
|
||||||
if ($response->hasError()) {
|
if ($response->hasError()) {
|
||||||
@ -98,7 +97,6 @@ class AsynchronousFileReader {
|
|||||||
} else {
|
} else {
|
||||||
$content = $response->getContent();
|
$content = $response->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
call_user_func($function, $content, $error);
|
call_user_func($function, $content, $error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ abstract class BackupUtil {
|
|||||||
trigger_error("Couldn't open Folder '{$folderName}' for Backup!");
|
trigger_error("Couldn't open Folder '{$folderName}' for Backup!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$useBaseFileNames = (count($baseFileNames) > 0);
|
$useBaseFileNames = !empty($baseFileNames);
|
||||||
while (false !== ($file = readdir($folderHandle))) {
|
while (false !== ($file = readdir($folderHandle))) {
|
||||||
if (substr($file, 0, 1) === '.') {
|
if (substr($file, 0, 1) === '.') {
|
||||||
// Skip such .files
|
// Skip such .files
|
||||||
|
@ -152,8 +152,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
// Start offsets
|
// Start offsets
|
||||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
//Create ManiaLink
|
//Create ManiaLink
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
@ -172,20 +172,20 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 12);
|
$headFrame->setY($posY - 12);
|
||||||
$array = array('$oId' => $x + 3.5, '$oName' => $x + 12.5, '$oAuthor' => $x + 59, '$oKarma' => $x + 85, '$oType' => $x + 103, '$oMood' => $x + 118, '$oLast Update' => $x + 130);
|
$array = array('$oId' => $posX + 3.5, '$oName' => $posX + 12.5, '$oAuthor' => $posX + 59, '$oKarma' => $posX + 85, '$oType' => $posX + 103, '$oMood' => $posX + 118, '$oLast Update' => $posX + 130);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 0;
|
$index = 0;
|
||||||
$y = $height / 2 - 16;
|
$posY = $height / 2 - 16;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
//TODO order possibilities
|
//TODO order possibilities
|
||||||
if ($i % self::MAX_MX_MAPS_PER_PAGE === 0) {
|
if ($index % self::MAX_MX_MAPS_PER_PAGE === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 16;
|
$posY = $height / 2 - 16;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
$mapFrame = new Frame();
|
$mapFrame = new Frame();
|
||||||
$pageFrame->add($mapFrame);
|
$pageFrame->add($mapFrame);
|
||||||
|
|
||||||
if ($i % 2 === 0) {
|
if ($index % 2 === 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$mapFrame->add($lineQuad);
|
$mapFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -202,19 +202,19 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
||||||
$array = array('$s' . $map->id => $x + 3.5, '$s' . $map->name => $x + 12.5, '$s' . $map->author => $x + 59, '$s' . str_replace('Arena', '', $map->maptype) => $x + 103, '$s' . $map->mood => $x + 118, '$s' . $time => $x + 130);
|
$array = array('$s' . $map->id => $posX + 3.5, '$s' . $map->name => $posX + 12.5, '$s' . $map->author => $posX + 59, '$s' . str_replace('Arena', '', $map->maptype) => $posX + 103, '$s' . $map->mood => $posX + 118, '$s' . $time => $posX + 130);
|
||||||
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||||
$authorLabel = $labels[2];
|
$authorLabel = $labels[2];
|
||||||
$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author);
|
$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author);
|
||||||
|
|
||||||
$mapFrame->setY($y);
|
$mapFrame->setY($posY);
|
||||||
|
|
||||||
$mxQuad = new Quad();
|
$mxQuad = new Quad();
|
||||||
$mapFrame->add($mxQuad);
|
$mapFrame->add($mxQuad);
|
||||||
$mxQuad->setSize(3, 3);
|
$mxQuad->setSize(3, 3);
|
||||||
$mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON));
|
$mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON));
|
||||||
$mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER));
|
$mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER));
|
||||||
$mxQuad->setX($x + 56);
|
$mxQuad->setX($posX + 56);
|
||||||
$mxQuad->setUrl($map->pageurl);
|
$mxQuad->setUrl($map->pageurl);
|
||||||
$mxQuad->setZ(0.01);
|
$mxQuad->setZ(0.01);
|
||||||
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
|
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
|
||||||
@ -223,7 +223,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
$addQuad = new Quad_Icons64x64_1();
|
$addQuad = new Quad_Icons64x64_1();
|
||||||
$mapFrame->add($addQuad);
|
$mapFrame->add($addQuad);
|
||||||
$addQuad->setX($x + 53);
|
$addQuad->setX($posX + 53);
|
||||||
$addQuad->setZ(-0.1);
|
$addQuad->setZ(-0.1);
|
||||||
$addQuad->setSubStyle($addQuad::SUBSTYLE_Add);
|
$addQuad->setSubStyle($addQuad::SUBSTYLE_Add);
|
||||||
$addQuad->setSize(4, 4);
|
$addQuad->setSize(4, 4);
|
||||||
@ -240,12 +240,12 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
$mapFrame->add($awardQuad);
|
$mapFrame->add($awardQuad);
|
||||||
$awardQuad->setSize(3, 3);
|
$awardQuad->setSize(3, 3);
|
||||||
$awardQuad->setSubStyle($awardQuad::SUBSTYLE_OfficialRace);
|
$awardQuad->setSubStyle($awardQuad::SUBSTYLE_OfficialRace);
|
||||||
$awardQuad->setX($x + 97);
|
$awardQuad->setX($posX + 97);
|
||||||
$awardQuad->setZ(0.01);
|
$awardQuad->setZ(0.01);
|
||||||
|
|
||||||
$awardLabel = new Label_Text();
|
$awardLabel = new Label_Text();
|
||||||
$mapFrame->add($awardLabel);
|
$mapFrame->add($awardLabel);
|
||||||
$awardLabel->setX($x + 98.5);
|
$awardLabel->setX($posX + 98.5);
|
||||||
$awardLabel->setHAlign(Control::LEFT);
|
$awardLabel->setHAlign(Control::LEFT);
|
||||||
$awardLabel->setText($map->awards);
|
$awardLabel->setText($map->awards);
|
||||||
$awardLabel->setTextSize(1.3);
|
$awardLabel->setTextSize(1.3);
|
||||||
@ -258,7 +258,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
$karmaGauge = new Gauge();
|
$karmaGauge = new Gauge();
|
||||||
$mapFrame->add($karmaGauge);
|
$mapFrame->add($karmaGauge);
|
||||||
$karmaGauge->setZ(2);
|
$karmaGauge->setZ(2);
|
||||||
$karmaGauge->setX($x + 89);
|
$karmaGauge->setX($posX + 89);
|
||||||
$karmaGauge->setSize(16.5, 9);
|
$karmaGauge->setSize(16.5, 9);
|
||||||
$karmaGauge->setDrawBg(false);
|
$karmaGauge->setDrawBg(false);
|
||||||
$karma = floatval($karma);
|
$karma = floatval($karma);
|
||||||
@ -269,7 +269,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
$karmaLabel = new Label();
|
$karmaLabel = new Label();
|
||||||
$mapFrame->add($karmaLabel);
|
$mapFrame->add($karmaLabel);
|
||||||
$karmaLabel->setZ(2);
|
$karmaLabel->setZ(2);
|
||||||
$karmaLabel->setX($x + 89);
|
$karmaLabel->setX($posX + 89);
|
||||||
$karmaLabel->setSize(16.5 * 0.9, 5);
|
$karmaLabel->setSize(16.5 * 0.9, 5);
|
||||||
$karmaLabel->setTextSize(0.9);
|
$karmaLabel->setTextSize(0.9);
|
||||||
$karmaLabel->setTextColor('000');
|
$karmaLabel->setTextColor('000');
|
||||||
@ -277,8 +277,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ManiaControl\ManiaExchange;
|
namespace ManiaControl\ManiaExchange;
|
||||||
|
|
||||||
|
use ManiaControl\Files\AsynchronousFileReader;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Maps\Map;
|
use ManiaControl\Maps\Map;
|
||||||
use ManiaControl\Maps\MapManager;
|
use ManiaControl\Maps\MapManager;
|
||||||
@ -94,7 +95,7 @@ class ManiaExchangeManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = 0;
|
$index = 0;
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
/** @var Map $map */
|
/** @var Map $map */
|
||||||
$fetchMapStatement->bind_param('i', $map->index);
|
$fetchMapStatement->bind_param('i', $map->index);
|
||||||
@ -119,10 +120,10 @@ class ManiaExchangeManager {
|
|||||||
$appendString = $map->uid . ',';
|
$appendString = $map->uid . ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
$id++;
|
$index++;
|
||||||
|
|
||||||
//If Max Maplimit is reached, or string gets too long send the request
|
//If Max Maplimit is reached, or string gets too long send the request
|
||||||
if ($id % self::MAPS_PER_MX_FETCH === 0) {
|
if ($index % self::MAPS_PER_MX_FETCH === 0) {
|
||||||
$mapIdString = substr($mapIdString, 0, -1);
|
$mapIdString = substr($mapIdString, 0, -1);
|
||||||
$this->getMaplistByMixedUidIdString($mapIdString);
|
$this->getMaplistByMixedUidIdString($mapIdString);
|
||||||
$mapIdString = '';
|
$mapIdString = '';
|
||||||
@ -179,7 +180,7 @@ class ManiaExchangeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$thisRef->updateMapObjectsWithManiaExchangeIds($maps);
|
$thisRef->updateMapObjectsWithManiaExchangeIds($maps);
|
||||||
}, "application/json");
|
}, AsynchronousFileReader::CONTENT_TYPE_JSON);
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
@ -229,16 +230,16 @@ class ManiaExchangeManager {
|
|||||||
/**
|
/**
|
||||||
* Get Map Info Asynchronously
|
* Get Map Info Asynchronously
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $mapId
|
||||||
* @param callable $function
|
* @param callable $function
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getMapInfo($id, callable $function) {
|
public function getMapInfo($mapId, callable $function) {
|
||||||
// Get Title Prefix
|
// Get Title Prefix
|
||||||
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame();
|
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame();
|
||||||
|
|
||||||
// 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=' . $mapId;
|
||||||
|
|
||||||
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;
|
||||||
@ -248,18 +249,18 @@ class ManiaExchangeManager {
|
|||||||
$mxMapList = json_decode($mapInfo);
|
$mxMapList = json_decode($mapInfo);
|
||||||
if (!is_array($mxMapList)) {
|
if (!is_array($mxMapList)) {
|
||||||
trigger_error('Cannot decode searched JSON data from ' . $url);
|
trigger_error('Cannot decode searched JSON data from ' . $url);
|
||||||
} else if (count($mxMapList) > 0) {
|
} else if (!empty($mxMapList)) {
|
||||||
$mxMapInfo = new MXMapInfo($titlePrefix, $mxMapList[0]);
|
$mxMapInfo = new MXMapInfo($titlePrefix, $mxMapList[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
call_user_func($function, $mxMapInfo);
|
call_user_func($function, $mxMapInfo);
|
||||||
}, "application/json");
|
}, AsynchronousFileReader::CONTENT_TYPE_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a MapList Asynchronously
|
* Fetch a MapList Asynchronously
|
||||||
*
|
*
|
||||||
* @param $function
|
* @param callable $function
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $author
|
* @param string $author
|
||||||
* @param string $env
|
* @param string $env
|
||||||
@ -267,12 +268,7 @@ class ManiaExchangeManager {
|
|||||||
* @param int $searchOrder
|
* @param int $searchOrder
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getMapsAsync($function, $name = '', $author = '', $env = '', $maxMapsReturned = 100, $searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) {
|
public function getMapsAsync(callable $function, $name = '', $author = '', $env = '', $maxMapsReturned = 100, $searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) {
|
||||||
if (!is_callable($function)) {
|
|
||||||
$this->maniaControl->log("Function is not callable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove $env because it's not really used?
|
// TODO: remove $env because it's not really used?
|
||||||
|
|
||||||
// Get Title Id
|
// Get Title Id
|
||||||
@ -337,7 +333,7 @@ class ManiaExchangeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
call_user_func($function, $maps);
|
call_user_func($function, $maps);
|
||||||
}, "application/json");
|
}, AsynchronousFileReader::CONTENT_TYPE_JSON);
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,9 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($mapList, array($this, 'sortByKarma'));
|
usort($mapList, function (Map $mapA, Map $mapB) {
|
||||||
|
return ($mapA->karma - $mapB->karma);
|
||||||
|
});
|
||||||
if ($best) {
|
if ($best) {
|
||||||
$mapList = array_reverse($mapList);
|
$mapList = array_reverse($mapList);
|
||||||
}
|
}
|
||||||
@ -453,10 +455,9 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
private function showMapListDate($newest, Player $player) {
|
private function showMapListDate($newest, Player $player) {
|
||||||
$maps = $this->maniaControl->mapManager->getMaps();
|
$maps = $this->maniaControl->mapManager->getMaps();
|
||||||
|
|
||||||
usort($maps, function ($a, $b) {
|
usort($maps, function (Map $mapA, Map $mapB) {
|
||||||
return ($a->index - $b->index);
|
return ($mapA->index - $mapB->index);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($newest) {
|
if ($newest) {
|
||||||
$maps = array_reverse($maps);
|
$maps = array_reverse($maps);
|
||||||
}
|
}
|
||||||
@ -473,15 +474,4 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
public function command_xList(array $chatCallback, Player $player) {
|
public function command_xList(array $chatCallback, Player $player) {
|
||||||
$this->maniaControl->mapManager->mxList->showList($chatCallback, $player);
|
$this->maniaControl->mapManager->mxList->showList($chatCallback, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper Function to sort Maps by Karma
|
|
||||||
*
|
|
||||||
* @param Map $a
|
|
||||||
* @param Map $b
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
private function sortByKarma(Map $a, Map $b) {
|
|
||||||
return ($a->karma - $b->karma);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -198,8 +198,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($height / 2 - 5);
|
$headFrame->setY($height / 2 - 5);
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115, 'Actions' => $width / 2 - 16);
|
$array = array('Id' => $posX + 5, 'Mx Id' => $posX + 10, 'Map Name' => $posX + 20, 'Author' => $posX + 68, 'Karma' => $posX + 115, 'Actions' => $width / 2 - 16);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
// Predefine description Label
|
// Predefine description Label
|
||||||
@ -214,11 +214,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$paging->setStartPageNumber($pageIndex + 1);
|
$paging->setStartPageNumber($pageIndex + 1);
|
||||||
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$id = 1 + $mapsBeginIndex;
|
$mapListId = 1 + $mapsBeginIndex;
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
/** @var Map $map */
|
|
||||||
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
|
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
|
||||||
$mxIcon = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON);
|
$mxIcon = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON);
|
||||||
$mxIconHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER);
|
$mxIconHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER);
|
||||||
@ -226,10 +225,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mxIconGreenHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN_MOVER);
|
$mxIconGreenHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN_MOVER);
|
||||||
|
|
||||||
foreach ($mapList as $map) {
|
foreach ($mapList as $map) {
|
||||||
|
/** @var Map $map */
|
||||||
if ($index % self::MAX_MAPS_PER_PAGE === 0) {
|
if ($index % self::MAX_MAPS_PER_PAGE === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame, $pageNumber);
|
$paging->addPage($pageFrame, $pageNumber);
|
||||||
$pageNumber++;
|
$pageNumber++;
|
||||||
}
|
}
|
||||||
@ -237,10 +237,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
// Map Frame
|
// Map Frame
|
||||||
$mapFrame = new Frame();
|
$mapFrame = new Frame();
|
||||||
$pageFrame->add($mapFrame);
|
$pageFrame->add($mapFrame);
|
||||||
|
$mapFrame->setY($posY);
|
||||||
$mapFrame->setZ(0.1);
|
$mapFrame->setZ(0.1);
|
||||||
$mapFrame->setY($y);
|
|
||||||
|
|
||||||
if ($id % 2 !== 0) {
|
if ($mapListId % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$mapFrame->add($lineQuad);
|
$mapFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -251,7 +251,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
if ($currentMap === $map) {
|
if ($currentMap === $map) {
|
||||||
$currentQuad = new Quad_Icons64x64_1();
|
$currentQuad = new Quad_Icons64x64_1();
|
||||||
$mapFrame->add($currentQuad);
|
$mapFrame->add($currentQuad);
|
||||||
$currentQuad->setX($x + 3.5);
|
$currentQuad->setX($posX + 3.5);
|
||||||
$currentQuad->setZ(0.2);
|
$currentQuad->setZ(0.2);
|
||||||
$currentQuad->setSize(4, 4);
|
$currentQuad->setSize(4, 4);
|
||||||
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
|
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
|
||||||
@ -266,7 +266,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mxQuad->setSize(3, 3);
|
$mxQuad->setSize(3, 3);
|
||||||
$mxQuad->setImage($mxIcon);
|
$mxQuad->setImage($mxIcon);
|
||||||
$mxQuad->setImageFocus($mxIconHover);
|
$mxQuad->setImageFocus($mxIconHover);
|
||||||
$mxQuad->setX($x + 65);
|
$mxQuad->setX($posX + 65);
|
||||||
$mxQuad->setUrl($map->mx->pageurl);
|
$mxQuad->setUrl($map->mx->pageurl);
|
||||||
$mxQuad->setZ(0.01);
|
$mxQuad->setZ(0.01);
|
||||||
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
|
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
|
||||||
@ -278,7 +278,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mxQuad->setSize(3, 3);
|
$mxQuad->setSize(3, 3);
|
||||||
$mxQuad->setImage($mxIconGreen);
|
$mxQuad->setImage($mxIconGreen);
|
||||||
$mxQuad->setImageFocus($mxIconGreenHover);
|
$mxQuad->setImageFocus($mxIconGreenHover);
|
||||||
$mxQuad->setX($x + 62);
|
$mxQuad->setX($posX + 62);
|
||||||
$mxQuad->setUrl($map->mx->pageurl);
|
$mxQuad->setUrl($map->mx->pageurl);
|
||||||
$mxQuad->setZ(0.01);
|
$mxQuad->setZ(0.01);
|
||||||
$description = 'Update for $<' . $map->name . '$> available on Mania-Exchange!';
|
$description = 'Update for $<' . $map->name . '$> available on Mania-Exchange!';
|
||||||
@ -292,7 +292,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display Maps
|
// Display Maps
|
||||||
$array = array($id => $x + 5, $mxId => $x + 10, Formatter::stripDirtyCodes($map->name) => $x + 20, $map->authorNick => $x + 68);
|
$array = array($mapListId => $posX + 5, $mxId => $posX + 10, Formatter::stripDirtyCodes($map->name) => $posX + 20, $map->authorNick => $posX + 68);
|
||||||
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||||
if (isset($labels[3])) {
|
if (isset($labels[3])) {
|
||||||
/** @var Label $label */
|
/** @var Label $label */
|
||||||
@ -359,7 +359,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$eraseLabel->setText('x');
|
$eraseLabel->setText('x');
|
||||||
$eraseLabel->setTextColor('a00');
|
$eraseLabel->setTextColor('a00');
|
||||||
|
|
||||||
$confirmFrame = $this->buildConfirmFrame($maniaLink, $y, $map->uid, true);
|
$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid, true);
|
||||||
$eraseLabel->addToggleFeature($confirmFrame);
|
$eraseLabel->addToggleFeature($confirmFrame);
|
||||||
$description = 'Remove Map: $<' . $map->name . '$>';
|
$description = 'Remove Map: $<' . $map->name . '$>';
|
||||||
$eraseLabel->addTooltipLabelFeature($descriptionLabel, $description);
|
$eraseLabel->addTooltipLabelFeature($descriptionLabel, $description);
|
||||||
@ -376,7 +376,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$switchLabel->setText('»');
|
$switchLabel->setText('»');
|
||||||
$switchLabel->setTextColor('0f0');
|
$switchLabel->setTextColor('0f0');
|
||||||
|
|
||||||
$confirmFrame = $this->buildConfirmFrame($maniaLink, $y, $map->uid);
|
$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid);
|
||||||
$switchLabel->addToggleFeature($confirmFrame);
|
$switchLabel->addToggleFeature($confirmFrame);
|
||||||
|
|
||||||
$description = 'Switch Directly to Map: $<' . $map->name . '$>';
|
$description = 'Switch Directly to Map: $<' . $map->name . '$>';
|
||||||
@ -438,7 +438,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$karmaGauge = new Gauge();
|
$karmaGauge = new Gauge();
|
||||||
$mapFrame->add($karmaGauge);
|
$mapFrame->add($karmaGauge);
|
||||||
$karmaGauge->setZ(2);
|
$karmaGauge->setZ(2);
|
||||||
$karmaGauge->setX($x + 120);
|
$karmaGauge->setX($posX + 120);
|
||||||
$karmaGauge->setSize(20, 9);
|
$karmaGauge->setSize(20, 9);
|
||||||
$karmaGauge->setDrawBg(false);
|
$karmaGauge->setDrawBg(false);
|
||||||
$karma = floatval($karma);
|
$karma = floatval($karma);
|
||||||
@ -449,7 +449,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$karmaLabel = new Label();
|
$karmaLabel = new Label();
|
||||||
$mapFrame->add($karmaLabel);
|
$mapFrame->add($karmaLabel);
|
||||||
$karmaLabel->setZ(2);
|
$karmaLabel->setZ(2);
|
||||||
$karmaLabel->setX($x + 120);
|
$karmaLabel->setX($posX + 120);
|
||||||
$karmaLabel->setSize(20 * 0.9, 5);
|
$karmaLabel->setSize(20 * 0.9, 5);
|
||||||
$karmaLabel->setTextSize(0.9);
|
$karmaLabel->setTextSize(0.9);
|
||||||
$karmaLabel->setTextColor('000');
|
$karmaLabel->setTextColor('000');
|
||||||
@ -457,8 +457,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$id++;
|
$mapListId++;
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,12 +494,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
* Builds the confirmation frame
|
* Builds the confirmation frame
|
||||||
*
|
*
|
||||||
* @param ManiaLink $maniaLink
|
* @param ManiaLink $maniaLink
|
||||||
* @param float $y
|
* @param float $posY
|
||||||
* @param bool $mapUid
|
* @param bool $mapUid
|
||||||
* @param bool $erase
|
* @param bool $erase
|
||||||
* @return Frame
|
* @return Frame
|
||||||
*/
|
*/
|
||||||
public function buildConfirmFrame(Manialink $maniaLink, $y, $mapUid, $erase = false) {
|
public function buildConfirmFrame(Manialink $maniaLink, $posY, $mapUid, $erase = false) {
|
||||||
// TODO: get rid of the confirm frame to decrease xml size & network usage
|
// TODO: get rid of the confirm frame to decrease xml size & network usage
|
||||||
|
|
||||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||||
@ -508,7 +508,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
$confirmFrame = new Frame();
|
$confirmFrame = new Frame();
|
||||||
$maniaLink->add($confirmFrame);
|
$maniaLink->add($confirmFrame);
|
||||||
$confirmFrame->setPosition($width / 2 + 6, $y);
|
$confirmFrame->setPosition($width / 2 + 6, $posY);
|
||||||
$confirmFrame->setVisible(false);
|
$confirmFrame->setVisible(false);
|
||||||
|
|
||||||
$quad = new Quad();
|
$quad = new Quad();
|
||||||
|
@ -244,22 +244,21 @@ class MapManager implements CallbackListener {
|
|||||||
public function addMapFromMx($mapId, $login, $update = false) {
|
public function addMapFromMx($mapId, $login, $update = false) {
|
||||||
if (is_numeric($mapId)) {
|
if (is_numeric($mapId)) {
|
||||||
// Check if map exists
|
// Check if map exists
|
||||||
$self = $this;
|
$this->maniaControl->mapManager->mxManager->getMapInfo($mapId, function (MXMapInfo $mapInfo) use (&$login, &$update) {
|
||||||
$this->maniaControl->mapManager->mxManager->getMapInfo($mapId, function (MXMapInfo $mapInfo) use (&$self, &$login, &$update) {
|
|
||||||
if (!$mapInfo || !isset($mapInfo->uploaded)) {
|
if (!$mapInfo || !isset($mapInfo->uploaded)) {
|
||||||
// Invalid id
|
// Invalid id
|
||||||
$self->maniaControl->chat->sendError('Invalid MX-Id!', $login);
|
$this->maniaControl->chat->sendError('Invalid MX-Id!', $login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download the file
|
// Download the file
|
||||||
$self->maniaControl->fileReader->loadFile($mapInfo->downloadurl, function ($file, $error) use (&$self, &$login, &$mapInfo, &$update) {
|
$this->maniaControl->fileReader->loadFile($mapInfo->downloadurl, function ($file, $error) use (&$login, &$mapInfo, &$update) {
|
||||||
if (!$file || $error) {
|
if (!$file || $error) {
|
||||||
// Download error
|
// Download error
|
||||||
$self->maniaControl->chat->sendError("Download failed: '{$error}'!", $login);
|
$this->maniaControl->chat->sendError("Download failed: '{$error}'!", $login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$self->processMapFile($file, $mapInfo, $login, $update);
|
$this->processMapFile($file, $mapInfo, $login, $update);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -379,9 +378,9 @@ class MapManager implements CallbackListener {
|
|||||||
$tempList = array();
|
$tempList = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$i = 0;
|
$offset = 0;
|
||||||
while (true) {
|
while ($this->maniaControl->client) {
|
||||||
$maps = $this->maniaControl->client->getMapList(150, $i);
|
$maps = $this->maniaControl->client->getMapList(150, $offset);
|
||||||
|
|
||||||
foreach ($maps as $rpcMap) {
|
foreach ($maps as $rpcMap) {
|
||||||
if (array_key_exists($rpcMap->uId, $this->maps)) {
|
if (array_key_exists($rpcMap->uId, $this->maps)) {
|
||||||
@ -394,7 +393,7 @@ class MapManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i += 150;
|
$offset += 150;
|
||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundException $e) {
|
} catch (IndexOutOfBoundException $e) {
|
||||||
}
|
}
|
||||||
@ -554,14 +553,14 @@ class MapManager implements CallbackListener {
|
|||||||
$lowerMapArray = array();
|
$lowerMapArray = array();
|
||||||
$higherMapArray = array();
|
$higherMapArray = array();
|
||||||
|
|
||||||
$i = 0;
|
$index = 0;
|
||||||
foreach ($this->maps as $map) {
|
foreach ($this->maps as $map) {
|
||||||
if ($i < $currentIndex) {
|
if ($index < $currentIndex) {
|
||||||
$lowerMapArray[] = $map->fileName;
|
$lowerMapArray[] = $map->fileName;
|
||||||
} else {
|
} else {
|
||||||
$higherMapArray[] = $map->fileName;
|
$higherMapArray[] = $map->fileName;
|
||||||
}
|
}
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapArray = array_merge($higherMapArray, $lowerMapArray);
|
$mapArray = array_merge($higherMapArray, $lowerMapArray);
|
||||||
@ -708,10 +707,8 @@ class MapManager implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Script EndMap Callback
|
* Handle Script EndMap Callback
|
||||||
*
|
|
||||||
* @param string $mapUid
|
|
||||||
*/
|
*/
|
||||||
public function handleScriptEndMap($mapUid) {
|
public function handleScriptEndMap() {
|
||||||
$this->endMap();
|
$this->endMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,12 +409,12 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getQueuedMapsRanking() {
|
public function getQueuedMapsRanking() {
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$queuedMaps = array();
|
$queuedMaps = array();
|
||||||
foreach ($this->queuedMaps as $queuedMap) {
|
foreach ($this->queuedMaps as $queuedMap) {
|
||||||
$map = $queuedMap[1];
|
$map = $queuedMap[1];
|
||||||
$queuedMaps[$map->uid] = $i;
|
$queuedMaps[$map->uid] = $index;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
return $queuedMaps;
|
return $queuedMaps;
|
||||||
}
|
}
|
||||||
|
@ -322,17 +322,17 @@ class PlayerActions {
|
|||||||
$label->setText('Administrative Warning');
|
$label->setText('Administrative Warning');
|
||||||
$label->setTextColor('f00');
|
$label->setTextColor('f00');
|
||||||
|
|
||||||
$y = $height / 2 - 15;
|
$posY = $height / 2 - 15;
|
||||||
foreach ($message as $line) {
|
foreach ($message as $line) {
|
||||||
// Message lines
|
// Message lines
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setStyle(Label_Text::STYLE_TextCardMedium);
|
$label->setStyle($label::STYLE_TextCardMedium);
|
||||||
$label->setText($line);
|
$label->setText($line);
|
||||||
$label->setTextColor('ff0');
|
$label->setTextColor('ff0');
|
||||||
$label->setTextSize(1.3);
|
$label->setTextSize(1.3);
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display manialink
|
// Display manialink
|
||||||
|
@ -70,13 +70,13 @@ class PlayerDetailed {
|
|||||||
$script = new Script();
|
$script = new Script();
|
||||||
$maniaLink->setScript($script);
|
$maniaLink->setScript($script);
|
||||||
|
|
||||||
$y = $this->height / 2 - 7;
|
$posY = $this->height / 2 - 7;
|
||||||
|
|
||||||
//Nation Quad
|
//Nation Quad
|
||||||
$countryQuad = new Quad();
|
$countryQuad = new Quad();
|
||||||
$frame->add($countryQuad);
|
$frame->add($countryQuad);
|
||||||
$countryQuad->setImage("file://ZoneFlags/Login/{$targetLogin}/country");
|
$countryQuad->setImage("file://ZoneFlags/Login/{$targetLogin}/country");
|
||||||
$countryQuad->setPosition(-$this->width / 2 + 10, $y);
|
$countryQuad->setPosition(-$this->width / 2 + 10, $posY);
|
||||||
$countryQuad->setSize(5, 5);
|
$countryQuad->setSize(5, 5);
|
||||||
$countryQuad->setZ(-0.1);
|
$countryQuad->setZ(-0.1);
|
||||||
$countryQuad->setHAlign(Control::LEFT);
|
$countryQuad->setHAlign(Control::LEFT);
|
||||||
@ -84,111 +84,111 @@ class PlayerDetailed {
|
|||||||
//Nickname
|
//Nickname
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setPosition(-$this->width / 2 + 15, $y);
|
$label->setPosition(-$this->width / 2 + 15, $posY);
|
||||||
$label->setText($target->nickname);
|
$label->setText($target->nickname);
|
||||||
$label->setHAlign(Control::LEFT);
|
$label->setHAlign(Control::LEFT);
|
||||||
|
|
||||||
|
|
||||||
//Define MainLabel (Login)
|
//Define MainLabel (Login)
|
||||||
$y -= 8;
|
$posY -= 8;
|
||||||
$mainLabel = new Label_Text();
|
$mainLabel = new Label_Text();
|
||||||
$frame->add($mainLabel);
|
$frame->add($mainLabel);
|
||||||
$mainLabel->setPosition(-$this->width / 2 + 10, $y);
|
$mainLabel->setPosition(-$this->width / 2 + 10, $posY);
|
||||||
$mainLabel->setTextSize(1.2);
|
$mainLabel->setTextSize(1.2);
|
||||||
$mainLabel->setHAlign(Control::LEFT);
|
$mainLabel->setHAlign(Control::LEFT);
|
||||||
$mainLabel->setText("Login:");
|
$mainLabel->setText("Login:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Nation: ");
|
$label->setText("Nation: ");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Province:");
|
$label->setText("Province:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Authorization:");
|
$label->setText("Authorization:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Ladder Rank:");
|
$label->setText("Ladder Rank:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Ladder Score:");
|
$label->setText("Ladder Score:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Inscribed Zone:");
|
$label->setText("Inscribed Zone:");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText('Avatar');
|
$label->setText('Avatar');
|
||||||
|
|
||||||
//Login
|
//Login
|
||||||
$y = $this->height / 2 - 15;
|
$posY = $this->height / 2 - 15;
|
||||||
$mainLabel = new Label_Text();
|
$mainLabel = new Label_Text();
|
||||||
$frame->add($mainLabel);
|
$frame->add($mainLabel);
|
||||||
$mainLabel->setPosition(-$this->width / 2 + 30, $y);
|
$mainLabel->setPosition(-$this->width / 2 + 30, $posY);
|
||||||
$mainLabel->setText($target->login);
|
$mainLabel->setText($target->login);
|
||||||
$mainLabel->setTextSize(1.2);
|
$mainLabel->setTextSize(1.2);
|
||||||
$mainLabel->setHAlign(Control::LEFT);
|
$mainLabel->setHAlign(Control::LEFT);
|
||||||
|
|
||||||
//Country
|
//Country
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText($target->getCountry());
|
$label->setText($target->getCountry());
|
||||||
|
|
||||||
//Province
|
//Province
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText($target->getProvince());
|
$label->setText($target->getProvince());
|
||||||
|
|
||||||
//AuthLevel
|
//AuthLevel
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText($this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel));
|
$label->setText($this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel));
|
||||||
|
|
||||||
//LadderRank
|
//LadderRank
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText($target->ladderRank);
|
$label->setText($target->ladderRank);
|
||||||
|
|
||||||
//LadderScore
|
//LadderScore
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText(round($target->ladderScore, 2));
|
$label->setText(round($target->ladderScore, 2));
|
||||||
|
|
||||||
//Played Since
|
//Played Since
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText(date("d M Y", time() - 3600 * 24 * $target->daysSinceZoneInscription));
|
$label->setText(date("d M Y", time() - 3600 * 24 * $target->daysSinceZoneInscription));
|
||||||
|
|
||||||
$quad = new Quad();
|
$quad = new Quad();
|
||||||
@ -227,7 +227,7 @@ class PlayerDetailed {
|
|||||||
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
||||||
$posY = $this->height / 2 - 15;
|
$posY = $this->height / 2 - 15;
|
||||||
$posX = -$this->width / 2 + 52;
|
$posX = -$this->width / 2 + 52;
|
||||||
$id = 1;
|
$index = 1;
|
||||||
|
|
||||||
foreach ($playerStats as $stat) {
|
foreach ($playerStats as $stat) {
|
||||||
$value = (float)$stat[1];
|
$value = (float)$stat[1];
|
||||||
@ -242,7 +242,7 @@ class PlayerDetailed {
|
|||||||
$value = round($value, 2);
|
$value = round($value, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($lineQuad);
|
$frame->add($lineQuad);
|
||||||
$lineQuad->setSize(49, 4);
|
$lineQuad->setSize(49, 4);
|
||||||
@ -265,12 +265,12 @@ class PlayerDetailed {
|
|||||||
$label->setTextSize(1.5);
|
$label->setTextSize(1.5);
|
||||||
|
|
||||||
$posY -= 4;
|
$posY -= 4;
|
||||||
$id++;
|
$index++;
|
||||||
|
|
||||||
if ($id > self::STATS_PER_COLUMN) {
|
if ($index > self::STATS_PER_COLUMN) {
|
||||||
$posY = $this->height / 2 - 15;
|
$posY = $this->height / 2 - 15;
|
||||||
$posX += 47;
|
$posX += 47;
|
||||||
$id = 0;
|
$index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $frame;
|
return $frame;
|
||||||
|
@ -152,8 +152,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
// Predefine Description Label
|
// Predefine Description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -162,32 +162,31 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
|
$labelLineArray = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Location' => $posX + 101);
|
||||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101, "Actions" => $x + 135);
|
$labelLineArray['Actions'] = $posX + 135;
|
||||||
} else {
|
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101);
|
|
||||||
}
|
}
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $labelLineArray);
|
||||||
|
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($players as $listPlayer) {
|
foreach ($players as $listPlayer) {
|
||||||
if ($i % self::MAX_PLAYERS_PER_PAGE === 1) {
|
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
|
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $listPlayer->getProvince();
|
$path = $listPlayer->getProvince();
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -195,16 +194,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$lineQuad->setZ(0.001);
|
$lineQuad->setZ(0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
$array = array($i => $x + 5, $listPlayer->nickname => $x + 18, $listPlayer->login => $x + 70, $path => $x + 101);
|
$array = array($index => $posX + 5, $listPlayer->nickname => $posX + 18, $listPlayer->login => $posX + 70, $path => $posX + 101);
|
||||||
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($posY);
|
||||||
|
|
||||||
// Show current Player Arrow
|
// Show current Player Arrow
|
||||||
if ($listPlayer->index === $player->index) {
|
if ($listPlayer->index === $player->index) {
|
||||||
$currentQuad = new Quad_Icons64x64_1();
|
$currentQuad = new Quad_Icons64x64_1();
|
||||||
$playerFrame->add($currentQuad);
|
$playerFrame->add($currentQuad);
|
||||||
$currentQuad->setX($x + 3.5);
|
$currentQuad->setX($posX + 3.5);
|
||||||
$currentQuad->setZ(0.2);
|
$currentQuad->setZ(0.2);
|
||||||
$currentQuad->setSize(4, 4);
|
$currentQuad->setSize(4, 4);
|
||||||
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
|
$currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue);
|
||||||
@ -215,7 +214,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Player is in a Team
|
// Player is in a Team
|
||||||
$teamQuad = new Quad_Emblems();
|
$teamQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($teamQuad);
|
$playerFrame->add($teamQuad);
|
||||||
$teamQuad->setX($x + 10);
|
$teamQuad->setX($posX + 10);
|
||||||
$teamQuad->setZ(0.1);
|
$teamQuad->setZ(0.1);
|
||||||
$teamQuad->setSize(3.8, 3.8);
|
$teamQuad->setSize(3.8, 3.8);
|
||||||
|
|
||||||
@ -231,7 +230,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Player is in Spectator Mode
|
// Player is in Spectator Mode
|
||||||
$specQuad = new Quad_BgRaceScore2();
|
$specQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($specQuad);
|
$playerFrame->add($specQuad);
|
||||||
$specQuad->setX($x + 10);
|
$specQuad->setX($posX + 10);
|
||||||
$specQuad->setZ(0.1);
|
$specQuad->setZ(0.1);
|
||||||
$specQuad->setSubStyle($specQuad::SUBSTYLE_Spectator);
|
$specQuad->setSubStyle($specQuad::SUBSTYLE_Spectator);
|
||||||
$specQuad->setSize(3.8, 3.8);
|
$specQuad->setSize(3.8, 3.8);
|
||||||
@ -243,7 +242,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$countryQuad = new Quad();
|
$countryQuad = new Quad();
|
||||||
$playerFrame->add($countryQuad);
|
$playerFrame->add($countryQuad);
|
||||||
$countryQuad->setImage("file://ZoneFlags/Login/{$listPlayer->login}/country");
|
$countryQuad->setImage("file://ZoneFlags/Login/{$listPlayer->login}/country");
|
||||||
$countryQuad->setX($x + 98);
|
$countryQuad->setX($posX + 98);
|
||||||
$countryQuad->setZ(1);
|
$countryQuad->setZ(1);
|
||||||
$countryQuad->setSize(4, 4);
|
$countryQuad->setSize(4, 4);
|
||||||
|
|
||||||
@ -253,14 +252,14 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Level Quad
|
// Level Quad
|
||||||
$rightQuad = new Quad_BgRaceScore2();
|
$rightQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($rightQuad);
|
$playerFrame->add($rightQuad);
|
||||||
$rightQuad->setX($x + 13);
|
$rightQuad->setX($posX + 13);
|
||||||
$rightQuad->setZ(3);
|
$rightQuad->setZ(3);
|
||||||
$rightQuad->setSize(7, 3.5);
|
$rightQuad->setSize(7, 3.5);
|
||||||
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
||||||
|
|
||||||
$rightLabel = new Label_Text();
|
$rightLabel = new Label_Text();
|
||||||
$playerFrame->add($rightLabel);
|
$playerFrame->add($rightLabel);
|
||||||
$rightLabel->setX($x + 13.9);
|
$rightLabel->setX($posX + 13.9);
|
||||||
$rightLabel->setZ(3.1);
|
$rightLabel->setZ(3.1);
|
||||||
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel));
|
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel));
|
||||||
$rightLabel->setTextSize(0.8);
|
$rightLabel->setTextSize(0.8);
|
||||||
@ -272,7 +271,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Player Statistics
|
// Player Statistics
|
||||||
$playerQuad = new Quad_Icons64x64_1();
|
$playerQuad = new Quad_Icons64x64_1();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
$playerQuad->setX($x + 61);
|
$playerQuad->setX($posX + 61);
|
||||||
$playerQuad->setZ(3);
|
$playerQuad->setZ(3);
|
||||||
$playerQuad->setSize(2.7, 2.7);
|
$playerQuad->setSize(2.7, 2.7);
|
||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_TrackInfo);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_TrackInfo);
|
||||||
@ -283,7 +282,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Camera Quad
|
// Camera Quad
|
||||||
$playerQuad = new Quad_UIConstruction_Buttons();
|
$playerQuad = new Quad_UIConstruction_Buttons();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
$playerQuad->setX($x + 64.5);
|
$playerQuad->setX($posX + 64.5);
|
||||||
$playerQuad->setZ(3);
|
$playerQuad->setZ(3);
|
||||||
$playerQuad->setSize(3.8, 3.8);
|
$playerQuad->setSize(3.8, 3.8);
|
||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
|
||||||
@ -294,7 +293,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Player Profile Quad
|
// Player Profile Quad
|
||||||
$playerQuad = new Quad_UIConstruction_Buttons();
|
$playerQuad = new Quad_UIConstruction_Buttons();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
$playerQuad->setX($x + 68);
|
$playerQuad->setX($posX + 68);
|
||||||
$playerQuad->setZ(3);
|
$playerQuad->setZ(3);
|
||||||
$playerQuad->setSize(3.8, 3.8);
|
$playerQuad->setSize(3.8, 3.8);
|
||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Author);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Author);
|
||||||
@ -308,7 +307,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Further Player actions Quad
|
// Further Player actions Quad
|
||||||
$playerQuad = new Quad_Icons64x64_1();
|
$playerQuad = new Quad_Icons64x64_1();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
$playerQuad->setX($x + 132);
|
$playerQuad->setX($posX + 132);
|
||||||
$playerQuad->setZ(0.1);
|
$playerQuad->setZ(0.1);
|
||||||
$playerQuad->setSize(3.8, 3.8);
|
$playerQuad->setSize(3.8, 3.8);
|
||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Buddy);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Buddy);
|
||||||
@ -324,7 +323,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Red-Team Quad
|
// Force to Red-Team Quad
|
||||||
$redQuad = new Quad_Emblems();
|
$redQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($redQuad);
|
$playerFrame->add($redQuad);
|
||||||
$redQuad->setX($x + 145);
|
$redQuad->setX($posX + 145);
|
||||||
$redQuad->setZ(0.1);
|
$redQuad->setZ(0.1);
|
||||||
$redQuad->setSize(3.8, 3.8);
|
$redQuad->setSize(3.8, 3.8);
|
||||||
$redQuad->setSubStyle($redQuad::SUBSTYLE_2);
|
$redQuad->setSubStyle($redQuad::SUBSTYLE_2);
|
||||||
@ -337,7 +336,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Blue-Team Quad
|
// Force to Blue-Team Quad
|
||||||
$blueQuad = new Quad_Emblems();
|
$blueQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($blueQuad);
|
$playerFrame->add($blueQuad);
|
||||||
$blueQuad->setX($x + 141);
|
$blueQuad->setX($posX + 141);
|
||||||
$blueQuad->setZ(0.1);
|
$blueQuad->setZ(0.1);
|
||||||
$blueQuad->setSize(3.8, 3.8);
|
$blueQuad->setSize(3.8, 3.8);
|
||||||
$blueQuad->setSubStyle($blueQuad::SUBSTYLE_1);
|
$blueQuad->setSubStyle($blueQuad::SUBSTYLE_1);
|
||||||
@ -351,7 +350,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Kick Player Vote
|
// Kick Player Vote
|
||||||
$kickQuad = new Quad_UIConstruction_Buttons();
|
$kickQuad = new Quad_UIConstruction_Buttons();
|
||||||
$playerFrame->add($kickQuad);
|
$playerFrame->add($kickQuad);
|
||||||
$kickQuad->setX($x + 141);
|
$kickQuad->setX($posX + 141);
|
||||||
$kickQuad->setZ(0.1);
|
$kickQuad->setZ(0.1);
|
||||||
$kickQuad->setSize(3.8, 3.8);
|
$kickQuad->setSize(3.8, 3.8);
|
||||||
$kickQuad->setSubStyle($kickQuad::SUBSTYLE_Validate_Step2);
|
$kickQuad->setSubStyle($kickQuad::SUBSTYLE_Validate_Step2);
|
||||||
@ -365,7 +364,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Play
|
// Force to Play
|
||||||
$playQuad = new Quad_Emblems();
|
$playQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($playQuad);
|
$playerFrame->add($playQuad);
|
||||||
$playQuad->setX($x + 143);
|
$playQuad->setX($posX + 143);
|
||||||
$playQuad->setZ(0.1);
|
$playQuad->setZ(0.1);
|
||||||
$playQuad->setSize(3.8, 3.8);
|
$playQuad->setSize(3.8, 3.8);
|
||||||
$playQuad->setSubStyle($playQuad::SUBSTYLE_2);
|
$playQuad->setSubStyle($playQuad::SUBSTYLE_2);
|
||||||
@ -380,7 +379,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Spectator Quad
|
// Force to Spectator Quad
|
||||||
$spectatorQuad = new Quad_BgRaceScore2();
|
$spectatorQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($spectatorQuad);
|
$playerFrame->add($spectatorQuad);
|
||||||
$spectatorQuad->setX($x + 137);
|
$spectatorQuad->setX($posX + 137);
|
||||||
$spectatorQuad->setZ(0.1);
|
$spectatorQuad->setZ(0.1);
|
||||||
$spectatorQuad->setSize(3.8, 3.8);
|
$spectatorQuad->setSize(3.8, 3.8);
|
||||||
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
||||||
@ -393,7 +392,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Force to Spectator Quad
|
// Force to Spectator Quad
|
||||||
$spectatorQuad = new Quad_BgRaceScore2();
|
$spectatorQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($spectatorQuad);
|
$playerFrame->add($spectatorQuad);
|
||||||
$spectatorQuad->setX($x + 137);
|
$spectatorQuad->setX($posX + 137);
|
||||||
$spectatorQuad->setZ(0.1);
|
$spectatorQuad->setZ(0.1);
|
||||||
$spectatorQuad->setSize(3.8, 3.8);
|
$spectatorQuad->setSize(3.8, 3.8);
|
||||||
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
||||||
@ -404,8 +403,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description);
|
$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show advanced window
|
// Show advanced window
|
||||||
@ -434,7 +433,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
$x = $width / 2 + 2.5;
|
$posX = $width / 2 + 2.5;
|
||||||
$width = 35;
|
$width = 35;
|
||||||
$height = $height * 0.75;
|
$height = $height * 0.75;
|
||||||
$hAlign = Control::LEFT;
|
$hAlign = Control::LEFT;
|
||||||
@ -446,7 +445,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// mainframe
|
// mainframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($x + $width / 2, 0);
|
$frame->setPosition($posX + $width / 2, 0);
|
||||||
|
|
||||||
// Add Close Quad (X)
|
// Add Close Quad (X)
|
||||||
$closeQuad = new Quad_Icons64x64_1();
|
$closeQuad = new Quad_Icons64x64_1();
|
||||||
@ -494,18 +493,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
// Mute Player
|
// Mute Player
|
||||||
$y = $height / 2 - 14;
|
$posY = $height / 2 - 14;
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
@ -519,97 +518,97 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Warn Player
|
// Warn Player
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_WARN_PLAYER . "." . $login);
|
$quad->setAction(self::ACTION_WARN_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Warn");
|
$label->setText("Warn");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
|
|
||||||
// Show Kick
|
// Show Kick
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_KICK_PLAYER . "." . $login);
|
$quad->setAction(self::ACTION_KICK_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Kick");
|
$label->setText("Kick");
|
||||||
$label->setTextColor("F90");
|
$label->setTextColor("F90");
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
// Show Ban
|
// Show Ban
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_BAN_PLAYER . "." . $login);
|
$quad->setAction(self::ACTION_BAN_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Ban");
|
$label->setText("Ban");
|
||||||
$label->setTextColor("700");
|
$label->setTextColor("700");
|
||||||
|
|
||||||
$y -= 10;
|
$posY -= 10;
|
||||||
// Show Add as Master-Admin
|
// Show Add as Master-Admin
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_MASTER . "." . $login);
|
$quad->setAction(self::ACTION_ADD_AS_MASTER . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
|
|
||||||
$label->setText("Set SuperAdmin");
|
$label->setText("Set SuperAdmin");
|
||||||
|
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
// Show Add as Admin
|
// Show Add as Admin
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_ADMIN . "." . $login);
|
$quad->setAction(self::ACTION_ADD_AS_ADMIN . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Set Admin");
|
$label->setText("Set Admin");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
// Show Add as Moderator
|
// Show Add as Moderator
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_MOD . "." . $login);
|
$quad->setAction(self::ACTION_ADD_AS_MOD . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Set Moderator");
|
$label->setText("Set Moderator");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
if ($player->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($admin, $player->authLevel + 1)) {
|
if ($player->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($admin, $player->authLevel + 1)) {
|
||||||
$y -= 5;
|
$posY -= 5;
|
||||||
// Revoke Rights
|
// Revoke Rights
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setY($y);
|
$quad->setY($posY);
|
||||||
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $login);
|
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $login);
|
||||||
|
|
||||||
$label = clone $label;
|
$label = clone $label;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($posY);
|
||||||
$label->setText("Revoke Rights");
|
$label->setText("Revoke Rights");
|
||||||
$label->setTextColor("700");
|
$label->setTextColor("700");
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
|||||||
$pagerSize = 9.;
|
$pagerSize = 9.;
|
||||||
$entryHeight = 5.;
|
$entryHeight = 5.;
|
||||||
$labelTextSize = 2;
|
$labelTextSize = 2;
|
||||||
$y = 0.;
|
$posY = 0.;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
// Pagers
|
// Pagers
|
||||||
@ -113,12 +113,12 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
|||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
$y = $height * 0.41;
|
$posY = $height * 0.41;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pluginFrame = new Frame();
|
$pluginFrame = new Frame();
|
||||||
$pageFrame->add($pluginFrame);
|
$pageFrame->add($pluginFrame);
|
||||||
$pluginFrame->setY($y);
|
$pluginFrame->setY($posY);
|
||||||
|
|
||||||
$nameLabel = new Label_Text();
|
$nameLabel = new Label_Text();
|
||||||
$pluginFrame->add($nameLabel);
|
$pluginFrame->add($nameLabel);
|
||||||
@ -152,7 +152,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
|||||||
$installButton->setText('Install');
|
$installButton->setText('Install');
|
||||||
$installButton->setAction(self::ACTION_PREFIX_INSTALL_PLUGIN . $plugin->id);
|
$installButton->setAction(self::ACTION_PREFIX_INSTALL_PLUGIN . $plugin->id);
|
||||||
|
|
||||||
$y -= $entryHeight;
|
$posY -= $entryHeight;
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,10 +129,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$posY = 0.;
|
$posY = 0.;
|
||||||
$pluginUpdates = $this->maniaControl->updateManager->pluginUpdateManager->getPluginsUpdates();
|
$pluginUpdates = $this->maniaControl->updateManager->pluginUpdateManager->getPluginsUpdates();
|
||||||
|
|
||||||
usort($pluginClasses, function ($a, $b) {
|
usort($pluginClasses, function ($pluginClassA, $pluginClassB) {
|
||||||
/** @var Plugin $a */
|
/** @var Plugin $pluginClassA */
|
||||||
/** @var Plugin $b */
|
/** @var Plugin $pluginClassB */
|
||||||
return strcmp($a::getName(), $b::getName());
|
return strcmp($pluginClassA::getName(), $pluginClassB::getName());
|
||||||
});
|
});
|
||||||
|
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
@ -250,7 +250,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$settings = $this->maniaControl->settingManager->getSettingsByClass($settingClass);
|
$settings = $this->maniaControl->settingManager->getSettingsByClass($settingClass);
|
||||||
|
|
||||||
$pageSettingsMaxCount = 12;
|
$pageSettingsMaxCount = 12;
|
||||||
$y = 0;
|
$posY = 0;
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$settingHeight = 5.;
|
$settingHeight = 5.;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
@ -260,12 +260,12 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
$y = $height * 0.41;
|
$posY = $height * 0.41;
|
||||||
}
|
}
|
||||||
|
|
||||||
$settingFrame = new Frame();
|
$settingFrame = new Frame();
|
||||||
$pageFrame->add($settingFrame);
|
$pageFrame->add($settingFrame);
|
||||||
$settingFrame->setY($y);
|
$settingFrame->setY($posY);
|
||||||
|
|
||||||
if ($index === 0) {
|
if ($index === 0) {
|
||||||
//Headline Label
|
//Headline Label
|
||||||
@ -279,12 +279,12 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$headLabel->setText($setting->class);
|
$headLabel->setText($setting->class);
|
||||||
$headLabel->setTextColor("F00");
|
$headLabel->setTextColor("F00");
|
||||||
|
|
||||||
$y -= $settingHeight;
|
$posY -= $settingHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
$settingFrame = new Frame();
|
$settingFrame = new Frame();
|
||||||
$pageFrame->add($settingFrame);
|
$pageFrame->add($settingFrame);
|
||||||
$settingFrame->setY($y);
|
$settingFrame->setY($posY);
|
||||||
// Headline Label finished
|
// Headline Label finished
|
||||||
|
|
||||||
$nameLabel = new Label_Text();
|
$nameLabel = new Label_Text();
|
||||||
@ -323,7 +323,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
|||||||
$entry->setVisible(false);
|
$entry->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$y -= $settingHeight;
|
$posY -= $settingHeight;
|
||||||
|
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,9 @@ class UsageReporter implements TimerListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report Usage every xx Minutes
|
* Report Usage of ManiaControl on the current Server
|
||||||
*
|
|
||||||
* @param float $time
|
|
||||||
*/
|
*/
|
||||||
public function reportUsage($time) {
|
public function reportUsage() {
|
||||||
if (DEV_MODE || !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_REPORT_USAGE)) {
|
if (DEV_MODE || !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_REPORT_USAGE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -515,6 +515,7 @@ class StatisticManager {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function insertStat($statName, Player $player, $serverIndex = -1, $value, $statType = self::STAT_TYPE_INT) {
|
public function insertStat($statName, Player $player, $serverIndex = -1, $value, $statType = self::STAT_TYPE_INT) {
|
||||||
|
// TODO: statType isn't used
|
||||||
if (!$player) {
|
if (!$player) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -94,17 +94,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform Hourly Update Check
|
* Perform Hourly Update Check
|
||||||
*
|
|
||||||
* @param float $time
|
|
||||||
*/
|
*/
|
||||||
public function hourlyUpdateCheck($time) {
|
public function hourlyUpdateCheck() {
|
||||||
$updateCheckEnabled = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ENABLE_UPDATECHECK);
|
$updateCheckEnabled = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ENABLE_UPDATECHECK);
|
||||||
if (!$updateCheckEnabled) {
|
if (!$updateCheckEnabled) {
|
||||||
$this->setCoreUpdateData();
|
$this->setCoreUpdateData();
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
$this->checkUpdate();
|
$this->checkUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Core Update Data
|
* Set Core Update Data
|
||||||
@ -132,6 +130,10 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
$url = ManiaControl::URL_WEBSERVICE . 'versions?current=1&channel=' . $updateChannel;
|
$url = ManiaControl::URL_WEBSERVICE . 'versions?current=1&channel=' . $updateChannel;
|
||||||
|
|
||||||
$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) {
|
$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) {
|
||||||
|
if ($error) {
|
||||||
|
$this->maniaControl->log('Error on UpdateCheck: ' . $error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
$versions = json_decode($dataJson);
|
$versions = json_decode($dataJson);
|
||||||
if (!$versions || !isset($versions[0])) {
|
if (!$versions || !isset($versions[0])) {
|
||||||
call_user_func($function);
|
call_user_func($function);
|
||||||
|
@ -28,9 +28,7 @@ abstract class Formatter {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function formatTime($time) {
|
public static function formatTime($time) {
|
||||||
if (!is_int($time)) {
|
|
||||||
$time = (int)$time;
|
$time = (int)$time;
|
||||||
}
|
|
||||||
$milliseconds = $time % 1000;
|
$milliseconds = $time % 1000;
|
||||||
$seconds = floor($time / 1000);
|
$seconds = floor($time / 1000);
|
||||||
$minutes = floor($seconds / 60);
|
$minutes = floor($seconds / 60);
|
||||||
@ -70,6 +68,7 @@ abstract class Formatter {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function time_elapsed_string($ptime) {
|
public static function time_elapsed_string($ptime) {
|
||||||
|
// TODO: refactor code: camelCase!
|
||||||
$etime = time() - $ptime;
|
$etime = time() - $ptime;
|
||||||
|
|
||||||
if ($etime < 1) {
|
if ($etime < 1) {
|
||||||
|
@ -343,18 +343,16 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$itemQuad->addToggleFeature($popoutFrame);
|
$itemQuad->addToggleFeature($popoutFrame);
|
||||||
|
|
||||||
// Add items
|
// Add items
|
||||||
$x = -1;
|
$posX = -1;
|
||||||
foreach ($this->voteMenuItems as $menuItems) {
|
foreach ($this->voteMenuItems as $menuItems) {
|
||||||
foreach ($menuItems as $menuItem) {
|
foreach ($menuItems as $menuItem) {
|
||||||
|
/** @var Quad $menuQuad */
|
||||||
$menuQuad = $menuItem[0];
|
$menuQuad = $menuItem[0];
|
||||||
/**
|
|
||||||
* @var Quad $menuQuad
|
|
||||||
*/
|
|
||||||
$popoutFrame->add($menuQuad);
|
$popoutFrame->add($menuQuad);
|
||||||
$menuQuad->setSize($itemSize, $itemSize);
|
$menuQuad->setSize($itemSize, $itemSize);
|
||||||
$menuQuad->setX($x);
|
$menuQuad->setX($posX);
|
||||||
$menuQuad->setHAlign(Control::RIGHT);
|
$menuQuad->setHAlign($menuQuad::RIGHT);
|
||||||
$x -= $itemSize * 1.05;
|
$posX -= $itemSize * 1.05;
|
||||||
|
|
||||||
if ($menuItem[1]) {
|
if ($menuItem[1]) {
|
||||||
$menuQuad->removeScriptFeatures();
|
$menuQuad->removeScriptFeatures();
|
||||||
@ -474,11 +472,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the Vote on Canceled Callback
|
* Destroy the Vote on Canceled Callback
|
||||||
*
|
|
||||||
* @param Player $player
|
|
||||||
*/
|
*/
|
||||||
public function handleVoteCanceled(Player $player) {
|
public function handleVoteCanceled() {
|
||||||
//reset vote
|
|
||||||
$this->destroyVote();
|
$this->destroyVote();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,8 +633,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
* @param float $votePercentage
|
* @param float $votePercentage
|
||||||
*/
|
*/
|
||||||
private function showVoteWidget($timeUntilExpire, $votePercentage) {
|
private function showVoteWidget($timeUntilExpire, $votePercentage) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT);
|
||||||
$maxTime = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_TIME);
|
$maxTime = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_TIME);
|
||||||
@ -654,7 +649,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y, 30);
|
$frame->setPosition($posX, $posY, 30);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -676,7 +671,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$label->setY($height / 2 - 6);
|
$label->setY($height / 2 - 6);
|
||||||
$label->setSize($width - 5, 2);
|
$label->setSize($width - 5, 2);
|
||||||
$label->setTextSize(1);
|
$label->setTextSize(1);
|
||||||
$label->setTextColor("F80");
|
$label->setTextColor('F80');
|
||||||
$label->setText('$sStarted by ' . $this->currentVote->voter->nickname);
|
$label->setText('$sStarted by ' . $this->currentVote->voter->nickname);
|
||||||
|
|
||||||
//Time Gauge
|
//Time Gauge
|
||||||
@ -700,7 +695,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$label->setSize($width - 5, $height);
|
$label->setSize($width - 5, $height);
|
||||||
$label->setTextSize(1.1);
|
$label->setTextSize(1.1);
|
||||||
$label->setText('$sTime left: ' . $timeUntilExpire . "s");
|
$label->setText('$sTime left: ' . $timeUntilExpire . "s");
|
||||||
$label->setTextColor("FFF");
|
$label->setTextColor('FFF');
|
||||||
|
|
||||||
//Vote Gauge
|
//Vote Gauge
|
||||||
$voteGauge = new Gauge();
|
$voteGauge = new Gauge();
|
||||||
@ -712,10 +707,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$gaugeColor = ColorUtil::floatToStatusColor($votePercentage);
|
$gaugeColor = ColorUtil::floatToStatusColor($votePercentage);
|
||||||
$voteGauge->setColor($gaugeColor . '6');
|
$voteGauge->setColor($gaugeColor . '6');
|
||||||
|
|
||||||
$y = -4.4;
|
$posY = -4.4;
|
||||||
$voteLabel = new Label();
|
$voteLabel = new Label();
|
||||||
$frame->add($voteLabel);
|
$frame->add($voteLabel);
|
||||||
$voteLabel->setY($y);
|
$voteLabel->setY($posY);
|
||||||
$voteLabel->setSize($width * 0.65, 12);
|
$voteLabel->setSize($width * 0.65, 12);
|
||||||
$voteLabel->setStyle($labelStyle);
|
$voteLabel->setStyle($labelStyle);
|
||||||
$voteLabel->setTextSize(1);
|
$voteLabel->setTextSize(1);
|
||||||
@ -724,18 +719,18 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
|
|
||||||
$positiveQuad = new Quad_BgsPlayerCard();
|
$positiveQuad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($positiveQuad);
|
$frame->add($positiveQuad);
|
||||||
$positiveQuad->setPosition(-$width / 2 + 6, $y);
|
$positiveQuad->setPosition(-$width / 2 + 6, $posY);
|
||||||
$positiveQuad->setSubStyle($positiveQuad::SUBSTYLE_BgPlayerCardBig);
|
$positiveQuad->setSubStyle($positiveQuad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$positiveQuad->setSize(5, 5);
|
$positiveQuad->setSize(5, 5);
|
||||||
|
|
||||||
$positiveLabel = new Label_Button();
|
$positiveLabel = new Label_Button();
|
||||||
$frame->add($positiveLabel);
|
$frame->add($positiveLabel);
|
||||||
$positiveLabel->setPosition(-$width / 2 + 6, $y);
|
$positiveLabel->setPosition(-$width / 2 + 6, $posY);
|
||||||
$positiveLabel->setStyle($labelStyle);
|
$positiveLabel->setStyle($labelStyle);
|
||||||
$positiveLabel->setTextSize(1);
|
$positiveLabel->setTextSize(1);
|
||||||
$positiveLabel->setSize(3, 3);
|
$positiveLabel->setSize(3, 3);
|
||||||
$positiveLabel->setTextColor("0F0");
|
$positiveLabel->setTextColor('0F0');
|
||||||
$positiveLabel->setText("F1");
|
$positiveLabel->setText('F1');
|
||||||
|
|
||||||
$negativeQuad = clone $positiveQuad;
|
$negativeQuad = clone $positiveQuad;
|
||||||
$frame->add($negativeQuad);
|
$frame->add($negativeQuad);
|
||||||
@ -744,8 +739,8 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$negativeLabel = clone $positiveLabel;
|
$negativeLabel = clone $positiveLabel;
|
||||||
$frame->add($negativeLabel);
|
$frame->add($negativeLabel);
|
||||||
$negativeLabel->setX($width / 2 - 6);
|
$negativeLabel->setX($width / 2 - 6);
|
||||||
$negativeLabel->setTextColor("F00");
|
$negativeLabel->setTextColor('F00');
|
||||||
$negativeLabel->setText("F2");
|
$negativeLabel->setText('F2');
|
||||||
|
|
||||||
// Voting Actions
|
// Voting Actions
|
||||||
$positiveQuad->addActionTriggerFeature(self::ACTION_POSITIVE_VOTE);
|
$positiveQuad->addActionTriggerFeature(self::ACTION_POSITIVE_VOTE);
|
||||||
|
@ -53,6 +53,18 @@ class DedimaniaData {
|
|||||||
$this->serverBuild = $serverVersion->build;
|
$this->serverBuild = $serverVersion->build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the Records
|
||||||
|
*/
|
||||||
|
public function sortRecords() {
|
||||||
|
usort($this->records, function (RecordData $first, RecordData $second) {
|
||||||
|
if ($first->best == $second->best) {
|
||||||
|
return ($first->rank - $second->rank);
|
||||||
|
}
|
||||||
|
return ($first->best - $second->best);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the Data Array
|
* Build the Data Array
|
||||||
*
|
*
|
||||||
|
@ -113,7 +113,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
* @see \ManiaControl\Plugins\Plugin::getDescription()
|
* @see \ManiaControl\Plugins\Plugin::getDescription()
|
||||||
*/
|
*/
|
||||||
public static function getDescription() {
|
public static function getDescription() {
|
||||||
return "Dedimania Plugin for TrackMania";
|
return 'Dedimania Plugin for TrackMania';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -264,7 +264,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
$self = $this;
|
$self = $this;
|
||||||
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
|
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$self->maniaControl->log("Dedimania Error: " . $error);
|
$self->maniaControl->log('Dedimania Error: ' . $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $self->decode($data);
|
$data = $self->decode($data);
|
||||||
@ -422,8 +422,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
$records = $this->dedimaniaData->records;
|
$records = $this->dedimaniaData->records;
|
||||||
|
|
||||||
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
||||||
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT);
|
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT);
|
||||||
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT);
|
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT);
|
||||||
@ -435,7 +435,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
$manialink = new ManiaLink(self::MLID_DEDIMANIA);
|
$manialink = new ManiaLink(self::MLID_DEDIMANIA);
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$manialink->add($frame);
|
$manialink->add($frame);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
@ -977,9 +977,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records);
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO move into class dedimania data
|
|
||||||
// Sort records
|
$this->dedimaniaData->sortRecords();
|
||||||
usort($this->dedimaniaData->records, array($this, 'compareRecords'));
|
|
||||||
|
|
||||||
// Update ranks
|
// Update ranks
|
||||||
$rank = 1;
|
$rank = 1;
|
||||||
@ -1066,8 +1065,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
// Predefine Description Label
|
// Predefine Description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -1076,26 +1075,26 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array("Rank" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Time" => $x + 101);
|
$array = array("Rank" => $posX + 5, "Nickname" => $posX + 18, "Login" => $posX + 70, "Time" => $posX + 101);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 0;
|
$index = 0;
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($records as $listRecord) {
|
foreach ($records as $listRecord) {
|
||||||
if ($i % 15 === 0) {
|
if ($index % 15 === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$recordFrame = new Frame();
|
$recordFrame = new Frame();
|
||||||
$pageFrame->add($recordFrame);
|
$pageFrame->add($recordFrame);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$recordFrame->add($lineQuad);
|
$recordFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -1106,13 +1105,13 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
if (strlen($listRecord->nickName) < 2) {
|
if (strlen($listRecord->nickName) < 2) {
|
||||||
$listRecord->nickName = $listRecord->login;
|
$listRecord->nickName = $listRecord->login;
|
||||||
}
|
}
|
||||||
$array = array($listRecord->rank => $x + 5, '$fff' . $listRecord->nickName => $x + 18, $listRecord->login => $x + 70, Formatter::formatTime($listRecord->best) => $x + 101);
|
$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickName => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->best) => $posX + 101);
|
||||||
$this->maniaControl->manialinkManager->labelLine($recordFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($recordFrame, $array);
|
||||||
|
|
||||||
$recordFrame->setY($y);
|
$recordFrame->setY($posY);
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render and display xml
|
// Render and display xml
|
||||||
@ -1136,26 +1135,4 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
|
|||||||
*/
|
*/
|
||||||
public function unload() {
|
public function unload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare function for sorting dedimania records
|
|
||||||
*
|
|
||||||
* @param \MCTeam\Dedimania\RecordData $first
|
|
||||||
* @param \MCTeam\Dedimania\RecordData $second
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
private function compareRecords(RecordData $first, RecordData $second) {
|
|
||||||
//TODO move into class dedimania data
|
|
||||||
if ($first->best < $second->best) {
|
|
||||||
return -1;
|
|
||||||
} else if ($first->best > $second->best) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
if ($first->rank < $second->rank) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -221,11 +221,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$descriptionLabel->setTextColor("0F0");
|
$descriptionLabel->setTextColor("0F0");
|
||||||
|
|
||||||
// Add items
|
// Add items
|
||||||
$x = -2;
|
$posX = -2;
|
||||||
foreach (array_reverse($valueArray) as $value) {
|
foreach (array_reverse($valueArray) as $value) {
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$popoutFrame->add($label);
|
$popoutFrame->add($label);
|
||||||
$label->setX($x);
|
$label->setX($posX);
|
||||||
$label->setHAlign(Control::RIGHT);
|
$label->setHAlign(Control::RIGHT);
|
||||||
$label->setText('$s$FFF' . $value . '$09FP');
|
$label->setText('$s$FFF' . $value . '$09FP');
|
||||||
$label->setTextSize(1.2);
|
$label->setTextSize(1.2);
|
||||||
@ -234,7 +234,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$description = "Donate {$value} Planets";
|
$description = "Donate {$value} Planets";
|
||||||
$label->addTooltipLabelFeature($descriptionLabel, $description);
|
$label->addTooltipLabelFeature($descriptionLabel, $description);
|
||||||
|
|
||||||
$x -= strlen($value) * 2 + 1.7;
|
$posX -= strlen($value) * 2 + 1.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send manialink
|
// Send manialink
|
||||||
@ -470,8 +470,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
//Predefine description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -480,27 +480,27 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array('$oId' => $x + 5, '$oNickname' => $x + 18, '$oDonated planets' => $x + 70);
|
$array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oDonated planets' => $posX + 70);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$y = $y - 10;
|
$posY = $posY - 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($stats as $playerIndex => $donations) {
|
foreach ($stats as $playerIndex => $donations) {
|
||||||
if ($i % 15 === 1) {
|
if ($index % 15 === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($posY);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -509,13 +509,13 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$donatingPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerIndex);
|
$donatingPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerIndex);
|
||||||
$array = array($i => $x + 5, $donatingPlayer->nickname => $x + 18, $donations => $x + 70);
|
$array = array($index => $posX + 5, $donatingPlayer->nickname => $posX + 18, $donations => $posX + 70);
|
||||||
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
|
|
||||||
if ($i > 100) {
|
if ($index > 100) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
use ManiaControl\Callbacks\TimerListener;
|
use ManiaControl\Callbacks\TimerListener;
|
||||||
|
use ManiaControl\Files\AsynchronousFileReader;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Maps\Map;
|
use ManiaControl\Maps\Map;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
@ -271,7 +272,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$self->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
|
$self->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
|
||||||
$self->mxKarma['connectionInProgress'] = false;
|
$self->mxKarma['connectionInProgress'] = false;
|
||||||
}
|
}
|
||||||
}, "application/json", 1000);
|
}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,6 +281,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
* @param string $mxKarmaCode
|
* @param string $mxKarmaCode
|
||||||
*/
|
*/
|
||||||
private function activateSession($mxKarmaCode) {
|
private function activateSession($mxKarmaCode) {
|
||||||
|
// TODO: unused private method! remove?
|
||||||
$hash = $this->buildActivationHash($this->mxKarma['session']->sessionSeed, $mxKarmaCode);
|
$hash = $this->buildActivationHash($this->mxKarma['session']->sessionSeed, $mxKarmaCode);
|
||||||
|
|
||||||
$query = self::MX_KARMA_URL . self::MX_KARMA_ACTIVATESESSION;
|
$query = self::MX_KARMA_URL . self::MX_KARMA_ACTIVATESESSION;
|
||||||
@ -314,7 +316,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$self->maniaControl->log($error);
|
$self->maniaControl->log($error);
|
||||||
$self->mxKarma['connectionInProgress'] = false;
|
$self->mxKarma['connectionInProgress'] = false;
|
||||||
}
|
}
|
||||||
}, "application/json", 1000);
|
}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,12 +400,12 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO remove temp trigger
|
// TODO remove temp trigger
|
||||||
$self->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: " . $data->data->message . " " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($self->mxKarma['session']->sessionKey));
|
$self->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: '{$data->data->message}' " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($self->mxKarma['session']->sessionKey));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->maniaControl->log($error);
|
$self->maniaControl->log($error);
|
||||||
}
|
}
|
||||||
}, $content, false, 'application/json');
|
}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -414,11 +416,9 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle BeginMap ManiaControl callback
|
* Handle Begin Map Callback
|
||||||
*
|
|
||||||
* @param Map $map
|
|
||||||
*/
|
*/
|
||||||
public function handleBeginMap(Map $map) {
|
public function handleBeginMap() {
|
||||||
// send Map Karma to MX from previous Map
|
// send Map Karma to MX from previous Map
|
||||||
if (isset($this->mxKarma['map'])) {
|
if (isset($this->mxKarma['map'])) {
|
||||||
$votes = array();
|
$votes = array();
|
||||||
@ -500,7 +500,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
} else {
|
} else {
|
||||||
$self->maniaControl->log($error);
|
$self->maniaControl->log($error);
|
||||||
}
|
}
|
||||||
}, $content, false, 'application/json');
|
}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -705,11 +705,12 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
while ($vote = $result->fetch_object()) {
|
while ($vote = $result->fetch_object()) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayerByIndex($vote->playerIndex);
|
$player = $this->maniaControl->playerManager->getPlayerByIndex($vote->playerIndex);
|
||||||
$karma = $vote->vote;
|
$karma = $vote->vote;
|
||||||
$votes[] = array('player' => $player, 'karma' => $karma);
|
$voteArray = array('player' => $player, 'karma' => $karma);
|
||||||
|
array_push($votes, $voteArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($votes, function ($a, $b) {
|
usort($votes, function ($paramA, $paramB) {
|
||||||
return $a['karma'] - $b['karma'];
|
return $paramA['karma'] - $paramB['karma'];
|
||||||
});
|
});
|
||||||
$votes = array_reverse($votes);
|
$votes = array_reverse($votes);
|
||||||
|
|
||||||
@ -876,7 +877,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build karma voting manialink if necessary
|
* Build Karma Voting Manialink if necessary
|
||||||
*
|
*
|
||||||
* @param bool $forceBuild
|
* @param bool $forceBuild
|
||||||
*/
|
*/
|
||||||
@ -886,8 +887,8 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT);
|
||||||
$labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle();
|
$labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle();
|
||||||
@ -898,7 +899,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
|
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$manialink->add($frame);
|
$manialink->add($frame);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
|
@ -213,8 +213,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
}
|
}
|
||||||
|
|
||||||
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
$title = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE);
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH);
|
||||||
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT);
|
$lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT);
|
||||||
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT);
|
$lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT);
|
||||||
@ -231,7 +231,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
$manialink = new ManiaLink(self::MLID_RECORDS);
|
$manialink = new ManiaLink(self::MLID_RECORDS);
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$manialink->add($frame);
|
$manialink->add($frame);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
@ -513,20 +513,16 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle Player Connect Callback
|
||||||
*
|
|
||||||
* @param Player $player
|
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(Player $player) {
|
public function handlePlayerConnect() {
|
||||||
$this->updateManialink = true;
|
$this->updateManialink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle BeginMap callback
|
* Handle Begin Map Callback
|
||||||
*
|
|
||||||
* @param Map $map
|
|
||||||
*/
|
*/
|
||||||
public function handleMapBegin(Map $map) {
|
public function handleMapBegin() {
|
||||||
$this->updateManialink = true;
|
$this->updateManialink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,8 +566,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
// Predefine Description Label
|
// Predefine Description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -580,26 +576,26 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array("Rank" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Time" => $x + 101);
|
$array = array('Rank' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Time' => $posX + 101);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 0;
|
$index = 0;
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
foreach ($records as $listRecord) {
|
foreach ($records as $listRecord) {
|
||||||
if ($i % 15 === 0) {
|
if ($index % 15 === 0) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$recordFrame = new Frame();
|
$recordFrame = new Frame();
|
||||||
$pageFrame->add($recordFrame);
|
$pageFrame->add($recordFrame);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$recordFrame->add($lineQuad);
|
$recordFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -610,13 +606,13 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
if (strlen($listRecord->nickname) < 2) {
|
if (strlen($listRecord->nickname) < 2) {
|
||||||
$listRecord->nickname = $listRecord->login;
|
$listRecord->nickname = $listRecord->login;
|
||||||
}
|
}
|
||||||
$array = array($listRecord->rank => $x + 5, '$fff' . $listRecord->nickname => $x + 18, $listRecord->login => $x + 70, Formatter::formatTime($listRecord->time) => $x + 101);
|
$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickname => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->time) => $posX + 101);
|
||||||
$this->maniaControl->manialinkManager->labelLine($recordFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($recordFrame, $array);
|
||||||
|
|
||||||
$recordFrame->setY($y);
|
$recordFrame->setY($posY);
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render and display xml
|
// Render and display xml
|
||||||
|
@ -156,6 +156,25 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given Ranking Type is valid
|
||||||
|
*
|
||||||
|
* @param string $rankingType
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function isValidRankingType($rankingType) {
|
||||||
|
return in_array($rankingType, $this->getRankingTypes());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the possible Ranking Types
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
private function getRankingTypes() {
|
||||||
|
return array(self::RANKING_TYPE_POINTS, self::RANKING_TYPE_RATIOS, self::RANKING_TYPE_RECORDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets and rebuilds the Ranking
|
* Resets and rebuilds the Ranking
|
||||||
*/
|
*/
|
||||||
@ -473,8 +492,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
$x = -$width / 2;
|
$posX = -$width / 2;
|
||||||
$y = $height / 2;
|
$posY = $height / 2;
|
||||||
|
|
||||||
//Predefine description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
@ -483,27 +502,27 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($posY - 5);
|
||||||
$array = array('$oRank' => $x + 5, '$oNickname' => $x + 18, '$oAverage' => $x + 70);
|
$array = array('$oRank' => $posX + 5, '$oNickname' => $posX + 18, '$oAverage' => $posX + 70);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$index = 1;
|
||||||
$y = $y - 10;
|
$posY -= 10;
|
||||||
$pageFrame = null;
|
$pageFrame = null;
|
||||||
|
|
||||||
while ($rankedPlayer = $result->fetch_object()) {
|
while ($rankedPlayer = $result->fetch_object()) {
|
||||||
if ($i % 15 === 1) {
|
if ($index % 15 === 1) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
$y = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPage($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($posY);
|
||||||
|
|
||||||
if ($i % 2 !== 0) {
|
if ($index % 2 !== 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -512,35 +531,16 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$playerObject = $this->maniaControl->playerManager->getPlayerByIndex($rankedPlayer->PlayerIndex);
|
$playerObject = $this->maniaControl->playerManager->getPlayerByIndex($rankedPlayer->PlayerIndex);
|
||||||
$array = array($rankedPlayer->Rank => $x + 5, $playerObject->nickname => $x + 18, (string)round($rankedPlayer->Avg, 2) => $x + 70);
|
$array = array($rankedPlayer->Rank => $posX + 5, $playerObject->nickname => $posX + 18, (string)round($rankedPlayer->Avg, 2) => $posX + 70);
|
||||||
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
$y -= 4;
|
$posY -= 4;
|
||||||
$i++;
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render and display xml
|
// Render and display xml
|
||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'TopRanks');
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'TopRanks');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the possible Ranking Types
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
private function getRankingTypes() {
|
|
||||||
return array(self::RANKING_TYPE_POINTS, self::RANKING_TYPE_RATIOS, self::RANKING_TYPE_RECORDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given Ranking Type is valid
|
|
||||||
*
|
|
||||||
* @param string $rankingType
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
private function isValidRankingType($rankingType) {
|
|
||||||
return in_array($rankingType, $this->getRankingTypes());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,6 @@ use ManiaControl\Callbacks\Callbacks;
|
|||||||
use ManiaControl\Callbacks\TimerListener;
|
use ManiaControl\Callbacks\TimerListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\IconManager;
|
use ManiaControl\Manialinks\IconManager;
|
||||||
use ManiaControl\Maps\Map;
|
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
@ -183,8 +182,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
* @param string $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayMapWidget($login = null) {
|
public function displayMapWidget($login = null) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT);
|
||||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||||
@ -198,7 +197,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -246,8 +245,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
* @param bool $login
|
* @param bool $login
|
||||||
*/
|
*/
|
||||||
public function displayClockWidget($login = false) {
|
public function displayClockWidget($login = false) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT);
|
||||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||||
@ -259,7 +258,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -285,8 +284,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
* @param string $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayServerInfoWidget($login = null) {
|
public function displayServerInfoWidget($login = null) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT);
|
||||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||||
@ -298,7 +297,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -390,12 +389,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle on Begin Map
|
* Handle Begin Map Callback
|
||||||
*
|
|
||||||
* @param Map $map
|
|
||||||
*/
|
*/
|
||||||
public function handleOnBeginMap(Map $map) {
|
public function handleOnBeginMap() {
|
||||||
// Display Map Widget
|
|
||||||
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
|
||||||
$this->displayMapWidget();
|
$this->displayMapWidget();
|
||||||
}
|
}
|
||||||
@ -403,12 +399,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle on End Map
|
* Handle End Map Callback
|
||||||
*
|
|
||||||
* @param Map $map
|
|
||||||
*/
|
*/
|
||||||
public function handleOnEndMap(Map $map) {
|
public function handleOnEndMap() {
|
||||||
// Display Map Widget
|
|
||||||
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED)) {
|
||||||
$this->displayNextMapWidget();
|
$this->displayNextMapWidget();
|
||||||
}
|
}
|
||||||
@ -420,8 +413,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
* @param string $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayNextMapWidget($login = null) {
|
public function displayNextMapWidget($login = null) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSX);
|
$posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSY);
|
$posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_WIDTH);
|
||||||
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT);
|
$height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT);
|
||||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||||
@ -434,7 +427,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($posX, $posY);
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
@ -519,11 +512,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerDisconnect Callback
|
||||||
*
|
|
||||||
* @param Player $player
|
|
||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(Player $player) {
|
public function handlePlayerDisconnect() {
|
||||||
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
||||||
$this->displayServerInfoWidget();
|
$this->displayServerInfoWidget();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user