Merge pull request #414 from Zebartin/fix/draggablelist

Fix: More tolerant insight_row
This commit is contained in:
LmeSzinc 2024-04-14 21:41:28 +08:00 committed by GitHub
commit cf92730d14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -160,6 +160,7 @@ class DraggableList:
logger.info(f'Insight row: {row}, index={row_index}')
last_buttons: set[OcrResultButton] = None
bottom_check = Timer(3, count=5).start()
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
@ -183,8 +184,11 @@ class DraggableList:
0, count=0), timeout=Timer(1.5, count=5))
skip_first_screenshot = True
if self.cur_buttons and last_buttons == set(self.cur_buttons):
logger.warning(f'No more rows in {self}')
return False
if bottom_check.reached():
logger.warning(f'No more rows in {self}')
return False
else:
bottom_check.reset()
last_buttons = set(self.cur_buttons)
return True

View File

@ -53,3 +53,13 @@ OCR_DOUBLE_EVENT_REMAIN_AT_COMBAT = ButtonWrapper(
button=(799, 460, 1268, 626),
),
)
OCR_DOUBLE_ROGUE_REMAIN = ButtonWrapper(
name='OCR_DOUBLE_ROGUE_REMAIN',
share=Button(
file='./assets/share/dungeon/event/OCR_DOUBLE_ROGUE_REMAIN.png',
area=(517, 179, 1118, 201),
search=(497, 159, 1138, 221),
color=(203, 145, 88),
button=(517, 179, 1118, 201),
),
)

View File

@ -209,7 +209,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
relic = 0
rogue = 0
if self.has_double_rogue_event():
rogue = self.get_double_event_remain()
rogue = self.get_double_rogue_remain()
if self.has_double_calyx_event():
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Calyx_Golden)
calyx = self.get_double_event_remain()

View File

@ -9,6 +9,7 @@ from tasks.dungeon.assets.assets_dungeon_event import (
DOUBLE_ROGUE_EVENT_TAG,
OCR_DOUBLE_EVENT_REMAIN,
OCR_DOUBLE_EVENT_REMAIN_AT_COMBAT,
OCR_DOUBLE_ROGUE_REMAIN,
)
@ -51,6 +52,8 @@ class DungeonEvent(UI):
"""
has = self.image_color_count(DOUBLE_ROGUE_EVENT_TAG, color=(252, 209, 123), threshold=221, count=50)
has |= self.image_color_count(DOUBLE_ROGUE_EVENT_TAG, color=(252, 251, 140), threshold=221, count=50)
# Anniversary 3x rogue event
has |= self.image_color_count(DOUBLE_ROGUE_EVENT_TAG, color=(229, 62, 44), threshold=221, count=50)
logger.attr('Double rogue', has)
return has
@ -84,6 +87,15 @@ class DungeonEvent(UI):
logger.attr('Double event remain', remain)
return remain
def get_double_rogue_remain(self) -> int:
"""
Pages:
in: page_guide, Survival_Index, selected at the nav with double event
"""
remain = self._get_double_event_remain(OCR_DOUBLE_ROGUE_REMAIN)
logger.attr('Double event remain', remain)
return remain
def get_double_event_remain_at_combat(self) -> int | None:
"""
Pages: