-<?php
-
-namespace App\DiscordAppCommands;
-
-use App\Models\AosSeed;
-use Discord\Builders\MessageBuilder;
-use Discord\Discord;
-use Discord\Parts\Interactions\Interaction;
-
-class AosrPresetCommand {
-
- public static function create(Discord $discord) {
- $choices = [];
- foreach (static::$presets as $preset) {
- $choices[] = [
- 'name' => $preset['name'],
- 'value' => $preset['value'],
- ];
- }
- $cmd = $discord->application->commands->create([
- 'name' => 'aosr',
- 'type' => 1,
- 'description' => 'Generate an AoSRando seed.',
- 'description_localizations' => [
- 'de' => 'Generiert einen AoSRando Seed.',
- ],
- 'options' => [[
- 'name' => 'preset',
- 'description' => 'Generate an AoSRando seed from preset.',
- 'description_localizations' => [
- 'de' => 'Generiert einen AoSRando Seed anhand eines Presets.',
- ],
- 'type' => 1,
- 'options' => [[
- 'name' => 'preset',
- 'description' => 'Which preset to use',
- 'description_localizations' => [
- 'de' => 'Welches Preset genutzt werden soll.',
- ],
- 'type' => 3,
- 'required' => true,
- 'choices' => $choices,
- ], [
- 'name' => 'race',
- 'description' => 'Generate race ROM, seed will be hidden',
- 'description_localizations' => [
- 'de' => 'Race ROM generieren, Seed wird versteckt.',
- ],
- 'type' => 5,
- 'required' => false,
- ]],
- ]],
- ]);
- $discord->application->commands->save($cmd);
- }
-
- public static function delete(Discord $discord) {
- $discord->application->commands->freshen()->then(function () use ($discord) {
- $cmd = $discord->application->commands->find(function ($cmd) {
- return $cmd->name == 'aosr';
- });
- if ($cmd) {
- $discord->application->commands->delete($cmd);
- }
- });
- }
-
- public static function presetByName($name) {
- if (isset(static::$presets[$name])) {
- return static::$presets[$name];
- }
- foreach (static::$presets as $presetName => $preset) {
- if (strcasecmp($name, $presetName) === 0) {
- return $preset;
- }
- }
- return null;
- }
-
- public static function listen(Discord $discord) {
- $discord->listenCommand(['aosr', 'preset'], function(Interaction $interaction) use ($discord) {
- $interaction
- ->acknowledgeWithResponse()
- ->done(function() use($discord, $interaction) {
- $presetName = $interaction->data->options['preset']->options['preset']->value;
- $race = isset($interaction->data->options['preset']->options['race'])
- ? $interaction->data->options['preset']->options['race']->value : false;
- if (isset(static::$presets[$presetName])) {
- $preset = static::$presets[$presetName];
- $seed = AosSeed::generateSurge($presetName, $preset['settings'], $race);
-
- $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);
- }
- });
- return true;
- });
- }
-
- public static $presets = [
- 'Normal' => [
- 'name' => 'Normal',
- 'value' => 'Normal',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'Vanilla',
- 'boss' => 'Vanilla',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Vanilla',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => 'Vanilla',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'Beginner' => [
- 'name' => 'Beginner',
- 'value' => 'Beginner',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'Vanilla',
- 'boss' => 'Vanilla',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '0',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => '2PerGroup',
- 'levelexp' => 'Casual',
- 'telestart' => 'false',
- 'mapassist' => 'true',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'SpicyNormal' => [
- 'name' => 'Spicy normal',
- 'value' => 'SpicyNormal',
- 'settings' => [
- 'logic' => 'VeryRandom',
- 'nodupes' => 'true',
- 'panther' => 'Rand70Dup',
- 'area' => 'Vanilla',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'RandomPM20',
- 'itempool' => 'Standard',
- 'weight' => '1.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Hard',
- 'telestart' => 'true',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'ExtraFastNormal' => [
- 'name' => 'Extra fast normal',
- 'value' => 'ExtraFastNormal',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'Vanilla',
- 'boss' => 'Vanilla',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '1.0',
- 'grahm' => 'NoCheck',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'true',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'Area' => [
- 'name' => 'Area',
- 'value' => 'Area',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Vanilla',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => 'Vanilla',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'AreaBeginner' => [
- 'name' => 'Area beginner',
- 'value' => 'AreaBeginner',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '0',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => '2PerGroup',
- 'levelexp' => 'Casual',
- 'telestart' => 'false',
- 'mapassist' => 'true',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'AreaSpicy' => [
- 'name' => 'Area spicy',
- 'value' => 'AreaSpicy',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'true',
- 'panther' => 'Rand70Dup',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'RandomPM20',
- 'itempool' => 'Standard',
- 'weight' => '1.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Hard',
- 'telestart' => 'true',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'AreaAllBosses' => [
- 'name' => 'Area all bosses',
- 'value' => 'AreaAllBosses',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'AllBosses',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => '2PerGroup',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'AreaExtraFast' => [
- 'name' => 'Area extra fast',
- 'value' => 'AreaExtraFast',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '1.0',
- 'grahm' => 'NoCheck',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'true',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'AreaExpert' => [
- 'name' => 'Area expert',
- 'value' => 'AreaExpert',
- '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' => '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',
- ],
- ],
- 'DoorAllBossesEasy' => [
- 'name' => 'Door all bosses easy',
- 'value' => 'DoorAllBossesEasy',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'DoorRandom',
- 'boss' => 'Vanilla',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '0',
- 'grahm' => 'AllBosses',
- 'kicker' => 'true',
- 'startshop' => 'Unlocked',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => '2PerGroup',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'true',
- 'mapassist' => 'true',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'DoorAllBosses' => [
- 'name' => 'Door all bosses',
- 'value' => 'DoorAllBosses',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'DoorRandom',
- 'boss' => 'Vanilla',
- 'enemy' => 'RandomPM20',
- 'itempool' => 'Standard',
- 'weight' => '0',
- 'grahm' => 'AllBosses',
- 'kicker' => 'true',
- 'startshop' => 'Vanilla',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => '2PerGroup',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'SGLive2020' => [
- 'name' => 'SGLive 2020',
- 'value' => 'SGLive2020',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'Vanilla',
- 'boss' => 'Vanilla',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Vanilla',
- 'shopprice' => 'Vanilla',
- 'shopSouls' => 'Vanilla',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'Tournament2021' => [
- 'name' => 'Tournament 2021',
- 'value' => 'Tournament2021',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'Rand70Dup',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'SGLive2021' => [
- 'name' => 'SGLive 2021',
- 'value' => 'SGLive2021',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- 'Tournament2022' => [
- 'name' => 'Tournament 2022',
- 'value' => 'Tournament2022',
- 'settings' => [
- 'logic' => 'AreaTechTiers',
- 'nodupes' => 'false',
- 'panther' => 'FirstAlways',
- 'area' => 'AreaRandom',
- 'boss' => 'Dead-endShuffle',
- 'enemy' => 'Vanilla',
- 'itempool' => 'Standard',
- 'weight' => '2.5',
- 'grahm' => 'BookSouls',
- 'kicker' => 'false',
- 'startshop' => 'Unlocked30k',
- 'shopprice' => 'RandHV',
- 'shopSouls' => 'Half',
- 'levelexp' => 'Vanilla',
- 'telestart' => 'false',
- 'mapassist' => 'false',
- 'doublechaos' => 'false',
- 'reqallsouls' => 'false',
- 'noww' => 'false',
- 'palette' => 'Vanilla',
- ],
- ],
- ];
-
-}