Skip to content

Commit 9cc8a69

Browse files
Silvrisel-u
authored andcommitted
CommonClient: Add a hints tab (ArchipelagoMW#2392)
Co-authored-by: el-u <[email protected]>
1 parent bcafcc3 commit 9cc8a69

File tree

3 files changed

+262
-83
lines changed

3 files changed

+262
-83
lines changed

CommonClient.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
758758
ctx.slot_info = {int(pid): data for pid, data in args["slot_info"].items()}
759759
ctx.hint_points = args.get("hint_points", 0)
760760
ctx.consume_players_package(args["players"])
761+
ctx.stored_data_notification_keys.add(f"_read_hints_{ctx.team}_{ctx.slot}")
761762
msgs = []
762763
if ctx.locations_checked:
763764
msgs.append({"cmd": "LocationChecks",
@@ -836,10 +837,14 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
836837

837838
elif cmd == "Retrieved":
838839
ctx.stored_data.update(args["keys"])
840+
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" in args["keys"]:
841+
ctx.ui.update_hints()
839842

840843
elif cmd == "SetReply":
841844
ctx.stored_data[args["key"]] = args["value"]
842-
if args["key"].startswith("EnergyLink"):
845+
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" == args["key"]:
846+
ctx.ui.update_hints()
847+
elif args["key"].startswith("EnergyLink"):
843848
ctx.current_energy_link_value = args["value"]
844849
if ctx.ui:
845850
ctx.ui.set_new_energy_link_value()

data/client.kv

+70-5
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717
color: "FFFFFF"
1818
<TabbedPanel>:
1919
tab_width: root.width / app.tab_count
20+
<TooltipLabel>:
21+
text_size: self.width, None
22+
size_hint_y: None
23+
height: self.texture_size[1]
24+
font_size: dp(20)
25+
markup: True
2026
<SelectableLabel>:
2127
canvas.before:
2228
Color:
2329
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1)
2430
Rectangle:
2531
size: self.size
2632
pos: self.pos
27-
text_size: self.width, None
28-
size_hint_y: None
29-
height: self.texture_size[1]
30-
font_size: dp(20)
31-
markup: True
3233
<UILog>:
3334
messages: 1000 # amount of messages stored in client logs.
3435
cols: 1
@@ -44,6 +45,70 @@
4445
height: self.minimum_height
4546
orientation: 'vertical'
4647
spacing: dp(3)
48+
<HintLabel>:
49+
canvas.before:
50+
Color:
51+
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1) if self.striped else (0.18, 0.18, 0.18, 1)
52+
Rectangle:
53+
size: self.size
54+
pos: self.pos
55+
height: self.minimum_height
56+
receiving_text: "Receiving Player"
57+
item_text: "Item"
58+
finding_text: "Finding Player"
59+
location_text: "Location"
60+
entrance_text: "Entrance"
61+
found_text: "Found?"
62+
TooltipLabel:
63+
id: receiving
64+
text: root.receiving_text
65+
halign: 'center'
66+
valign: 'center'
67+
pos_hint: {"center_y": 0.5}
68+
TooltipLabel:
69+
id: item
70+
text: root.item_text
71+
halign: 'center'
72+
valign: 'center'
73+
pos_hint: {"center_y": 0.5}
74+
TooltipLabel:
75+
id: finding
76+
text: root.finding_text
77+
halign: 'center'
78+
valign: 'center'
79+
pos_hint: {"center_y": 0.5}
80+
TooltipLabel:
81+
id: location
82+
text: root.location_text
83+
halign: 'center'
84+
valign: 'center'
85+
pos_hint: {"center_y": 0.5}
86+
TooltipLabel:
87+
id: entrance
88+
text: root.entrance_text
89+
halign: 'center'
90+
valign: 'center'
91+
pos_hint: {"center_y": 0.5}
92+
TooltipLabel:
93+
id: found
94+
text: root.found_text
95+
halign: 'center'
96+
valign: 'center'
97+
pos_hint: {"center_y": 0.5}
98+
<HintLog>:
99+
cols: 1
100+
viewclass: 'HintLabel'
101+
scroll_y: self.height
102+
scroll_type: ["content", "bars"]
103+
bar_width: dp(12)
104+
effect_cls: "ScrollEffect"
105+
SelectableRecycleBoxLayout:
106+
default_size: None, dp(20)
107+
default_size_hint: 1, None
108+
size_hint_y: None
109+
height: self.minimum_height
110+
orientation: 'vertical'
111+
spacing: dp(3)
47112
<ServerLabel>:
48113
text: "Server:"
49114
size_hint_x: None

0 commit comments

Comments
 (0)