|
1 | 1 | from typing import List |
| 2 | + |
2 | 3 | from module.base.button import ButtonGrid |
3 | 4 | from module.base.decorator import cached_property |
4 | 5 | from module.base.template import Template |
5 | 6 | from module.logger import logger |
6 | 7 | from module.map_detection.utils import Points |
7 | 8 | from module.os_handler.map_event import MapEventHandler |
8 | 9 | from module.os_handler.os_status import OSStatus |
| 10 | +from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid |
9 | 11 | from module.os_shop.selector import Selector |
10 | 12 | from module.os_shop.ui import OSShopUI, OS_SHOP_SCROLL |
11 | | -from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid |
12 | 13 | from module.statistics.utils import load_folder |
13 | 14 |
|
14 | 15 |
|
@@ -133,19 +134,21 @@ def scan_all(self) -> List[Item]: |
133 | 134 |
|
134 | 135 | while True: |
135 | 136 | pre_pos = self.pre_scroll(pre_pos, cur_pos) |
136 | | - _items = self.os_shop_get_items(i, cur_pos) |
137 | 137 |
|
138 | | - for _ in range(2): |
| 138 | + _items = [] |
| 139 | + for _ in range(3): |
| 140 | + _items = self.os_shop_get_items(i, cur_pos) |
139 | 141 | if not len(_items) or any(not item.is_known_item() for item in _items): |
140 | 142 | logger.warning('Empty OS shop or empty items, confirming') |
141 | 143 | self.device.sleep((0.3, 0.5)) |
142 | 144 | self.device.screenshot() |
143 | | - _items = self.os_shop_get_items(i, cur_pos) |
144 | 145 | continue |
145 | 146 | else: |
146 | | - items += _items |
147 | 147 | logger.info(f'Found {len(_items)} items in shop {i + 1} at pos {cur_pos:.2f}') |
148 | 148 | break |
| 149 | + # always add items, even if last item list contains unknown items |
| 150 | + # so any known items can be scanned |
| 151 | + items += _items |
149 | 152 |
|
150 | 153 | if OS_SHOP_SCROLL.at_bottom(main=self): |
151 | 154 | logger.info('OS shop reach bottom, stop') |
|
0 commit comments