Add: Dungeon at double relic event

This commit is contained in:
LmeSzinc 2023-08-21 00:51:10 +08:00
parent adefd5a956
commit bc9642772f
13 changed files with 114 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -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"

View File

@ -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,

View File

@ -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 ]

View File

@ -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

View File

@ -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

View File

@ -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": "",

View File

@ -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",

View File

@ -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": "",

View File

@ -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": "",

View File

@ -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(

View File

@ -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):
"""

View File

@ -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)