]> git.localhorst.tv Git - alttp.git/blobdiff - app/DiscordAppCommands/AosrPresetCommand.php
new aosr settings
[alttp.git] / app / DiscordAppCommands / AosrPresetCommand.php
index 96db00cdb38fad94fc3a694066c02873a1e7fe48..5ad05e00b0628c87145b467fa16a3c6a52d0e1ef 100644 (file)
@@ -5,9 +5,6 @@ namespace App\DiscordAppCommands;
 use App\Models\AosSeed;
 use Discord\Builders\MessageBuilder;
 use Discord\Discord;
-use Discord\Parts\Embed\Embed;
-use Discord\Parts\Embed\Field;
-use Discord\Parts\Embed\Footer;
 use Discord\Parts\Interactions\Interaction;
 
 class AosrPresetCommand {
@@ -65,41 +62,33 @@ class AosrPresetCommand {
                                $presetName = $interaction->data->options['preset']->options['preset']->value;
                                $race =  isset($interaction->data->options['preset']->options['race'])
                                        ? $interaction->data->options['preset']->options['race']->value : false;
-                               $message = MessageBuilder::new();
                                if (isset(static::$presets[$presetName])) {
                                        $preset = static::$presets[$presetName];
                                        $seed = AosSeed::generateSurge($presetName, $preset['settings'], $race);
 
-                                       $embed = new Embed($discord, [
-                                               'fields' => [
-                                                       new Field($discord, [ 'name' => 'Generator', 'value' => 'This seed has been generated with fusecv\'s randomizer on aosrando.surge.sh.' ]),
-                                                       new Field($discord, [ 'name' => 'Preset', 'value' => $preset['name'], 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Seed', 'value' => $seed->seed, 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Logic', 'value' => $preset['settings']['logic'], 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Area', 'value' => $preset['settings']['area'], 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Boss', 'value' => $preset['settings']['boss'], 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Enemy', 'value' => $preset['settings']['enemy'], 'inline' => true ]),
-                                                       new Field($discord, [ 'name' => 'Permalink', 'value' => $seed->permalink ]),
-                                               ],
-                                               'footer' => new Footer($discord, [
-                                                       'text' => 'GrĂ¼n',
-                                               ]),
-                                               'timestamp' => now(),
-                                               'title' => 'AoSRando Seed',
-                                               'type' => 'rich',
-                                               'url' => $seed->permalink,
-                                       ]);
-                                       $message->addEmbed($embed);
+                                       $process = $seed->createProcess();
+                                       $process->on('exit', function() use ($discord, $interaction, $seed) {
+                                               $seed = $seed->fresh();
+
+                                               $embed = $seed->createEmbed($discord);
+                                               $message = MessageBuilder::new();
+                                               $message->addEmbed($embed);
+
+                                               $interaction->updateOriginalResponse($message);
+                                       });
+
+                                       $process->start($discord->getLoop());
                                } else {
+                                       $message = MessageBuilder::new();
                                        $message->setContent('unknown preset '.$presetName);
+                                       $interaction->updateOriginalResponse($message);
                                }
-                               $interaction->updateOriginalResponse($message);
                        });
                        return true;
                });
        }
 
-       private static $presets = [
+       public static $presets = [
                'Normal' => [
                        'name' => 'Normal',
                        'value' => 'Normal',
@@ -121,6 +110,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -145,6 +136,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'true',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -169,6 +162,8 @@ class AosrPresetCommand {
                                'telestart' => 'true',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -193,6 +188,8 @@ class AosrPresetCommand {
                                'telestart' => 'true',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -217,6 +214,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -241,6 +240,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'true',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -265,6 +266,8 @@ class AosrPresetCommand {
                                'telestart' => 'true',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -289,6 +292,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -313,6 +318,8 @@ class AosrPresetCommand {
                                'telestart' => 'true',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -337,6 +344,34 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'true',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
+                               'palette' => 'Vanilla',
+                       ],
+               ],
+               'AreaRequireAllSouls' => [
+                       'name' => 'Area require all souls',
+                       'value' => 'AreaRequireAllSouls',
+                       'settings' => [
+                               'logic' => 'AreaTechTiers',
+                               'nodupes' => 'true',
+                               'panther' => 'NeverExists',
+                               'area' => 'AreaRandom',
+                               'boss' => 'Dead-endShuffle',
+                               'enemy' => 'RandomNoLimit',
+                               'itempool' => 'Standard',
+                               'weight' => '2.5',
+                               'grahm' => 'BookSouls',
+                               'kicker' => 'true',
+                               'startshop' => 'Vanilla',
+                               'shopprice' => 'Vanilla',
+                               'shopSouls' => 'Half',
+                               'levelexp' => 'Lvl1',
+                               'telestart' => 'false',
+                               'mapassist' => 'false',
+                               'doublechaos' => 'true',
+                               'reqallsouls' => 'true',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -361,6 +396,8 @@ class AosrPresetCommand {
                                'telestart' => 'true',
                                'mapassist' => 'true',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -385,6 +422,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -409,16 +448,18 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
-               'SGLive2021' => [
-                       'name' => 'SGLive 2021',
-                       'value' => 'SGLive2021',
+               'Tournament2021' => [
+                       'name' => 'Tournament 2021',
+                       'value' => 'Tournament2021',
                        'settings' => [
                                'logic' => 'AreaTechTiers',
                                'nodupes' => 'false',
-                               'panther' => 'FirstAlways',
+                               'panther' => 'Rand70Dup',
                                'area' => 'AreaRandom',
                                'boss' => 'Dead-endShuffle',
                                'enemy' => 'Vanilla',
@@ -433,16 +474,18 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
-               'Tournament2021' => [
-                       'name' => 'Tournament 2021',
-                       'value' => 'Tournament2021',
+               'SGLive2021' => [
+                       'name' => 'SGLive 2021',
+                       'value' => 'SGLive2021',
                        'settings' => [
                                'logic' => 'AreaTechTiers',
                                'nodupes' => 'false',
-                               'panther' => 'Rand70Dup',
+                               'panther' => 'FirstAlways',
                                'area' => 'AreaRandom',
                                'boss' => 'Dead-endShuffle',
                                'enemy' => 'Vanilla',
@@ -457,6 +500,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],
@@ -481,6 +526,8 @@ class AosrPresetCommand {
                                'telestart' => 'false',
                                'mapassist' => 'false',
                                'doublechaos' => 'false',
+                               'reqallsouls' => 'false',
+                               'noww' => 'false',
                                'palette' => 'Vanilla',
                        ],
                ],