mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: Handle default state of SALVAGE button
This commit is contained in:
parent
3f0bdb6aa3
commit
3a372146de
BIN
assets/share/item/relics/FIRST_RELIC_SELECTED.png
Normal file
BIN
assets/share/item/relics/FIRST_RELIC_SELECTED.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
@ -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(
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user