From 0c1e3097c318842cf2ea31972b1e5022e090eec5 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Mon, 10 Apr 2023 17:01:54 -0500 Subject: [PATCH] WebHost: Set defaults for lists/sets on Weighted Settings page (#1692) --- WebHostLib/options.py | 3 +++ WebHostLib/static/assets/weighted-settings.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/WebHostLib/options.py b/WebHostLib/options.py index a4d7ccc17c9f..9b6fc9040271 100644 --- a/WebHostLib/options.py +++ b/WebHostLib/options.py @@ -131,6 +131,7 @@ 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): @@ -138,6 +139,7 @@ def get_html_doc(option_type: type(Options.Option)) -> str: "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): @@ -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: diff --git a/WebHostLib/static/assets/weighted-settings.js b/WebHostLib/static/assets/weighted-settings.js index e471e0837a46..11854d3ce045 100644 --- a/WebHostLib/static/assets/weighted-settings.js +++ b/WebHostLib/static/assets/weighted-settings.js @@ -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: