Fix: change to match template on detecting whether curio is selected

This commit is contained in:
Hengyu 2023-12-21 01:51:59 +08:00 committed by LmeSzinc
parent 4facf4de75
commit 8cab5e0626
3 changed files with 14 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -13,6 +13,16 @@ CURIO_ENFORCE = ButtonWrapper(
button=(465, 114, 815, 545), button=(465, 114, 815, 545),
), ),
) )
CURIO_SELECTED = ButtonWrapper(
name='CURIO_SELECTED',
share=Button(
file='./assets/share/rogue/curio/CURIO_SELECTED.png',
area=(1024, 116, 1040, 134),
search=(1004, 96, 1060, 154),
color=(127, 117, 110),
button=(1024, 116, 1040, 134),
),
)
OCR_ROGUE_CURIO = ButtonWrapper( OCR_ROGUE_CURIO = ButtonWrapper(
name='OCR_ROGUE_CURIO', name='OCR_ROGUE_CURIO',
share=Button( share=Button(

View File

@ -4,10 +4,10 @@ import numpy as np
from module.base.filter import MultiLangFilter from module.base.filter import MultiLangFilter
from module.base.timer import Timer from module.base.timer import Timer
from module.base.utils import get_color from module.base.utils import area_offset, area_pad
from module.logger import logger from module.logger import logger
from module.ocr.ocr import Ocr, OcrResultButton from module.ocr.ocr import Ocr, OcrResultButton
from tasks.rogue.assets.assets_rogue_curio import CURIO_ENFORCE, OCR_ROGUE_CURIO from tasks.rogue.assets.assets_rogue_curio import CURIO_ENFORCE, OCR_ROGUE_CURIO, CURIO_SELECTED
from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_LOST, BLESSING_OBTAINED from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_LOST, BLESSING_OBTAINED
from tasks.rogue.blessing.preset import CURIO_PRESET from tasks.rogue.blessing.preset import CURIO_PRESET
from tasks.rogue.blessing.selector import RogueSelector from tasks.rogue.blessing.selector import RogueSelector
@ -53,7 +53,8 @@ class RogueCurioSelector(RogueSelector):
def ui_select(self, target: OcrResultButton | None, skip_first_screenshot=True): def ui_select(self, target: OcrResultButton | None, skip_first_screenshot=True):
def is_curio_selected(): def is_curio_selected():
return np.mean(get_color(self.main.device.image, tuple(target.area))) > 60 # shiny background CURIO_SELECTED.matched_button.search = area_pad(area_offset(target.area, (0, -50)), -50)
return self.main.appear(CURIO_SELECTED)
def is_select_curio_complete(): def is_select_curio_complete():
""" """