From 6fd4cdc7973dabda22dd48833bb4ccf649944465 Mon Sep 17 00:00:00 2001 From: W1NDes Date: Sun, 6 Jul 2025 14:08:03 +0800 Subject: [PATCH] =?UTF-8?q?Fix(storage):=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E7=A7=91=E7=A0=94=E8=A3=85=E5=A4=87=E7=AE=B1=E4=B8=8D=E8=B6=B3?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/storage/storage.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/module/storage/storage.py b/module/storage/storage.py index bdbea0973..90b625777 100644 --- a/module/storage/storage.py +++ b/module/storage/storage.py @@ -15,7 +15,7 @@ from module.storage.assets import * from module.storage.ui import StorageUI from module.ui.assets import BACK_ARROW, STORAGE_CHECK from module.ui.scroll import Scroll - +from module.exception import GameTooManyClickError MATERIAL_SCROLL = Scroll(METERIAL_SCROLL, color=(247, 211, 66)) EQUIPMENT_GRIDS = ButtonGrid(origin=(140, 88), delta=(159, 178), button_shape=(124, 124), @@ -96,10 +96,13 @@ class StorageHandler(StorageUI): if retry.reached(): button = AMOUNT_PLUS if diff > 0 else AMOUNT_MINUS - self.device.multi_click(button, n=abs(diff), interval=(0.1, 0.2)) + try: + self.device.multi_click(button, n=abs(diff), interval=(0.1, 0.2)) + except GameTooManyClickError: + return current retry.reset() - return True + return amount def _storage_use_one_box(self, button, amount=1): """ @@ -156,10 +159,10 @@ class StorageHandler(StorageUI): # use match_template_color on BOX_AMOUNT_CONFIRM # a long animation that opens a box, will be on the top of BOX_AMOUNT_CONFIRM if self.match_template_color(BOX_AMOUNT_CONFIRM, offset=(20, 20), interval=5): - self._handle_use_box_amount(amount) + real_used = self._handle_use_box_amount(amount) self.device.click(BOX_AMOUNT_CONFIRM) self.interval_reset(BOX_AMOUNT_CONFIRM) - used = amount + used = real_used continue if self.appear_then_click(EQUIP_CONFIRM, offset=(20, 20), interval=5): self.interval_reset(MATERIAL_CHECK)