Add: Dungeon at double calyx event

This commit is contained in:
LmeSzinc 2023-07-10 23:36:35 +08:00
parent 5467f71b6e
commit d9f9b43b6f
16 changed files with 188 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -40,7 +40,8 @@
"ServerUpdate": "04:00"
},
"Dungeon": {
"Name": "Calyx_Golden_Memories",
"Name": "Calyx_Golden_Treasures",
"NameAtDoubleCalyx": "Calyx_Golden_Treasures",
"Team": 1
}
},

View File

@ -170,7 +170,7 @@
"Dungeon": {
"Name": {
"type": "select",
"value": "Calyx_Golden_Memories",
"value": "Calyx_Golden_Treasures",
"option": [
"Calyx_Golden_Memories",
"Calyx_Golden_Aether",
@ -199,6 +199,23 @@
"Cavern_of_Corrosion_Path_of_Conflagration"
]
},
"NameAtDoubleCalyx": {
"type": "select",
"value": "Calyx_Golden_Treasures",
"option": [
"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"
]
},
"Team": {
"type": "select",
"value": 1,

View File

@ -72,8 +72,12 @@ Optimization:
Dungeon:
Name:
# Options will be injected in config updater
value: Calyx_Golden_Memories
option: [Calyx_Golden_Memories, ]
value: Calyx_Golden_Treasures
option: [Calyx_Golden_Treasures, ]
NameAtDoubleCalyx:
# Options will be injected in config updater
value: Calyx_Golden_Treasures
option: [ do_not_participate, ]
Team:
value: 1
option: [ 1, 2, 3, 4, 5, 6 ]

View File

@ -39,7 +39,8 @@ class GeneratedConfig:
Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game
# Group `Dungeon`
Dungeon_Name = 'Calyx_Golden_Memories' # 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, 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
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, 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
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_Team = 1 # 1, 2, 3, 4, 5, 6
# Group `Assignment`

View File

@ -283,6 +283,12 @@ class ConfigGenerator:
if dungeon.name in dailies:
value = dungeon.__getattribute__(ingame_lang)
deep_set(new, keys=['Dungeon', 'Name', dungeon.name], value=value)
# Copy dungeon i18n to double events
for dungeon in deep_get(new, keys='Dungeon.NameAtDoubleCalyx').values():
if '_' in dungeon:
value = deep_get(new, keys=['Dungeon', 'Name', dungeon])
if value:
deep_set(new, keys=['Dungeon', 'NameAtDoubleCalyx', dungeon], value=value)
# GUI i18n
for path, _ in deep_iter(self.gui, depth=2):
@ -356,6 +362,11 @@ class ConfigGenerator:
dungeons = [dungeon.name for dungeon in DungeonList.instances.values() if dungeon.is_daily_dungeon]
deep_set(self.argument, keys='Dungeon.Name.option', value=dungeons)
deep_set(self.args, keys='Dungeon.Dungeon.Name.option', value=dungeons)
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)
def insert_assignment(self):
from tasks.assignment.keywords import AssignmentEntry

View File

@ -182,7 +182,7 @@
},
"Name": {
"name": "Dungeon Name",
"help": "",
"help": "Default dungeon setting",
"Calyx_Golden_Memories": "Material: Character EXP (Bud of Memories)",
"Calyx_Golden_Aether": "Material: Light Cone EXP (Bud of Aether)",
"Calyx_Golden_Treasures": "Material: Credit (Bud of Treasures)",
@ -209,6 +209,21 @@
"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)"
},
"NameAtDoubleCalyx": {
"name": "At Double Calyx Event, choose dungeon",
"help": "Return to the default dungeon settings after double times exhausted",
"do_not_participate": "Dont participate in event",
"Calyx_Golden_Memories": "Material: Character EXP (Bud of Memories)",
"Calyx_Golden_Aether": "Material: Light Cone EXP (Bud of Aether)",
"Calyx_Golden_Treasures": "Material: Credit (Bud of Treasures)",
"Calyx_Crimson_Destruction": "Trace: Destruction (Bud of Destruction)",
"Calyx_Crimson_Preservation": "Trace: Preservation (Bud of Preservation)",
"Calyx_Crimson_Hunt": "Trace: Hunt (Bud of Hunt)",
"Calyx_Crimson_Abundance": "Trace: Abundance (Bud of Abundance)",
"Calyx_Crimson_Erudition": "Trace: Erudition (Bud of Erudition)",
"Calyx_Crimson_Harmony": "Trace: Harmony (Bud of Harmony)",
"Calyx_Crimson_Nihility": "Trace: Nihility (Bud of Nihility)"
},
"Team": {
"name": "Dungeon Team",
"help": "",

View File

@ -209,6 +209,21 @@
"Cavern_of_Corrosion_Path_of_Holy_Hymn": "侵蝕トンネル・聖頌の路",
"Cavern_of_Corrosion_Path_of_Conflagration": "侵蝕トンネル・野焔の路"
},
"NameAtDoubleCalyx": {
"name": "Dungeon.NameAtDoubleCalyx.name",
"help": "Dungeon.NameAtDoubleCalyx.help",
"do_not_participate": "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": "疑似花萼(赤)・虚無の蕾"
},
"Team": {
"name": "Dungeon.Team.name",
"help": "Dungeon.Team.help",

View File

@ -182,7 +182,7 @@
},
"Name": {
"name": "副本名称",
"help": "",
"help": "默认打本设置",
"Calyx_Golden_Memories": "材料:角色经验(回忆之蕾•拟造花萼金)",
"Calyx_Golden_Aether": "材料:武器经验(以太之蕾•拟造花萼金)",
"Calyx_Golden_Treasures": "材料:信用点(藏珍之蕾•拟造花萼金)",
@ -209,6 +209,21 @@
"Cavern_of_Corrosion_Path_of_Holy_Hymn": "遗器:防御套+雷套(圣颂之径•侵蚀隧洞)",
"Cavern_of_Corrosion_Path_of_Conflagration": "遗器:火套+虚数套(野焰之径•侵蚀隧洞)"
},
"NameAtDoubleCalyx": {
"name": "有双倍花活动时,选择副本",
"help": "次数耗尽后回退到默认打本设置",
"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": "行迹材料:虚无(虚无之蕾•拟造花萼赤)"
},
"Team": {
"name": "打本队伍",
"help": "",

View File

@ -182,7 +182,7 @@
},
"Name": {
"name": "副本名稱",
"help": "",
"help": "默認打本設置",
"Calyx_Golden_Memories": "材料:角色經驗(回憶之蕾•擬造花萼金)",
"Calyx_Golden_Aether": "材料:武器經驗(乙太之蕾•擬造花萼金)",
"Calyx_Golden_Treasures": "材料:信用點(藏珍之蕾•擬造花萼金)",
@ -209,6 +209,21 @@
"Cavern_of_Corrosion_Path_of_Holy_Hymn": "遺器:防禦套+雷套(聖頌之徑•侵蝕隧洞)",
"Cavern_of_Corrosion_Path_of_Conflagration": "遺器:火套+虛數套(野焰之徑•侵蝕隧洞)"
},
"NameAtDoubleCalyx": {
"name": "有雙倍花活動時,選擇副本",
"help": "次數耗儘後回退到默認打本設置",
"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": "行跡材料:虛無(虛無之蕾•擬造花萼赤)"
},
"Team": {
"name": "打本隊伍",
"help": "",

View File

@ -269,6 +269,10 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, MapControlJ
wave_limit: Limit combat runs, 0 means no limit.
skip_first_screenshot:
Returns:
bool: True if trailblaze power exhausted
False if reached wave_limit but still have trailblaze power
Pages:
in: COMBAT_PREPARE
or page_main with DUNGEON_COMBAT_INTERACT
@ -295,3 +299,5 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, MapControlJ
continue
if finish:
break
return self.state.TrailblazePower < self.combat_wave_cost

View File

@ -0,0 +1,25 @@
from module.base.button import Button, ButtonWrapper
# This file was auto-generated, do not modify it manually. To generate:
# ``` python -m dev_tools.button_extract ```
DOUBLE_CALYX_EVENT_TAG = ButtonWrapper(
name='DOUBLE_CALYX_EVENT_TAG',
share=Button(
file='./assets/share/dungeon/event/DOUBLE_CALYX_EVENT_TAG.png',
area=(329, 224, 425, 392),
search=(309, 204, 445, 412),
color=(131, 127, 117),
button=(329, 224, 425, 392),
),
)
OCR_DOUBLE_EVENT_REMAIN = ButtonWrapper(
name='OCR_DOUBLE_EVENT_REMAIN',
share=Button(
file='./assets/share/dungeon/event/OCR_DOUBLE_EVENT_REMAIN.png',
area=(434, 141, 1163, 166),
search=(414, 121, 1183, 186),
color=(228, 185, 100),
button=(434, 141, 1163, 166),
),
)

View File

@ -1,23 +1,37 @@
from module.base.utils import area_offset
from module.logger import logger
from tasks.combat.combat import Combat
from tasks.dungeon.event import DungeonEvent
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DungeonUI
class Dungeon(DungeonUI, Combat):
class Dungeon(DungeonUI, DungeonEvent, Combat):
def run(self, dungeon: DungeonList = None, team: int = None):
if dungeon is None:
dungeon = DungeonList.find(self.config.Dungeon_Name)
if team is None:
team = self.config.Dungeon_Team
# Run
# UI switches
switched = self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
if not switched:
# Nav must at top, reset nav states
self.ui_goto_main()
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
if not self.dungeon_goto(dungeon):
logger.error('Please check you dungeon settings')
self.config.Scheduler_Enable = False
self.config.task_stop()
# Check double events
if self.config.Dungeon_NameAtDoubleCalyx != 'do_not_participate' and self.has_double_calyx_event():
calyx = DungeonList.find(self.config.Dungeon_NameAtDoubleCalyx)
self._dungeon_nav_goto(calyx)
if remain := self.get_double_event_remain():
self.dungeon_goto(calyx)
if self.combat(team, wave_limit=remain):
self.delay_dungeon_task(calyx)
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
# Combat
self.dungeon_goto(dungeon)
if dungeon == KEYWORDS_DUNGEON_LIST.Stagnant_Shadow_Blaze:
if self.handle_destructible_around_blaze():
@ -25,8 +39,9 @@ class Dungeon(DungeonUI, Combat):
self.dungeon_goto(dungeon)
self.combat(team)
self.delay_dungeon_task(dungeon)
# Scheduler
def delay_dungeon_task(self, dungeon):
if dungeon.is_Cavern_of_Corrosion:
limit = 80
else:

28
tasks/dungeon/event.py Normal file
View File

@ -0,0 +1,28 @@
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
class DungeonEvent(UI):
def has_double_calyx_event(self) -> bool:
"""
Pages:
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)
logger.attr('Double calyx', has)
return has
def get_double_event_remain(self) -> int:
"""
Pages:
in: page_guide, Survival_Index, selected at the nav with double event
"""
ocr = DigitCounter(OCR_DOUBLE_EVENT_REMAIN)
remain, _, total = ocr.ocr_single_line(self.device.image)
if total != 12:
logger.warning(f'Invalid double event remain')
remain = 0
logger.attr('Double event remain', remain)
return remain

View File

@ -58,6 +58,7 @@ SWITCH_DUNGEON_TAB.add_state(
class OcrDungeonNav(Ocr):
def after_process(self, result):
result = super().after_process(result)
result = result.replace('#', '')
if self.lang == 'ch':
result = result.replace('萼喜', '')
result = result.replace('', '') # 凝带虚影