Skip to content
Permalink
Browse files

Merge pull request #24 from EvoTM/develop

Develop
  • Loading branch information...
brakerb committed Oct 3, 2019
2 parents 62bf51e + 1dcf1e8 commit 591849089857e2c1c8d7cd8237c386172a11083b
Showing with 6,258 additions and 2,732 deletions.
  1. +47 −0 Migrations/1568455055_remove-mx-details-from-maps-table.php
  2. +37 −0 Migrations/1569049329_create-pb-table.php
  3. +6 −3 README.md
  4. +1 −1 config/default/colors.config.json
  5. +5 −0 core/Classes/ChatCommand.php
  6. +15 −11 core/Classes/ChatMessage.php
  7. +26 −0 core/Classes/DB.php
  8. +1 −1 core/Classes/File.php
  9. +1 −1 core/Classes/Hook.php
  10. +29 −77 core/Classes/Log.php
  11. +40 −4 core/Classes/ManiaLinkEvent.php
  12. +2 −2 core/Classes/RestClient.php
  13. +17 −5 core/Classes/Server.php
  14. +33 −23 core/Classes/Template.php
  15. +26 −21 core/Classes/Timer.php
  16. +115 −0 core/Commands/ChatRouter.php
  17. +56 −14 core/Commands/EscRun.php
  18. +197 −0 core/Commands/ImportPyplanet.php
  19. +56 −58 core/Commands/ImportUaseco.php
  20. +57 −0 core/Controllers/AccessRightsController.php
  21. +18 −10 core/Controllers/AfkController.php
  22. +11 −3 core/Controllers/BansController.php
  23. +47 −38 core/Controllers/ChatController.php
  24. +10 −0 core/Controllers/ConfigController.php
  25. +26 −0 core/Controllers/ControllerController.php
  26. +48 −37 core/Controllers/CountdownController.php
  27. +26 −13 core/Controllers/EventController.php
  28. +25 −12 core/Controllers/HookController.php
  29. +86 −49 core/Controllers/MapController.php
  30. +88 −6 core/Controllers/MatchSettingsController.php
  31. +21 −3 core/Controllers/ModeScriptEventController.php
  32. +52 −30 core/Controllers/ModuleController.php
  33. +9 −0 core/Controllers/PlanetsController.php
  34. +79 −29 core/Controllers/PlayerController.php
  35. +29 −21 core/Controllers/QueueController.php
  36. +36 −16 core/Controllers/SetupController.php
  37. +30 −21 core/Controllers/TemplateController.php
  38. +8 −0 core/Dictionary/de/general.json
  39. +8 −0 core/Dictionary/en/general.json
  40. +7 −0 core/Interfaces/ControllerInterface.php
  41. +2 −1 core/Interfaces/ModuleInterface.php
  42. +1 −1 core/Models/AccessRight.php
  43. +25 −17 core/Models/Map.php
  44. +4 −0 core/Models/MapQueue.php
  45. +25 −0 core/Models/Pb.php
  46. +26 −15 core/Models/Player.php
  47. +5 −0 core/Modules/321/321go.config.json
  48. +163 −0 core/Modules/321/Templates/widget.latte.xml
  49. +31 −0 core/Modules/321/ThreeTwoOneGo.php
  50. +0 −11 core/Modules/_tester/Templates/test.latte.xml
  51. +12 −9 core/Modules/_tester/TestModule.php
  52. +51 −18 core/Modules/added-time-info/AddedTimeInfo.php
  53. +74 −76 core/Modules/added-time-info/Templates/widget.latte.xml
  54. +6 −0 core/Modules/added-time-info/added-time-info.config.json
  55. +13 −12 core/Modules/alter-ui/AlterUi.php
  56. +1 −1 core/Modules/ban-gui/BanGUI.php
  57. +4 −3 core/Modules/clock/Templates/clock.latte.xml
  58. +12 −50 core/Modules/countdown/CountDown.php
  59. +111 −64 core/Modules/countdown/Templates/widget.latte.xml
  60. +6 −0 core/Modules/countdown/countdown.config.json
  61. +57 −9 core/Modules/cp-position-tracker/CpPositionTracker.php
  62. +98 −72 core/Modules/cp-position-tracker/Templates/manialink.latte.xml
  63. +12 −0 core/Modules/cp-position-tracker/Templates/update.latte.xml
  64. +4 −2 core/Modules/cp-position-tracker/cp-pos-tracker.config.json
  65. +1 −2 core/Modules/cp-position-tracker/module.json
  66. +47 −5 core/Modules/cp-records/CPRecords.php
  67. +7 −0 core/Modules/cp-records/Templates/widget.latte.xml
  68. +19 −19 core/Modules/dedimania-records/Dedimania.php
  69. +17 −1 core/Modules/dedimania-records/Models/Dedi.php
  70. +1 −1 core/Modules/dedimania-records/dedimania.config.json
  71. +2 −10 core/Modules/group-manager/GroupManager.php
  72. +3 −4 core/Modules/help/Help.php
  73. +8 −3 core/Modules/help/Templates/about.latte.xml
  74. +8 −3 core/Modules/help/Templates/cmds.latte.xml
  75. +22 −11 core/Modules/info-messages/InfoMessages.php
  76. +57 −58 core/Modules/info-messages/Templates/manialink.latte.xml
  77. +2 −2 core/Modules/key-binds/KeyBinds.php
  78. +179 −0 core/Modules/live-rankings-rounds/LiveRankingsRounds.php
  79. +12 −0 core/Modules/live-rankings-rounds/Templates/update.latte.xml
  80. +214 −0 core/Modules/live-rankings-rounds/Templates/widget.latte.xml
  81. 0 core/Modules/{live-rankings → live-rankings-rounds}/live-rankings.config.json
  82. +5 −0 core/Modules/live-rankings-rounds/module.json
  83. +21 −12 core/Modules/live-rankings/LiveRankings.php
  84. +5 −6 core/Modules/live-rankings/Templates/widget.latte.xml
  85. +9 −0 core/Modules/live-rankings/live-rankings-rounds.config.json
  86. +197 −137 core/Modules/local-records/LocalRecords.php
  87. +16 −0 core/Modules/local-records/Models/LocalRecord.php
  88. +21 −82 core/Modules/local-records/Templates/manialink.latte.xml
  89. +8 −11 core/Modules/local-records/Templates/update.latte.xml
  90. +1 −1 core/Modules/local-records/locals.config.json
  91. +60 −75 core/Modules/map-list/MapList.php
  92. +355 −664 core/Modules/map-list/Templates/map-list.latte.xml
  93. +241 −0 core/Modules/map-list/Templates/map-queue.latte.xml
  94. +156 −0 core/Modules/map-list/Templates/map-widget.latte.xml
  95. +13 −0 core/Modules/map-list/Templates/update-favorites.latte.xml
  96. +13 −4 core/Modules/map-list/Templates/update-map-list.latte.xml
  97. +4 −3 core/Modules/map-list/Templates/update-map-queue.latte.xml
  98. +107 −0 core/Modules/match-tracker/MatchTracker.php
  99. +12 −0 core/Modules/match-tracker/Template/update.latte.xml
  100. +177 −0 core/Modules/match-tracker/Template/widget.latte.xml
  101. +7 −0 core/Modules/match-tracker/match-tracker.config.json
  102. +126 −46 core/Modules/matchsettings-manager/MatchSettingsManager.php
  103. +205 −0 core/Modules/matchsettings-manager/Templates/edit-maps.latte.xml
  104. +167 −0 core/Modules/matchsettings-manager/Templates/edit-settings.latte.xml
  105. +2 −3 core/Modules/matchsettings-manager/Templates/edit.latte.xml
  106. +18 −12 core/Modules/matchsettings-manager/Templates/overview.latte.xml
  107. +26 −0 core/Modules/matchsettings-manager/Templates/send-maps.latte.xml
  108. +42 −19 core/Modules/music-client/MusicClient.php
  109. +216 −0 core/Modules/music-client/Templates/list.latte.xml
  110. +29 −251 core/Modules/music-client/Templates/music-client.latte.xml
  111. +1 −4 core/Modules/music-client/Templates/search-command.latte.xml
  112. +33 −0 core/Modules/music-client/Templates/send-music.latte.xml
  113. +51 −21 core/Modules/mx-details/MxMapDetails.php
  114. +14 −12 core/Modules/mx-details/Templates/window.latte.xml
  115. +5 −1 core/Modules/mx-download/Classes/MxMap.php
  116. +11 −11 core/Modules/mx-download/MxDownload.php
  117. +9 −1 core/Modules/mx-download/Templates/add-map-info.latte.xml
  118. +62 −69 core/Modules/mx-karma/MxKarma.php
  119. +3 −0 core/Modules/mx-packs/MxPackJob.php
  120. +56 −8 core/Modules/mx-packs/Templates/confirm.latte.xml
  121. +17 −5 core/Modules/next-map/NextMap.php
  122. +1 −1 core/Modules/next-map/Templates/widget.latte.xml
  123. +43 −24 core/Modules/pb-records/PBRecords.php
  124. +7 −7 core/Modules/profile-viewer/ProfileViewer.php
  125. +8 −5 core/Modules/quick-buttons/QuickButtons.php
  126. +40 −28 core/Modules/quick-buttons/Templates/overlay.latte.xml
  127. +4 −1 core/Modules/quick-buttons/quick-buttons.config.json
  128. +47 −3 core/Modules/records-table/RecordsTable.php
  129. +106 −0 core/Modules/records-table/Templates/graph.latte.xml
  130. +17 −9 core/Modules/records-table/Templates/table.latte.xml
  131. +1 −1 core/Modules/reset/ResetModule.php
  132. +46 −19 core/Modules/roundtime/Templates/meter.latte.xml
  133. +32 −0 core/Modules/scoreboard/Scoreboard.php
  134. +12 −0 core/Modules/scoreboard/Templates/bootstrap.latte.xml
  135. +13 −0 core/Modules/scoreboard/Templates/scoreboard.latte.xml
  136. +10 −5 core/Modules/server-hopper/Template/widget.latte.xml
  137. +1 −1 core/Modules/server-hopper/server-hopper.config.json
  138. +37 −10 core/Modules/speedometer/Templates/meter.latte.xml
  139. +24 −13 core/Modules/statistics/Classes/StatisticWidget.php
  140. +53 −39 core/Modules/statistics/Statistics.php
  141. +21 −14 core/Modules/ui-settings/Templates/manialink.latte.xml
  142. +10 −4 core/Modules/votes/Votes.php
  143. +40 −0 core/Modules/warmup-widget/Templates/widget.latte.xml
  144. +58 −0 core/Modules/warmup-widget/WarmUpWidget.php
  145. +7 −0 core/Modules/warmup-widget/warmup.config.json
  146. +1 −1 core/Modules/warning/Warning.php
  147. +15 −0 core/TemplateComponents/components/pagination.latte.xml
  148. +45 −4 core/TemplateComponents/components/tabbed-window.latte.xml
  149. +7 −1 core/TemplateComponents/components/tabs.latte.xml
  150. +29 −18 core/TemplateComponents/components/widget-base.latte.xml
  151. +49 −13 core/TemplateComponents/components/window.latte.xml
  152. +8 −6 core/TemplateComponents/dialogues/confirm.latte.xml
  153. +17 −0 core/TemplateComponents/scripts/drag.latte.xml
  154. +3 −3 core/TemplateComponents/scripts/hide.latte.xml
  155. +25 −0 core/TemplateComponents/scripts/mle.latte.xml
  156. +23 −1 core/autoload.php
  157. +98 −52 core/global-functions.php
  158. +6 −2 esc
