2023-08-14 07:12:02 +00:00
|
|
|
import re
|
|
|
|
|
2023-08-14 19:35:15 +00:00
|
|
|
from module.ocr.ocr import Digit, Ocr
|
2023-08-10 09:12:17 +00:00
|
|
|
from tasks.base.ui import UI
|
|
|
|
from tasks.rogue.assets.assets_rogue_ui import *
|
|
|
|
from tasks.rogue.keywords import *
|
2023-08-14 07:12:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RogueBonusOcr(Ocr):
|
|
|
|
def after_process(self, result):
|
|
|
|
result = super().after_process(result)
|
|
|
|
if self.lang == 'ch':
|
|
|
|
replace_pattern_dict = {
|
|
|
|
"[宇宝][宙审]": "宇宙",
|
|
|
|
}
|
|
|
|
for pat, replace in replace_pattern_dict.items():
|
|
|
|
result = re.sub(pat, replace, result)
|
|
|
|
return result
|
2023-08-10 09:12:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RogueUI(UI):
|
|
|
|
path: RoguePath
|
2023-08-12 17:04:54 +00:00
|
|
|
cosmic_fragment_cache: int
|
|
|
|
|
|
|
|
@property
|
|
|
|
def cosmic_fragment(self):
|
|
|
|
if self.appear(COSMIC_FRAGMENT):
|
|
|
|
self.cosmic_fragment_cache = Digit(OCR_COSMIC_FRAGMENT).ocr_single_line(self.device.image)
|
|
|
|
return self.cosmic_fragment_cache
|
2023-08-10 09:12:17 +00:00
|
|
|
|
|
|
|
def is_page_choose_blessing(self):
|
2023-08-12 17:04:54 +00:00
|
|
|
return (self.image_color_count(PAGE_CHOOSE_BUFF, (245, 245, 245), count=200)
|
|
|
|
and self.appear(CHECK_BLESSING))
|
2023-08-10 09:12:17 +00:00
|
|
|
|
|
|
|
def is_page_choose_curio(self):
|
2023-08-12 07:15:25 +00:00
|
|
|
return self.appear(PAGE_CHOOSE_CURIO)
|
2023-08-14 07:12:02 +00:00
|
|
|
|
|
|
|
def is_page_choose_bonus(self):
|
|
|
|
return self.appear(PAGE_CHOOSE_BONUS)
|