Fix: Skip non-draggable event options

This commit is contained in:
LmeSzinc 2023-11-16 13:34:43 +08:00
parent afa771e1b4
commit e6b0f8a92a
2 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,20 @@ class Scroll:
"""
return np.mean(self.match_color(main)) > 0.1
def is_draggable(self, main):
"""
If scroll `length` is just a little smaller than `total`,
game client may not respond to such a short swipe.
Args:
main (ModuleBase):
Returns:
bool:
"""
_ = self.cal_position(main)
return self.length / self.total < 0.95
def at_top(self, main):
return self.cal_position(main) < self.edge_threshold

View File

@ -288,7 +288,7 @@ class RogueEvent(RogueUI):
self._event_option_match()
self._event_option_ocr(len(self.options))
# Check next page if there is scroll
if SCROLL_OPTION.appear(main=self):
if SCROLL_OPTION.appear(main=self) and SCROLL_OPTION.is_draggable(main=self):
if SCROLL_OPTION.set_bottom(main=self):
expected = self._event_option_match(is_bottom_page=True)
self._event_option_ocr(expected)