Fix: Handle blessing randomized by curio

This commit is contained in:
LmeSzinc 2023-10-18 21:28:17 +08:00
parent 8da4644e13
commit 6c9678cf87
4 changed files with 20 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -23,6 +23,16 @@ BLESSING_ENHANCED = ButtonWrapper(
button=(630, 351, 651, 370), button=(630, 351, 651, 370),
), ),
) )
BLESSING_LOST = ButtonWrapper(
name='BLESSING_LOST',
share=Button(
file='./assets/share/rogue/ui/BLESSING_LOST.png',
area=(51, 530, 81, 552),
search=(31, 510, 101, 572),
color=(248, 248, 248),
button=(51, 530, 81, 552),
),
)
BLESSING_OBTAINED = ButtonWrapper( BLESSING_OBTAINED = ButtonWrapper(
name='BLESSING_OBTAINED', name='BLESSING_OBTAINED',
share=Button( share=Button(

View File

@ -8,7 +8,7 @@ from module.base.utils import get_color
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
from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_OBTAINED from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_LOST, BLESSING_OBTAINED
from tasks.rogue.bleesing.preset import CURIO_PRESET_1 from tasks.rogue.bleesing.preset import CURIO_PRESET_1
from tasks.rogue.bleesing.selector import RogueSelector from tasks.rogue.bleesing.selector import RogueSelector
from tasks.rogue.bleesing.utils import get_regex_from_keyword_name, parse_name from tasks.rogue.bleesing.utils import get_regex_from_keyword_name, parse_name
@ -62,6 +62,7 @@ class RogueCurioSelector(RogueSelector):
Case 3: is_page_choose_blessing() Case 3: is_page_choose_blessing()
Case 4: BLESSING_ENHANCED Case 4: BLESSING_ENHANCED
Case 5: BLESSING_OBTAINED Case 5: BLESSING_OBTAINED
Case 6: BLESSING_LOST
""" """
if self.main.is_in_main(): if self.main.is_in_main():
logger.info("Main page checked") logger.info("Main page checked")
@ -78,6 +79,9 @@ class RogueCurioSelector(RogueSelector):
if self.main.appear(BLESSING_OBTAINED): if self.main.appear(BLESSING_OBTAINED):
logger.info("BLESSING_OBTAINED checked") logger.info("BLESSING_OBTAINED checked")
return True return True
if self.main.appear(BLESSING_LOST):
logger.info("BLESSING_LOST checked")
return True
return False return False
enforce = False enforce = False

View File

@ -76,4 +76,9 @@ class RogueUI(UI):
logger.info(f'{BLESSING_ENHANCED} -> {BLESSING_CONFIRM}') logger.info(f'{BLESSING_ENHANCED} -> {BLESSING_CONFIRM}')
self.device.click(BLESSING_CONFIRM) self.device.click(BLESSING_CONFIRM)
return True return True
# Lost and re-obtain blessing, randomized by curio
if self.appear(BLESSING_LOST, interval=2):
logger.info(f'{BLESSING_LOST} -> {BLESSING_CONFIRM}')
self.device.click(BLESSING_CONFIRM)
return True
return False return False