|
6 | 6 | import tempfile
|
7 | 7 | import zipfile
|
8 | 8 | from collections import Counter
|
9 |
| -from typing import Any, Dict, List, Optional, Union |
| 9 | +from typing import Any, Dict, List, Optional, Union, Set |
10 | 10 |
|
11 | 11 | from flask import flash, redirect, render_template, request, session, url_for
|
12 | 12 | from pony.orm import commit, db_session
|
|
16 | 16 | from Main import main as ERmain
|
17 | 17 | from Utils import __version__
|
18 | 18 | from WebHostLib import app
|
| 19 | +from settings import ServerOptions, GeneratorOptions |
19 | 20 | from worlds.alttp.EntranceRandomizer import parse_arguments
|
20 | 21 | from .check import get_yaml_data, roll_options
|
21 | 22 | from .models import Generation, STATE_ERROR, STATE_QUEUED, Seed, UUID
|
22 | 23 | from .upload import upload_zip_to_db
|
23 | 24 |
|
24 | 25 |
|
25 | 26 | def get_meta(options_source: dict, race: bool = False) -> Dict[str, Union[List[str], Dict[str, Any]]]:
|
26 |
| - plando_options = { |
27 |
| - options_source.get("plando_bosses", ""), |
28 |
| - options_source.get("plando_items", ""), |
29 |
| - options_source.get("plando_connections", ""), |
30 |
| - options_source.get("plando_texts", "") |
31 |
| - } |
32 |
| - plando_options -= {""} |
| 27 | + plando_options: Set[str] = set() |
| 28 | + for substr in ("bosses", "items", "connections", "texts"): |
| 29 | + if options_source.get(f"plando_{substr}", substr in GeneratorOptions.plando_options): |
| 30 | + plando_options.add(substr) |
33 | 31 |
|
34 | 32 | server_options = {
|
35 |
| - "hint_cost": int(options_source.get("hint_cost", 10)), |
36 |
| - "release_mode": options_source.get("release_mode", "goal"), |
37 |
| - "remaining_mode": options_source.get("remaining_mode", "disabled"), |
38 |
| - "collect_mode": options_source.get("collect_mode", "disabled"), |
39 |
| - "item_cheat": bool(int(options_source.get("item_cheat", 1))), |
| 33 | + "hint_cost": int(options_source.get("hint_cost", ServerOptions.hint_cost)), |
| 34 | + "release_mode": options_source.get("release_mode", ServerOptions.release_mode), |
| 35 | + "remaining_mode": options_source.get("remaining_mode", ServerOptions.remaining_mode), |
| 36 | + "collect_mode": options_source.get("collect_mode", ServerOptions.collect_mode), |
| 37 | + "item_cheat": bool(int(options_source.get("item_cheat", not ServerOptions.disable_item_cheat))), |
40 | 38 | "server_password": options_source.get("server_password", None),
|
41 | 39 | }
|
42 | 40 | generator_options = {
|
43 |
| - "spoiler": int(options_source.get("spoiler", 0)), |
44 |
| - "race": race |
| 41 | + "spoiler": int(options_source.get("spoiler", GeneratorOptions.spoiler)), |
| 42 | + "race": race, |
45 | 43 | }
|
46 | 44 |
|
47 | 45 | if race:
|
|
0 commit comments