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_interact import DUNGEON_COMBAT_INTERACT, MAP_LOADING
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
from tasks.map.assets.assets_map_control import A_BUTTON from tasks.map.assets.assets_map_control import A_BUTTON
from tasks.rogue.assets.assets_rogue_weekly import REWARD_ENTER
class CombatInteract(UI): class CombatInteract(UI):
@ -22,6 +23,7 @@ class CombatInteract(UI):
Pages: Pages:
in: page_main, DUNGEON_COMBAT_INTERACT in: page_main, DUNGEON_COMBAT_INTERACT
out: COMBAT_PREPARE out: COMBAT_PREPARE
or REWARD_ENTER
""" """
logger.info('Combat enter from map') logger.info('Combat enter from map')
while 1: 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): if self.image_color_count(COMBAT_PREPARE.button, color=(230, 230, 230), threshold=240, count=400):
logger.info(f'At {COMBAT_PREPARE}') logger.info(f'At {COMBAT_PREPARE}')
break 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(): if self.handle_combat_interact():
continue continue

View File

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

View File

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