diff --git a/src/town/town_manager.py b/src/town/town_manager.py index 5789eda..81d2b1c 100644 --- a/src/town/town_manager.py +++ b/src/town/town_manager.py @@ -1,3 +1,4 @@ +import keyboard import template_finder from config import Config from pather import Location @@ -161,12 +162,22 @@ class TownManager: # check if we can Identify in current act if self._acts[curr_act].can_identify(): success = self._acts[curr_act].identify(curr_loc) - view.return_to_play() + if success: + wait(0.2) + # close cain dialog so inventory key is not blocked + keyboard.send("esc") + else: + view.return_to_play() return success new_loc = self.go_to_act(5, curr_loc) if not new_loc: return False success = self._acts[Location.A5_TOWN_START].identify(new_loc) - view.return_to_play() + if success: + wait(0.2) + # close cain dialog so inventory key is not blocked + keyboard.send("esc") + else: + view.return_to_play() return success def open_stash(self, curr_loc: Location) -> Location | bool: diff --git a/src/ui/view.py b/src/ui/view.py index 642e537..6165c1f 100644 --- a/src/ui/view.py +++ b/src/ui/view.py @@ -81,7 +81,7 @@ def return_to_play() -> bool: substrings = ["NPC", "Panel", "SaveAndExit"] img=grab() start=time.time() - while (elapsed := (time.time() - start) < 8): + while (elapsed := (time.time() - start) < 5): need_escape = False match = detect_screen_object(ScreenObjects.InGame, img) if match.valid and "DARK" in match.name: @@ -92,7 +92,7 @@ def return_to_play() -> bool: break if need_escape: keyboard.send("esc") - wait(1.7) + wait(1) img=grab() else: break