mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 18:05:26 +00:00
Fix: interval_is_reached() and interval_reset() should have the same interval
This commit is contained in:
parent
6c9678cf87
commit
c4f19cf41a
@ -95,18 +95,18 @@ class AssignmentDispatch(AssignmentUI):
|
|||||||
# Search EMPTY_SLOT to load offset
|
# Search EMPTY_SLOT to load offset
|
||||||
if not self.appear(CHARACTER_LIST) and self.appear(EMPTY_SLOT):
|
if not self.appear(CHARACTER_LIST) and self.appear(EMPTY_SLOT):
|
||||||
if self.interval_is_reached(CHARACTER_LIST, interval=2):
|
if self.interval_is_reached(CHARACTER_LIST, interval=2):
|
||||||
self.interval_reset(CHARACTER_LIST, interval=2)
|
|
||||||
self.device.click(EMPTY_SLOT)
|
self.device.click(EMPTY_SLOT)
|
||||||
|
self.interval_reset(CHARACTER_LIST, interval=2)
|
||||||
continue
|
continue
|
||||||
# Select
|
# Select
|
||||||
if self.interval_is_reached(CHARACTER_1_SELECTED, interval=2):
|
if self.interval_is_reached(CHARACTER_1_SELECTED, interval=2):
|
||||||
self.interval_reset(CHARACTER_1_SELECTED, interval=2)
|
|
||||||
if not self.image_color_count(CHARACTER_1_SELECTED, (240, 240, 240)):
|
if not self.image_color_count(CHARACTER_1_SELECTED, (240, 240, 240)):
|
||||||
self.device.click(CHARACTER_1)
|
self.device.click(CHARACTER_1)
|
||||||
|
self.interval_reset(CHARACTER_1_SELECTED, interval=2)
|
||||||
if self.interval_is_reached(CHARACTER_2_SELECTED, interval=2):
|
if self.interval_is_reached(CHARACTER_2_SELECTED, interval=2):
|
||||||
self.interval_reset(CHARACTER_2_SELECTED, interval=2)
|
|
||||||
if not self.image_color_count(CHARACTER_2_SELECTED, (240, 240, 240)):
|
if not self.image_color_count(CHARACTER_2_SELECTED, (240, 240, 240)):
|
||||||
self.device.click(CHARACTER_2)
|
self.device.click(CHARACTER_2)
|
||||||
|
self.interval_reset(CHARACTER_2_SELECTED, interval=2)
|
||||||
|
|
||||||
def _select_support(self):
|
def _select_support(self):
|
||||||
skip_first_screenshot = True
|
skip_first_screenshot = True
|
||||||
@ -124,13 +124,13 @@ class AssignmentDispatch(AssignmentUI):
|
|||||||
# Ensure support list
|
# Ensure support list
|
||||||
if not self.appear(CHARACTER_SUPPORT_LIST):
|
if not self.appear(CHARACTER_SUPPORT_LIST):
|
||||||
if self.interval_is_reached(CHARACTER_SUPPORT_LIST, interval=2):
|
if self.interval_is_reached(CHARACTER_SUPPORT_LIST, interval=2):
|
||||||
self.interval_reset(CHARACTER_SUPPORT_LIST, interval=2)
|
|
||||||
self.device.click(EMPTY_SLOT_SUPPORT)
|
self.device.click(EMPTY_SLOT_SUPPORT)
|
||||||
|
self.interval_reset(CHARACTER_SUPPORT_LIST, interval=2)
|
||||||
continue
|
continue
|
||||||
# Select
|
# Select
|
||||||
if self.interval_is_reached(CHARACTER_SUPPORT_SELECTED, interval=2):
|
if self.interval_is_reached(CHARACTER_SUPPORT_SELECTED, interval=2):
|
||||||
self.interval_reset(CHARACTER_SUPPORT_SELECTED, interval=2)
|
|
||||||
self.device.click(CHARACTER_SUPPORT)
|
self.device.click(CHARACTER_SUPPORT)
|
||||||
|
self.interval_reset(CHARACTER_SUPPORT_SELECTED, interval=2)
|
||||||
|
|
||||||
def _select_duration(self, duration: int):
|
def _select_duration(self, duration: int):
|
||||||
if duration not in {4, 8, 12, 20}:
|
if duration not in {4, 8, 12, 20}:
|
||||||
|
@ -110,10 +110,10 @@ class PopupHandler(ModuleBase):
|
|||||||
If handled.
|
If handled.
|
||||||
"""
|
"""
|
||||||
if callable(appear_button):
|
if callable(appear_button):
|
||||||
if self.interval_is_reached(appear_button) and appear_button():
|
if self.interval_is_reached(appear_button, interval=interval) and appear_button():
|
||||||
logger.info(f'{appear_button.__name__} -> {CLOSE}')
|
logger.info(f'{appear_button.__name__} -> {CLOSE}')
|
||||||
self.device.click(CLOSE)
|
self.device.click(CLOSE)
|
||||||
self.interval_reset(appear_button)
|
self.interval_reset(appear_button, interval=interval)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if self.appear(appear_button, interval=interval):
|
if self.appear(appear_button, interval=interval):
|
||||||
@ -133,10 +133,10 @@ class PopupHandler(ModuleBase):
|
|||||||
If handled.
|
If handled.
|
||||||
"""
|
"""
|
||||||
if callable(appear_button):
|
if callable(appear_button):
|
||||||
if self.interval_is_reached(appear_button) and appear_button():
|
if self.interval_is_reached(appear_button, interval=interval) and appear_button():
|
||||||
logger.info(f'{appear_button.__name__} -> {BACK}')
|
logger.info(f'{appear_button.__name__} -> {BACK}')
|
||||||
self.device.click(BACK)
|
self.device.click(BACK)
|
||||||
self.interval_reset(appear_button)
|
self.interval_reset(appear_button, interval=interval)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if self.appear(appear_button, interval=interval):
|
if self.appear(appear_button, interval=interval):
|
||||||
|
@ -89,7 +89,7 @@ class RogueRewardHandler(RogueUI):
|
|||||||
if self.interval_is_reached(CLAIM_ALL, interval=1):
|
if self.interval_is_reached(CLAIM_ALL, interval=1):
|
||||||
if self.image_color_count(CLAIM_ALL, color=(255, 199, 89), threshold=221, count=500):
|
if self.image_color_count(CLAIM_ALL, color=(255, 199, 89), threshold=221, count=500):
|
||||||
self.device.click(CLAIM_ALL)
|
self.device.click(CLAIM_ALL)
|
||||||
self.interval_reset(CLAIM_ALL)
|
self.interval_reset(CLAIM_ALL, interval=1)
|
||||||
appear = True
|
appear = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -159,6 +159,7 @@ class RogueEvent(RogueUI):
|
|||||||
self.device.click(BLESSING_CONFIRM)
|
self.device.click(BLESSING_CONFIRM)
|
||||||
return True
|
return True
|
||||||
if self.appear_then_click(CHOOSE_STORY, interval=2):
|
if self.appear_then_click(CHOOSE_STORY, interval=2):
|
||||||
|
self.device.click_record_clear()
|
||||||
return True
|
return True
|
||||||
if self.appear_then_click(CHOOSE_OPTION_CONFIRM, interval=2):
|
if self.appear_then_click(CHOOSE_OPTION_CONFIRM, interval=2):
|
||||||
self.interval_reset([
|
self.interval_reset([
|
||||||
@ -189,7 +190,7 @@ class RogueEvent(RogueUI):
|
|||||||
if count == 1:
|
if count == 1:
|
||||||
if self.interval_is_reached(CHOOSE_OPTION, interval=2):
|
if self.interval_is_reached(CHOOSE_OPTION, interval=2):
|
||||||
self.device.click(self.valid_options[0].prefix_icon)
|
self.device.click(self.valid_options[0].prefix_icon)
|
||||||
self.interval_reset(CHOOSE_OPTION)
|
self.interval_reset(CHOOSE_OPTION, interval=2)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.interval_is_reached(CHOOSE_OPTION, interval=2):
|
if self.interval_is_reached(CHOOSE_OPTION, interval=2):
|
||||||
@ -200,7 +201,7 @@ class RogueEvent(RogueUI):
|
|||||||
else:
|
else:
|
||||||
SCROLL_OPTION.set_top(main=self)
|
SCROLL_OPTION.set_top(main=self)
|
||||||
self.device.click(option.prefix_icon)
|
self.device.click(option.prefix_icon)
|
||||||
self.interval_reset(CHOOSE_OPTION)
|
self.interval_reset(CHOOSE_OPTION, interval=2)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user