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 'palette' => 'Vanilla',
117 'name' => 'Beginner',
118 'value' => 'Beginner',
120 'logic' => 'AreaTechTiers',
121 'nodupes' => 'false',
122 'panther' => 'FirstAlways',
125 'enemy' => 'Vanilla',
126 'itempool' => 'Standard',
128 'grahm' => 'BookSouls',
130 'startshop' => 'Unlocked30k',
131 'shopprice' => 'Vanilla',
132 'shopSouls' => '2PerGroup',
133 'levelexp' => 'Casual',
134 'telestart' => 'false',
135 'mapassist' => 'true',
136 'doublechaos' => 'false',
137 'palette' => 'Vanilla',
141 'name' => 'Spicy normal',
142 'value' => 'SpicyNormal',
144 'logic' => 'VeryRandom',
146 'panther' => 'Rand70Dup',
148 'boss' => 'Dead-endShuffle',
149 'enemy' => 'RandomPM20',
150 'itempool' => 'Standard',
152 'grahm' => 'BookSouls',
154 'startshop' => 'Unlocked30k',
155 'shopprice' => 'RandHV',
156 'shopSouls' => 'Half',
157 'levelexp' => 'Hard',
158 'telestart' => 'true',
159 'mapassist' => 'false',
160 'doublechaos' => 'false',
161 'palette' => 'Vanilla',
164 'ExtraFastNormal' => [
165 'name' => 'Extra fast normal',
166 'value' => 'ExtraFastNormal',
168 'logic' => 'AreaTechTiers',
169 'nodupes' => 'false',
170 'panther' => 'FirstAlways',
173 'enemy' => 'Vanilla',
174 'itempool' => 'Standard',
176 'grahm' => 'NoCheck',
178 'startshop' => 'Unlocked30k',
179 'shopprice' => 'RandHV',
180 'shopSouls' => 'Half',
181 'levelexp' => 'Vanilla',
182 'telestart' => 'true',
183 'mapassist' => 'false',
184 'doublechaos' => 'false',
185 'palette' => 'Vanilla',
192 'logic' => 'AreaTechTiers',
193 'nodupes' => 'false',
194 'panther' => 'Rand70Dup',
195 'area' => 'AreaRandom',
196 'boss' => 'Dead-endShuffle',
197 'enemy' => 'Vanilla',
198 'itempool' => 'Standard',
200 'grahm' => 'BookSouls',
202 'startshop' => 'Vanilla',
203 'shopprice' => 'Vanilla',
204 'shopSouls' => 'Vanilla',
205 'levelexp' => 'Vanilla',
206 'telestart' => 'false',
207 'mapassist' => 'false',
208 'doublechaos' => 'false',
209 'palette' => 'Vanilla',
213 'name' => 'Area beginner',
214 'value' => 'AreaBeginner',
216 'logic' => 'AreaTechTiers',
217 'nodupes' => 'false',
218 'panther' => 'FirstAlways',
219 'area' => 'AreaRandom',
220 'boss' => 'Dead-endShuffle',
221 'enemy' => 'Vanilla',
222 'itempool' => 'Standard',
224 'grahm' => 'BookSouls',
226 'startshop' => 'Unlocked30k',
227 'shopprice' => 'Vanilla',
228 'shopSouls' => '2PerGroup',
229 'levelexp' => 'Casual',
230 'telestart' => 'false',
231 'mapassist' => 'true',
232 'doublechaos' => 'false',
233 'palette' => 'Vanilla',
237 'name' => 'Area spicy',
238 'value' => 'AreaSpicy',
240 'logic' => 'AreaTechTiers',
242 'panther' => 'Rand70Dup',
243 'area' => 'AreaRandom',
244 'boss' => 'Dead-endShuffle',
245 'enemy' => 'RandomPM20',
246 'itempool' => 'Standard',
248 'grahm' => 'BookSouls',
250 'startshop' => 'Unlocked30k',
251 'shopprice' => 'RandHV',
252 'shopSouls' => 'Half',
253 'levelexp' => 'Hard',
254 'telestart' => 'true',
255 'mapassist' => 'false',
256 'doublechaos' => 'false',
257 'palette' => 'Vanilla',
261 'name' => 'Area all bosses',
262 'value' => 'AreaAllBosses',
264 'logic' => 'AreaTechTiers',
265 'nodupes' => 'false',
266 'panther' => 'Rand70Dup',
267 'area' => 'AreaRandom',
268 'boss' => 'Dead-endShuffle',
269 'enemy' => 'Vanilla',
270 'itempool' => 'Standard',
272 'grahm' => 'AllBosses',
274 'startshop' => 'Unlocked',
275 'shopprice' => 'Vanilla',
276 'shopSouls' => '2PerGroup',
277 'levelexp' => 'Vanilla',
278 'telestart' => 'false',
279 'mapassist' => 'false',
280 'doublechaos' => 'false',
281 'palette' => 'Vanilla',
285 'name' => 'Area extra fast',
286 'value' => 'AreaExtraFast',
288 'logic' => 'AreaTechTiers',
289 'nodupes' => 'false',
290 'panther' => 'FirstAlways',
291 'area' => 'AreaRandom',
292 'boss' => 'Dead-endShuffle',
293 'enemy' => 'Vanilla',
294 'itempool' => 'Standard',
296 'grahm' => 'NoCheck',
298 'startshop' => 'Unlocked30k',
299 'shopprice' => 'RandHV',
300 'shopSouls' => 'Half',
301 'levelexp' => 'Vanilla',
302 'telestart' => 'true',
303 'mapassist' => 'false',
304 'doublechaos' => 'false',
305 'palette' => 'Vanilla',
309 'name' => 'Area expert',
310 'value' => 'AreaExpert',
312 'logic' => 'AreaTechTiers',
314 'panther' => 'NeverExists',
315 'area' => 'AreaRandom',
316 'boss' => 'Dead-endShuffle',
317 'enemy' => 'RandomNoLimit',
318 'itempool' => 'Standard',
320 'grahm' => 'BookSouls',
322 'startshop' => 'Vanilla',
323 'shopprice' => 'Vanilla',
324 'shopSouls' => 'Half',
325 'levelexp' => 'Lvl1',
326 'telestart' => 'false',
327 'mapassist' => 'false',
328 'doublechaos' => 'true',
329 'palette' => 'Vanilla',
332 'DoorAllBossesEasy' => [
333 'name' => 'Door all bosses easy',
334 'value' => 'DoorAllBossesEasy',
336 'logic' => 'AreaTechTiers',
337 'nodupes' => 'false',
338 'panther' => 'Rand70Dup',
339 'area' => 'DoorRandom',
341 'enemy' => 'Vanilla',
342 'itempool' => 'Standard',
344 'grahm' => 'AllBosses',
346 'startshop' => 'Unlocked',
347 'shopprice' => 'Vanilla',
348 'shopSouls' => '2PerGroup',
349 'levelexp' => 'Vanilla',
350 'telestart' => 'true',
351 'mapassist' => 'true',
352 'doublechaos' => 'false',
353 'palette' => 'Vanilla',
357 'name' => 'Door all bosses',
358 'value' => 'DoorAllBosses',
360 'logic' => 'AreaTechTiers',
361 'nodupes' => 'false',
362 'panther' => 'Rand70Dup',
363 'area' => 'DoorRandom',
365 'enemy' => 'RandomPM20',
366 'itempool' => 'Standard',
368 'grahm' => 'AllBosses',
370 'startshop' => 'Vanilla',
371 'shopprice' => 'Vanilla',
372 'shopSouls' => '2PerGroup',
373 'levelexp' => 'Vanilla',
374 'telestart' => 'false',
375 'mapassist' => 'false',
376 'doublechaos' => 'false',
377 'palette' => 'Vanilla',
381 'name' => 'SGLive 2020',
382 'value' => 'SGLive2020',
384 'logic' => 'AreaTechTiers',
385 'nodupes' => 'false',
386 'panther' => 'Rand70Dup',
389 'enemy' => 'Vanilla',
390 'itempool' => 'Standard',
392 'grahm' => 'BookSouls',
394 'startshop' => 'Vanilla',
395 'shopprice' => 'Vanilla',
396 'shopSouls' => 'Vanilla',
397 'levelexp' => 'Vanilla',
398 'telestart' => 'false',
399 'mapassist' => 'false',
400 'doublechaos' => 'false',
401 'palette' => 'Vanilla',
405 'name' => 'SGLive 2021',
406 'value' => 'SGLive2021',
408 'logic' => 'AreaTechTiers',
409 'nodupes' => 'false',
410 'panther' => 'FirstAlways',
411 'area' => 'AreaRandom',
412 'boss' => 'Dead-endShuffle',
413 'enemy' => 'Vanilla',
414 'itempool' => 'Standard',
416 'grahm' => 'BookSouls',
418 'startshop' => 'Unlocked30k',
419 'shopprice' => 'RandHV',
420 'shopSouls' => 'Half',
421 'levelexp' => 'Vanilla',
422 'telestart' => 'false',
423 'mapassist' => 'false',
424 'doublechaos' => 'false',
425 'palette' => 'Vanilla',
428 'Tournament2021' => [
429 'name' => 'Tournament 2021',
430 'value' => 'Tournament2021',
432 'logic' => 'AreaTechTiers',
433 'nodupes' => 'false',
434 'panther' => 'Rand70Dup',
435 'area' => 'AreaRandom',
436 'boss' => 'Dead-endShuffle',
437 'enemy' => 'Vanilla',
438 'itempool' => 'Standard',
440 'grahm' => 'BookSouls',
442 'startshop' => 'Unlocked30k',
443 'shopprice' => 'RandHV',
444 'shopSouls' => 'Half',
445 'levelexp' => 'Vanilla',
446 'telestart' => 'false',
447 'mapassist' => 'false',
448 'doublechaos' => 'false',
449 'palette' => 'Vanilla',
452 'Tournament2022' => [
453 'name' => 'Tournament 2022',
454 'value' => 'Tournament2022',
456 'logic' => 'AreaTechTiers',
457 'nodupes' => 'false',
458 'panther' => 'FirstAlways',
459 'area' => 'AreaRandom',
460 'boss' => 'Dead-endShuffle',
461 'enemy' => 'Vanilla',
462 'itempool' => 'Standard',
464 'grahm' => 'BookSouls',
466 'startshop' => 'Unlocked30k',
467 'shopprice' => 'RandHV',
468 'shopSouls' => 'Half',
469 'levelexp' => 'Vanilla',
470 'telestart' => 'false',
471 'mapassist' => 'false',
472 'doublechaos' => 'false',
473 'palette' => 'Vanilla',