mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: OCR of double event
This commit is contained in:
parent
5d55f86b27
commit
f01d2a5648
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -27,9 +27,9 @@ OCR_DOUBLE_EVENT_REMAIN = ButtonWrapper(
|
||||
name='OCR_DOUBLE_EVENT_REMAIN',
|
||||
share=Button(
|
||||
file='./assets/share/dungeon/event/OCR_DOUBLE_EVENT_REMAIN.png',
|
||||
area=(434, 141, 1163, 166),
|
||||
search=(414, 121, 1183, 186),
|
||||
color=(228, 185, 100),
|
||||
button=(434, 141, 1163, 166),
|
||||
area=(437, 177, 1169, 208),
|
||||
search=(417, 157, 1189, 228),
|
||||
color=(234, 190, 103),
|
||||
button=(437, 177, 1169, 208),
|
||||
),
|
||||
)
|
||||
|
@ -1,3 +1,5 @@
|
||||
import re
|
||||
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import DigitCounter
|
||||
from tasks.base.ui import UI
|
||||
@ -8,6 +10,14 @@ from tasks.dungeon.assets.assets_dungeon_event import (
|
||||
)
|
||||
|
||||
|
||||
class DoubleEventOcr(DigitCounter):
|
||||
def after_process(self, result):
|
||||
result = super().after_process(result)
|
||||
# 9112 -> 9/12
|
||||
result = re.sub(r'112$', '/12', result)
|
||||
return result
|
||||
|
||||
|
||||
class DungeonEvent(UI):
|
||||
def has_double_calyx_event(self) -> bool:
|
||||
"""
|
||||
@ -34,7 +44,7 @@ class DungeonEvent(UI):
|
||||
Pages:
|
||||
in: page_guide, Survival_Index, selected at the nav with double event
|
||||
"""
|
||||
ocr = DigitCounter(OCR_DOUBLE_EVENT_REMAIN)
|
||||
ocr = DoubleEventOcr(OCR_DOUBLE_EVENT_REMAIN)
|
||||
remain, _, total = ocr.ocr_single_line(self.device.image)
|
||||
if total not in [3, 12]:
|
||||
logger.warning(f'Invalid double event remain')
|
||||
|
Loading…
Reference in New Issue
Block a user