Add: GUI options in task Dungeon

This commit is contained in:
LmeSzinc 2023-06-18 00:13:21 +08:00
parent 1a564b4e8e
commit 9928d5b4cc
13 changed files with 342 additions and 61 deletions

View File

@ -22,9 +22,6 @@
"ScreenshotInterval": 0.2,
"CombatScreenshotInterval": 1.0,
"WhenTaskQueueEmpty": "goto_main"
},
"Storage": {
"Storage": {}
}
},
"Restart": {
@ -33,9 +30,18 @@
"NextRun": "2020-01-01 00:00:00",
"Command": "Restart",
"ServerUpdate": "00:00"
}
},
"Dungeon": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "Dungeon",
"ServerUpdate": "00:00"
},
"Storage": {
"Storage": {}
"Dungeon": {
"Name": "Calyx_Golden_Memories",
"Team": 1
}
}
}

View File

@ -119,14 +119,6 @@
"close_game"
]
}
},
"Storage": {
"Storage": {
"type": "storage",
"value": {},
"valuetype": "ignore",
"display": "disabled"
}
}
},
"Restart": {
@ -151,13 +143,73 @@
"value": "00:00",
"display": "hide"
}
}
},
"Dungeon": {
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
},
"NextRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "input",
"value": "Dungeon",
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "00:00",
"display": "hide"
}
},
"Storage": {
"Storage": {
"type": "storage",
"value": {},
"valuetype": "ignore",
"display": "disabled"
"Dungeon": {
"Name": {
"type": "select",
"value": "Calyx_Golden_Memories",
"option": [
"Calyx_Golden_Memories",
"Calyx_Golden_Aether",
"Calyx_Golden_Treasures",
"Calyx_Crimson_Destruction",
"Calyx_Crimson_Preservation",
"Calyx_Crimson_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"
]
},
"Team": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4,
5,
6
]
}
}
}

View File

@ -69,6 +69,14 @@ Optimization:
# ==================== Farm ====================
Dungeon:
Name:
# Options will be injected in config updater
value: Calyx_Golden_Memories
option: [Calyx_Golden_Memories, ]
Team:
value: 1
option: [ 1, 2, 3, 4, 5, 6 ]
# ==================== Daily ====================

View File

@ -6,5 +6,12 @@
"Alas",
"Restart"
]
},
"Daily": {
"menu": "list",
"page": "setting",
"tasks": [
"Dungeon"
]
}
}

View File

@ -16,10 +16,12 @@ Alas:
Restart:
- Scheduler
# ==================== Farm ====================
# ==================== Daily ====================
# ==================== Tools ====================
Daily:
menu: 'list'
page: 'setting'
tasks:
Dungeon:
- Scheduler
- Dungeon

View File

@ -38,5 +38,6 @@ class GeneratedConfig:
Optimization_CombatScreenshotInterval = 1.0
Optimization_WhenTaskQueueEmpty = 'goto_main' # stay_there, goto_main, close_game
# Group `Storage`
Storage_Storage = {}
# Group `Dungeon`
Dungeon_Name = 'Calyx_Golden_Memories' # Calyx_Golden_Memories, Calyx_Golden_Aether, Calyx_Golden_Treasures, Calyx_Crimson_Destruction, Calyx_Crimson_Preservation, Calyx_Crimson_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_Team = 1 # 1, 2, 3, 4, 5, 6

View File

