diff --git a/assets/share/item/relics/FIRST_RELIC_SELECTED.png b/assets/share/item/relics/FIRST_RELIC_SELECTED.png new file mode 100644 index 000000000..d39d0c3b2 Binary files /dev/null and b/assets/share/item/relics/FIRST_RELIC_SELECTED.png differ diff --git a/tasks/item/assets/assets_item_relics.py b/tasks/item/assets/assets_item_relics.py index 4a74732bc..d4060b601 100644 --- a/tasks/item/assets/assets_item_relics.py +++ b/tasks/item/assets/assets_item_relics.py @@ -13,6 +13,16 @@ FIRST_RELIC = ButtonWrapper( button=(434, 160, 530, 260), ), ) +FIRST_RELIC_SELECTED = ButtonWrapper( + name='FIRST_RELIC_SELECTED', + share=Button( + file='./assets/share/item/relics/FIRST_RELIC_SELECTED.png', + area=(424, 136, 452, 164), + search=(404, 116, 472, 184), + color=(193, 194, 198), + button=(424, 136, 452, 164), + ), +) GOTO_SALVAGE = ButtonWrapper( name='GOTO_SALVAGE', share=Button( diff --git a/tasks/item/relics.py b/tasks/item/relics.py index 0f10852a2..2c72b905a 100644 --- a/tasks/item/relics.py +++ b/tasks/item/relics.py @@ -21,6 +21,7 @@ class RelicsUI(ItemUI): self.device.screenshot() if self._is_in_salvage(): + logger.info('_is_in_salvage') break if self.appear_then_click(GOTO_SALVAGE, interval=2): continue @@ -33,11 +34,16 @@ class RelicsUI(ItemUI): else: self.device.screenshot() - if SALVAGE.match_template_color(self.device.image): + # The first frame entering relic page, SALVAGE is a white button as it's the default state. + # At the second frame, SALVAGE is disabled since no items are selected. + # So here uses the minus button on the first relic. + if self.image_color_count(FIRST_RELIC_SELECTED, color=(245, 245, 245), threshold=221, count=50): + logger.info('First relic selected') break if self.appear_then_click(ORDER_DESCENDING, interval=2): continue - if interval.reached() and self.image_color_count(FIRST_RELIC, (233, 192, 108)): + if interval.reached() and self.appear(ORDER_ASCENDING) \ + and self.image_color_count(FIRST_RELIC, (233, 192, 108)): self.device.click(FIRST_RELIC) interval.reset() continue