X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FDiscordAppCommands%2FAosrPresetCommand.php;fp=app%2FDiscordAppCommands%2FAosrPresetCommand.php;h=8ec3eb4bf1d4c4bd43d9ac1dd2e0de5f38e150e4;hb=9aeade5903cf6d08509fe5b1264a6bc4e0eeb60a;hp=0000000000000000000000000000000000000000;hpb=e3880b3664a3916242a8a774a188686dd5c5297f;p=alttp.git diff --git a/app/DiscordAppCommands/AosrPresetCommand.php b/app/DiscordAppCommands/AosrPresetCommand.php new file mode 100644 index 0000000..8ec3eb4 --- /dev/null +++ b/app/DiscordAppCommands/AosrPresetCommand.php @@ -0,0 +1,474 @@ + $preset['name'], + 'value' => $preset['value'], + ]; + } + $cmd = $discord->application->commands->create([ + 'name' => 'aosr', + 'type' => 1, + 'description' => '(testing) Generate an AoSRando seed.', + 'description_localizations' => [ + 'de' => '(test) Generiert einen AoSRando Seed.', + ], + 'options' => [[ + 'name' => 'preset', + 'description' => '(testing) Generate an AoSRando seed from preset.', + 'description_localizations' => [ + 'de' => '(test) 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, + ]], + ]], + ]); + $discord->application->commands->save($cmd); + } + + public static function listen(Discord $discord) { + $discord->listenCommand(['aosr', 'preset'], function(Interaction $interaction) use ($discord) { + $presetName = $interaction->data->options['preset']->options['preset']->value; + $message = MessageBuilder::new(); + if (isset(static::$presets[$presetName])) { + $preset = static::$presets[$presetName]; + $seed = strval(random_int(-2147483648, 2147483647)); + $params = array_merge(['seed' => $seed], $preset['settings']); + $url = 'https://aosrando.surge.sh/?'.http_build_query($params, '', '&'); + $embed = new Embed($discord, [ + 'fields' => [ + new Field($discord, [ 'name' => 'Preset', 'value' => $preset['name'], 'inline' => true ]), + new Field($discord, [ 'name' => 'Seed', 'value' => $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' => 'Link', 'value' => $url ]), + ], + 'footer' => new Footer($discord, [ + 'text' => 'Grün', + ]), + 'timestamp' => now(), + 'title' => 'AoSRando Seed', + 'type' => 'rich', + 'url' => $url, + ]); + $message->addEmbed($embed); + } else { + $message->setContent('unknown preset '.$presetName); + } + $interaction->respondWithMessage($message); + return true; + }); + } + + private 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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + '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', + 'palette' => 'Vanilla', + ], + ], + ]; + +}