Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/tasks/BaseGfTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,30 @@ def skip_dialogs(self, end_match, end_box=None, time_out=120, has_dialog=True, r
self.back()
self.sleep(1)
else:
if has_dialog:
if has_dialog and not self._is_loading_frame(boxes):
self.click_relative(0.95, 0.04)
self.sleep(2)
self.next_frame()
if raise_if_not_found:
raise Exception('跳过剧情超时!')

def _is_loading_frame(self, boxes):
"""
判断当前帧是否为加载界面。
:param boxes: OCR 识别结果
:return: True 如果是加载界面,否则 False
"""
if not boxes:
return True
Comment on lines +114 to +115

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Don't classify a single empty OCR pass as a loading frame.

skip_dialogs() uses the top-right fallback precisely when OCR found nothing actionable. Returning True on Line 114 turns every OCR miss into "loading", so the new guard at Lines 101-103 just sleeps and retries until timeout instead of dismissing the dialog. That can stall real flows such as ClearMapTask.skip_dialogs(...) and DailyTask.skip_dialogs(...) on transient OCR misses. Please gate empty OCR on consecutive frames or an adjacent explicit loading token instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tasks/BaseGfTask.py` around lines 114 - 115, The empty OCR fallback in
skip_dialogs() is too aggressive because it treats a single no-box frame as
loading, which blocks the top-right dismissal path. Update
BaseGfTask.skip_dialogs() so that one empty OCR pass does not immediately return
True; instead, only classify loading after consecutive empty frames or when an
explicit loading token is detected. Keep the change localized to the
skip_dialogs logic so callers like ClearMapTask.skip_dialogs() and
DailyTask.skip_dialogs() continue to dismiss dialogs on transient OCR misses.

for box in boxes:
name = box.name
if not name:
continue
if '资源加载中' in name:
return True
if re.search(r'\d{1,3}%', name):
return True
return False

def auto_battle(self, end_match=None, end_box=None, has_dialog=False, need_click_auto=False,
has_dialog_behind_start=False):
Expand Down