@@ -0,0 +1,47 @@
<?php
namespace esc\Migrations;
use esc\Classes\Cache;
use esc\Classes\File;
use esc\Models\Map;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
class RemoveMxDetailsFromMapsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(Builder $schemaBuilder)
{
if (!File::dirExists(cacheDir('mx-details'))) {
File::makeDir(cacheDir('mx-details'));
}
if (!File::dirExists(cacheDir('mx-wr'))) {
File::makeDir(cacheDir('mx-wr'));
}
$schemaBuilder->table('maps', function (Blueprint $schema) {
$schema->dropColumn('mx_details');
$schema->dropColumn('mx_world_record');
$schema->integer('mx_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(Builder $schemaBuilder)
{
$schemaBuilder->table('maps', function (Blueprint $schema) {
$schema->text('mx_details')->nullable();
$schema->text('mx_world_record')->nullable();
});
}
}
@@ -0,0 +1,37 @@
<?php
namespace esc\Migrations;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
class CreatePbTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(Builder $schemaBuilder)
{
$schemaBuilder->create('pbs', function (Blueprint $table) {
$table->integer('map_id');
$table->integer('player_id');
$table->integer('score');
$table->text('checkpoints');
$table->timestamps();
$table->unique(['map_id', 'player_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(Builder $schemaBuilder)
{
$schemaBuilder->dropIfExists('pbs');
}
}
@@ -11,6 +11,9 @@ A server controller for Trackmania² based on PHP 7.2 with Maniaplanet 4.1 suppo
| ⚠ WARNING: The controller is not ready to run _stable_ on a live server in its current state. |
| --- |

:no_entry: **Do not use the develop-branch unless you are a developer.** The branch can be unstable and we do not have the time and ressources to give support at all times. Safe updates are always pushed to the master-branch.


### Requirements
* PHP 7.2+
* MySQL or MariaDB Server
@@ -27,8 +30,7 @@ A server controller for Trackmania² based on PHP 7.2 with Maniaplanet 4.1 suppo
| ⚠ If the cache and log folder are not created automatically, you need to create them and restart the controller. |
| --- |
###### Updating a github installation
1. Go to the EvoSC directory you want to update and run `git pull`.

1. Go to the EvoSC directory you want to update and run `git pull`.
### Music server installation
Download the [music-server](https://github.com/EvoTM/EvoSC/raw/master/core/Modules/music-client/music-server.zip) and extract it to your webserver with the ogg-files. Copy the `music.config.json` from the music-client-module directory to your config directory and set `url` to the URL of your webserver.

@@ -40,8 +42,9 @@ Get all available commands `php esc list`

| Action | Description |
| --------- | -------------------------------------------- |
| Run EvoSC | In terminal type `php esc run (-v&#124;-vv&#124;-vvv)` |
| Run EvoSC | In terminal type `php esc run (-v/-vv/-vvv/-s/-f)`. -v/vv/vvv for verbosity. -f will skip map verification on start. -s will skip migrations on start.|
| Import data from UASECO | In terminal type `php esc import:uaseco {host} {database} {user} {password}` optionally add `{table_prefix}` |
| Import data from PyPlanet | In terminal type `php esc import:pyplanet {host} {database} {user} {password}` optionally add `{table_prefix}` |
| Fix player scores and ranking | Run `php esc fix:scores` to re-calculate all scores and fix the player ranks. |
| Creating a database migration | Run `php esc make:migration <MigrationClassName>`. The migration is saved to to /Migrations. Copy it to your module if necessary. |

@@ -3,7 +3,7 @@
"secondary": "eee",
"chat" : "FF0",
"info" : "5ad",
"warning" : "f22",
"warning" : "e33",
"local" : "3d4",
"dedi" : "4b2",
"ui" : {
@@ -176,4 +176,9 @@ public function execute(Player $player, string $text)
call_user_func_array($this->callback, $arguments);
}
}
public static function removeAll()
{
self::$commands = collect();
}
}
@@ -24,7 +24,7 @@ class ChatMessage
*
* Parts can be strings, numbers, player/group/map/local/etc-objects (most objects are formatted automatically).
*
* @param mixed ...$message
* @param mixed ...$message
*/
public function __construct(...$message)
{
@@ -35,7 +35,7 @@ public function __construct(...$message)
/**
* Set the primary color of the chat message.
*
* @param string $color
* @param string $color
*
* @return \esc\Classes\ChatMessage
*/
@@ -49,7 +49,7 @@ public function setColor(string $color): ChatMessage
/**
* Set the icon of the chat-message, can contain color-code.
*
* @param string $icon
* @param string $icon
*
* @return \esc\Classes\ChatMessage
*/
@@ -68,7 +68,7 @@ public function setIcon(string $icon): ChatMessage
public function setIsInfoMessage(): ChatMessage
{
$this->color = config('colors.info');
$this->icon = '';
$this->icon = '';
return $this;
}
@@ -81,15 +81,15 @@ public function setIsInfoMessage(): ChatMessage
public function setIsWarning(): ChatMessage
{
$this->color = config('colors.warning');
$this->icon = '';
$this->icon = '';
return $this;
}
/**
* Overwrite the chat-message content.
*
* @param mixed ...$parts
* @param mixed ...$parts
*
* @return \esc\Classes\ChatMessage
*/
@@ -111,7 +111,7 @@ public function getMessage(): string
foreach ($this->parts as $part) {
if ($part instanceof Player || $part instanceof Map) {
$message .= secondary($part) . '$z$s';
$message .= secondary($part).'$z$s';
continue;
}
@@ -120,15 +120,15 @@ public function getMessage(): string
continue;
}
$message .= '$z$s$' . $this->color . $part;
$message .= '$z$s$'.$this->color.$part;
}
if ($this->icon) {
return '$fff' . $this->icon . ' $z$s' . $message;
return '$fff'.$this->icon.' $z$s'.$message;
}
if (substr($message, -1) != '.') {
$message .= '$z$s$' . $this->color . '.';
$message .= '$z$s$'.$this->color.'.';
}
return $message;
@@ -140,6 +140,7 @@ public function getMessage(): string
public function sendAll()
{
Server::chatSendServerMessage($this->getMessage());
Log::info($this->getMessage());
}
/**
@@ -155,12 +156,13 @@ public function sendAdmin()
});
Server::executeMulticall();
Log::info($this->getMessage());
}
/**
* Send the message to a specific player.
*
* @param \esc\Models\Player|null|string $player
* @param \esc\Models\Player|null|string $player
*/
public function send($player = null)
{
@@ -170,9 +172,11 @@ public function send($player = null)
if ($player instanceof Player) {
Server::chatSendServerMessage($this->getMessage(), $player->Login);
Log::info("(@$player)".$this->getMessage(), isVerbose());
} else {
if (is_string($player)) {
Server::chatSendServerMessage($this->getMessage(), $player);
Log::info("(@$player)".$this->getMessage(), isVerbose());
}
}
}
@@ -0,0 +1,26 @@
<?php
namespace esc\Classes;
class DB
{
/**
* @param string $tableName
* @return \Illuminate\Database\Query\Builder
*/
public static function table(string $tableName)
{
return Database::getConnection()->table($tableName);
}
/**
* @param string $query
* @return bool
*/
public static function raw(string $query)
{
return Database::getConnection()->statement($query);
}
}
@@ -186,7 +186,7 @@ public static function delete(string $path): bool
if (file_exists($path) && is_file($path)) {
unlink($path);
Log::write('Deleted file: ' . $path);
Log::warning('Deleted file: ' . $path);
return true;
}
@@ -131,7 +131,7 @@ public static function add(string $event, callable $callback, bool $runOnce = fa
try {
HookController::add($event, $callback, $runOnce, $priority);
} catch (Exception $e) {
Log::write(sprintf('Failed to add hook %s: %s', $event, serialize($callback)));
Log::error(sprintf('Failed to add hook %s: %s', $event, serialize($callback)));
}
}

0 comments on commit 5918490

Please sign in to comment.
You can’t perform that action at this time.