diff --git a/changelog.txt b/changelog.txt index 08848471..08bea907 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,34 @@ -##v0.16x### -# Additions +###v0.252### +#Additions +- Ingame-Changelog +- New customizations for Join&Leave-Messages +- Symbolic Link resolving in ServerManager +- Times in Map Widget + +#Bug Fixes +- GReplay for Dedimania-Records not being sent +- non-numeric value warning on self-triggered debug notice + +###v0.250### +#Additions +- AuthenticationManager allows permissions to be stored inside Plugins +- CallQueue to balance performance-heavy functions +- Commands can be disabled by Plugins +- /delrec can delete your personal local record (Permission-Setting) +- simple DB-Installation-Script (Unix-only) + +#Bug Fixes +- //delrec can delete every local record (Permission-Setting) +- Replaced deprecated code + +#Changes +- Format milliseconds with dot instead of double colon (1:02:375 -> 1:02.375) +- Notification-System of Local Records + +###v0.16x### +#Additions - updated mx links to https -# Changes +#Changes - CommunicationMethod SET_SERVER_OPTIONS sets the changed values also in database on call - Changed Copyright label to 2014-2016 @@ -12,7 +39,7 @@ - added Scriptcallbacks SCORESREADY / SCORES - added SSL support as well as http Redirections of the FileReader -# Bug fixes +#Bug Fixes - Banning of not connected Players now possible ###v0.162### diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 5a4f9b7c..f5a83926 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -34,6 +34,7 @@ use ManiaControl\Script\ModeScriptEventManager; use ManiaControl\Server\Server; use ManiaControl\Settings\SettingManager; use ManiaControl\Statistics\StatisticManager; +use ManiaControl\Update\ChangeLog; use ManiaControl\Update\UpdateManager; use ManiaControl\Utils\CommandLineHelper; use ManiaControl\Utils\SystemUtil; @@ -94,6 +95,10 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, * @see getChat() */ private $chat = null; + /** @var ChangeLog $changeLog + * @see getChangeLog() + */ + private $changeLog = null; /** @var ColorManager $colorManager * @see getColorManager() */ @@ -212,6 +217,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, $this->configurator = new Configurator($this); $this->pluginManager = new PluginManager($this); $this->updateManager = new UpdateManager($this); + $this->changeLog = new ChangeLog($this); $this->getErrorHandler()->init(); @@ -346,6 +352,15 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, return $this->chat; } + /** + * Return the changelog + * + * @return ChangeLog + */ + public function getChangeLog() { + return $this->changeLog; + } + /** * Return the error handler * diff --git a/core/Update/ChangeLog.php b/core/Update/ChangeLog.php new file mode 100644 index 00000000..eea13b15 --- /dev/null +++ b/core/Update/ChangeLog.php @@ -0,0 +1,134 @@ + + * @copyright 2014-2020 ManiaControl Team + * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 + */ +class ChangeLog implements CommandListener { + /* + * Private properties + */ + /** @var ManiaControl $maniaControl */ + private $maniaControl = null; + + /** + * Construct a new update manager instance + * + * @param ManiaControl $maniaControl + */ + public function __construct(ManiaControl $maniaControl) { + $this->maniaControl = $maniaControl; + + // Chat commands + $this->maniaControl->getCommandManager()->registerCommandListener('changelog', $this, 'handle_ChangeLog', true, 'Opens a ChangeLog ingame.'); + } + + /** + * Get the ChangeLog + * @return array + */ + private function getChangeLogArray() { + static $changelog = null; + if ($changelog === null) { + $changelog = $this->readChangeLog(); + } + + return $changelog; + } + + /** + * Displays the ChangeLog Window + * @param array $chatCallback + * @param Player $player + */ + public function handle_ChangeLog(array $chatCallback, Player $player) { + // Build Manialink + $height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); + $width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); + $quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); + + $manialink = new ManiaLink(ManialinkManager::MAIN_MLID); + $script = $manialink->getScript(); + $paging = new Paging(); + $script->addFeature($paging); + + $frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); + $manialink->addChild($frame); + + // Headline + $label = new Label_Text(); + $frame->addChild($label); + $label->setHorizontalAlign($label::LEFT); + $label->setPosition(-0.45*$width, 0.45*$height); + $label->setSize($width * 0.6, 5); + $label->setStyle($label::STYLE_TextCardSmall); + $label->setText('Changelog of ManiaControl'); + $label->setTextColor('ff0'); + $label->setTextSize(3); + $label->setVerticalAlign($label::TOP); + + $posX = -0.45*$width; + $initialPosY = 0.4*$height - 5; + + $changelog = $this->getChangeLogArray(); + if (empty($changelog)) { + // TODO error + } + + $i = 0; + $numLines = 15; + $pageFrame = null; + foreach ($changelog as $line) { + if ($i % $numLines == 0 || substr($line, 0, 3) === '###') { + // page full, or new version number + $pageFrame = new Frame(); + $frame->addChild($pageFrame); + $paging->addPageControl($pageFrame); + + $posY = $initialPosY; + $i = 0; + } + + $label = new Label_Text(); + $pageFrame->addChild($label); + $label->setHorizontalAlign($label::LEFT); + $label->setPosition($posX, $posY); + $label->setStyle($label::STYLE_TextCardMedium); + $label->setText(str_replace('$', '$$', $line)); // prevent ManiaPlanet formatting + $label->setTextSize(2); + + $posY -= 4; + $i++; + } + + // Display manialink + $this->maniaControl->getManialinkManager()->sendManialink($manialink, $player); + } + + /** + * Reads the changelog.txt in the root-directory into an array + */ + private function readChangeLog() { + $changelog = file_get_contents('changelog.txt'); + if ($changelog === false) { + return array(); + } + + return preg_split('/[\r\n]/', $changelog); + } +} \ No newline at end of file diff --git a/core/Update/UpdateManager.php b/core/Update/UpdateManager.php index ca37d6ce..637bf95b 100644 --- a/core/Update/UpdateManager.php +++ b/core/Update/UpdateManager.php @@ -402,7 +402,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener, // Set the build date $this->setBuildDate($updateData->releaseDate); - $message = 'Update finished!'; + $message = 'Update finished! See what we updated with $<$fff//chatlog$>!'; if ($player) { $this->maniaControl->getChat()->sendSuccess($message, $player); }