Fix: wait_selected() has no return

This commit is contained in:
LmeSzinc 2024-06-19 22:55:09 +08:00
parent f0926d0b50
commit f241b4315c

View File

@ -319,6 +319,13 @@ class InventoryManager:
self.update() self.update()
def wait_selected(self, skip_first_screenshot=True): def wait_selected(self, skip_first_screenshot=True):
"""
Args:
skip_first_screenshot:
Returns:
bool: If success
"""
timeout = Timer(2, count=6).start() timeout = Timer(2, count=6).start()
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
@ -328,7 +335,7 @@ class InventoryManager:
self.update() self.update()
if self.selected is not None: if self.selected is not None:
break return True
if timeout.reached(): if timeout.reached():
logger.warning('Wait inventory selected timeout') logger.warning('Wait inventory selected timeout')
break return False