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),
|
button=(668, 652, 690, 674),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
REVERSE_ORDER = ButtonWrapper(
|
ORDER_ASCENDING = ButtonWrapper(
|
||||||
name='REVERSE_ORDER',
|
name='ORDER_ASCENDING',
|
||||||
share=Button(
|
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),
|
area=(720, 649, 738, 667),
|
||||||
search=(700, 629, 758, 687),
|
search=(700, 629, 758, 687),
|
||||||
color=(179, 180, 180),
|
color=(179, 180, 180),
|
||||||
@ -38,7 +48,7 @@ SALVAGE = ButtonWrapper(
|
|||||||
share=Button(
|
share=Button(
|
||||||
file='./assets/share/item/relics/SALVAGE.png',
|
file='./assets/share/item/relics/SALVAGE.png',
|
||||||
area=(1038, 646, 1062, 670),
|
area=(1038, 646, 1062, 670),
|
||||||
search=(1018, 626, 1082, 690),
|
search=(936, 642, 1213, 675),
|
||||||
color=(122, 115, 98),
|
color=(122, 115, 98),
|
||||||
button=(1038, 646, 1062, 670),
|
button=(1038, 646, 1062, 670),
|
||||||
),
|
),
|
||||||
|
@ -1,39 +1,42 @@
|
|||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from tasks.base.assets.assets_base_page import CLOSE
|
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.assets.assets_item_relics import *
|
||||||
from tasks.item.keywords import KEYWORD_ITEM_TAB
|
from tasks.item.keywords import KEYWORD_ITEM_TAB
|
||||||
from tasks.item.ui import ItemUI
|
from tasks.item.ui import ItemUI
|
||||||
|
|
||||||
|
|
||||||
class RelicsUI(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:
|
def salvage_relic(self, skip_first_screenshot=True) -> bool:
|
||||||
logger.hr('Salvage Relic', level=2)
|
logger.hr('Salvage Relic', level=2)
|
||||||
self.item_goto(KEYWORD_ITEM_TAB.Relics, wait_until_stable=False)
|
self.item_goto(KEYWORD_ITEM_TAB.Relics, wait_until_stable=False)
|
||||||
interval = Timer(1)
|
|
||||||
while 1: # relic tab -> salvage
|
while 1: # relic tab -> salvage
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
else:
|
else:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.appear(REVERSE_ORDER):
|
if self._is_in_salvage():
|
||||||
break
|
break
|
||||||
if self.appear_then_click(GOTO_SALVAGE):
|
if self.appear_then_click(GOTO_SALVAGE, interval=2):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
skip_first_screenshot = True
|
skip_first_screenshot = True
|
||||||
|
interval = Timer(1)
|
||||||
while 1: # salvage -> first relic selected
|
while 1: # salvage -> first relic selected
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
else:
|
else:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.appear_then_click(REVERSE_ORDER): # this should judge before break condition
|
if SALVAGE.match_template_color(self.device.image):
|
||||||
continue
|
|
||||||
if self.appear(SALVAGE):
|
|
||||||
break
|
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.image_color_count(FIRST_RELIC, (233, 192, 108)):
|
||||||
self.device.click(FIRST_RELIC)
|
self.device.click(FIRST_RELIC)
|
||||||
interval.reset()
|
interval.reset()
|
||||||
@ -46,15 +49,16 @@ class RelicsUI(ItemUI):
|
|||||||
else:
|
else:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.handle_reward():
|
if self.appear(GET_REWARD):
|
||||||
logger.info("Relic salvaged")
|
logger.info("Relic salvaged")
|
||||||
break
|
break
|
||||||
if self.appear_then_click(SALVAGE):
|
if self.appear_then_click(SALVAGE, interval=2):
|
||||||
continue
|
continue
|
||||||
if self.appear_then_click(CONFIRM_POPUP):
|
if self.appear_then_click(CONFIRM_POPUP, interval=2):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
skip_first_screenshot = True
|
skip_first_screenshot = True
|
||||||
|
interval = Timer(1)
|
||||||
while 1: # rewards claimed -> relic tab page
|
while 1: # rewards claimed -> relic tab page
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
@ -64,6 +68,11 @@ class RelicsUI(ItemUI):
|
|||||||
if self.appear(GOTO_SALVAGE):
|
if self.appear(GOTO_SALVAGE):
|
||||||
logger.info("Salvage page exited")
|
logger.info("Salvage page exited")
|
||||||
break
|
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
|
continue
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user