diff --git a/assets/share/combat/prepare/FUEL.SEARCH.png b/assets/share/combat/prepare/FUEL.SEARCH.png new file mode 100644 index 000000000..74c45cf5f Binary files /dev/null and b/assets/share/combat/prepare/FUEL.SEARCH.png differ diff --git a/assets/share/combat/prepare/FUEL.png b/assets/share/combat/prepare/FUEL.png index 8a54c1b20..2a7d0466d 100644 Binary files a/assets/share/combat/prepare/FUEL.png and b/assets/share/combat/prepare/FUEL.png differ diff --git a/assets/share/combat/prepare/FUEL_SELECTED.png b/assets/share/combat/prepare/FUEL_SELECTED.png index 5d61f5370..caf5132f4 100644 Binary files a/assets/share/combat/prepare/FUEL_SELECTED.png and b/assets/share/combat/prepare/FUEL_SELECTED.png differ diff --git a/tasks/combat/assets/assets_combat_prepare.py b/tasks/combat/assets/assets_combat_prepare.py index 31ecca11a..1eaf77bee 100644 --- a/tasks/combat/assets/assets_combat_prepare.py +++ b/tasks/combat/assets/assets_combat_prepare.py @@ -34,10 +34,10 @@ FUEL = ButtonWrapper( name='FUEL', share=Button( file='./assets/share/combat/prepare/FUEL.png', - area=(592, 276, 688, 388), - search=(572, 256, 708, 408), - color=(113, 90, 123), - button=(592, 276, 688, 388), + area=(592, 276, 688, 366), + search=(474, 271, 811, 396), + color=(123, 96, 134), + button=(592, 276, 688, 366), ), ) FUEL_ENTRANCE = ButtonWrapper( @@ -74,10 +74,10 @@ FUEL_SELECTED = ButtonWrapper( name='FUEL_SELECTED', share=Button( file='./assets/share/combat/prepare/FUEL_SELECTED.png', - area=(587, 271, 692, 395), + area=(587, 271, 692, 368), search=(474, 271, 811, 396), - color=(130, 111, 137), - button=(587, 271, 692, 395), + color=(136, 112, 144), + button=(587, 271, 692, 368), ), ) FUEL_SLIDER = ButtonWrapper( diff --git a/tasks/combat/fuel.py b/tasks/combat/fuel.py index 9a8e54528..65de458c8 100644 --- a/tasks/combat/fuel.py +++ b/tasks/combat/fuel.py @@ -1,4 +1,5 @@ import module.config.server as server +from module.base.timer import Timer from module.base.utils import crop, area_offset from module.logger import logger @@ -122,9 +123,10 @@ class Fuel(UI): skip_first_screenshot=True ) - def set_fuel_count(self, count, total): + def set_fuel_count(self, count): slider = Slider(main=self, slider=FUEL_SLIDER) - slider.set(count, total) + # Can only use 5 fuel at one time + slider.set(count, 5) self.ui_ensure_index( count, letter=Digit(OCR_FUEL_COUNT, lang=server.lang), next_button=FUEL_PLUS, prev_button=FUEL_MINUS, @@ -139,20 +141,29 @@ class Fuel(UI): return logger.info("Use Fuel") + + timeout = Timer(1, count=3) + has_fuel = False while 1: if skip_first_screenshot: skip_first_screenshot = False else: self.device.screenshot() - if self.appear(POPUP_CONFIRM) and not (self.appear(FUEL_SELECTED) and self.appear(FUEL)): - logger.info("No fuel found") - return if self.appear(FUEL_SELECTED): + logger.info('Fuel selected') break + if self.appear(POPUP_CONFIRM): + timeout.start() + if self.appear(FUEL_SELECTED) or self.appear(FUEL): + has_fuel = True + if not has_fuel and timeout.reached(): + logger.info("No fuel found") + return if self.appear_then_click(FUEL): + has_fuel = True continue - if self.appear_then_click(FUEL_ENTRANCE): + if not self.appear(POPUP_CONFIRM) and self.appear_then_click(FUEL_ENTRANCE): continue offset = FUEL_SELECTED.button_offset @@ -178,6 +189,8 @@ class Fuel(UI): break if self.appear(FUEL) and self.handle_popup_confirm(): continue + if self.appear(FUEL_SELECTED) and self.handle_popup_confirm(): + continue - self.set_fuel_count(use, count) + self.set_fuel_count(use) self._fuel_confirm()