@ -21,6 +21,16 @@ class GeneratedConfig:
"""
'''.strip().split('\n')
DICT_GUI_TO_INGAME = {
'zh-CN': 'cn',
'en-US': 'en',
'ja-JP': 'jp',
'zh-TW': 'cht',
}
def gui_lang_to_ingame_lang(lang: str) -> str:
return DICT_GUI_TO_INGAME.get(lang, 'en')
class ConfigGenerator:
@ -55,13 +65,13 @@ class ConfigGenerator:
deep_set(data, keys=path, value=arg)
# Define storage group
arg = {
'type': 'storage',
'value': {},
'valuetype': 'ignore',
'display': 'disabled',
}
deep_set(data, keys=['Storage', 'Storage'], value=arg)
# arg = {
# 'type': 'storage',
# 'value': {},
# 'valuetype': 'ignore',
# 'display': 'disabled',
# }
# deep_set(data, keys=['Storage', 'Storage'], value=arg)
return data
@cached_property
@ -118,7 +128,7 @@ class ConfigGenerator:
continue
task = path[2]
# Add storage to all task
groups.append('Storage')
# groups.append('Storage')
for group in groups:
if group not in self.argument:
print(f'`{task}.{group}` is not related to any argument group')
@ -248,7 +258,6 @@ class ConfigGenerator:
path = ['Emulator', 'PackageName', package]
if deep_get(new, keys=path) == package:
deep_set(new, keys=path, value=server.upper())
for package, server_and_channel in VALID_CHANNEL_PACKAGE.items():
server, channel = server_and_channel
name = deep_get(new, keys=['Emulator', 'PackageName', to_package(server)])
@ -264,6 +273,16 @@ class ConfigGenerator:
# prefix = server.split('_')[0].upper()
# prefix = '国服' if prefix == 'CN' else prefix
# deep_set(new, keys=path, value=f'[{prefix}] {_list[index]}')
# Dungeon names
ingame_lang = gui_lang_to_ingame_lang(lang)
from tasks.dungeon.keywords import DungeonList
dailies = deep_get(self.argument, keys='Dungeon.Name.option')
for dungeon in DungeonList.instances.values():
if dungeon.name in dailies:
value = dungeon.__getattribute__(ingame_lang)
deep_set(new, keys=['Dungeon', 'Name', dungeon.name], value=value)
# GUI i18n
for path, _ in deep_iter(self.gui, depth=2):
group, key = path
@ -331,6 +350,12 @@ class ConfigGenerator:
# update('template-docker', docker)
# update('template-docker-cn', docker, cn)
def insert_dungeon(self):
from tasks.dungeon.keywords import DungeonList
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)
def insert_package(self):
option = deep_get(self.argument, keys='Emulator.PackageName.option')
option += list(VALID_PACKAGE.keys())
@ -343,7 +368,7 @@ class ConfigGenerator:
_ = self.args
_ = self.menu
# _ = self.event
# self.insert_event()
self.insert_dungeon()
self.insert_package()
# self.insert_server()
write_file(filepath_args(), self.args)

View File

@ -3,6 +3,10 @@
"Alas": {
"name": "SRC",
"help": ""
},
"Daily": {
"name": "Daily",
"help": ""
}
},
"Task": {
@ -13,6 +17,10 @@
"Restart": {
"name": "Error Handling",
"help": ""
},
"Dungeon": {
"name": "Dungeon",
"help": ""
}
},
"Scheduler": {
@ -155,14 +163,49 @@
"close_game": "Close Game"
}
},
"Storage": {
"Dungeon": {
"_info": {
"name": "Task status",
"help": "Store internal status of the task. Clear manually when the task is abnormal"
"name": "Dungeon Settings",
"help": "Brush a dungeon until trailblaze power runs out"
},
"Storage": {
"name": "Storage.Storage.name",
"help": "Storage.Storage.help"
"Name": {
"name": "Dungeon Name",
"help": "",
"Calyx_Golden_Memories": "Bud of Memories",
"Calyx_Golden_Aether": "Bud of Aether",
"Calyx_Golden_Treasures": "Bud of Treasures",
"Calyx_Crimson_Destruction": "Bud of Destruction",
"Calyx_Crimson_Preservation": "Bud of Preservation",
"Calyx_Crimson_Calyx_Crimson_Hunt": "Calyx (Crimson): Bud of Hunt",
"Calyx_Crimson_Abundance": "Bud of Abundance",
"Calyx_Crimson_Erudition": "Bud of Erudition",
"Calyx_Crimson_Harmony": "Bud of Harmony",
"Calyx_Crimson_Nihility": "Bud of Nihility",
"Stagnant_Shadow_Quanta": "Shape of Quanta",
"Stagnant_Shadow_Gust": "Shape of Gust",
"Stagnant_Shadow_Fulmination": "Shape of Fulmination",
"Stagnant_Shadow_Blaze": "Shape of Blaze",
"Stagnant_Shadow_Spike": "Shape of Spike",
"Stagnant_Shadow_Rime": "Shape of Rime",
"Stagnant_Shadow_Mirage": "Shape of Mirage",
"Stagnant_Shadow_Icicle": "Shape of Icicle",
"Stagnant_Shadow_Doom": "Shape of Doom",
"Cavern_of_Corrosion_Path_of_Gelid_Wind": "Cavern of Corrosion: Path of Gelid Wind",
"Cavern_of_Corrosion_Path_of_Jabbing_Punch": "Cavern of Corrosion: Path of Jabbing Punch",
"Cavern_of_Corrosion_Path_of_Drifting": "Cavern of Corrosion: Path of Drifting",
"Cavern_of_Corrosion_Path_of_Providence": "Cavern of Corrosion: Path of Providence",
"Cavern_of_Corrosion_Path_of_Holy_Hymn": "Cavern of Corrosion: Path of Holy Hymn",
"Cavern_of_Corrosion_Path_of_Conflagration": "Cavern of Corrosion: Path of Conflagration"
},
"Team": {
"name": "Dungeon Team",
"help": "",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6"
}
},
"Gui": {

View File

@ -3,6 +3,10 @@
"Alas": {
"name": "Menu.Alas.name",
"help": "Menu.Alas.help"
},
"Daily": {
"name": "Menu.Daily.name",
"help": "Menu.Daily.help"
}
},
"Task": {
@ -13,6 +17,10 @@
"Restart": {
"name": "再起動設定",
"help": ""
},
"Dungeon": {
"name": "Task.Dungeon.name",
"help": "Task.Dungeon.help"
}
},
"Scheduler": {
@ -155,14 +163,49 @@
"close_game": "close_game"
}
},
"Storage": {
"Dungeon": {
"_info": {
"name": "Storage._info.name",
"help": "Storage._info.help"
"name": "Dungeon._info.name",
"help": "Dungeon._info.help"
},
"Storage": {
"name": "Storage.Storage.name",
"help": "Storage.Storage.help"
"Name": {
"name": "Dungeon.Name.name",
"help": "Dungeon.Name.help",
"Calyx_Golden_Memories": "疑似花萼(金)・回憶の蕾",
"Calyx_Golden_Aether": "疑似花萼(金)・エーテルの蕾",
"Calyx_Golden_Treasures": "疑似花萼(金)・秘蔵の蕾",
"Calyx_Crimson_Destruction": "疑似花萼(赤)・壊滅の蕾",
"Calyx_Crimson_Preservation": "疑似花萼(赤)・存護の蕾",
"Calyx_Crimson_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": "侵蝕トンネル・野焔の路"
},
"Team": {
"name": "Dungeon.Team.name",
"help": "Dungeon.Team.help",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6"
}
},
"Gui": {

View File

@ -3,6 +3,10 @@
"Alas": {
"name": "SRC",
"help": ""
},
"Daily": {
"name": "每日",
"help": ""
}
},
"Task": {
@ -13,6 +17,10 @@
"Restart": {
"name": "异常处理",
"help": ""
},
"Dungeon": {
"name": "每日副本",
"help": ""
}
},
"Scheduler": {
@ -155,14 +163,49 @@
"close_game": "关闭游戏"
}
},
"Storage": {
"Dungeon": {
"_info": {
"name": "任务状态",
"help": "存放任务内部状态,任务异常时可以手动清除"
"name": "每日副本设置",
"help": "打本清体力直到清空"
},
"Storage": {
"name": "Storage.Storage.name",
"help": "Storage.Storage.help"
"Name": {
"name": "副本名称",
"help": "",
"Calyx_Golden_Memories": "回忆之蕾•拟造花萼(金)",
"Calyx_Golden_Aether": "以太之蕾•拟造花萼(金)",
"Calyx_Golden_Treasures": "藏珍之蕾•拟造花萼(金)",
"Calyx_Crimson_Destruction": "毁灭之蕾•拟造花萼(赤)",
"Calyx_Crimson_Preservation": "存护之蕾•拟造花萼(赤)",
"Calyx_Crimson_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": "野焰之径•侵蚀隧洞"
},
"Team": {
"name": "打本队伍",
"help": "",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6"
}
},
"Gui": {

View File

@ -3,6 +3,10 @@
"Alas": {
"name": "SRC",
"help": ""
},
"Daily": {
"name": "每日",
"help": ""
}
},
"Task": {
@ -13,6 +17,10 @@
"Restart": {
"name": "除錯",
"help": ""
},
"Dungeon": {
"name": "每日副本",
"help": ""
}
},
"Scheduler": {
@ -155,14 +163,49 @@
"close_game": "關閉遊戲"
}
},
"Storage": {
"Dungeon": {
"_info": {
"name": "任務狀態",
"help": "存放任務內部狀態,任務异常時可以手動清除"
"name": "每日副本設定",
"help": "打本清體力直到清空"
},
"Storage": {
"name": "Storage.Storage.name",
"help": "Storage.Storage.help"
"Name": {
"name": "副本名稱",
"help": "",
"Calyx_Golden_Memories": "回憶之蕾•擬造花萼(金)",
"Calyx_Golden_Aether": "乙太之蕾•擬造花萼(金)",
"Calyx_Golden_Treasures": "藏珍之蕾•擬造花萼(金)",
"Calyx_Crimson_Destruction": "毀滅之蕾•擬造花萼(赤)",
"Calyx_Crimson_Preservation": "存護之蕾•擬造花萼(赤)",
"Calyx_Crimson_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": "野焰之徑•侵蝕隧洞"
},
"Team": {
"name": "打本隊伍",
"help": "",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6"
}
},
"Gui": {

View File

@ -107,7 +107,7 @@ class Keyword:
instances: ClassVar = {}
```
"""
# Key: instance ID. Value: instance object.
instances: ClassVar = {}
def __post_init__(self):

View File

@ -42,6 +42,14 @@ class DungeonList(Keyword):
def is_Simulated_Universe(self):
return 'Simulated_Universe' in self.name
@property
def is_daily_dungeon(self):
return self.is_Calyx_Golden or self.is_Calyx_Crimson or self.is_Stagnant_Shadow or self.is_Cavern_of_Corrosion
@property
def is_weekly_dungeon(self):
return self.is_Echo_of_War
@dataclass(repr=False)
class DungeonEntrance(Keyword):