Core: change HINT_FOUND to 40 and HINT_UNSPECIFIED to 0 (#4620)

This commit is contained in:
Fabian Dill
2025-02-10 19:19:00 +01:00
committed by GitHub
parent 18bcaa85a2
commit a298be9c41
3 changed files with 16 additions and 7 deletions

View File

@@ -12,11 +12,11 @@ from Utils import ByValue, Version
class HintStatus(ByValue, enum.IntEnum): class HintStatus(ByValue, enum.IntEnum):
HINT_FOUND = 0 HINT_UNSPECIFIED = 0
HINT_UNSPECIFIED = 1
HINT_NO_PRIORITY = 10 HINT_NO_PRIORITY = 10
HINT_AVOID = 20 HINT_AVOID = 20
HINT_PRIORITY = 30 HINT_PRIORITY = 30
HINT_FOUND = 40
class JSONMessagePart(typing.TypedDict, total=False): class JSONMessagePart(typing.TypedDict, total=False):

View File

@@ -363,11 +363,11 @@ An enumeration containing the possible hint states.
```python ```python
import enum import enum
class HintStatus(enum.IntEnum): class HintStatus(enum.IntEnum):
HINT_FOUND = 0 # The location has been collected. Status cannot be changed once found. HINT_UNSPECIFIED = 0 # The receiving player has not specified any status
HINT_UNSPECIFIED = 1 # The receiving player has not specified any status
HINT_NO_PRIORITY = 10 # The receiving player has specified that the item is unneeded HINT_NO_PRIORITY = 10 # The receiving player has specified that the item is unneeded
HINT_AVOID = 20 # The receiving player has specified that the item is detrimental HINT_AVOID = 20 # The receiving player has specified that the item is detrimental
HINT_PRIORITY = 30 # The receiving player has specified that the item is needed HINT_PRIORITY = 30 # The receiving player has specified that the item is needed
HINT_FOUND = 40 # The location has been collected. Status cannot be changed once found.
``` ```
- Hints for items with `ItemClassification.trap` default to `HINT_AVOID`. - Hints for items with `ItemClassification.trap` default to `HINT_AVOID`.
- Hints created with `LocationScouts`, `!hint_location`, or similar (hinting a location) default to `HINT_UNSPECIFIED`. - Hints created with `LocationScouts`, `!hint_location`, or similar (hinting a location) default to `HINT_UNSPECIFIED`.

15
kvui.py
View File

@@ -444,8 +444,11 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout):
if child.collide_point(*touch.pos): if child.collide_point(*touch.pos):
key = child.sort_key key = child.sort_key
if key == "status": if key == "status":
parent.hint_sorter = lambda element: element["status"]["hint"]["status"] parent.hint_sorter = lambda element: status_sort_weights[element["status"]["hint"]["status"]]
else: parent.hint_sorter = lambda element: remove_between_brackets.sub("", element[key]["text"]).lower() else:
parent.hint_sorter = lambda element: (
remove_between_brackets.sub("", element[key]["text"]).lower()
)
if key == parent.sort_key: if key == parent.sort_key:
# second click reverses order # second click reverses order
parent.reversed = not parent.reversed parent.reversed = not parent.reversed
@@ -829,7 +832,13 @@ status_colors: typing.Dict[HintStatus, str] = {
HintStatus.HINT_AVOID: "salmon", HintStatus.HINT_AVOID: "salmon",
HintStatus.HINT_PRIORITY: "plum", HintStatus.HINT_PRIORITY: "plum",
} }
status_sort_weights: dict[HintStatus, int] = {
HintStatus.HINT_FOUND: 0,
HintStatus.HINT_UNSPECIFIED: 1,
HintStatus.HINT_NO_PRIORITY: 2,
HintStatus.HINT_AVOID: 3,
HintStatus.HINT_PRIORITY: 4,
}
class HintLog(RecycleView): class HintLog(RecycleView):