diff --git a/assets/share/rogue/entry/THEME_DLC.2.png b/assets/share/rogue/entry/THEME_DLC.2.png new file mode 100644 index 000000000..d99770170 Binary files /dev/null and b/assets/share/rogue/entry/THEME_DLC.2.png differ diff --git a/assets/share/rogue/entry/THEME_DLC.png b/assets/share/rogue/entry/THEME_DLC.png new file mode 100644 index 000000000..70af71a36 Binary files /dev/null and b/assets/share/rogue/entry/THEME_DLC.png differ diff --git a/assets/share/rogue/entry/THEME_ROGUE.png b/assets/share/rogue/entry/THEME_ROGUE.png new file mode 100644 index 000000000..05dc1e2f9 Binary files /dev/null and b/assets/share/rogue/entry/THEME_ROGUE.png differ diff --git a/assets/share/rogue/entry/THEME_SWITCH.png b/assets/share/rogue/entry/THEME_SWITCH.png new file mode 100644 index 000000000..1d4ba898b Binary files /dev/null and b/assets/share/rogue/entry/THEME_SWITCH.png differ diff --git a/dev_tools/keyword_extract.py b/dev_tools/keyword_extract.py index 5861ead02..fe080163a 100644 --- a/dev_tools/keyword_extract.py +++ b/dev_tools/keyword_extract.py @@ -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]: """ diff --git a/tasks/dungeon/keywords/classes.py b/tasks/dungeon/keywords/classes.py index 6b6cf7f55..c531cf4cb 100644 --- a/tasks/dungeon/keywords/classes.py +++ b/tasks/dungeon/keywords/classes.py @@ -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): diff --git a/tasks/dungeon/keywords/dungeon.py b/tasks/dungeon/keywords/dungeon.py index 0787c2f3b..94018cee7 100644 --- a/tasks/dungeon/keywords/dungeon.py +++ b/tasks/dungeon/keywords/dungeon.py @@ -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', +) diff --git a/tasks/rogue/assets/assets_rogue_entry.py b/tasks/rogue/assets/assets_rogue_entry.py index c7c219a1e..16934f2fc 100644 --- a/tasks/rogue/assets/assets_rogue_entry.py +++ b/tasks/rogue/assets/assets_rogue_entry.py @@ -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( diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index a78d249e8..4998ad9cf 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -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: