Fix: Enter classic rogue as more rogue mode was added

This commit is contained in:
LmeSzinc 2024-11-22 23:20:07 +08:00
parent 6868351c95
commit e8e6a3f2b9
4 changed files with 19 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -37,10 +37,10 @@ SIMULATED_UNIVERSE_LOADED_CLASSIC = ButtonWrapper(
name='SIMULATED_UNIVERSE_LOADED_CLASSIC', name='SIMULATED_UNIVERSE_LOADED_CLASSIC',
share=Button( share=Button(
file='./assets/share/dungeon/ui_rogue/SIMULATED_UNIVERSE_LOADED_CLASSIC.png', file='./assets/share/dungeon/ui_rogue/SIMULATED_UNIVERSE_LOADED_CLASSIC.png',
area=(549, 607, 572, 629), area=(507, 501, 547, 541),
search=(529, 587, 592, 649), search=(465, 172, 588, 656),
color=(147, 137, 157), color=(157, 155, 157),
button=(549, 607, 572, 629), button=(507, 501, 547, 541),
), ),
) )
SURVIVAL_INDEX_OE_LOADED = ButtonWrapper( SURVIVAL_INDEX_OE_LOADED = ButtonWrapper(

View File

@ -1,5 +1,5 @@
from module.base.timer import Timer from module.base.timer import Timer
from module.base.utils import random_rectangle_vector from module.base.utils import area_in_area, random_rectangle_vector
from module.logger import logger from module.logger import logger
from tasks.base.page import page_guide from tasks.base.page import page_guide
from tasks.dungeon.assets.assets_dungeon_ui import * from tasks.dungeon.assets.assets_dungeon_ui import *
@ -94,17 +94,6 @@ class DungeonRogueUI(DungeonUI):
Swipe down to find teleport button of classic rogue Swipe down to find teleport button of classic rogue
Note that this method will change SIMULATED_UNIVERSE_LOADED_CLASSIC.search, original value should have a backup Note that this method will change SIMULATED_UNIVERSE_LOADED_CLASSIC.search, original value should have a backup
""" """
# Already having classic rogue entry insight
SIMULATED_UNIVERSE_LOADED_CLASSIC.load_search(OCR_DUNGEON_LIST.button)
if self.appear(SIMULATED_UNIVERSE_LOADED_CLASSIC):
buttons = TELEPORT.match_multi_template(self.device.image)
y = SIMULATED_UNIVERSE_LOADED_CLASSIC.button[1]
for button in buttons:
# And having a teleport button below
if button.button[1] > y:
logger.info('Classic rogue teleport already in sight')
return True
logger.info('Dungeon rogue swipe down') logger.info('Dungeon rogue swipe down')
interval = Timer(2, count=4) interval = Timer(2, count=4)
while 1: while 1:
@ -114,10 +103,20 @@ class DungeonRogueUI(DungeonUI):
self.device.screenshot() self.device.screenshot()
# End # End
if self.appear(SIMULATED_UNIVERSE_LOADED_CLASSIC): if self.appear(SIMULATED_UNIVERSE_LOADED_CLASSIC, interval=3):
if self.appear(LAST_TELEPORT): logger.info('Found rogue icon')
logger.info('Classic rogue teleport at end') # Search teleport button on the right
_, y1, _, y2 = SIMULATED_UNIVERSE_LOADED_CLASSIC.button
x1, _, x2, _ = TELEPORT.area
search = (x1 - 50, y1 - 120, x2 + 50, y2 + 120)
# Check if button in search area
for button in TELEPORT.match_multi_template(self.device.image):
if area_in_area(button.button, search, threshold=0):
logger.info('Found rogue TELEPORT')
self.device.click(button)
return True return True
# TELEPORT not found
self.interval_clear(SIMULATED_UNIVERSE_LOADED_CLASSIC)
# Swipe # Swipe
if interval.reached(): if interval.reached():