Chore: _dungeon_nav_goto now receive nav input

This commit is contained in:
LmeSzinc 2024-02-12 23:29:21 +08:00
parent 6b9aa3b076
commit 282ab6da72
5 changed files with 19 additions and 19 deletions

View File

@ -7,7 +7,7 @@ import module.config.server as server
from module.exception import ScriptError from module.exception import ScriptError
# ord('') = 65294 # ord('') = 65294
REGEX_PUNCTUATION = re.compile(r'[ ,.\'"“”,。…:;!??·・•●〇*※\-—-/\\\n\t()\[\]()「」『』【】《》[]]') REGEX_PUNCTUATION = re.compile(r'[ ,.\'"“”,。…:;!??·・•●〇°*※\-—-/\\\n\t()\[\]()「」『』【】《》[]]')
def parse_name(n): def parse_name(n):

View File

@ -4,7 +4,7 @@ from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
from tasks.combat.combat import Combat from tasks.combat.combat import Combat
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.dungeon.event import DungeonEvent from tasks.dungeon.event import DungeonEvent
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_TAB from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.stamina import DungeonStamina from tasks.dungeon.stamina import DungeonStamina
@ -211,10 +211,10 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if self.has_double_rogue_event(): if self.has_double_rogue_event():
rogue = self.get_double_event_remain() rogue = self.get_double_event_remain()
if self.has_double_calyx_event(): if self.has_double_calyx_event():
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Calyx_Golden_Treasures_Jarilo_VI) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Calyx_Golden)
calyx = self.get_double_event_remain() calyx = self.get_double_event_remain()
if self.has_double_relic_event(): if self.has_double_relic_event():
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Cavern_of_Corrosion_Path_of_Gelid_Wind) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Cavern_of_Corrosion)
relic = self.get_double_event_remain() relic = self.get_double_event_remain()
with self.config.multi_set(): with self.config.multi_set():
self.config.stored.DungeonDouble.calyx = calyx self.config.stored.DungeonDouble.calyx = calyx

View File

@ -351,17 +351,17 @@ class DungeonUI(DungeonState):
logger.info('No Echo_of_War in list skip waiting') logger.info('No Echo_of_War in list skip waiting')
return False return False
def _dungeon_nav_goto(self, dungeon: DungeonList, skip_first_screenshot=True): def _dungeon_nav_goto(self, nav: DungeonNav, skip_first_screenshot=True):
""" """
Equivalent to `DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self)` Equivalent to `DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self)`
but with tricks to be faster but with tricks to be faster
Args: Args:
dungeon: nav:
skip_first_screenshot: skip_first_screenshot:
""" """
logger.hr('Dungeon nav goto', level=2) logger.hr('Dungeon nav goto', level=2)
logger.info(f'Dungeon nav goto {dungeon.dungeon_nav}') logger.info(f'Dungeon nav goto {nav}')
# Wait rows # Wait rows
while 1: while 1:
@ -402,11 +402,11 @@ class DungeonUI(DungeonState):
else: else:
# To start from any list states. # To start from any list states.
logger.info('DUNGEON_NAV_LIST not at top') logger.info('DUNGEON_NAV_LIST not at top')
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self) DUNGEON_NAV_LIST.select_row(nav, main=self)
return True return True
# Check the first page # Check the first page
if dungeon.dungeon_nav in [ if nav in [
KEYWORDS_DUNGEON_NAV.Simulated_Universe, KEYWORDS_DUNGEON_NAV.Simulated_Universe,
KEYWORDS_DUNGEON_NAV.Calyx_Golden, KEYWORDS_DUNGEON_NAV.Calyx_Golden,
KEYWORDS_DUNGEON_NAV.Calyx_Crimson, KEYWORDS_DUNGEON_NAV.Calyx_Crimson,
@ -415,9 +415,9 @@ class DungeonUI(DungeonState):
KEYWORDS_DUNGEON_NAV.Forgotten_Hall, KEYWORDS_DUNGEON_NAV.Forgotten_Hall,
KEYWORDS_DUNGEON_NAV.Pure_Fiction, KEYWORDS_DUNGEON_NAV.Pure_Fiction,
]: ]:
button = DUNGEON_NAV_LIST.keyword2button(dungeon.dungeon_nav) button = DUNGEON_NAV_LIST.keyword2button(nav)
if button: if button:
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self, insight=False) DUNGEON_NAV_LIST.select_row(nav, main=self, insight=False)
return True return True
# Check the second page # Check the second page
@ -425,7 +425,7 @@ class DungeonUI(DungeonState):
DUNGEON_NAV_LIST.drag_page('down', main=self) DUNGEON_NAV_LIST.drag_page('down', main=self)
# No skip_first_screenshot since drag_page is just called # No skip_first_screenshot since drag_page is just called
if self._dungeon_wait_until_echo_or_war_stabled(skip_first_screenshot=False): if self._dungeon_wait_until_echo_or_war_stabled(skip_first_screenshot=False):
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self, insight=False) DUNGEON_NAV_LIST.select_row(nav, main=self, insight=False)
return True return True
def _dungeon_world_set(self, dungeon: DungeonList, skip_first_screenshot=True): def _dungeon_world_set(self, dungeon: DungeonList, skip_first_screenshot=True):
@ -636,7 +636,7 @@ class DungeonUI(DungeonState):
if self.appear(SURVIVAL_INDEX_LOADED): if self.appear(SURVIVAL_INDEX_LOADED):
logger.info('Already at nav Simulated_Universe') logger.info('Already at nav Simulated_Universe')
else: else:
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Simulated_Universe_World_1) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Simulated_Universe)
def dungeon_goto(self, dungeon: DungeonList): def dungeon_goto(self, dungeon: DungeonList):
""" """
@ -662,13 +662,13 @@ class DungeonUI(DungeonState):
or dungeon.is_Stagnant_Shadow \ or dungeon.is_Stagnant_Shadow \
or dungeon.is_Cavern_of_Corrosion \ or dungeon.is_Cavern_of_Corrosion \
or dungeon.is_Echo_of_War: or dungeon.is_Echo_of_War:
self._dungeon_nav_goto(dungeon) self._dungeon_nav_goto(dungeon.dungeon_nav)
self._dungeon_wait_until_dungeon_list_loaded() self._dungeon_wait_until_dungeon_list_loaded()
self._dungeon_insight(dungeon) self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon) self._dungeon_enter(dungeon)
return True return True
if dungeon.is_Calyx_Golden: if dungeon.is_Calyx_Golden:
self._dungeon_nav_goto(dungeon) self._dungeon_nav_goto(dungeon.dungeon_nav)
self._dungeon_wait_until_dungeon_list_loaded() self._dungeon_wait_until_dungeon_list_loaded()
self._dungeon_world_set_wrapper(dungeon) self._dungeon_world_set_wrapper(dungeon)
self._dungeon_wait_until_dungeon_list_loaded() self._dungeon_wait_until_dungeon_list_loaded()

