mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Opt: Faster relic salvage
This commit is contained in:
parent
dc4240b198
commit
54cd0f7c90
BIN
assets/share/item/relics/ORDER_ASCENDING.png
Normal file
BIN
assets/share/item/relics/ORDER_ASCENDING.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
BIN
assets/share/item/relics/SALVAGE.SEARCH.png
Normal file
BIN
assets/share/item/relics/SALVAGE.SEARCH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
@ -23,10 +23,20 @@ GOTO_SALVAGE = ButtonWrapper(
|
||||
button=(668, 652, 690, 674),
|
||||
),
|
||||
)
|
||||
REVERSE_ORDER = ButtonWrapper(
|
||||
name='REVERSE_ORDER',
|
||||
ORDER_ASCENDING = ButtonWrapper(
|
||||
name='ORDER_ASCENDING',
|
||||
share=Button(
|
||||
file='./assets/share/item/relics/REVERSE_ORDER.png',
|
||||
file='./assets/share/item/relics/ORDER_ASCENDING.png',
|
||||
area=(720, 649, 737, 667),
|
||||
search=(700, 629, 757, 687),
|
||||
color=(176, 176, 178),
|
||||
button=(720, 649, 737, 667),
|
||||
),
|
||||
)
|
||||
ORDER_DESCENDING = ButtonWrapper(
|
||||
name='ORDER_DESCENDING',
|
||||
share=Button(
|
||||
file='./assets/share/item/relics/ORDER_DESCENDING.png',
|
||||
area=(720, 649, 738, 667),
|
||||
search=(700, 629, 758, 687),
|
||||
color=(179, 180, 180),
|
||||
@ -38,7 +48,7 @@ SALVAGE = ButtonWrapper(
|
||||
share=Button(
|
||||
file='./assets/share/item/relics/SALVAGE.png',
|
||||
area=(1038, 646, 1062, 670),
|
||||
search=(1018, 626, 1082, 690),
|
||||
search=(936, 642, 1213, 675),
|
||||
color=(122, 115, 98),
|
||||
button=(1038, 646, 1062, 670),
|
||||
),
|
||||
|
@ -1,39 +1,42 @@
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from tasks.base.assets.assets_base_page import CLOSE
|
||||
from tasks.base.assets.assets_base_popup import CONFIRM_POPUP
|
||||
from tasks.base.assets.assets_base_popup import CONFIRM_POPUP, GET_REWARD
|
||||
from tasks.item.assets.assets_item_relics import *
|
||||
from tasks.item.keywords import KEYWORD_ITEM_TAB
|
||||
from tasks.item.ui import ItemUI
|
||||
|
||||
|
||||
class RelicsUI(ItemUI):
|
||||
def _is_in_salvage(self) -> bool:
|
||||
return self.appear(ORDER_ASCENDING) or self.appear(ORDER_DESCENDING)
|
||||
|
||||
def salvage_relic(self, skip_first_screenshot=True) -> bool:
|
||||
logger.hr('Salvage Relic', level=2)
|
||||
self.item_goto(KEYWORD_ITEM_TAB.Relics, wait_until_stable=False)
|
||||
interval = Timer(1)
|
||||
while 1: # relic tab -> salvage
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.appear(REVERSE_ORDER):
|
||||
if self._is_in_salvage():
|
||||
break
|
||||
if self.appear_then_click(GOTO_SALVAGE):
|
||||
if self.appear_then_click(GOTO_SALVAGE, interval=2):
|
||||
continue
|
||||
|
||||
skip_first_screenshot = True
|
||||
interval = Timer(1)
|
||||
while 1: # salvage -> first relic selected
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.appear_then_click(REVERSE_ORDER): # this should judge before break condition
|
||||
continue
|
||||
if self.appear(SALVAGE):
|
||||
if SALVAGE.match_template_color(self.device.image):
|
||||
break
|
||||
if self.appear_then_click(ORDER_DESCENDING, interval=2):
|
||||
continue
|
||||
if interval.reached() and self.image_color_count(FIRST_RELIC, (233, 192, 108)):
|
||||
self.device.click(FIRST_RELIC)
|
||||
interval.reset()
|
||||
@ -46,15 +49,16 @@ class RelicsUI(ItemUI):
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.handle_reward():
|
||||
if self.appear(GET_REWARD):
|
||||
logger.info("Relic salvaged")
|
||||
break
|
||||
if self.appear_then_click(SALVAGE):
|
||||
if self.appear_then_click(SALVAGE, interval=2):
|
||||
continue
|
||||
if self.appear_then_click(CONFIRM_POPUP):
|
||||
if self.appear_then_click(CONFIRM_POPUP, interval=2):
|
||||
continue
|
||||
|
||||
skip_first_screenshot = True
|
||||
interval = Timer(1)
|
||||
while 1: # rewards claimed -> relic tab page
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
@ -64,6 +68,11 @@ class RelicsUI(ItemUI):
|
||||
if self.appear(GOTO_SALVAGE):
|
||||
logger.info("Salvage page exited")
|
||||
break
|
||||
if self.appear_then_click(CLOSE, interval=1):
|
||||
if self.handle_reward(interval=2):
|
||||
continue
|
||||
if interval.reached() and self._is_in_salvage():
|
||||
logger.info(f'_is_in_salvage -> {CLOSE}')
|
||||
self.device.click(CLOSE)
|
||||
interval.reset()
|
||||
continue
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user