Compare commits

...

4 Commits

Author SHA1 Message Date
Chris Wilson
f8fe779add Merge branch 'main' into fix-text-choice 2024-05-31 17:23:01 -04:00
Chris Wilson
95af4554d5 Update WebHostLib/options.py
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
2024-05-28 21:00:32 -04:00
Chris Wilson
e95a850f11 Merge branch 'main' into fix-text-choice 2024-05-23 18:23:44 -04:00
Chris Wilson
1b8b256886 Fix TextChoice options with custom values improperly being included in YAML output 2024-05-23 18:19:14 -04:00

View File

@@ -169,9 +169,9 @@ def generate_yaml(game: str):
else:
options[key] = val
# Detect and build ItemDict options from their name pattern
for key, val in options.copy().items():
key_parts = key.rsplit("||", 2)
# Detect and build ItemDict options from their name pattern
if key_parts[-1] == "qty":
if key_parts[0] not in options:
options[key_parts[0]] = {}
@@ -179,6 +179,13 @@ def generate_yaml(game: str):
options[key_parts[0]][key_parts[1]] = int(val)
del options[key]
# Detect keys which end with -custom, indicating a TextChoice with a possible custom value
elif key_parts[-1].endswith("-custom"):
if val:
options[key_parts[-1][:-7]] = val
del options[key]
# Detect random-* keys and set their options accordingly
for key, val in options.copy().items():
if key.startswith("random-"):