Skip to content

Commit 6562ce0

Browse files
committed
Fix: always add items, even if last item list contains unknown items
1 parent 4b83292 commit 6562ce0

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

module/os_shop/port_shop.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from typing import List
2+
23
from module.base.button import ButtonGrid
34
from module.base.decorator import cached_property
45
from module.base.template import Template
56
from module.logger import logger
67
from module.map_detection.utils import Points
78
from module.os_handler.map_event import MapEventHandler
89
from module.os_handler.os_status import OSStatus
10+
from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid
911
from module.os_shop.selector import Selector
1012
from module.os_shop.ui import OSShopUI, OS_SHOP_SCROLL
11-
from module.os_shop.item import OSShopItem as Item, OSShopItemGrid as ItemGrid
1213
from module.statistics.utils import load_folder
1314

1415

@@ -133,19 +134,21 @@ def scan_all(self) -> List[Item]:
133134

134135
while True:
135136
pre_pos = self.pre_scroll(pre_pos, cur_pos)
136-
_items = self.os_shop_get_items(i, cur_pos)
137137

138-
for _ in range(2):
138+
_items = []
139+
for _ in range(3):
140+
_items = self.os_shop_get_items(i, cur_pos)
139141
if not len(_items) or any(not item.is_known_item() for item in _items):
140142
logger.warning('Empty OS shop or empty items, confirming')
141143
self.device.sleep((0.3, 0.5))
142144
self.device.screenshot()
143-
_items = self.os_shop_get_items(i, cur_pos)
144145
continue
145146
else:
146-
items += _items
147147
logger.info(f'Found {len(_items)} items in shop {i + 1} at pos {cur_pos:.2f}')
148148
break
149+
# always add items, even if last item list contains unknown items
150+
# so any known items can be scanned
151+
items += _items
149152

150153
if OS_SHOP_SCROLL.at_bottom(main=self):
151154
logger.info('OS shop reach bottom, stop')

0 commit comments

Comments
 (0)