diff --git a/Options.py b/Options.py index 40213eb5780b..727501db3727 100644 --- a/Options.py +++ b/Options.py @@ -805,6 +805,7 @@ def verify(self, world: typing.Type[World], player_name: str, plando_options: "P class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys, typing.Mapping[str, typing.Any]): default: typing.Dict[str, typing.Any] = {} supports_weighting = False + group_name = "Item & Location Options" def __init__(self, value: typing.Dict[str, typing.Any]): self.value = deepcopy(value) @@ -846,6 +847,7 @@ class OptionList(Option[typing.List[typing.Any]], VerifyKeys): default: typing.List[typing.Any] = [] supports_weighting = False + group_name = "Item & Location Options" def __init__(self, value: typing.List[typing.Any]): self.value = deepcopy(value) @@ -872,6 +874,7 @@ def __contains__(self, item): class OptionSet(Option[typing.Set[str]], VerifyKeys): default: typing.Union[typing.Set[str], typing.FrozenSet[str]] = frozenset() supports_weighting = False + group_name = "Item & Location Options" def __init__(self, value: typing.Iterable[str]): self.value = set(deepcopy(value)) @@ -997,7 +1000,6 @@ class StartInventory(ItemDict): """Start with these items.""" verify_item_name = True display_name = "Start Inventory" - group_name = "Item & Location Options" class StartInventoryPool(StartInventory): @@ -1005,7 +1007,6 @@ class StartInventoryPool(StartInventory): The game decides what the replacement items will be.""" verify_item_name = True display_name = "Start Inventory from Pool" - group_name = "Item & Location Options" class StartHints(ItemSet): @@ -1017,25 +1018,21 @@ class StartHints(ItemSet): class LocationSet(OptionSet): verify_location_name = True convert_name_groups = True - group_name = "Item & Location Options" class StartLocationHints(LocationSet): """Start with these locations and their item prefilled into the !hint command""" display_name = "Start Location Hints" - group_name = "Item & Location Options" class ExcludeLocations(LocationSet): """Prevent these locations from having an important item""" display_name = "Excluded Locations" - group_name = "Item & Location Options" class PriorityLocations(LocationSet): """Prevent these locations from having an unimportant item""" display_name = "Priority Locations" - group_name = "Item & Location Options" class DeathLink(Toggle): diff --git a/WebHostLib/misc.py b/WebHostLib/misc.py index 56acfbf8d925..71a44d827c0d 100644 --- a/WebHostLib/misc.py +++ b/WebHostLib/misc.py @@ -65,6 +65,21 @@ def player_options(game: str): all_options: Dict[str, Options.AssembleOptions] = world.options_dataclass.type_hints grouped_options = collections.defaultdict(dict) for option_name, option in all_options.items(): + if issubclass(option, Options.ItemDict) and not option.verify_item_name: + continue + + if issubclass(option, Options.OptionList) and not hasattr(option, "valid_keys"): + continue + + if issubclass(option, Options.LocationSet) and not option.verify_location_name: + continue + + if issubclass(option, Options.ItemSet) and not option.verify_item_name: + continue + + if issubclass(option, Options.OptionSet) and not hasattr(option, "valid_keys"): + continue + grouped_options[getattr(option, "group_name", "Game Options")][option_name] = option return render_template( diff --git a/WebHostLib/static/styles/playerOptions/playerOptions.css b/WebHostLib/static/styles/playerOptions/playerOptions.css index f08ad1c2bc98..c72df804cce3 100644 --- a/WebHostLib/static/styles/playerOptions/playerOptions.css +++ b/WebHostLib/static/styles/playerOptions/playerOptions.css @@ -161,6 +161,45 @@ html { #player-options table .text-choice-container .text-choice-wrapper select { flex-grow: 1; } +#player-options table .option-container { + display: flex; + flex-direction: column; + background-color: rgba(0, 0, 0, 0.125); + border: 1px solid rgba(20, 20, 20, 0.125); + border-radius: 3px; + color: #ffffff; + max-height: 10rem; + overflow-y: auto; + padding-right: 0.25rem; + padding-left: 0.25rem; +} +#player-options table .option-container .option-entry { + display: flex; + flex-direction: row; + margin-bottom: 0.125rem; + margin-top: 0.125rem; +} +#player-options table .option-container .option-entry:hover { + background-color: rgba(20, 20, 20, 0.125); +} +#player-options table .option-container .option-entry input[type=checkbox] { + margin-right: 0.25rem; +} +#player-options table .option-container .option-entry input[type=number] { + max-width: 1.5rem; + max-height: 1rem; + margin-left: 0.125rem; + text-align: center; + /* Hide arrows on input[type=number] fields */ + -moz-appearance: textfield; +} +#player-options table .option-container .option-entry input[type=number]::-webkit-outer-spin-button, #player-options table .option-container .option-entry input[type=number]::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} +#player-options table .option-container .option-entry span { + flex-grow: 1; +} #player-options table .randomize-button { display: flex; flex-direction: column; diff --git a/WebHostLib/static/styles/playerOptions/playerOptions.css.map b/WebHostLib/static/styles/playerOptions/playerOptions.css.map index 214f3778e83e..208fe2472a28 100644 --- a/WebHostLib/static/styles/playerOptions/playerOptions.css.map +++ b/WebHostLib/static/styles/playerOptions/playerOptions.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["playerOptions.scss"],"names":[],"mappings":"AAAQ;AAER;EACI;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAGJ;EACI;EACA;EACA;;AAIR;EACI;;AAGJ;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;;AAEA;EACI;;AAGJ;EACI;EACA;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;;AAEA;EACI;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;AAIR;EACI;;AAGJ;EACI;;AAEA;EACI;;AAIR;EACI;EACA;;AAIR;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;;;AAKZ;EACI;IACI;;EAEA;IACI;IACA;IACA;;EAGJ;IACI;IACA;;EAEA;IACI;;EAEA;IACI;IACA;;EAGJ;IACI;;EAKZ;IACI","file":"playerOptions.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["playerOptions.scss"],"names":[],"mappings":"AAAQ;AAER;EACI;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;;AAIR;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAGJ;EACI;EACA;EACA;;AAIR;EACI;;AAGJ;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA;;AAEA;EACI;EACA;;AAEA;EACI;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;;AAEA;EACI;;AAGJ;EACI;EACA;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;;AAEA;EACI;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;;AAKZ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAEA;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;AAEA;EACA;;AACA;EACI;EACA;;AAIR;EACI;;AAKZ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACI;;AAIR;EACI;;AAGJ;EACI;;AAEA;EACI;;AAIR;EACI;EACA;;AAIR;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;;;AAKZ;EACI;IACI;;EAEA;IACI;IACA;IACA;;EAGJ;IACI;IACA;;EAEA;IACI;;EAEA;IACI;IACA;;EAGJ;IACI;;EAKZ;IACI","file":"playerOptions.css"} \ No newline at end of file diff --git a/WebHostLib/static/styles/playerOptions/playerOptions.scss b/WebHostLib/static/styles/playerOptions/playerOptions.scss index 1104e97e53b8..2f46ad8a1ace 100644 --- a/WebHostLib/static/styles/playerOptions/playerOptions.scss +++ b/WebHostLib/static/styles/playerOptions/playerOptions.scss @@ -193,6 +193,52 @@ html{ } } + .option-container{ + display: flex; + flex-direction: column; + background-color: rgba(0, 0, 0, 0.125); + border: 1px solid rgba(20, 20, 20, 0.125); + border-radius: 3px; + color: #ffffff; + max-height: 10rem; + overflow-y: auto; + padding-right: 0.25rem; + padding-left: 0.25rem; + + .option-entry{ + display: flex; + flex-direction: row; + margin-bottom: 0.125rem; + margin-top: 0.125rem; + + &:hover{ + background-color: rgba(20, 20, 20, 0.125); + } + + input[type=checkbox]{ + margin-right: 0.25rem; + } + + input[type=number]{ + max-width: 1.5rem; + max-height: 1rem; + margin-left: 0.125rem; + text-align: center; + + /* Hide arrows on input[type=number] fields */ + -moz-appearance: textfield; + &::-webkit-outer-spin-button, &::-webkit-inner-spin-button{ + -webkit-appearance: none; + margin: 0; + } + } + + span{ + flex-grow: 1; + } + } + } + .randomize-button{ display: flex; flex-direction: column; diff --git a/WebHostLib/templates/playerOptions/macros.html b/WebHostLib/templates/playerOptions/macros.html index 032a8bf6941e..35da00613e26 100644 --- a/WebHostLib/templates/playerOptions/macros.html +++ b/WebHostLib/templates/playerOptions/macros.html @@ -101,7 +101,7 @@