AzurLaneAutoScript
AzurLaneAutoScript copied to clipboard
MedalShop相关的exception
在提问之前...
- [x] 我已经搜索了现有的 issues
- [x] 我在提问题之前至少花费了 5 分钟来思考和准备
- [x] 我已经阅读了 Wiki 中的 常见问题(FAQ)
- [x] 我正在使用最新版的 Alas
描述你的问题
勋章商店warning处理有问题
medals的类型应该是ndarray[ndarray]
如何复现
- 前往 '...'
- 点击 '....'
- 滑动到 '....'
- 出现问题
预期行为
No response
相关 Logs
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
SHOPONCE
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
2025-05-14 00:03:08.633 | INFO | UI get current page
2025-05-14 00:03:08.670 | INFO | [UI] page_munitions
2025-05-14 00:03:08.672 | INFO | Already at page_munitions
2025-05-14 00:03:08.673 | INFO | SHOP_TAB set to left=2
2025-05-14 00:03:08.675 | INFO | Nav item active: 1 from range (0, 1)
2025-05-14 00:03:08.677 | INFO | SHOP_NAV set to left=2 upper=2
2025-05-14 00:03:08.679 | INFO | Nav item active: 0 from range (0, 4)
2025-05-14 00:03:08.680 | INFO | Click ( 347, 296) @ SHOP_NAV_0_1
2025-05-14 00:03:08.838 | INFO | Nav item active: 1 from range (0, 4)
═════════════════════════════════════════════════════ MERIT SHOP ══════════════════════════════════════════════════════
2025-05-14 00:03:08.841 | INFO | MERIT SHOP
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2025-05-14 00:03:08.843 | INFO | SHOP BUY
2025-05-14 00:03:08.844 | INFO | Loading template folder: ./assets/shop/merit
2025-05-14 00:03:09.380 | INFO | [next_template_index] 64
2025-05-14 00:03:09.394 | INFO | New template: 65
2025-05-14 00:03:09.551 | INFO | [Price_ocr 0.148s] [15000, 3000, 20000, 8000, 5000, 1500, 300, 300, 400, 100]
2025-05-14 00:03:09.553 | INFO | [Item detected] 10
2025-05-14 00:03:09.716 | INFO | [Price_ocr 0.137s] [15000, 3000, 20000, 8000, 5000, 1500, 300, 300, 400, 100]
2025-05-14 00:03:09.718 | INFO | [Item detected] 10
2025-05-14 00:03:09.720 | INFO | Shop row 1: ['BulinT2_x1_Merit_x15000', 'BulinT1_x1_Merit_x3000',
'Eldridge_x1_Merit_x20000', '65_x1_Merit_x8000', 'SanJuan_x1_Merit_x5000']
2025-05-14 00:03:09.722 | INFO | Shop row 2: ['BoxT4_x1_Merit_x1500', 'BoxIrisT2_x1_Merit_x300',
'BoxIrisT2_x1_Merit_x300', 'BoxIrisT2_x1_Merit_x400', 'BoxT1_x1_Merit_x100']
2025-05-14 00:03:09.748 | INFO | [SHOP_MERIT 0.025s] 355890
2025-05-14 00:03:09.750 | INFO | Merit: 355890
2025-05-14 00:03:09.751 | INFO | Shop buy finished
2025-05-14 00:03:09.752 | INFO | SHOP_TAB set to left=2
2025-05-14 00:03:09.754 | INFO | Nav item active: 1 from range (0, 1)
2025-05-14 00:03:09.755 | INFO | SHOP_NAV set to left=3 upper=3
2025-05-14 00:03:09.757 | INFO | Nav item active: 1 from range (0, 4)
2025-05-14 00:03:09.758 | INFO | Click ( 345, 371) @ SHOP_NAV_0_2
2025-05-14 00:03:09.824 | INFO | Nav item active: 1 from range (0, 4)
2025-05-14 00:03:10.020 | INFO | Nav item active: 2 from range (0, 4)
═════════════════════════════════════════════════════ GUILD SHOP ══════════════════════════════════════════════════════
2025-05-14 00:03:10.023 | INFO | GUILD SHOP
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2025-05-14 00:03:10.025 | INFO | SHOP BUY
2025-05-14 00:03:10.026 | INFO | Loading template folder: ./assets/shop/guild
2025-05-14 00:03:10.391 | INFO | [next_template_index] 40
2025-05-14 00:03:10.470 | INFO | [Price_ocr 0.066s] [800, 300, 2000, 50]
2025-05-14 00:03:10.472 | INFO | [Item detected] 4
2025-05-14 00:03:10.553 | INFO | [Price_ocr 0.061s] [800, 300, 2000, 50]
2025-05-14 00:03:10.554 | INFO | [Item detected] 4
2025-05-14 00:03:10.555 | INFO | Shop row 1: ['ShipT2_x1_GuildCoins_x800', 'ShipT2_x1_GuildCoins_x300',
'ShipT2_x1_GuildCoins_x2000']
2025-05-14 00:03:10.557 | INFO | Shop row 2: ['RetrofitT2_x1_GuildCoins_x50']
2025-05-14 00:03:10.582 | INFO | [SHOP_GUILD_COINS 0.023s] 25898
2025-05-14 00:03:10.584 | INFO | Guild coins: 25898
2025-05-14 00:03:10.585 | INFO | Shop buy finished
2025-05-14 00:03:13.717 | INFO | SHOP_TAB set to left=1
2025-05-14 00:03:13.719 | INFO | Nav item active: 1 from range (0, 1)
2025-05-14 00:03:13.721 | INFO | Click ( 490, 128) @ SHOP_TAB_0_0
2025-05-14 00:03:13.920 | INFO | Nav item active: 0 from range (0, 1)
2025-05-14 00:03:13.922 | INFO | SHOP_NAV set to left=2 upper=2
2025-05-14 00:03:13.925 | INFO | Nav item active: 0 from range (0, 4)
2025-05-14 00:03:13.927 | INFO | Click ( 347, 303) @ SHOP_NAV_0_1
2025-05-14 00:03:14.108 | INFO | Nav item active: 1 from range (0, 4)
══════════════════════════════════════════════════════ CORE SHOP ══════════════════════════════════════════════════════
2025-05-14 00:03:14.111 | INFO | CORE SHOP
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2025-05-14 00:03:14.113 | INFO | SHOP BUY
2025-05-14 00:03:14.114 | INFO | Loading template folder: ./assets/shop/core
2025-05-14 00:03:14.148 | INFO | [next_template_index] 4
2025-05-14 00:03:14.156 | INFO | New template: 5
2025-05-14 00:03:14.158 | INFO | New template: 6
2025-05-14 00:03:14.160 | INFO | New template: 7
2025-05-14 00:03:14.161 | INFO | New template: 8
2025-05-14 00:03:14.163 | INFO | New template: 9
2025-05-14 00:03:14.164 | INFO | New template: 10
2025-05-14 00:03:14.166 | INFO | New template: 11
2025-05-14 00:03:14.167 | INFO | New template: 12
2025-05-14 00:03:14.168 | INFO | New template: 13
2025-05-14 00:03:14.170 | INFO | New template: 14
2025-05-14 00:03:14.329 | INFO | [Price_ocr 0.153s] [1500, 1500, 1200, 1200, 1200, 1000, 1000, 1500, 800, 800]
2025-05-14 00:03:14.331 | INFO | [Item detected] 10
2025-05-14 00:03:14.501 | INFO | [Price_ocr 0.143s] [1500, 1500, 1200, 1200, 1200, 1000, 1000, 1500, 800, 800]
2025-05-14 00:03:14.502 | INFO | [Item detected] 10
2025-05-14 00:03:14.503 | INFO | Shop row 1: ['5_x1_Core_x1500', '6_x1_Core_x1500', '7_x1_Core_x1200',
'8_x1_Core_x1200', '9_x1_Core_x1200']
2025-05-14 00:03:14.506 | INFO | Shop row 2: ['10_x1_Core_x1000', '11_x1_Core_x1000', '12_x1_Core_x1500',
'13_x1_Core_x800', '14_x1_Core_x800']
2025-05-14 00:03:14.532 | INFO | [SHOP_CORE 0.025s] 8677
2025-05-14 00:03:14.535 | INFO | Core: 8677
2025-05-14 00:03:14.536 | INFO | Shop buy finished
2025-05-14 00:03:14.537 | INFO | SHOP_TAB set to left=1
2025-05-14 00:03:14.538 | INFO | Nav item active: 0 from range (0, 1)
2025-05-14 00:03:14.540 | INFO | SHOP_NAV set to left=3 upper=3
2025-05-14 00:03:14.542 | INFO | Nav item active: 1 from range (0, 4)
2025-05-14 00:03:14.544 | INFO | Click ( 347, 369) @ SHOP_NAV_0_2
2025-05-14 00:03:14.607 | INFO | Nav item active: 1 from range (0, 4)
2025-05-14 00:03:14.806 | INFO | Nav item active: 2 from range (0, 4)
═════════════════════════════════════════════════════ MEDAL SHOP ══════════════════════════════════════════════════════
2025-05-14 00:03:14.810 | INFO | MEDAL SHOP
2025-05-14 00:03:14.828 | INFO | [Medals_icon] 2
2025-05-14 00:03:14.829 | INFO | MEDAL_SHOP_SCROLL_AREA set to 0.0
2025-05-14 00:03:14.832 | INFO | [MEDAL_SHOP_SCROLL_AREA] 0.00 (60.5-61.0)/(422-122)
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2025-05-14 00:03:14.833 | INFO | SHOP BUY
2025-05-14 00:03:14.850 | INFO | [Medals_icon] 2
2025-05-14 00:03:14.851 | INFO | Loading template folder: ./assets/shop/medal
2025-05-14 00:03:15.813 | INFO | [next_template_index] 114
2025-05-14 00:03:15.953 | INFO | [Price_ocr 0.116s] [80, 80, 80, 30, 20, 20, 10, 6, 6, 6]
2025-05-14 00:03:15.957 | INFO | [Item detected] 10
2025-05-14 00:03:16.087 | INFO | [Price_ocr 0.107s] [80, 80, 80, 30, 20, 20, 10, 6, 6, 6]
2025-05-14 00:03:16.090 | INFO | [Item detected] 10
2025-05-14 00:03:16.091 | INFO | Shop row 1: ['ShipT4_x1_Medal_x80', 'ShipT4_x1_Medal_x80', 'BulinT2_x1_Medal_x80',
'BulinT1_x1_Medal_x30', 'DRS2_x1_Medal_x20']
2025-05-14 00:03:16.092 | INFO | Shop row 2: ['DRS2_x1_Medal_x20', 'FoodT6_x1_Medal_x10', 'FoodT5_x1_Medal_x6',
'BookRedT3_x1_Medal_x6', 'BookBlueT3_x1_Medal_x6']
2025-05-14 00:03:16.120 | INFO | [SHOP_MEDAL 0.027s] 102934
2025-05-14 00:03:16.123 | INFO | Medal: 102934
2025-05-14 00:03:16.124 | INFO | Shop buy finished
2025-05-14 00:03:16.125 | INFO | [MEDAL_SHOP_SCROLL_AREA] 0.00 (60.5-61.0)/(422-122)
2025-05-14 00:03:16.127 | INFO | [MEDAL_SHOP_SCROLL_AREA] 0.00 (60.5-61.0)/(422-122)
2025-05-14 00:03:16.129 | INFO | MEDAL_SHOP_SCROLL_AREA set to 0.268
2025-05-14 00:03:16.130 | INFO | [MEDAL_SHOP_SCROLL_AREA] 0.00 (60.5-61.0)/(422-122)
2025-05-14 00:03:16.131 | INFO | Swipe (1264, 288) -> (1261, 361)
2025-05-14 00:03:16.348 | INFO | [MEDAL_SHOP_SCROLL_AREA] 0.21 (125.5-62.0)/(422-124)
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2025-05-14 00:03:16.351 | INFO | SHOP BUY
2025-05-14 00:03:16.367 | INFO | [Medals_icon] 3
2025-05-14 00:03:16.369 | ERROR | AttributeError: 'numpy.ndarray' object has no attribute 'area'
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ │
│ D:\code\azurlaneautoscript\alas.py:69 in run │
│ │
│ 66 │ │ try: │
│ 67 │ │ │ if not skip_first_screenshot: │
│ 68 │ │ │ │ self.device.screenshot() │
│ > 69 │ │ │ self.__getattribute__(command)() │
│ 70 │ │ │ return True │
│ 71 │ │ except TaskEnd: │
│ 72 │ │ │ return True │
│ │
│ ┌───────────────────────────────────────── locals ─────────────────────────────────────────┐ │
│ │ command = 'shop_once' │ │
│ │ e = AttributeError("'numpy.ndarray' object has no attribute 'area'") │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x000002B7A15DD448> │ │
│ │ skip_first_screenshot = False │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────┘ │
│ D:\code\azurlaneautoscript\alas.py:229 in shop_once │
│ │
│ 226 │ │
│ 227 │ def shop_once(self): │
│ 228 │ │ from module.shop.shop_reward import RewardShop │
│ > 229 │ │ RewardShop(config=self.config, device=self.device).run_once() │
│ 230 │ │
│ 231 │ def shipyard(self): │
│ 232 │ │ from module.shipyard.shipyard_reward import RewardShipyard │
│ │
│ ┌────────────────────────────── locals ───────────────────────────────┐ │
│ │ RewardShop = <class 'module.shop.shop_reward.RewardShop'> │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x000002B7A15DD448> │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_reward.py:39 in run_once │
│ │
│ 36 │ │ │
│ 37 │ │ self.shop_tab.set(main=self, left=1) │
│ 38 │ │ self.shop_nav.set(main=self, upper=3) │
│ > 39 │ │ MedalShop2(self.config, self.device).run() │
│ 40 │ │ │
│ 41 │ │ self.config.task_delay(server_update=True) │
│ 42 │
│ │
│ ┌───────────────────────────────── locals ─────────────────────────────────┐ │
│ │ self = <module.shop.shop_reward.RewardShop object at 0x000002B7823D7188> │ │
│ └──────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:219 in run │
│ │
│ 216 │ │ # Execute buy operations │
│ 217 │ │ MEDAL_SHOP_SCROLL.set_top(main=self) │
│ 218 │ │ while 1: │
│ > 219 │ │ │ self.shop_buy() │
│ 220 │ │ │ if MEDAL_SHOP_SCROLL.at_bottom(main=self): │
│ 221 │ │ │ │ logger.info('Medal shop reach bottom, stop') │
│ 222 │ │ │ │ break │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\clerk.py:331 in shop_buy │
│ │
│ 328 │ │ │ logger.hr('Shop buy', level=2) │
│ 329 │ │ │ # Get first for innate delay to ocr │
│ 330 │ │ │ # shop currency for accurate parse │
│ > 331 │ │ │ items = self.shop_get_items() │
│ 332 │ │ │ self.shop_currency() │
│ 333 │ │ │ if self._currency <= 0: │
│ 334 │ │ │ │ logger.warning(f'Current funds: {self._currency}, stopped') │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ _ = 0 │ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\base.py:220 in shop_get_items │
│ │
│ 217 │ │ │ list[Item]: │
│ 218 │ │ """ │
│ 219 │ │ # Retrieve ShopItemGrid │
│ > 220 │ │ shop_items = self.shop_items() │
│ 221 │ │ if shop_items is None: │
│ 222 │ │ │ logger.warning('Expected type \'ShopItemGrid\' but was None') │
│ 223 │ │ │ return [] │
│ │
│ ┌───────────────────────────────────────── locals ─────────────────────────────────────────┐ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ │ skip_first_screenshot = True │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:145 in shop_items │
│ │
│ 142 │ │ Returns: │
│ 143 │ │ │ ShopItemGrid: │
│ 144 │ │ """ │
│ > 145 │ │ return self.shop_medal_items │
│ 146 │ │
│ 147 │ def shop_currency(self): │
│ 148 │ │ """ │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\base\decorator.py:97 in __get__ │
│ │
│ 94 │ │ if obj is None: │
│ 95 │ │ │ return self │
│ 96 │ │ │
│ > 97 │ │ value = obj.__dict__[self.func.__name__] = self.func(obj) │
│ 98 │ │ return value │
│ 99 │
│ 100 │
│ │
│ ┌────────────────────────────────── locals ───────────────────────────────────┐ │
│ │ cls = <class 'module.shop.shop_medal.MedalShop2'> │ │
│ │ obj = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ │ self = <module.base.decorator.cached_property object at 0x000002B78276E088> │ │
│ └─────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:124 in shop_medal_items │
│ │
│ 121 │ │ Returns: │
│ 122 │ │ │ ShopItemGrid: │
│ 123 │ │ """ │
│ > 124 │ │ shop_grid = self.shop_grid │
│ 125 │ │ shop_medal_items = ShopItemGrid( │
│ 126 │ │ │ shop_grid, │
│ 127 │ │ │ templates={}, amount_area=(60, 74, 96, 95), │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\base\decorator.py:97 in __get__ │
│ │
│ 94 │ │ if obj is None: │
│ 95 │ │ │ return self │
│ 96 │ │ │
│ > 97 │ │ value = obj.__dict__[self.func.__name__] = self.func(obj) │
│ 98 │ │ return value │
│ 99 │
│ 100 │
│ │
│ ┌────────────────────────────────── locals ───────────────────────────────────┐ │
│ │ cls = <class 'module.shop.shop_medal.MedalShop2'> │ │
│ │ obj = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ │ self = <module.base.decorator.cached_property object at 0x000002B78276EEC8> │ │
│ └─────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:74 in shop_grid │
│ │
│ 71 │ │
│ 72 │ @cached_property │
│ 73 │ def shop_grid(self): │
│ > 74 │ │ return self.shop_medal_grid() │
│ 75 │ │
│ 76 │ def shop_medal_grid(self): │
│ 77 │ │ """ │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:103 in shop_medal_grid │
│ │
│ 100 │ │ │ delta_y = abs(y1 - y2) │
│ 101 │ │ │ row = 2 │
│ 102 │ │ else: │
│ > 103 │ │ │ logger.warning(f'Unexpected medal icon match result: {[m.area for m in │
│ medals]}') │
│ 104 │ │ │ origin_y = 246 │
│ 105 │ │ │ delta_y = 213 │
│ 106 │ │ │ row = 2 │
│ │
│ ┌───────────────────────────────── locals ──────────────────────────────────┐ │
│ │ count = 3 │ │
│ │ medals = array([[ 0, 2], │ │
│ │ │ [ 0, 214], │ │
│ │ │ [ 0, 252]]) │ │
│ │ self = <module.shop.shop_medal.MedalShop2 object at 0x000002B784A107C8> │ │
│ └───────────────────────────────────────────────────────────────────────────┘ │
│ │
│ D:\code\azurlaneautoscript\module\shop\shop_medal.py:103 in <listcomp> │
│ │
│ 100 │ │ │ delta_y = abs(y1 - y2) │
│ 101 │ │ │ row = 2 │
│ 102 │ │ else: │
│ > 103 │ │ │ logger.warning(f'Unexpected medal icon match result: {[m.area for m in │
│ medals]}') │
│ 104 │ │ │ origin_y = 246 │
│ 105 │ │ │ delta_y = 213 │
│ 106 │ │ │ row = 2 │
│ │
│ ┌─────────────────── locals ───────────────────┐ │
│ │ .0 = <iterator object at 0x000002B7EA45DB48> │ │
│ │ m = array([0, 2]) │ │
│ └──────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'numpy.ndarray' object has no attribute 'area'
2025-05-14 00:03:16.756 | WARNING | Saving error: ./log/error/1747152196756
截图
还有别的吗?
No response
相同问题,报错相同,标记一下
一樣狀況