From 0215e1fa28b4f1bdde43ae500c84bf8f03829638 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 18 Sep 2022 12:40:35 +0200 Subject: [PATCH] SC2: always show uncollected locations (#1007) --- Starcraft2Client.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Starcraft2Client.py b/Starcraft2Client.py index 7f4bb8f4..09e4db8b 100644 --- a/Starcraft2Client.py +++ b/Starcraft2Client.py @@ -295,34 +295,37 @@ class SC2Context(CommonContext): category_panel.add_widget( Label(text=category, size_hint_y=None, height=50, outline_width=1)) - # Map is completed for mission in categories[category]: - text = mission - tooltip = "" + text: str = mission + tooltip: str = "" # Map has uncollected locations if mission in unfinished_missions: text = f"[color=6495ED]{text}[/color]" - tooltip = f"Uncollected locations:\n" - tooltip += "\n".join([self.ctx.location_names[loc] for loc in - self.ctx.locations_for_mission(mission) - if loc in self.ctx.missing_locations]) elif mission in available_missions: text = f"[color=FFFFFF]{text}[/color]" # Map requirements not met else: text = f"[color=a9a9a9]{text}[/color]" tooltip = f"Requires: " - if len(self.ctx.mission_req_table[mission].required_world) > 0: + if self.ctx.mission_req_table[mission].required_world: tooltip += ", ".join(list(self.ctx.mission_req_table)[req_mission - 1] for req_mission in self.ctx.mission_req_table[mission].required_world) - if self.ctx.mission_req_table[mission].number > 0: + if self.ctx.mission_req_table[mission].number: tooltip += " and " - if self.ctx.mission_req_table[mission].number > 0: + if self.ctx.mission_req_table[mission].number: tooltip += f"{self.ctx.mission_req_table[mission].number} missions completed" + remaining_location_names: typing.List[str] = [ + self.ctx.location_names[loc] for loc in self.ctx.locations_for_mission(mission) + if loc in self.ctx.missing_locations] + if remaining_location_names: + if tooltip: + tooltip += "\n" + tooltip += f"Uncollected locations:\n" + tooltip += "\n".join(remaining_location_names) mission_button = MissionButton(text=text, size_hint_y=None, height=50) mission_button.tooltip_text = tooltip