Fix: Selecting rogue path when Erudition is unlocked

This commit is contained in:
Zebartin 2024-01-03 19:05:34 +08:00 committed by LmeSzinc
parent 1553d78b83
commit 1beb66d0ab
3 changed files with 19 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -43,6 +43,16 @@ CHECK_ELATION = ButtonWrapper(
button=(228, 275, 266, 320), button=(228, 275, 266, 320),
), ),
) )
CHECK_ERUDITION = ButtonWrapper(
name='CHECK_ERUDITION',
share=Button(
file='./assets/share/rogue/path/CHECK_ERUDITION.png',
area=(231, 264, 260, 330),
search=(211, 244, 280, 350),
color=(129, 105, 74),
button=(231, 264, 260, 330),
),
)
CHECK_NIHILITY = ButtonWrapper( CHECK_NIHILITY = ButtonWrapper(
name='CHECK_NIHILITY', name='CHECK_NIHILITY',
share=Button( share=Button(

View File

@ -40,6 +40,7 @@ class RoguePathHandler(RogueUI):
KEYWORDS_ROGUE_PATH.Destruction: CHECK_DESTRUCTION, KEYWORDS_ROGUE_PATH.Destruction: CHECK_DESTRUCTION,
KEYWORDS_ROGUE_PATH.Elation: CHECK_ELATION, KEYWORDS_ROGUE_PATH.Elation: CHECK_ELATION,
KEYWORDS_ROGUE_PATH.Propagation: CHECK_PROPAGATION, KEYWORDS_ROGUE_PATH.Propagation: CHECK_PROPAGATION,
KEYWORDS_ROGUE_PATH.Erudition: CHECK_ERUDITION,
} }
# 2023.12.28 Buttons moved up # 2023.12.28 Buttons moved up
for b in buttons.values(): for b in buttons.values():
@ -76,6 +77,7 @@ class RoguePathHandler(RogueUI):
KEYWORDS_ROGUE_PATH.Destruction: 6, KEYWORDS_ROGUE_PATH.Destruction: 6,
KEYWORDS_ROGUE_PATH.Elation: 7, KEYWORDS_ROGUE_PATH.Elation: 7,
KEYWORDS_ROGUE_PATH.Propagation: 8, KEYWORDS_ROGUE_PATH.Propagation: 8,
KEYWORDS_ROGUE_PATH.Erudition: 9,
} }
return buttons return buttons
@ -141,6 +143,7 @@ class RoguePathHandler(RogueUI):
""" """
logger.info('Change confirm path') logger.info('Change confirm path')
interval = Timer(2) interval = Timer(2)
load_timer = Timer(3, count=4).start()
timeout = Timer(10, count=20).start() timeout = Timer(10, count=20).start()
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
@ -162,11 +165,17 @@ class RoguePathHandler(RogueUI):
if diff > 0: if diff > 0:
self.device.multi_click(CHOOSE_RIGHT, n=diff) self.device.multi_click(CHOOSE_RIGHT, n=diff)
interval.reset() interval.reset()
load_timer.reset()
elif diff < 0: elif diff < 0:
self.device.multi_click(CHOOSE_LEFT, n=abs(diff)) self.device.multi_click(CHOOSE_LEFT, n=abs(diff))
interval.reset() interval.reset()
load_timer.reset()
else: else:
logger.warning(f'Invalid path distance: {diff}') logger.warning(f'Invalid path distance: {diff}')
if selected_path is None and load_timer.reached_and_reset():
# Clicking left should be enough to skip invalid paths
self.device.click(CHOOSE_LEFT)
continue
def rogue_path_select(self, path: str | RoguePath, skip_first_screenshot=True): def rogue_path_select(self, path: str | RoguePath, skip_first_screenshot=True):
""" """