3 namespace App\DiscordAppCommands;
5 use App\Models\AosSeed;
6 use Discord\Builders\MessageBuilder;
8 use Discord\Parts\Interactions\Interaction;
10 class AosrPresetCommand {
12 public static function create(Discord $discord) {
14 foreach (static::$presets as $preset) {
16 'name' => $preset['name'],
17 'value' => $preset['value'],
20 $cmd = $discord->application->commands->create([
23 'description' => 'Generate an AoSRando seed.',
24 'description_localizations' => [
25 'de' => 'Generiert einen AoSRando Seed.',
29 'description' => 'Generate an AoSRando seed from preset.',
30 'description_localizations' => [
31 'de' => 'Generiert einen AoSRando Seed anhand eines Presets.',
36 'description' => 'Which preset to use',
37 'description_localizations' => [
38 'de' => 'Welches Preset genutzt werden soll.',
42 'choices' => $choices,
45 'description' => 'Generate race ROM, seed will be hidden',
46 'description_localizations' => [
47 'de' => 'Race ROM generieren, Seed wird versteckt.',
54 $discord->application->commands->save($cmd);
57 public static function listen(Discord $discord) {
58 $discord->listenCommand(['aosr', 'preset'], function(Interaction $interaction) use ($discord) {
60 ->acknowledgeWithResponse()
61 ->done(function() use($discord, $interaction) {
62 $presetName = $interaction->data->options['preset']->options['preset']->value;
63 $race = isset($interaction->data->options['preset']->options['race'])
64 ? $interaction->data->options['preset']->options['race']->value : false;
65 if (isset(static::$presets[$presetName])) {
66 $preset = static::$presets[$presetName];
67 $seed = AosSeed::generateSurge($presetName, $preset['settings'], $race);
69 $process = $seed->createProcess();
70 $process->on('exit', function() use ($discord, $interaction, $seed) {
71 $seed = $seed->fresh();
73 $embed = $seed->createEmbed($discord);
74 $message = MessageBuilder::new();
75 $message->addEmbed($embed);
77 $interaction->updateOriginalResponse($message);
80 $process->start($discord->getLoop());
82 $message = MessageBuilder::new();
83 $message->setContent('unknown preset '.$presetName);
84 $interaction->updateOriginalResponse($message);
91 public static $presets = [
96 'logic' => 'AreaTechTiers',
98 'panther' => 'Rand70Dup',
101 'enemy' => 'Vanilla',
102 'itempool' => 'Standard',
104 'grahm' => 'BookSouls',
106 'startshop' => 'Vanilla',
107 'shopprice' => 'Vanilla',
108 'shopSouls' => 'Vanilla',
109 'levelexp' => 'Vanilla',
110 'telestart' => 'false',
111 'mapassist' => 'false',
112 'doublechaos' => 'false',
113 'reqallsouls' => 'false',
115 'palette' => 'Vanilla',
119 'name' => 'Beginner',
120 'value' => 'Beginner',
122 'logic' => 'AreaTechTiers',
123 'nodupes' => 'false',
124 'panther' => 'FirstAlways',
127 'enemy' => 'Vanilla',
128 'itempool' => 'Standard',
130 'grahm' => 'BookSouls',
132 'startshop' => 'Unlocked30k',
133 'shopprice' => 'Vanilla',
134 'shopSouls' => '2PerGroup',
135 'levelexp' => 'Casual',
136 'telestart' => 'false',
137 'mapassist' => 'true',
138 'doublechaos' => 'false',
139 'reqallsouls' => 'false',
141 'palette' => 'Vanilla',
145 'name' => 'Spicy normal',
146 'value' => 'SpicyNormal',
148 'logic' => 'VeryRandom',
150 'panther' => 'Rand70Dup',
152 'boss' => 'Dead-endShuffle',
153 'enemy' => 'RandomPM20',
154 'itempool' => 'Standard',
156 'grahm' => 'BookSouls',
158 'startshop' => 'Unlocked30k',
159 'shopprice' => 'RandHV',
160 'shopSouls' => 'Half',
161 'levelexp' => 'Hard',
162 'telestart' => 'true',
163 'mapassist' => 'false',
164 'doublechaos' => 'false',
165 'reqallsouls' => 'false',
167 'palette' => 'Vanilla',
170 'ExtraFastNormal' => [
171 'name' => 'Extra fast normal',
172 'value' => 'ExtraFastNormal',
174 'logic' => 'AreaTechTiers',
175 'nodupes' => 'false',
176 'panther' => 'FirstAlways',
179 'enemy' => 'Vanilla',
180 'itempool' => 'Standard',
182 'grahm' => 'NoCheck',
184 'startshop' => 'Unlocked30k',
185 'shopprice' => 'RandHV',
186 'shopSouls' => 'Half',
187 'levelexp' => 'Vanilla',
188 'telestart' => 'true',
189 'mapassist' => 'false',
190 'doublechaos' => 'false',
191 'reqallsouls' => 'false',
193 'palette' => 'Vanilla',
200 'logic' => 'AreaTechTiers',
201 'nodupes' => 'false',
202 'panther' => 'Rand70Dup',
203 'area' => 'AreaRandom',
204 'boss' => 'Dead-endShuffle',
205 'enemy' => 'Vanilla',
206 'itempool' => 'Standard',
208 'grahm' => 'BookSouls',
210 'startshop' => 'Vanilla',
211 'shopprice' => 'Vanilla',
212 'shopSouls' => 'Vanilla',
213 'levelexp' => 'Vanilla',
214 'telestart' => 'false',
215 'mapassist' => 'false',
216 'doublechaos' => 'false',
217 'reqallsouls' => 'false',
219 'palette' => 'Vanilla',
223 'name' => 'Area beginner',
224 'value' => 'AreaBeginner',
226 'logic' => 'AreaTechTiers',
227 'nodupes' => 'false',
228 'panther' => 'FirstAlways',
229 'area' => 'AreaRandom',
230 'boss' => 'Dead-endShuffle',
231 'enemy' => 'Vanilla',
232 'itempool' => 'Standard',
234 'grahm' => 'BookSouls',
236 'startshop' => 'Unlocked30k',
237 'shopprice' => 'Vanilla',
238 'shopSouls' => '2PerGroup',
239 'levelexp' => 'Casual',
240 'telestart' => 'false',
241 'mapassist' => 'true',
242 'doublechaos' => 'false',
243 'reqallsouls' => 'false',
245 'palette' => 'Vanilla',
249 'name' => 'Area spicy',
250 'value' => 'AreaSpicy',
252 'logic' => 'AreaTechTiers',
254 'panther' => 'Rand70Dup',
255 'area' => 'AreaRandom',
256 'boss' => 'Dead-endShuffle',
257 'enemy' => 'RandomPM20',
258 'itempool' => 'Standard',
260 'grahm' => 'BookSouls',
262 'startshop' => 'Unlocked30k',
263 'shopprice' => 'RandHV',
264 'shopSouls' => 'Half',
265 'levelexp' => 'Hard',
266 'telestart' => 'true',
267 'mapassist' => 'false',
268 'doublechaos' => 'false',
269 'reqallsouls' => 'false',
271 'palette' => 'Vanilla',
275 'name' => 'Area all bosses',
276 'value' => 'AreaAllBosses',
278 'logic' => 'AreaTechTiers',
279 'nodupes' => 'false',
280 'panther' => 'Rand70Dup',
281 'area' => 'AreaRandom',
282 'boss' => 'Dead-endShuffle',
283 'enemy' => 'Vanilla',
284 'itempool' => 'Standard',
286 'grahm' => 'AllBosses',
288 'startshop' => 'Unlocked',
289 'shopprice' => 'Vanilla',
290 'shopSouls' => '2PerGroup',
291 'levelexp' => 'Vanilla',
292 'telestart' => 'false',
293 'mapassist' => 'false',
294 'doublechaos' => 'false',
295 'reqallsouls' => 'false',
297 'palette' => 'Vanilla',
301 'name' => 'Area extra fast',
302 'value' => 'AreaExtraFast',
304 'logic' => 'AreaTechTiers',
305 'nodupes' => 'false',
306 'panther' => 'FirstAlways',
307 'area' => 'AreaRandom',
308 'boss' => 'Dead-endShuffle',
309 'enemy' => 'Vanilla',
310 'itempool' => 'Standard',
312 'grahm' => 'NoCheck',
314 'startshop' => 'Unlocked30k',
315 'shopprice' => 'RandHV',
316 'shopSouls' => 'Half',
317 'levelexp' => 'Vanilla',
318 'telestart' => 'true',
319 'mapassist' => 'false',
320 'doublechaos' => 'false',
321 'reqallsouls' => 'false',
323 'palette' => 'Vanilla',
327 'name' => 'Area expert',
328 'value' => 'AreaExpert',
330 'logic' => 'AreaTechTiers',
332 'panther' => 'NeverExists',
333 'area' => 'AreaRandom',
334 'boss' => 'Dead-endShuffle',
335 'enemy' => 'RandomNoLimit',
336 'itempool' => 'Standard',
338 'grahm' => 'BookSouls',
340 'startshop' => 'Vanilla',
341 'shopprice' => 'Vanilla',
342 'shopSouls' => 'Half',
343 'levelexp' => 'Lvl1',
344 'telestart' => 'false',
345 'mapassist' => 'false',
346 'doublechaos' => 'true',
347 'reqallsouls' => 'false',
349 'palette' => 'Vanilla',
352 'AreaRequireAllSouls' => [
353 'name' => 'Area require all souls',
354 'value' => 'AreaRequireAllSouls',
356 'logic' => 'AreaTechTiers',
358 'panther' => 'NeverExists',
359 'area' => 'AreaRandom',
360 'boss' => 'Dead-endShuffle',
361 'enemy' => 'RandomNoLimit',
362 'itempool' => 'Standard',
364 'grahm' => 'BookSouls',
366 'startshop' => 'Vanilla',
367 'shopprice' => 'Vanilla',
368 'shopSouls' => 'Half',
369 'levelexp' => 'Lvl1',
370 'telestart' => 'false',
371 'mapassist' => 'false',
372 'doublechaos' => 'true',
373 'reqallsouls' => 'true',
375 'palette' => 'Vanilla',
378 'DoorAllBossesEasy' => [
379 'name' => 'Door all bosses easy',
380 'value' => 'DoorAllBossesEasy',
382 'logic' => 'AreaTechTiers',
383 'nodupes' => 'false',
384 'panther' => 'Rand70Dup',
385 'area' => 'DoorRandom',
387 'enemy' => 'Vanilla',
388 'itempool' => 'Standard',
390 'grahm' => 'AllBosses',
392 'startshop' => 'Unlocked',
393 'shopprice' => 'Vanilla',
394 'shopSouls' => '2PerGroup',
395 'levelexp' => 'Vanilla',
396 'telestart' => 'true',
397 'mapassist' => 'true',
398 'doublechaos' => 'false',
399 'reqallsouls' => 'false',
401 'palette' => 'Vanilla',
405 'name' => 'Door all bosses',
406 'value' => 'DoorAllBosses',
408 'logic' => 'AreaTechTiers',
409 'nodupes' => 'false',
410 'panther' => 'Rand70Dup',
411 'area' => 'DoorRandom',
413 'enemy' => 'RandomPM20',
414 'itempool' => 'Standard',
416 'grahm' => 'AllBosses',
418 'startshop' => 'Vanilla',
419 'shopprice' => 'Vanilla',
420 'shopSouls' => '2PerGroup',
421 'levelexp' => 'Vanilla',
422 'telestart' => 'false',
423 'mapassist' => 'false',
424 'doublechaos' => 'false',
425 'reqallsouls' => 'false',
427 'palette' => 'Vanilla',
431 'name' => 'SGLive 2020',
432 'value' => 'SGLive2020',
434 'logic' => 'AreaTechTiers',
435 'nodupes' => 'false',
436 'panther' => 'Rand70Dup',
439 'enemy' => 'Vanilla',
440 'itempool' => 'Standard',
442 'grahm' => 'BookSouls',
444 'startshop' => 'Vanilla',
445 'shopprice' => 'Vanilla',
446 'shopSouls' => 'Vanilla',
447 'levelexp' => 'Vanilla',
448 'telestart' => 'false',
449 'mapassist' => 'false',
450 'doublechaos' => 'false',
451 'reqallsouls' => 'false',
453 'palette' => 'Vanilla',
456 'Tournament2021' => [
457 'name' => 'Tournament 2021',
458 'value' => 'Tournament2021',
460 'logic' => 'AreaTechTiers',
461 'nodupes' => 'false',
462 'panther' => 'Rand70Dup',
463 'area' => 'AreaRandom',
464 'boss' => 'Dead-endShuffle',
465 'enemy' => 'Vanilla',
466 'itempool' => 'Standard',
468 'grahm' => 'BookSouls',
470 'startshop' => 'Unlocked30k',
471 'shopprice' => 'RandHV',
472 'shopSouls' => 'Half',
473 'levelexp' => 'Vanilla',
474 'telestart' => 'false',
475 'mapassist' => 'false',
476 'doublechaos' => 'false',
477 'reqallsouls' => 'false',
479 'palette' => 'Vanilla',
483 'name' => 'SGLive 2021',
484 'value' => 'SGLive2021',
486 'logic' => 'AreaTechTiers',
487 'nodupes' => 'false',
488 'panther' => 'FirstAlways',
489 'area' => 'AreaRandom',
490 'boss' => 'Dead-endShuffle',
491 'enemy' => 'Vanilla',
492 'itempool' => 'Standard',
494 'grahm' => 'BookSouls',
496 'startshop' => 'Unlocked30k',
497 'shopprice' => 'RandHV',
498 'shopSouls' => 'Half',
499 'levelexp' => 'Vanilla',
500 'telestart' => 'false',
501 'mapassist' => 'false',
502 'doublechaos' => 'false',
503 'reqallsouls' => 'false',
505 'palette' => 'Vanilla',
508 'Tournament2022' => [
509 'name' => 'Tournament 2022',
510 'value' => 'Tournament2022',
512 'logic' => 'AreaTechTiers',
513 'nodupes' => 'false',
514 'panther' => 'FirstAlways',
515 'area' => 'AreaRandom',
516 'boss' => 'Dead-endShuffle',
517 'enemy' => 'Vanilla',
518 'itempool' => 'Standard',
520 'grahm' => 'BookSouls',
522 'startshop' => 'Unlocked30k',
523 'shopprice' => 'RandHV',
524 'shopSouls' => 'Half',
525 'levelexp' => 'Vanilla',
526 'telestart' => 'false',
527 'mapassist' => 'false',
528 'doublechaos' => 'false',
529 'reqallsouls' => 'false',
531 'palette' => 'Vanilla',