Add: Allow entering rogue from map interact

This commit is contained in:
LmeSzinc 2023-11-03 01:55:28 +08:00
parent afa94986bc
commit 3e530033fa
3 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from tasks.base.ui import UI
from tasks.combat.assets.assets_combat_interact import DUNGEON_COMBAT_INTERACT, MAP_LOADING
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
from tasks.map.assets.assets_map_control import A_BUTTON
from tasks.rogue.assets.assets_rogue_weekly import REWARD_ENTER
class CombatInteract(UI):
@ -22,6 +23,7 @@ class CombatInteract(UI):
Pages:
in: page_main, DUNGEON_COMBAT_INTERACT
out: COMBAT_PREPARE
or REWARD_ENTER
"""
logger.info('Combat enter from map')
while 1:
@ -35,6 +37,10 @@ class CombatInteract(UI):
if self.image_color_count(COMBAT_PREPARE.button, color=(230, 230, 230), threshold=240, count=400):
logger.info(f'At {COMBAT_PREPARE}')
break
# is_page_rogue_main()
if self.match_template_color(REWARD_ENTER):
logger.info(f'At rogue {REWARD_ENTER}')
break
if self.handle_combat_interact():
continue

View File

@ -15,7 +15,6 @@ from module.ui.switch import Switch
from tasks.base.page import page_guide
from tasks.combat.assets.assets_combat_interact import DUNGEON_COMBAT_INTERACT, DUNGEON_COMBAT_INTERACT_TEXT
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
from tasks.combat.interact import CombatInteract
from tasks.dungeon.assets.assets_dungeon_ui import *
from tasks.dungeon.keywords import (
DungeonList,
@ -120,7 +119,7 @@ DUNGEON_LIST = DraggableDungeonList(
ocr_class=OcrDungeonList, search_button=OCR_DUNGEON_LIST)
class DungeonUI(DungeonState, CombatInteract):
class DungeonUI(DungeonState):
def dungeon_tab_goto(self, state: DungeonTab):
"""
Args:

View File

@ -74,7 +74,7 @@ class OcrRogueWorld(Ocr):
return 0
class RogueEntry(DungeonUI, RogueRewardHandler, RoguePathHandler, RouteBase):
class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
def _rogue_world_set(self, world: int | DungeonList, skip_first_screenshot=True):
"""
Args:
@ -306,12 +306,16 @@ class RogueEntry(DungeonUI, RogueRewardHandler, RoguePathHandler, RouteBase):
logger.info('At any page_rogue')
self.clear_blessing()
self.ui_get_current_page()
# Already in a rogue domain, no UI switching required, continue the rogue
if self.ui_current == page_main:
self.handle_lang_check(page=page_main)
# Already in a rogue domain, no UI switching required, continue the rogue
if self.plane.rogue_domain:
logger.info('At rogue domain')
return
# In Herta's Office, interact to enter rogue
if self.get_dungeon_interact() == Simulated_Universe_World_1:
logger.info('At rogue entry')
self.combat_enter_from_map()
# Not in page_rogue, goto
if not is_rogue_entry():
self.goto_rogue()