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 presetByName($name) {
58 if (isset(static::$presets[$name])) {
59 return static::$presets[$name];
61 foreach (static::$presets as $presetName => $preset) {
62 if (strcasecmp($name, $presetName) === 0) {
69 public static function listen(Discord $discord) {
70 $discord->listenCommand(['aosr', 'preset'], function(Interaction $interaction) use ($discord) {
72 ->acknowledgeWithResponse()
73 ->done(function() use($discord, $interaction) {
74 $presetName = $interaction->data->options['preset']->options['preset']->value;
75 $race = isset($interaction->data->options['preset']->options['race'])
76 ? $interaction->data->options['preset']->options['race']->value : false;
77 if (isset(static::$presets[$presetName])) {
78 $preset = static::$presets[$presetName];
79 $seed = AosSeed::generateSurge($presetName, $preset['settings'], $race);
81 $process = $seed->createProcess();
82 $process->on('exit', function() use ($discord, $interaction, $seed) {
83 $seed = $seed->fresh();
85 $embed = $seed->createEmbed($discord);
86 $message = MessageBuilder::new();
87 $message->addEmbed($embed);
89 $interaction->updateOriginalResponse($message);
92 $process->start($discord->getLoop());
94 $message = MessageBuilder::new();
95 $message->setContent('unknown preset '.$presetName);
96 $interaction->updateOriginalResponse($message);
103 public static $presets = [
108 'logic' => 'AreaTechTiers',
109 'nodupes' => 'false',
110 'panther' => 'Rand70Dup',
113 'enemy' => 'Vanilla',
114 'itempool' => 'Standard',
116 'grahm' => 'BookSouls',
118 'startshop' => 'Vanilla',
119 'shopprice' => 'Vanilla',
120 'shopSouls' => 'Vanilla',
121 'levelexp' => 'Vanilla',
122 'telestart' => 'false',
123 'mapassist' => 'false',
124 'doublechaos' => 'false',
125 'reqallsouls' => 'false',
127 'palette' => 'Vanilla',
131 'name' => 'Beginner',
132 'value' => 'Beginner',
134 'logic' => 'AreaTechTiers',
135 'nodupes' => 'false',
136 'panther' => 'FirstAlways',
139 'enemy' => 'Vanilla',
140 'itempool' => 'Standard',
142 'grahm' => 'BookSouls',
144 'startshop' => 'Unlocked30k',
145 'shopprice' => 'Vanilla',
146 'shopSouls' => '2PerGroup',
147 'levelexp' => 'Casual',
148 'telestart' => 'false',
149 'mapassist' => 'true',
150 'doublechaos' => 'false',
151 'reqallsouls' => 'false',
153 'palette' => 'Vanilla',
157 'name' => 'Spicy normal',
158 'value' => 'SpicyNormal',
160 'logic' => 'VeryRandom',
162 'panther' => 'Rand70Dup',
164 'boss' => 'Dead-endShuffle',
165 'enemy' => 'RandomPM20',
166 'itempool' => 'Standard',
168 'grahm' => 'BookSouls',
170 'startshop' => 'Unlocked30k',
171 'shopprice' => 'RandHV',
172 'shopSouls' => 'Half',
173 'levelexp' => 'Hard',
174 'telestart' => 'true',
175 'mapassist' => 'false',
176 'doublechaos' => 'false',
177 'reqallsouls' => 'false',
179 'palette' => 'Vanilla',
182 'ExtraFastNormal' => [
183 'name' => 'Extra fast normal',
184 'value' => 'ExtraFastNormal',
186 'logic' => 'AreaTechTiers',
187 'nodupes' => 'false',
188 'panther' => 'FirstAlways',
191 'enemy' => 'Vanilla',
192 'itempool' => 'Standard',
194 'grahm' => 'NoCheck',
196 'startshop' => 'Unlocked30k',
197 'shopprice' => 'RandHV',
198 'shopSouls' => 'Half',
199 'levelexp' => 'Vanilla',
200 'telestart' => 'true',
201 'mapassist' => 'false',
202 'doublechaos' => 'false',
203 'reqallsouls' => 'false',
205 'palette' => 'Vanilla',
212 'logic' => 'AreaTechTiers',
213 'nodupes' => 'false',
214 'panther' => 'Rand70Dup',
215 'area' => 'AreaRandom',
216 'boss' => 'Dead-endShuffle',
217 'enemy' => 'Vanilla',
218 'itempool' => 'Standard',
220 'grahm' => 'BookSouls',
222 'startshop' => 'Vanilla',
223 'shopprice' => 'Vanilla',
224 'shopSouls' => 'Vanilla',
225 'levelexp' => 'Vanilla',
226 'telestart' => 'false',
227 'mapassist' => 'false',
228 'doublechaos' => 'false',
229 'reqallsouls' => 'false',
231 'palette' => 'Vanilla',
235 'name' => 'Area beginner',
236 'value' => 'AreaBeginner',
238 'logic' => 'AreaTechTiers',
239 'nodupes' => 'false',
240 'panther' => 'FirstAlways',
241 'area' => 'AreaRandom',
242 'boss' => 'Dead-endShuffle',
243 'enemy' => 'Vanilla',
244 'itempool' => 'Standard',
246 'grahm' => 'BookSouls',
248 'startshop' => 'Unlocked30k',
249 'shopprice' => 'Vanilla',
250 'shopSouls' => '2PerGroup',
251 'levelexp' => 'Casual',
252 'telestart' => 'false',
253 'mapassist' => 'true',
254 'doublechaos' => 'false',
255 'reqallsouls' => 'false',
257 'palette' => 'Vanilla',
261 'name' => 'Area spicy',
262 'value' => 'AreaSpicy',
264 'logic' => 'AreaTechTiers',
266 'panther' => 'Rand70Dup',
267 'area' => 'AreaRandom',
268 'boss' => 'Dead-endShuffle',
269 'enemy' => 'RandomPM20',
270 'itempool' => 'Standard',
272 'grahm' => 'BookSouls',
274 'startshop' => 'Unlocked30k',
275 'shopprice' => 'RandHV',
276 'shopSouls' => 'Half',
277 'levelexp' => 'Hard',
278 'telestart' => 'true',
279 'mapassist' => 'false',
280 'doublechaos' => 'false',
281 'reqallsouls' => 'false',
283 'palette' => 'Vanilla',
287 'name' => 'Area all bosses',
288 'value' => 'AreaAllBosses',
290 'logic' => 'AreaTechTiers',
291 'nodupes' => 'false',
292 'panther' => 'Rand70Dup',
293 'area' => 'AreaRandom',
294 'boss' => 'Dead-endShuffle',
295 'enemy' => 'Vanilla',
296 'itempool' => 'Standard',
298 'grahm' => 'AllBosses',
300 'startshop' => 'Unlocked',
301 'shopprice' => 'Vanilla',
302 'shopSouls' => '2PerGroup',
303 'levelexp' => 'Vanilla',
304 'telestart' => 'false',
305 'mapassist' => 'false',
306 'doublechaos' => 'false',
307 'reqallsouls' => 'false',
309 'palette' => 'Vanilla',
313 'name' => 'Area extra fast',
314 'value' => 'AreaExtraFast',
316 'logic' => 'AreaTechTiers',
317 'nodupes' => 'false',
318 'panther' => 'FirstAlways',
319 'area' => 'AreaRandom',
320 'boss' => 'Dead-endShuffle',
321 'enemy' => 'Vanilla',
322 'itempool' => 'Standard',
324 'grahm' => 'NoCheck',
326 'startshop' => 'Unlocked30k',
327 'shopprice' => 'RandHV',
328 'shopSouls' => 'Half',
329 'levelexp' => 'Vanilla',
330 'telestart' => 'true',
331 'mapassist' => 'false',
332 'doublechaos' => 'false',
333 'reqallsouls' => 'false',
335 'palette' => 'Vanilla',
339 'name' => 'Area expert',
340 'value' => 'AreaExpert',
342 'logic' => 'AreaTechTiers',
344 'panther' => 'NeverExists',
345 'area' => 'AreaRandom',
346 'boss' => 'Dead-endShuffle',
347 'enemy' => 'RandomNoLimit',
348 'itempool' => 'Standard',
350 'grahm' => 'BookSouls',
352 'startshop' => 'Vanilla',
353 'shopprice' => 'Vanilla',
354 'shopSouls' => 'Half',
355 'levelexp' => 'Lvl1',
356 'telestart' => 'false',
357 'mapassist' => 'false',
358 'doublechaos' => 'true',
359 'reqallsouls' => 'false',
361 'palette' => 'Vanilla',
364 'AreaRequireAllSouls' => [
365 'name' => 'Area require all souls',
366 'value' => 'AreaRequireAllSouls',
368 'logic' => 'AreaTechTiers',
370 'panther' => 'NeverExists',
371 'area' => 'AreaRandom',
372 'boss' => 'Dead-endShuffle',
373 'enemy' => 'RandomNoLimit',
374 'itempool' => 'Standard',
376 'grahm' => 'BookSouls',
378 'startshop' => 'Vanilla',
379 'shopprice' => 'Vanilla',
380 'shopSouls' => 'Half',
381 'levelexp' => 'Lvl1',
382 'telestart' => 'false',
383 'mapassist' => 'false',
384 'doublechaos' => 'true',
385 'reqallsouls' => 'true',
387 'palette' => 'Vanilla',
390 'DoorAllBossesEasy' => [
391 'name' => 'Door all bosses easy',
392 'value' => 'DoorAllBossesEasy',
394 'logic' => 'AreaTechTiers',
395 'nodupes' => 'false',
396 'panther' => 'Rand70Dup',
397 'area' => 'DoorRandom',
399 'enemy' => 'Vanilla',
400 'itempool' => 'Standard',
402 'grahm' => 'AllBosses',
404 'startshop' => 'Unlocked',
405 'shopprice' => 'Vanilla',
406 'shopSouls' => '2PerGroup',
407 'levelexp' => 'Vanilla',
408 'telestart' => 'true',
409 'mapassist' => 'true',
410 'doublechaos' => 'false',
411 'reqallsouls' => 'false',
413 'palette' => 'Vanilla',
417 'name' => 'Door all bosses',
418 'value' => 'DoorAllBosses',
420 'logic' => 'AreaTechTiers',
421 'nodupes' => 'false',
422 'panther' => 'Rand70Dup',
423 'area' => 'DoorRandom',
425 'enemy' => 'RandomPM20',
426 'itempool' => 'Standard',
428 'grahm' => 'AllBosses',
430 'startshop' => 'Vanilla',
431 'shopprice' => 'Vanilla',
432 'shopSouls' => '2PerGroup',
433 'levelexp' => 'Vanilla',
434 'telestart' => 'false',
435 'mapassist' => 'false',
436 'doublechaos' => 'false',
437 'reqallsouls' => 'false',
439 'palette' => 'Vanilla',
443 'name' => 'SGLive 2020',
444 'value' => 'SGLive2020',
446 'logic' => 'AreaTechTiers',
447 'nodupes' => 'false',
448 'panther' => 'Rand70Dup',
451 'enemy' => 'Vanilla',
452 'itempool' => 'Standard',
454 'grahm' => 'BookSouls',
456 'startshop' => 'Vanilla',
457 'shopprice' => 'Vanilla',
458 'shopSouls' => 'Vanilla',
459 'levelexp' => 'Vanilla',
460 'telestart' => 'false',
461 'mapassist' => 'false',
462 'doublechaos' => 'false',
463 'reqallsouls' => 'false',
465 'palette' => 'Vanilla',
468 'Tournament2021' => [
469 'name' => 'Tournament 2021',
470 'value' => 'Tournament2021',
472 'logic' => 'AreaTechTiers',
473 'nodupes' => 'false',
474 'panther' => 'Rand70Dup',
475 'area' => 'AreaRandom',
476 'boss' => 'Dead-endShuffle',
477 'enemy' => 'Vanilla',
478 'itempool' => 'Standard',
480 'grahm' => 'BookSouls',
482 'startshop' => 'Unlocked30k',
483 'shopprice' => 'RandHV',
484 'shopSouls' => 'Half',
485 'levelexp' => 'Vanilla',
486 'telestart' => 'false',
487 'mapassist' => 'false',
488 'doublechaos' => 'false',
489 'reqallsouls' => 'false',
491 'palette' => 'Vanilla',
495 'name' => 'SGLive 2021',
496 'value' => 'SGLive2021',
498 'logic' => 'AreaTechTiers',
499 'nodupes' => 'false',
500 'panther' => 'FirstAlways',
501 'area' => 'AreaRandom',
502 'boss' => 'Dead-endShuffle',
503 'enemy' => 'Vanilla',
504 'itempool' => 'Standard',
506 'grahm' => 'BookSouls',
508 'startshop' => 'Unlocked30k',
509 'shopprice' => 'RandHV',
510 'shopSouls' => 'Half',
511 'levelexp' => 'Vanilla',
512 'telestart' => 'false',
513 'mapassist' => 'false',
514 'doublechaos' => 'false',
515 'reqallsouls' => 'false',
517 'palette' => 'Vanilla',
520 'Tournament2022' => [
521 'name' => 'Tournament 2022',
522 'value' => 'Tournament2022',
524 'logic' => 'AreaTechTiers',
525 'nodupes' => 'false',
526 'panther' => 'FirstAlways',
527 'area' => 'AreaRandom',
528 'boss' => 'Dead-endShuffle',
529 'enemy' => 'Vanilla',
530 'itempool' => 'Standard',
532 'grahm' => 'BookSouls',
534 'startshop' => 'Unlocked30k',
535 'shopprice' => 'RandHV',
536 'shopSouls' => 'Half',
537 'levelexp' => 'Vanilla',
538 'telestart' => 'false',
539 'mapassist' => 'false',
540 'doublechaos' => 'false',
541 'reqallsouls' => 'false',
543 'palette' => 'Vanilla',