mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 00:52:22 +00:00
Fix: No ship to enhance
- When there ship to enhance, but dock full, try one_click_retire - Fix retire SR ship when using one_click_retire
This commit is contained in:
parent
f406022da0
commit
ad5fcc2abc
@ -36,7 +36,7 @@ class Dock(UI, Equipment):
|
||||
self.handle_dock_cards_loading()
|
||||
|
||||
def _dock_quit_check_func(self):
|
||||
return not self.appear(DOCK_CHECK)
|
||||
return not self.appear(DOCK_CHECK, offset=(20, 20))
|
||||
|
||||
def dock_quit(self):
|
||||
self.ui_back(check_button=self._dock_quit_check_func, skip_first_screenshot=True)
|
||||
|
@ -72,7 +72,6 @@ class Enhancement(Dock):
|
||||
self.equip_sidebar_ensure(index=4)
|
||||
self.wait_until_appear(ENHANCE_RECOMMEND, offset=(5, 5), skip_first_screenshot=True)
|
||||
|
||||
|
||||
status = color_bar_percentage(self.device.image, area=ENHANCE_RELOAD.area, prev_color=(231, 178, 74))
|
||||
logger.attr('Reload_enhanced', f'{int(status * 100)}%')
|
||||
choose = np.sum(np.array(self.device.image.crop(ENHANCE_FILLED.area)) > 200) > 100
|
||||
@ -134,7 +133,4 @@ class Enhancement(Dock):
|
||||
self.dock_quit()
|
||||
self.config.DOCK_FULL_TRIGGERED = True
|
||||
|
||||
if total == 0:
|
||||
logger.warning('No ship enhanced, exit')
|
||||
raise ScriptError('No ship enhanced, exit')
|
||||
return True
|
||||
return total
|
||||
|
@ -22,6 +22,8 @@ CARD_RARITY_COLORS = {
|
||||
|
||||
|
||||
class Retirement(Enhancement):
|
||||
_unable_to_enhance = False
|
||||
|
||||
def _retirement_choose(self, amount=10, target_rarity=('N',)):
|
||||
"""
|
||||
Args:
|
||||
@ -114,7 +116,7 @@ class Retirement(Enhancement):
|
||||
executed = False
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
if self.config.RETIRE_SR or self.config.RETIRE_SSR or self.config.USE_ONE_CLICK_RETIREMENT:
|
||||
if self.config.RETIRE_SR or self.config.RETIRE_SSR or self.config.RETIREMENT_METHOD == 'one_click_retire':
|
||||
if self.handle_popup_confirm():
|
||||
continue
|
||||
if self.appear_then_click(SHIP_CONFIRM, offset=30, interval=2):
|
||||
@ -238,10 +240,27 @@ class Retirement(Enhancement):
|
||||
if not self.retirement_appear():
|
||||
return False
|
||||
|
||||
if self.config.RETIREMENT_METHOD == 'enhance':
|
||||
return self._enhance_handler()
|
||||
if self._unable_to_enhance:
|
||||
self.config.RETIREMENT_METHOD = 'one_click_retire'
|
||||
total = self._retire_handler()
|
||||
self.config.RETIREMENT_METHOD = 'enhance'
|
||||
self._unable_to_enhance = False
|
||||
if not total:
|
||||
logger.warning('No ship retired, exit')
|
||||
raise ScriptError('No ship retired, exit')
|
||||
elif 'retire' in self.config.RETIREMENT_METHOD or self._unable_to_enhance:
|
||||
total = self._retire_handler()
|
||||
self._unable_to_enhance = False
|
||||
if not total:
|
||||
logger.warning('No ship retired, exit')
|
||||
raise ScriptError('No ship retired, exit')
|
||||
else:
|
||||
return self._retire_handler()
|
||||
total = self._enhance_handler()
|
||||
if not total:
|
||||
logger.info('No ship to enhance, but dock full, will try retire')
|
||||
self._unable_to_enhance = True
|
||||
|
||||
return True
|
||||
|
||||
def _retire_handler(self):
|
||||
self.ui_click(RETIRE_APPEAR_1, check_button=IN_RETIREMENT_CHECK, skip_first_screenshot=True)
|
||||
@ -252,7 +271,4 @@ class Retirement(Enhancement):
|
||||
self._retirement_quit()
|
||||
self.config.DOCK_FULL_TRIGGERED = True
|
||||
|
||||
if total == 0:
|
||||
logger.warning('No ship retired, exit')
|
||||
raise ScriptError('No ship retired, exit')
|
||||
return True
|
||||
return total
|
||||
|
Loading…
Reference in New Issue
Block a user