View File

@ -3,7 +3,7 @@ from module.ocr.ocr import DigitCounter
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.dungeon.assets.assets_dungeon_ui import OCR_DUNGEON_LIST, OCR_WEEKLY_LIMIT from tasks.dungeon.assets.assets_dungeon_ui import OCR_DUNGEON_LIST, OCR_WEEKLY_LIMIT
from tasks.dungeon.dungeon import Dungeon from tasks.dungeon.dungeon import Dungeon
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_TAB from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DUNGEON_LIST from tasks.dungeon.ui import DUNGEON_LIST
@ -53,7 +53,7 @@ class WeeklyDungeon(Dungeon):
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index) self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
# Equivalent to self.dungeon_goto(dungeon), but check limit remains # Equivalent to self.dungeon_goto(dungeon), but check limit remains
DUNGEON_LIST.search_button = OCR_DUNGEON_LIST DUNGEON_LIST.search_button = OCR_DUNGEON_LIST
self._dungeon_nav_goto(dungeon) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Echo_of_War)
# Check limit # Check limit
remain = self.get_weekly_remain() remain = self.get_weekly_remain()

View File

@ -10,7 +10,7 @@ from module.ocr.keyword import Keyword
from module.ocr.ocr import Ocr, OcrResultButton from module.ocr.ocr import Ocr, OcrResultButton
from module.ui.draggable_list import DraggableList from module.ui.draggable_list import DraggableList
from tasks.base.assets.assets_base_page import FORGOTTEN_HALL_CHECK, MAP_EXIT from tasks.base.assets.assets_base_page import FORGOTTEN_HALL_CHECK, MAP_EXIT
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_TAB from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DungeonUI from tasks.dungeon.ui import DungeonUI
from tasks.forgotten_hall.assets.assets_forgotten_hall_nav import * from tasks.forgotten_hall.assets.assets_forgotten_hall_nav import *
from tasks.forgotten_hall.assets.assets_forgotten_hall_ui import * from tasks.forgotten_hall.assets.assets_forgotten_hall_ui import *
@ -187,7 +187,7 @@ class ForgottenHallUI(DungeonUI, ForgottenHallTeam):
logger.info('Already in forgotten hall') logger.info('Already in forgotten hall')
else: else:
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Treasures_Lightward) self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Treasures_Lightward)
self._dungeon_nav_goto(dungeon) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Forgotten_Hall)
self.stage_choose(dungeon) self.stage_choose(dungeon)
logger.info(f'Stage list select: {stage_keyword}') logger.info(f'Stage list select: {stage_keyword}')