Fix: Switch rogue theme

This commit is contained in:
LmeSzinc 2023-12-28 00:50:31 +08:00
parent 4b143fc991
commit 5e52459263
9 changed files with 117 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -30,6 +30,8 @@ def dungeon_name(name: str) -> str:
name = re.sub('Path_of_(.*)', r'Cavern_of_Corrosion_Path_of_\1', name)
if name in ['Destruction_Beginning', 'End_of_the_Eternal_Freeze', 'Divine_Seed']:
name = f'Echo_of_War_{name}'
if name in ['The_Swarm_Disaster', 'Gold_and_Gears']:
name = f'Simulated_Universe_{name}'
return name
@ -146,6 +148,9 @@ class KeywordExtract:
yield temp_save
# 'Memory of Chaos' is not a real dungeon, but represents a group
yield '混沌回忆'
# Consider rogue DLC as a dungeon
yield '寰宇蝗灾'
yield '黄金与机械'
def find_keyword(self, keyword, lang) -> tuple[int, str]:
"""

View File

@ -99,6 +99,22 @@ class DungeonList(Keyword):
raise ScriptError(f'Cannot convert {self} to DungeonNav, please check keyword extractions')
@cached_property
def rogue_theme(self) -> str:
"""
Returns:
'rogue' for normal simulated universe farmed every week
'dlc' for special rogue theme
'' for non-rogue
"""
if self.is_Simulated_Universe:
if self.name.startswith('Simulated_Universe_World'):
return 'rogue'
else:
return 'dlc'
else:
return ''
@dataclass(repr=False)
class DungeonEntrance(Keyword):

View File

@ -408,3 +408,21 @@ Memory_of_Chaos = DungeonList(
jp='混沌の記憶',
es='Evocación caótica',
)
Simulated_Universe_The_Swarm_Disaster = DungeonList(
id=46,
name='Simulated_Universe_The_Swarm_Disaster',
cn='寰宇蝗灾',
cht='寰宇蝗災',
en='The Swarm Disaster',
jp='宇宙の蝗害',
es='La Plaga',
)
Simulated_Universe_Gold_and_Gears = DungeonList(
id=47,
name='Simulated_Universe_Gold_and_Gears',
cn='黄金与机械',
cht='黃金與機械',
en='Gold and Gears',
jp='黄金と機械',
es='Oro y maquinaria',
)

View File

@ -33,6 +33,45 @@ OCR_WORLD = ButtonWrapper(
button=(500, 362, 700, 390),
),
)
THEME_DLC = ButtonWrapper(
name='THEME_DLC',
share=[
Button(
file='./assets/share/rogue/entry/THEME_DLC.png',
area=(229, 300, 299, 370),
search=(209, 280, 319, 390),
color=(109, 25, 65),
button=(229, 300, 299, 370),
),
Button(
file='./assets/share/rogue/entry/THEME_DLC.2.png',
area=(224, 324, 299, 399),
search=(204, 304, 319, 419),
color=(29, 115, 140),
button=(224, 324, 299, 399),
),
],
)
THEME_ROGUE = ButtonWrapper(
name='THEME_ROGUE',
share=Button(
file='./assets/share/rogue/entry/THEME_ROGUE.png',
area=(227, 325, 297, 395),
search=(207, 305, 317, 415),
color=(80, 55, 176),
button=(227, 325, 297, 395),
),
)
THEME_SWITCH = ButtonWrapper(
name='THEME_SWITCH',
share=Button(
file='./assets/share/rogue/entry/THEME_SWITCH.png',
area=(47, 494, 87, 534),
search=(27, 474, 107, 554),
color=(86, 71, 170),
button=(47, 494, 87, 534),
),
)
WORLD_ENTER = ButtonWrapper(
name='WORLD_ENTER',
share=Button(

View File

@ -17,9 +17,12 @@ from tasks.rogue.assets.assets_rogue_entry import (
LEVEL_CONFIRM,
OCR_WEEKLY_POINT,
OCR_WORLD,
THEME_DLC,
THEME_ROGUE,
THEME_SWITCH,
WORLD_ENTER,
WORLD_NEXT,
WORLD_PREV,
WORLD_PREV
)
from tasks.rogue.assets.assets_rogue_path import CONFIRM_PATH
from tasks.rogue.assets.assets_rogue_ui import ROGUE_LAUNCH
@ -102,6 +105,40 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
if current:
break
def _rogue_theme_set(self, world: DungeonList, skip_first_screenshot=True):
"""
Args:
world: KEYWORDS_DUNGEON_LIST.Simulated_Universe_World_7
skip_first_screenshot:
Pages:
in: is_page_rogue_main()
"""
logger.info(f'Rogue theme set: {world.rogue_theme}')
if world.rogue_theme == 'rogue':
check_button = THEME_ROGUE
elif world.rogue_theme == 'dlc':
check_button = THEME_DLC
else:
logger.warning(f'Invalid rogue theme: {world}')
raise RequestHumanTakeover
interval = Timer(2, count=10)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
if self.appear(check_button):
logger.info(f'At theme {world.rogue_theme}')
break
# Click
if interval.reached() and self.is_page_rogue_main():
self.device.click(THEME_SWITCH)
interval.reset()
def _rogue_world_set(self, world: int | DungeonList, skip_first_screenshot=True):
"""
Args:
@ -373,6 +410,7 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI):
self.check_stop_condition()
# Enter
self._rogue_theme_set(world)
self._rogue_world_set(world)
# Check stop condition again as immersifier updated
try: