diff --git a/module/os_handler/storage.py b/module/os_handler/storage.py index 8e2c4be09..4a0533c8e 100644 --- a/module/os_handler/storage.py +++ b/module/os_handler/storage.py @@ -252,3 +252,36 @@ class StorageHandler(GlobeOperation, ZoneManager): result = self.storage_checkout_item(item) return result + + +class StorageHandler(StorageHandler): + def storage_checkout_item(self, item): + """ + Args: + item (str): 'OBSCURE' or 'ABYSSAL'. + + Returns: + bool: If checkout + + Pages: + in: STORAGE_CHECK + out: is_in_map, in an obscure/abyssal zone if checkout. + is_in_map, in previous zone if no more obscure/abyssal coordinates. + """ + logger.hr(f'Storage checkout item {item}') + if SCROLL_STORAGE.appear(main=self): + SCROLL_STORAGE.set_top(main=self) + + confirm_timer = Timer(0.6, count=2).start() + for _ in self.loop(): + image = rgb2gray(self.device.image) + items = self._storage_item_to_template(item).match_multi(image, similarity=0.75) + logger.attr(f'Storage_{item}', len(items)) + + if len(items): + self._storage_coordinate_checkout(items[0], types=(item,)) + return True + if confirm_timer.reached(): + logger.info(f'No more {item} items in storage') + self.storage_quit() + return False