From 9d0c276db5c9d1d3fae9f0f77db320826a85596d Mon Sep 17 00:00:00 2001 From: RedDeadDepresso <94017243+RedDeadDepresso@users.noreply.github.com> Date: Wed, 10 Jan 2024 14:34:05 +0000 Subject: [PATCH] perf: mission --- tasks/mission/mission.py | 14 ++++++++++---- tasks/mission/ui.py | 15 +++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tasks/mission/mission.py b/tasks/mission/mission.py index 6570bb2..293167a 100644 --- a/tasks/mission/mission.py +++ b/tasks/mission/mission.py @@ -34,11 +34,17 @@ class Mission(MissionUI, CommissionsUI): case "H": return 20 case "E": - stage = int(self.current_stage, base=10) - return 20 if stage >= 9 else 10 + 5 * math.floor(stage / 5) + if self.current_stage >= "09": + return 20 + elif self.current_stage <= "04": + return 10 + else: + return 15 case "XP" | "CR": - stage = int(self.current_stage, base=10) - return 40 if stage >= 8 else stage * 5 + if self.current_stage >= "08": + return 40 + else: + return int(self.current_stage, base=10) * 5 @property def mission_info(self) -> list: diff --git a/tasks/mission/ui.py b/tasks/mission/ui.py index 30dd098..948c0fc 100644 --- a/tasks/mission/ui.py +++ b/tasks/mission/ui.py @@ -49,11 +49,7 @@ class MissionUI(UI, AP): logger.warning("Area not found") return False - to_switch = { - "N": SWITCH_NORMAL, - "H": SWITCH_HARD - } - switch = to_switch[mode] + switch = SWITCH_HARD if mode == "H" else SWITCH_NORMAL if not self.select_mode(switch) and not self.select_area(area): return False return True @@ -146,11 +142,10 @@ class MissionUI(UI, AP): class CommissionsUI(UI, AP): """Works the same way as select_bounty""" def select_commission(self, mode): - to_button = { - "CR": (SELECT_CR, CHECK_CR), - "XP": (SELECT_XP, CHECK_XP) - } - dest_enter, dest_check = to_button[mode] + if mode == "CR": + dest_enter, dest_check = SELECT_CR, CHECK_CR + else: + dest_enter, dest_check = SELECT_XP, CHECK_XP timer = Timer(5, 10).start() while 1: self.device.screenshot()