diff --git a/assets/share/dungeon/event/DOUBLE_RELIC_EVENT_TAG.png b/assets/share/dungeon/event/DOUBLE_RELIC_EVENT_TAG.png new file mode 100644 index 000000000..574b194a1 Binary files /dev/null and b/assets/share/dungeon/event/DOUBLE_RELIC_EVENT_TAG.png differ diff --git a/config/template.json b/config/template.json index fbe284d7d..1bae146ce 100644 --- a/config/template.json +++ b/config/template.json @@ -42,6 +42,7 @@ "Dungeon": { "Name": "Calyx_Golden_Treasures", "NameAtDoubleCalyx": "Calyx_Golden_Treasures", + "NameAtDoubleRelic": "Cavern_of_Corrosion_Path_of_Providence", "Team": 1, "Support": "when_daily", "SupportCharacter": "FirstCharacter" diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 451746a0b..b3b93a7e9 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -218,6 +218,20 @@ "Calyx_Crimson_Nihility" ] }, + "NameAtDoubleRelic": { + "type": "select", + "value": "Cavern_of_Corrosion_Path_of_Providence", + "option": [ + "do_not_participate", + "Cavern_of_Corrosion_Path_of_Gelid_Wind", + "Cavern_of_Corrosion_Path_of_Jabbing_Punch", + "Cavern_of_Corrosion_Path_of_Drifting", + "Cavern_of_Corrosion_Path_of_Providence", + "Cavern_of_Corrosion_Path_of_Holy_Hymn", + "Cavern_of_Corrosion_Path_of_Conflagration", + "Cavern_of_Corrosion_Path_of_Elixir_Seekers" + ] + }, "Team": { "type": "select", "value": 1, diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 8eb6ba1ce..fde21773c 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -78,6 +78,10 @@ Dungeon: # Options will be injected in config updater value: Calyx_Golden_Treasures option: [ do_not_participate, ] + NameAtDoubleRelic: + # Options will be injected in config updater + value: Cavern_of_Corrosion_Path_of_Providence + option: [ do_not_participate, ] Team: value: 1 option: [ 1, 2, 3, 4, 5, 6 ] diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 7b57b6b74..1a169de24 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -41,6 +41,7 @@ class GeneratedConfig: # Group `Dungeon` Dungeon_Name = 'Calyx_Golden_Treasures' # Calyx_Golden_Memories, Calyx_Golden_Aether, Calyx_Golden_Treasures, Calyx_Crimson_Destruction, Calyx_Crimson_Preservation, Calyx_Crimson_Hunt, Calyx_Crimson_Abundance, Calyx_Crimson_Erudition, Calyx_Crimson_Harmony, Calyx_Crimson_Nihility, Stagnant_Shadow_Quanta, Stagnant_Shadow_Gust, Stagnant_Shadow_Fulmination, Stagnant_Shadow_Blaze, Stagnant_Shadow_Spike, Stagnant_Shadow_Rime, Stagnant_Shadow_Mirage, Stagnant_Shadow_Icicle, Stagnant_Shadow_Doom, Stagnant_Shadow_Celestial, Cavern_of_Corrosion_Path_of_Gelid_Wind, Cavern_of_Corrosion_Path_of_Jabbing_Punch, Cavern_of_Corrosion_Path_of_Drifting, Cavern_of_Corrosion_Path_of_Providence, Cavern_of_Corrosion_Path_of_Holy_Hymn, Cavern_of_Corrosion_Path_of_Conflagration, Cavern_of_Corrosion_Path_of_Elixir_Seekers Dungeon_NameAtDoubleCalyx = 'Calyx_Golden_Treasures' # do_not_participate, Calyx_Golden_Memories, Calyx_Golden_Aether, Calyx_Golden_Treasures, Calyx_Crimson_Destruction, Calyx_Crimson_Preservation, Calyx_Crimson_Hunt, Calyx_Crimson_Abundance, Calyx_Crimson_Erudition, Calyx_Crimson_Harmony, Calyx_Crimson_Nihility + Dungeon_NameAtDoubleRelic = 'Cavern_of_Corrosion_Path_of_Providence' # do_not_participate, Cavern_of_Corrosion_Path_of_Gelid_Wind, Cavern_of_Corrosion_Path_of_Jabbing_Punch, Cavern_of_Corrosion_Path_of_Drifting, Cavern_of_Corrosion_Path_of_Providence, Cavern_of_Corrosion_Path_of_Holy_Hymn, Cavern_of_Corrosion_Path_of_Conflagration, Cavern_of_Corrosion_Path_of_Elixir_Seekers Dungeon_Team = 1 # 1, 2, 3, 4, 5, 6 Dungeon_Support = 'when_daily' # do_not_use, always_use, when_daily Dungeon_SupportCharacter = 'FirstCharacter' # FirstCharacter, Arlan, Asta, Bailu, Blade, Bronya, Clara, DanHeng, Gepard, Herta, Himeko, Hook, JingYuan, Kafka, Luka, Luocha, March7th, Natasha, Pela, Qingque, Sampo, Seele, Serval, SilverWolf, Sushang, Tingyun, TrailblazerDestruction, TrailblazerPreservation, Welt, Yanqing, Yukong diff --git a/module/config/config_updater.py b/module/config/config_updater.py index c125430d2..b1f6d8a55 100644 --- a/module/config/config_updater.py +++ b/module/config/config_updater.py @@ -288,6 +288,11 @@ class ConfigGenerator: value = deep_get(new, keys=['Dungeon', 'Name', dungeon]) if value: deep_set(new, keys=['Dungeon', 'NameAtDoubleCalyx', dungeon], value=value) + for dungeon in deep_get(new, keys='Dungeon.NameAtDoubleRelic').values(): + if '_' in dungeon: + value = deep_get(new, keys=['Dungeon', 'Name', dungeon]) + if value: + deep_set(new, keys=['Dungeon', 'NameAtDoubleRelic', dungeon], value=value) from tasks.character.keywords import CharacterList ingame_lang = gui_lang_to_ingame_lang(lang) @@ -379,11 +384,16 @@ class ConfigGenerator: deep_set(self.argument, keys='Dungeon.SupportCharacter.option', value=characters) deep_set(self.args, keys='Dungeon.Dungeon.SupportCharacter.option', value=characters) + # Double events dungeons = deep_get(self.argument, keys='Dungeon.NameAtDoubleCalyx.option') dungeons += [dungeon.name for dungeon in DungeonList.instances.values() if dungeon.is_Calyx_Golden or dungeon.is_Calyx_Crimson] deep_set(self.argument, keys='Dungeon.NameAtDoubleCalyx.option', value=dungeons) deep_set(self.args, keys='Dungeon.Dungeon.NameAtDoubleCalyx.option', value=dungeons) + dungeons = deep_get(self.argument, keys='Dungeon.NameAtDoubleRelic.option') + dungeons += [dungeon.name for dungeon in DungeonList.instances.values() if dungeon.is_Cavern_of_Corrosion] + deep_set(self.argument, keys='Dungeon.NameAtDoubleRelic.option', value=dungeons) + deep_set(self.args, keys='Dungeon.Dungeon.NameAtDoubleRelic.option', value=dungeons) def insert_assignment(self): from tasks.assignment.keywords import AssignmentEntry diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index d60f43412..e8245cff5 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -226,6 +226,18 @@ "Calyx_Crimson_Harmony": "Trace: Harmony (Bud of Harmony)", "Calyx_Crimson_Nihility": "Trace: Nihility (Bud of Nihility)" }, + "NameAtDoubleRelic": { + "name": "At Double Relic Event, choose dungeon", + "help": "Return to the default dungeon settings after double times exhausted", + "do_not_participate": "Dont participate in event", + "Cavern_of_Corrosion_Path_of_Gelid_Wind": "Relics: Ice Set & Wind Set (Path of Gelid Wind)", + "Cavern_of_Corrosion_Path_of_Jabbing_Punch": "Relics: Physical Set & Break Effect Set (Path of Jabbing Punch)", + "Cavern_of_Corrosion_Path_of_Drifting": "Relics: Healing Set & Musketeer Set (Path of Drifting)", + "Cavern_of_Corrosion_Path_of_Providence": "Relics: Guard Set & Quantum Set (Path of Providence)", + "Cavern_of_Corrosion_Path_of_Holy_Hymn": "Relics: DEF Set & Lighting Set (Path of Holy Hymn)", + "Cavern_of_Corrosion_Path_of_Conflagration": "Relics: Fire Set & Imaginary Set (Path of Conflagration)", + "Cavern_of_Corrosion_Path_of_Elixir_Seekers": "Relics: HP Set & SPD Set (Path of Elixir Seekers)" + }, "Team": { "name": "Dungeon Team", "help": "", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 1b5a5040d..0bc53d6ca 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -226,6 +226,18 @@ "Calyx_Crimson_Harmony": "疑似花萼(赤)・調和の蕾", "Calyx_Crimson_Nihility": "疑似花萼(赤)・虚無の蕾" }, + "NameAtDoubleRelic": { + "name": "Dungeon.NameAtDoubleRelic.name", + "help": "Dungeon.NameAtDoubleRelic.help", + "do_not_participate": "do_not_participate", + "Cavern_of_Corrosion_Path_of_Gelid_Wind": "侵蝕トンネル・霜風の路", + "Cavern_of_Corrosion_Path_of_Jabbing_Punch": "侵蝕トンネル・迅拳の路", + "Cavern_of_Corrosion_Path_of_Drifting": "侵蝕トンネル・漂泊の路", + "Cavern_of_Corrosion_Path_of_Providence": "侵蝕トンネル・睿治の路", + "Cavern_of_Corrosion_Path_of_Holy_Hymn": "侵蝕トンネル・聖頌の路", + "Cavern_of_Corrosion_Path_of_Conflagration": "侵蝕トンネル・野焔の路", + "Cavern_of_Corrosion_Path_of_Elixir_Seekers": "侵蝕トンネル・薬使の路" + }, "Team": { "name": "Dungeon.Team.name", "help": "Dungeon.Team.help", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 268e38aca..2dbef8373 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -226,6 +226,18 @@ "Calyx_Crimson_Harmony": "行迹材料:同谐(同谐之蕾•拟造花萼赤)", "Calyx_Crimson_Nihility": "行迹材料:虚无(虚无之蕾•拟造花萼赤)" }, + "NameAtDoubleRelic": { + "name": "有遗器活动时,选择副本", + "help": "次数耗尽后回退到默认打本设置", + "do_not_participate": "不参与活动", + "Cavern_of_Corrosion_Path_of_Gelid_Wind": "遗器:冰套+风套(霜风之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Jabbing_Punch": "遗器:物理套+击破套(迅拳之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Drifting": "遗器:治疗套+快枪手(漂泊之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Providence": "遗器:铁卫套+量子套(睿治之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Holy_Hymn": "遗器:防御套+雷套(圣颂之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Conflagration": "遗器:火套+虚数套(野焰之径•侵蚀隧洞)", + "Cavern_of_Corrosion_Path_of_Elixir_Seekers": "遗器:生命套+速度套(药使之径•侵蚀隧洞)" + }, "Team": { "name": "打本队伍", "help": "", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index bbc2f1e71..96150ee04 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -226,6 +226,18 @@ "Calyx_Crimson_Harmony": "行跡材料:同諧(同諧之蕾•擬造花萼赤)", "Calyx_Crimson_Nihility": "行跡材料:虛無(虛無之蕾•擬造花萼赤)" }, + "NameAtDoubleRelic": { + "name": "有遺器活動時,選擇副本", + "help": "次數耗儘後回退到默認打本設置", + "do_not_participate": "不參與活動", + "Cavern_of_Corrosion_Path_of_Gelid_Wind": "遺器:冰套+風套(霜風之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Jabbing_Punch": "遺器:物理套+擊破套(迅拳之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Drifting": "遺器:治療套+快槍手(漂泊之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Providence": "遺器:鐵衛套+量子套(睿治之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Holy_Hymn": "遺器:防禦套+雷套(聖頌之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Conflagration": "遺器:火套+虛數套(野焰之徑•侵蝕隧洞)", + "Cavern_of_Corrosion_Path_of_Elixir_Seekers": "遺器:生命套+速度套(藥使之徑•侵蝕隧洞)" + }, "Team": { "name": "打本隊伍", "help": "", diff --git a/tasks/dungeon/assets/assets_dungeon_event.py b/tasks/dungeon/assets/assets_dungeon_event.py index ea2f6fa44..f09003247 100644 --- a/tasks/dungeon/assets/assets_dungeon_event.py +++ b/tasks/dungeon/assets/assets_dungeon_event.py @@ -13,6 +13,16 @@ DOUBLE_CALYX_EVENT_TAG = ButtonWrapper( button=(329, 224, 425, 392), ), ) +DOUBLE_RELIC_EVENT_TAG = ButtonWrapper( + name='DOUBLE_RELIC_EVENT_TAG', + share=Button( + file='./assets/share/dungeon/event/DOUBLE_RELIC_EVENT_TAG.png', + area=(329, 505, 425, 589), + search=(309, 485, 445, 609), + color=(211, 206, 198), + button=(329, 505, 425, 589), + ), +) OCR_DOUBLE_EVENT_REMAIN = ButtonWrapper( name='OCR_DOUBLE_EVENT_REMAIN', share=Button( diff --git a/tasks/dungeon/dungeon.py b/tasks/dungeon/dungeon.py index 0e703b685..dabb256e6 100644 --- a/tasks/dungeon/dungeon.py +++ b/tasks/dungeon/dungeon.py @@ -34,6 +34,14 @@ class Dungeon(DungeonUI, DungeonEvent, Combat): if self.combat(team, wave_limit=remain, support_character=support_character): self.delay_dungeon_task(calyx) self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index) + if self.config.Dungeon_NameAtDoubleRelic != 'do_not_participate' and self.has_double_relic_event(): + calyx = DungeonList.find(self.config.Dungeon_NameAtDoubleRelic) + self._dungeon_nav_goto(calyx) + if remain := self.get_double_event_remain(): + self.dungeon_goto(calyx) + if self.combat(team, wave_limit=remain, support_character=support_character): + self.delay_dungeon_task(calyx) + self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index) # Combat self.dungeon_goto(dungeon) @@ -55,6 +63,7 @@ class Dungeon(DungeonUI, DungeonEvent, Combat): cover = max(limit - self.state.TrailblazePower, 0) * 6 logger.info(f'Currently has {self.state.TrailblazePower} need {cover} minutes to reach {limit}') self.config.task_delay(minute=cover) + self.config.task_stop() def handle_destructible_around_blaze(self): """ diff --git a/tasks/dungeon/event.py b/tasks/dungeon/event.py index 896a7d239..6c9f0c464 100644 --- a/tasks/dungeon/event.py +++ b/tasks/dungeon/event.py @@ -1,7 +1,11 @@ from module.logger import logger from module.ocr.ocr import DigitCounter from tasks.base.ui import UI -from tasks.dungeon.assets.assets_dungeon_event import DOUBLE_CALYX_EVENT_TAG, OCR_DOUBLE_EVENT_REMAIN +from tasks.dungeon.assets.assets_dungeon_event import ( + DOUBLE_CALYX_EVENT_TAG, + DOUBLE_RELIC_EVENT_TAG, + OCR_DOUBLE_EVENT_REMAIN +) class DungeonEvent(UI): @@ -11,9 +15,20 @@ class DungeonEvent(UI): in: page_guide, Survival_Index, nav at top """ has = self.image_color_count(DOUBLE_CALYX_EVENT_TAG, color=(252, 209, 123), threshold=221, count=50) + has |= self.image_color_count(DOUBLE_CALYX_EVENT_TAG, color=(252, 251, 140), threshold=221, count=50) logger.attr('Double calyx', has) return has + def has_double_relic_event(self) -> bool: + """ + Pages: + in: page_guide, Survival_Index, nav at top + """ + has = self.image_color_count(DOUBLE_RELIC_EVENT_TAG, color=(252, 209, 123), threshold=221, count=50) + has |= self.image_color_count(DOUBLE_RELIC_EVENT_TAG, color=(252, 251, 140), threshold=221, count=50) + logger.attr('Double relic', has) + return has + def get_double_event_remain(self) -> int: """ Pages: @@ -21,7 +36,7 @@ class DungeonEvent(UI): """ ocr = DigitCounter(OCR_DOUBLE_EVENT_REMAIN) remain, _, total = ocr.ocr_single_line(self.device.image) - if total != 12: + if total not in [3, 12]: logger.warning(f'Invalid double event remain') remain = 0 logger.attr('Double event remain', remain)