Skip to content

Commit

Permalink
WebHost: Set defaults for lists/sets on Weighted Settings page (Archi…
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar authored Apr 10, 2023
1 parent cdf7ca1 commit 0c1e309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions WebHostLib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,15 @@ def get_html_doc(option_type: type(Options.Option)) -> str:
"type": "items-list",
"displayName": option.display_name if hasattr(option, "display_name") else option_name,
"description": get_html_doc(option),
"defaultValue": list(option.default)
}

elif issubclass(option, Options.LocationSet):
game_options[option_name] = {
"type": "locations-list",
"displayName": option.display_name if hasattr(option, "display_name") else option_name,
"description": get_html_doc(option),
"defaultValue": list(option.default)
}

elif issubclass(option, Options.VerifyKeys):
Expand All @@ -147,6 +149,7 @@ def get_html_doc(option_type: type(Options.Option)) -> str:
"displayName": option.display_name if hasattr(option, "display_name") else option_name,
"description": get_html_doc(option),
"options": list(option.valid_keys),
"defaultValue": list(option.default) if hasattr(option, "default") else []
}

else:
Expand Down
2 changes: 1 addition & 1 deletion WebHostLib/static/assets/weighted-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const createDefaultSettings = (settingData) => {
case 'items-list':
case 'locations-list':
case 'custom-list':
newSettings[game][gameSetting] = [];
newSettings[game][gameSetting] = setting.defaultValue;
break;

default:
Expand Down

0 comments on commit 0c1e309

Please sign in to comment.