diff --git a/NetUtils.py b/NetUtils.py index 5bcc583c..f2ae2a63 100644 --- a/NetUtils.py +++ b/NetUtils.py @@ -12,11 +12,11 @@ from Utils import ByValue, Version class HintStatus(ByValue, enum.IntEnum): - HINT_FOUND = 0 - HINT_UNSPECIFIED = 1 + HINT_UNSPECIFIED = 0 HINT_NO_PRIORITY = 10 HINT_AVOID = 20 HINT_PRIORITY = 30 + HINT_FOUND = 40 class JSONMessagePart(typing.TypedDict, total=False): diff --git a/docs/network protocol.md b/docs/network protocol.md index e5d3b7e6..05a53344 100644 --- a/docs/network protocol.md +++ b/docs/network protocol.md @@ -363,11 +363,11 @@ An enumeration containing the possible hint states. ```python import enum class HintStatus(enum.IntEnum): - HINT_FOUND = 0 # The location has been collected. Status cannot be changed once found. - HINT_UNSPECIFIED = 1 # The receiving player has not specified any status + HINT_UNSPECIFIED = 0 # The receiving player has not specified any status 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_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 created with `LocationScouts`, `!hint_location`, or similar (hinting a location) default to `HINT_UNSPECIFIED`. diff --git a/kvui.py b/kvui.py index 6718e48b..60042b00 100644 --- a/kvui.py +++ b/kvui.py @@ -444,8 +444,11 @@ class HintLabel(RecycleDataViewBehavior, BoxLayout): if child.collide_point(*touch.pos): key = child.sort_key if key == "status": - parent.hint_sorter = lambda element: element["status"]["hint"]["status"] - else: parent.hint_sorter = lambda element: remove_between_brackets.sub("", element[key]["text"]).lower() + 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() + ) if key == parent.sort_key: # second click reverses order parent.reversed = not parent.reversed @@ -829,7 +832,13 @@ status_colors: typing.Dict[HintStatus, str] = { HintStatus.HINT_AVOID: "salmon", 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):