mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Opt: Reduce ocr in goto_entry
This commit is contained in:
parent
818b196e45
commit
c033d3b60d
@ -132,16 +132,18 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
|||||||
return remain
|
return remain
|
||||||
for group in self._iter_groups():
|
for group in self._iter_groups():
|
||||||
self.goto_group(group)
|
self.goto_group(group)
|
||||||
|
insight = False
|
||||||
for assignment in self._iter_entries():
|
for assignment in self._iter_entries():
|
||||||
if assignment in self.dispatched:
|
if assignment in self.dispatched:
|
||||||
continue
|
continue
|
||||||
logger.hr('Assignment all', level=2)
|
logger.hr('Assignment all', level=2)
|
||||||
logger.info(f'Check assignment all: {assignment}')
|
logger.info(f'Check assignment all: {assignment}')
|
||||||
self.goto_entry(assignment)
|
self.goto_entry(assignment, insight)
|
||||||
status = self._check_assignment_status()
|
status = self._check_assignment_status()
|
||||||
if status == AssignmentStatus.CLAIMABLE:
|
if status == AssignmentStatus.CLAIMABLE:
|
||||||
self.claim(assignment, None, should_redispatch=False)
|
self.claim(assignment, None, should_redispatch=False)
|
||||||
remain += 1
|
remain += 1
|
||||||
|
insight = True # Order of entries change after claiming
|
||||||
continue
|
continue
|
||||||
if status == AssignmentStatus.DISPATCHED:
|
if status == AssignmentStatus.DISPATCHED:
|
||||||
self.dispatched[assignment] = datetime.now() + \
|
self.dispatched[assignment] = datetime.now() + \
|
||||||
@ -191,12 +193,14 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
|||||||
if not isinstance(group, AssignmentEventGroup):
|
if not isinstance(group, AssignmentEventGroup):
|
||||||
continue
|
continue
|
||||||
self.goto_group(group)
|
self.goto_group(group)
|
||||||
|
insight = False
|
||||||
for assignment in self._iter_entries():
|
for assignment in self._iter_entries():
|
||||||
if assignment in self.dispatched:
|
if assignment in self.dispatched:
|
||||||
continue
|
continue
|
||||||
logger.hr('Assignment event', level=2)
|
logger.hr('Assignment event', level=2)
|
||||||
logger.info(f'Check assignment event: {assignment}')
|
logger.info(f'Check assignment event: {assignment}')
|
||||||
self.goto_entry(assignment)
|
self.goto_entry(assignment, insight)
|
||||||
|
insight = True
|
||||||
status = self._check_assignment_status()
|
status = self._check_assignment_status()
|
||||||
# Should only be dispatchable or locked after _check_all
|
# Should only be dispatchable or locked after _check_all
|
||||||
if status == AssignmentStatus.DISPATCHABLE:
|
if status == AssignmentStatus.DISPATCHABLE:
|
||||||
|
@ -140,10 +140,11 @@ class AssignmentUI(UI):
|
|||||||
if ASSIGNMENT_GROUP_SWITCH.set(group, self):
|
if ASSIGNMENT_GROUP_SWITCH.set(group, self):
|
||||||
self._wait_until_entry_loaded()
|
self._wait_until_entry_loaded()
|
||||||
|
|
||||||
def goto_entry(self, entry: AssignmentEntry):
|
def goto_entry(self, entry: AssignmentEntry, insight: bool = True):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
entry (AssignmentEntry):
|
entry (AssignmentEntry):
|
||||||
|
insight (bool): skip ocr to save time if insight is False
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
self = AssignmentUI('src')
|
self = AssignmentUI('src')
|
||||||
@ -160,7 +161,7 @@ class AssignmentUI(UI):
|
|||||||
raise ScriptError(err_msg)
|
raise ScriptError(err_msg)
|
||||||
else:
|
else:
|
||||||
self.goto_group(entry.group)
|
self.goto_group(entry.group)
|
||||||
ASSIGNMENT_ENTRY_LIST.select_row(entry, self)
|
ASSIGNMENT_ENTRY_LIST.select_row(entry, self, insight=insight)
|
||||||
|
|
||||||
def _wait_until_group_loaded(self):
|
def _wait_until_group_loaded(self):
|
||||||
skip_first_screenshot = True
|
skip_first_screenshot = True
|
||||||
|
Loading…
Reference in New Issue
Block a user