Add: unrecorded preset option

This commit is contained in:
Hengyu 2023-08-23 03:00:45 +08:00
parent 8c0ea40c76
commit 97ff1c8554
13 changed files with 225 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -90,10 +90,13 @@
"Bonus": "Blessing Cosmos", "Bonus": "Blessing Cosmos",
"PresetResonanceFilter": "preset-1", "PresetResonanceFilter": "preset-1",
"CustomResonanceFilter": "回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞", "CustomResonanceFilter": "回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞",
"ResonanceSelectionStrategy": "follow-presets",
"PresetBlessingFilter": "preset-1", "PresetBlessingFilter": "preset-1",
"CustomBlessingFilter": "巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random", "CustomBlessingFilter": "巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random",
"BlessingSelectionStrategy": "follow-presets",
"PresetCurioFilter": "preset-1", "PresetCurioFilter": "preset-1",
"CustomCurioFilter": "博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random" "CustomCurioFilter": "博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random",
"CurioSelectionStrategy": "follow-presets"
} }
} }
} }

View File

@ -490,6 +490,15 @@
"type": "textarea", "type": "textarea",
"value": "回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞" "value": "回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞"
}, },
"ResonanceSelectionStrategy": {
"type": "select",
"value": "follow-presets",
"option": [
"follow-presets",
"unrecorded-first",
"before-random"
]
},
"PresetBlessingFilter": { "PresetBlessingFilter": {
"type": "select", "type": "select",
"value": "preset-1", "value": "preset-1",
@ -502,6 +511,15 @@
"type": "textarea", "type": "textarea",
"value": "巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random" "value": "巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random"
}, },
"BlessingSelectionStrategy": {
"type": "select",
"value": "follow-presets",
"option": [
"follow-presets",
"unrecorded-first",
"before-random"
]
},
"PresetCurioFilter": { "PresetCurioFilter": {
"type": "select", "type": "select",
"value": "preset-1", "value": "preset-1",
@ -513,6 +531,15 @@
"CustomCurioFilter": { "CustomCurioFilter": {
"type": "textarea", "type": "textarea",
"value": "博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random" "value": "博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random"
},
"CurioSelectionStrategy": {
"type": "select",
"value": "follow-presets",
"option": [
"follow-presets",
"unrecorded-first",
"before-random"
]
} }
} }
} }

View File

@ -127,14 +127,24 @@ Rogue:
> 回响构音:射不主皮 > 回响构音:柘弓危矢 > 回响构音:射不主皮 > 回响构音:柘弓危矢
> 回响构音:激变变星 > 回响构音:极端氦闪 > 回响构音:激变变星 > 回响构音:极端氦闪
> 回响构音:末日狂欢 > 回响构音:树苗长高舞 > 回响构音:末日狂欢 > 回响构音:树苗长高舞
ResonanceSelectionStrategy:
value: follow-presets
option: [ follow-presets, unrecorded-first, before-random ]
PresetBlessingFilter: PresetBlessingFilter:
value: preset-1 value: preset-1
option: [ preset-1, custom ] option: [ preset-1, custom ]
CustomBlessingFilter: |- CustomBlessingFilter: |-
巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3
> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random > 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random
BlessingSelectionStrategy:
value: follow-presets
option: [ follow-presets, unrecorded-first, before-random ]
PresetCurioFilter: PresetCurioFilter:
value: preset-1 value: preset-1
option: [ preset-1, custom ] option: [ preset-1, custom ]
CustomCurioFilter: |- CustomCurioFilter: |-
博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random 博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random
CurioSelectionStrategy:
value: follow-presets
option: [ follow-presets, unrecorded-first, before-random ]

View File

@ -57,7 +57,10 @@ class GeneratedConfig:
Rogue_Bonus = 'Blessing Cosmos' # Blessing Cosmos, Miracle Cosmos, Fragmented Cosmos Rogue_Bonus = 'Blessing Cosmos' # Blessing Cosmos, Miracle Cosmos, Fragmented Cosmos
Rogue_PresetResonanceFilter = 'preset-1' # preset-1, custom Rogue_PresetResonanceFilter = 'preset-1' # preset-1, custom
Rogue_CustomResonanceFilter = '回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞' Rogue_CustomResonanceFilter = '回响构音:均晶转变 > 回响构音:零维强化\n> 回响构音:第二次初恋 > 回响构音:体验的富翁\n> 回响构音:局外人 > 回响构音:怀疑的四重根\n> 回响构音:诸法无我 > 回响构音:诸行无常\n> 回响构音:射不主皮 > 回响构音:柘弓危矢\n> 回响构音:激变变星 > 回响构音:极端氦闪\n> 回响构音:末日狂欢 > 回响构音:树苗长高舞'
Rogue_ResonanceSelectionStrategy = 'follow-presets' # follow-presets, unrecorded-first, before-random
Rogue_PresetBlessingFilter = 'preset-1' # preset-1, custom Rogue_PresetBlessingFilter = 'preset-1' # preset-1, custom
Rogue_CustomBlessingFilter = '巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random' Rogue_CustomBlessingFilter = '巡猎-3 > 《冠军晚餐·猫的摇篮》 > 丰饶众生,一法界心 > 毁灭-3 \n> 火堆外的夜 > 巡猎-2 > 毁灭-2 > 巡猎 > reset > random'
Rogue_BlessingSelectionStrategy = 'follow-presets' # follow-presets, unrecorded-first, before-random
Rogue_PresetCurioFilter = 'preset-1' # preset-1, custom Rogue_PresetCurioFilter = 'preset-1' # preset-1, custom
Rogue_CustomCurioFilter = '博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random' Rogue_CustomCurioFilter = '博士之袍 > 福灵胶 > 分裂金币 > 信仰债券 > 换境桂冠 > 俱乐部券 > 碎星芳饵 > random'
Rogue_CurioSelectionStrategy = 'follow-presets' # follow-presets, unrecorded-first, before-random

View File

@ -400,6 +400,13 @@
"name": "Custom Resonance Filter", "name": "Custom Resonance Filter",
"help": "" "help": ""
}, },
"ResonanceSelectionStrategy": {
"name": "Resonance Selection Strategy",
"help": "",
"follow-presets": "Follow presets",
"unrecorded-first": "Choose index locked resonance first",
"before-random": "Follow presets, but choose index locked one first when filter goes to randomly choose"
},
"PresetBlessingFilter": { "PresetBlessingFilter": {
"name": "Preset Blessing Filter", "name": "Preset Blessing Filter",
"help": "", "help": "",
@ -410,6 +417,13 @@
"name": "Custom Blessing Filter", "name": "Custom Blessing Filter",
"help": "" "help": ""
}, },
"BlessingSelectionStrategy": {
"name": "Blessing jSelection Strategy",
"help": "",
"follow-presets": "Follow presets",
"unrecorded-first": "Choose index locked blessing first",
"before-random": "Follow presets, but choose index locked one first when filter goes to randomly choose"
},
"PresetCurioFilter": { "PresetCurioFilter": {
"name": "Preset Curio Filter", "name": "Preset Curio Filter",
"help": "", "help": "",
@ -419,6 +433,13 @@
"CustomCurioFilter": { "CustomCurioFilter": {
"name": "Custom Curio Filter", "name": "Custom Curio Filter",
"help": "" "help": ""
},
"CurioSelectionStrategy": {
"name": "Curio Selection Strategy",
"help": "",
"follow-presets": "Follow presets",
"unrecorded-first": "Choose index locked curio first",
"before-random": "Follow presets, but choose index locked one first when filter goes to randomly choose"
} }
}, },
"Gui": { "Gui": {

View File

@ -400,6 +400,13 @@
"name": "Rogue.CustomResonanceFilter.name", "name": "Rogue.CustomResonanceFilter.name",
"help": "Rogue.CustomResonanceFilter.help" "help": "Rogue.CustomResonanceFilter.help"
}, },
"ResonanceSelectionStrategy": {
"name": "Rogue.ResonanceSelectionStrategy.name",
"help": "Rogue.ResonanceSelectionStrategy.help",
"follow-presets": "follow-presets",
"unrecorded-first": "unrecorded-first",
"before-random": "before-random"
},
"PresetBlessingFilter": { "PresetBlessingFilter": {
"name": "Rogue.PresetBlessingFilter.name", "name": "Rogue.PresetBlessingFilter.name",
"help": "Rogue.PresetBlessingFilter.help", "help": "Rogue.PresetBlessingFilter.help",
@ -410,6 +417,13 @@
"name": "Rogue.CustomBlessingFilter.name", "name": "Rogue.CustomBlessingFilter.name",
"help": "Rogue.CustomBlessingFilter.help" "help": "Rogue.CustomBlessingFilter.help"
}, },
"BlessingSelectionStrategy": {
"name": "Rogue.BlessingSelectionStrategy.name",
"help": "Rogue.BlessingSelectionStrategy.help",
"follow-presets": "follow-presets",
"unrecorded-first": "unrecorded-first",
"before-random": "before-random"
},
"PresetCurioFilter": { "PresetCurioFilter": {
"name": "Rogue.PresetCurioFilter.name", "name": "Rogue.PresetCurioFilter.name",
"help": "Rogue.PresetCurioFilter.help", "help": "Rogue.PresetCurioFilter.help",
@ -419,6 +433,13 @@
"CustomCurioFilter": { "CustomCurioFilter": {
"name": "Rogue.CustomCurioFilter.name", "name": "Rogue.CustomCurioFilter.name",
"help": "Rogue.CustomCurioFilter.help" "help": "Rogue.CustomCurioFilter.help"
},
"CurioSelectionStrategy": {
"name": "Rogue.CurioSelectionStrategy.name",
"help": "Rogue.CurioSelectionStrategy.help",
"follow-presets": "follow-presets",
"unrecorded-first": "unrecorded-first",
"before-random": "before-random"
} }
}, },
"Gui": { "Gui": {

View File

@ -391,15 +391,22 @@
"Fragmented Cosmos": "破碎宇宙(获得宇宙碎片)" "Fragmented Cosmos": "破碎宇宙(获得宇宙碎片)"
}, },
"PresetResonanceFilter": { "PresetResonanceFilter": {
"name": "命途回响过滤器", "name": "回响构音过滤器",
"help": "", "help": "",
"preset-1": "预设 1", "preset-1": "预设 1",
"custom": "自定义" "custom": "自定义"
}, },
"CustomResonanceFilter": { "CustomResonanceFilter": {
"name": "自定义命途回响过滤器", "name": "自定义回响构音过滤器",
"help": "" "help": ""
}, },
"ResonanceSelectionStrategy": {
"name": "回响构音选择策略",
"help": "",
"follow-presets": "遵循预设",
"unrecorded-first": "优先选择图鉴未解锁的回响构音",
"before-random": "遵循预设,但选择\"图鉴未解锁\"的优先级高于\"随机选择\""
},
"PresetBlessingFilter": { "PresetBlessingFilter": {
"name": "祝福过滤器", "name": "祝福过滤器",
"help": "", "help": "",
@ -410,6 +417,13 @@
"name": "自定义祝福过滤器", "name": "自定义祝福过滤器",
"help": "" "help": ""
}, },
"BlessingSelectionStrategy": {
"name": "祝福选择策略",
"help": "",
"follow-presets": "遵循预设",
"unrecorded-first": "优先选择图鉴未解锁的祝福",
"before-random": "遵循预设,但选择\"图鉴未解锁\"的优先级高于\"随机选择\""
},
"PresetCurioFilter": { "PresetCurioFilter": {
"name": "奇物过滤器", "name": "奇物过滤器",
"help": "", "help": "",
@ -419,6 +433,13 @@
"CustomCurioFilter": { "CustomCurioFilter": {
"name": "自定义祝福过滤器", "name": "自定义祝福过滤器",
"help": "" "help": ""
},
"CurioSelectionStrategy": {
"name": "奇物选择策略",
"help": "",
"follow-presets": "遵循预设",
"unrecorded-first": "优先选择图鉴未解锁的奇物",
"before-random": "遵循预设,但选择\"图鉴未解锁\"的优先级高于\"随机选择\""
} }
}, },
"Gui": { "Gui": {

View File

@ -391,15 +391,22 @@
"Fragmented Cosmos": "破碎宇宙(獲得宇宙碎片)" "Fragmented Cosmos": "破碎宇宙(獲得宇宙碎片)"
}, },
"PresetResonanceFilter": { "PresetResonanceFilter": {
"name": "命途迴響过滤器", "name": "迴響構音过滤器",
"help": "", "help": "",
"preset-1": "預設 1", "preset-1": "預設 1",
"custom": "自訂" "custom": "自訂"
}, },
"CustomResonanceFilter": { "CustomResonanceFilter": {
"name": "自訂命途迴響过滤器", "name": "自訂迴響構音过滤器",
"help": "" "help": ""
}, },
"ResonanceSelectionStrategy": {
"name": "迴響構音選擇策略",
"help": "",
"follow-presets": "遵循預設",
"unrecorded-first": "優先選擇圖鑑未解鎖的迴響構音",
"before-random": "遵循預設,但選擇\"圖鑑未解鎖\"的優先級高於\"隨機選擇\""
},
"PresetBlessingFilter": { "PresetBlessingFilter": {
"name": "祝福过滤器", "name": "祝福过滤器",
"help": "", "help": "",
@ -410,6 +417,13 @@
"name": "自訂祝福过滤器", "name": "自訂祝福过滤器",
"help": "" "help": ""
}, },
"BlessingSelectionStrategy": {
"name": "祝福選擇策略",
"help": "",
"follow-presets": "遵循預設",
"unrecorded-first": "優先選擇圖鑑未解鎖的祝福",
"before-random": "遵循預設,但選擇\"圖鑑未解鎖\"的優先級高於\"隨機選擇\""
},
"PresetCurioFilter": { "PresetCurioFilter": {
"name": "奇物过滤器", "name": "奇物过滤器",
"help": "", "help": "",
@ -419,6 +433,13 @@
"CustomCurioFilter": { "CustomCurioFilter": {
"name": "自訂奇物过滤器", "name": "自訂奇物过滤器",
"help": "" "help": ""
},
"CurioSelectionStrategy": {
"name": "奇物選擇策略",
"help": "",
"follow-presets": "遵循預設",
"unrecorded-first": "優先選擇圖鑑未解鎖的奇物",
"before-random": "遵循預設,但選擇\"圖鑑未解鎖\"的優先級高於\"隨機選擇\""
} }
}, },
"Gui": { "Gui": {

View File

@ -33,6 +33,16 @@ COSMIC_FRAGMENT = ButtonWrapper(
button=(1146, 19, 1181, 55), button=(1146, 19, 1181, 55),
), ),
) )
FLAG_UNRECORD = ButtonWrapper(
name='FLAG_UNRECORD',
share=Button(
file='./assets/share/rogue/ui/FLAG_UNRECORD.png',
area=(746, 149, 778, 181),
search=(726, 129, 798, 201),
color=(133, 130, 161),
button=(746, 149, 778, 181),
),
)
OCR_COSMIC_FRAGMENT = ButtonWrapper( OCR_COSMIC_FRAGMENT = ButtonWrapper(
name='OCR_COSMIC_FRAGMENT', name='OCR_COSMIC_FRAGMENT',
share=Button( share=Button(

View File

@ -43,7 +43,7 @@ pattern += enhancement_regex
BLESSING_FILTER_ATTR += (ENHANCEMENT_ATTR_NAME,) BLESSING_FILTER_ATTR += (ENHANCEMENT_ATTR_NAME,)
FILETER_REGEX = re.compile(pattern) FILETER_REGEX = re.compile(pattern)
BLESSING_FILTER_PRESET = ("reset", "random") BLESSING_FILTER_PRESET = ("reset", "random", "unrecorded")
BLESSING_FILTER = MultiLangFilter(FILETER_REGEX, BLESSING_FILTER_ATTR, BLESSING_FILTER_PRESET) BLESSING_FILTER = MultiLangFilter(FILETER_REGEX, BLESSING_FILTER_ATTR, BLESSING_FILTER_PRESET)
# resonance filter # resonance filter
@ -51,12 +51,13 @@ RESONANCE_ATTR_NAME = 'resonance_name'
pattern = get_regex_from_keyword_name(RogueResonance, RESONANCE_ATTR_NAME) pattern = get_regex_from_keyword_name(RogueResonance, RESONANCE_ATTR_NAME)
FILETER_REGEX = re.compile(pattern) FILETER_REGEX = re.compile(pattern)
RESONANCE_FILTER_PRESET = ("random",) RESONANCE_FILTER_PRESET = ("random", "unrecorded")
RESONANCE_FILTER = MultiLangFilter(FILETER_REGEX, (RESONANCE_ATTR_NAME,), RESONANCE_FILTER_PRESET) RESONANCE_FILTER = MultiLangFilter(FILETER_REGEX, (RESONANCE_ATTR_NAME,), RESONANCE_FILTER_PRESET)
class RogueBuffOcr(Ocr): class RogueBuffOcr(Ocr):
merge_thres_y = 40 merge_thres_x = 40
merge_thres_y = 20
def after_process(self, result): def after_process(self, result):
result = super().after_process(result) result = super().after_process(result)
@ -64,9 +65,9 @@ class RogueBuffOcr(Ocr):
replace_pattern_dict = { replace_pattern_dict = {
"蓬失": "蓬矢", "蓬失": "蓬矢",
"柘弓危失": "柘弓危矢", "柘弓危失": "柘弓危矢",
"飞虹凿齿": "飞虹诛凿齿", "飞虹珠??齿": "飞虹诛凿齿",
"天培步危": "天棓步危", "天培步危": "天棓步危",
"云[摘销]?逐步离": "云镝逐步离", "云[摘销]?逐步离": "云镝逐步离",
"制桑": "制穹桑", "制桑": "制穹桑",
"乌号基": "乌号綦", "乌号基": "乌号綦",
"追摩物": "追孽物", "追摩物": "追孽物",
@ -83,7 +84,7 @@ class RogueBuffOcr(Ocr):
"虚安供品": "虚妄供品", "虚安供品": "虚妄供品",
"原初的苦$": "原初的苦衷", "原初的苦$": "原初的苦衷",
"厌离邪苦": "厌离邪秽苦", "厌离邪苦": "厌离邪秽苦",
r".*繁.*": "葳蕤繁祉,延彼遐龄" r".*繁.*": "葳蕤繁祉,延彼遐龄",
} }
for pat, replace in replace_pattern_dict.items(): for pat, replace in replace_pattern_dict.items():
result = re.sub(pat, replace, result) result = re.sub(pat, replace, result)
@ -257,20 +258,45 @@ class RogueBlessingSelector(RogueSelector):
return True return True
def load_filter(self): def load_filter(self):
filter_ = None
keyword = self.ocr_results[0].matched_keyword keyword = self.ocr_results[0].matched_keyword
if isinstance(keyword, RogueBlessing): if not isinstance(keyword, (RogueBlessing, RogueResonance)):
filter_ = BLESSING_FILTER return
if self.main.config.Rogue_PresetBlessingFilter == 'preset-1': filter_configs = {
filter_.load(parse_name(BLESSING_PRESET_1)) RogueBlessing: {
if self.main.config.Rogue_PresetBlessingFilter == 'custom': "filter_": BLESSING_FILTER,
filter_.load(parse_name(self.main.config.Rogue_CustomBlessingFilter)) "preset_config": self.main.config.Rogue_PresetBlessingFilter,
if isinstance(keyword, RogueResonance): "strategy_config": self.main.config.Rogue_BlessingSelectionStrategy,
filter_ = RESONANCE_FILTER "preset_values": {
if self.main.config.Rogue_PresetResonanceFilter == 'preset-1': 'preset-1': BLESSING_PRESET_1,
RESONANCE_FILTER.load(parse_name(RESONANCE_PRESET_1)) 'custom': self.main.config.Rogue_CustomBlessingFilter
if self.main.config.Rogue_PresetResonanceFilter == 'custom': },
RESONANCE_FILTER.load(parse_name(self.main.config.Rogue_CustomResonanceFilter)) },
RogueResonance: {
"filter_": RESONANCE_FILTER,
"preset_config": self.main.config.Rogue_PresetResonanceFilter,
"strategy_config": self.main.config.Rogue_ResonanceSelectionStrategy,
"preset_values": {
'preset-1': RESONANCE_PRESET_1,
'custom': self.main.config.Rogue_PresetResonanceFilter,
},
}
}
# preset
config = filter_configs[type(keyword)]
filter_ = config['filter_']
preset_config = config['preset_config']
preset_values = config['preset_values']
string = preset_values[preset_config]
string = parse_name(string)
# strategy
strategy_config = config['strategy_config']
if strategy_config == 'unrecorded-first':
string = "unrecorded > " + string
if strategy_config == 'before-random':
string = string.replace('random', 'unrecorded > random')
filter_.load(string)
self.filter_ = filter_ self.filter_ = filter_
def try_select(self, option: OcrResultButton | str): def try_select(self, option: OcrResultButton | str):
@ -283,6 +309,12 @@ class RogueBlessingSelector(RogueSelector):
choose = np.random.choice(self.ocr_results) choose = np.random.choice(self.ocr_results)
self.ui_select(choose) self.ui_select(choose)
return True return True
if option.lower() == 'unrecorded':
for result in self.ocr_results:
if self.main.is_unrecorded(result, (0, -720, 300, 0)):
self.ui_select(result)
return True
return False
if isinstance(option, OcrResultButton): if isinstance(option, OcrResultButton):
self.ui_select(option) self.ui_select(option)

View File

@ -18,7 +18,7 @@ CURIO_FILTER_ATTR = tuple()
CURIO_ATTR_NAME = 'curio_name' CURIO_ATTR_NAME = 'curio_name'
pattern = get_regex_from_keyword_name(RogueCurio, CURIO_ATTR_NAME) pattern = get_regex_from_keyword_name(RogueCurio, CURIO_ATTR_NAME)
CURIO_FILTER_ATTR += (CURIO_ATTR_NAME,) CURIO_FILTER_ATTR += (CURIO_ATTR_NAME,)
CURIO_FILTER_PRESET = ('random',) CURIO_FILTER_PRESET = ('random', 'unrecorded')
FILTER_REGEX = re.compile(pattern) FILTER_REGEX = re.compile(pattern)
CURIO_FILTER = MultiLangFilter(FILTER_REGEX, CURIO_FILTER_ATTR, CURIO_FILTER_PRESET) CURIO_FILTER = MultiLangFilter(FILTER_REGEX, CURIO_FILTER_ATTR, CURIO_FILTER_PRESET)
@ -104,6 +104,13 @@ class RogueCurioSelector(RogueSelector):
target = np.random.choice(self.ocr_results) target = np.random.choice(self.ocr_results)
self.ui_select(target) self.ui_select(target)
return True return True
if option == 'unrecorded':
for result in self.ocr_results:
if self.main.is_unrecorded(result, (0, -720, 300, 0)):
self.ui_select(result)
return True
return False
if isinstance(option, OcrResultButton): if isinstance(option, OcrResultButton):
self.ui_select(option) self.ui_select(option)
return True return True
@ -111,8 +118,19 @@ class RogueCurioSelector(RogueSelector):
def load_filter(self): def load_filter(self):
filter_ = CURIO_FILTER filter_ = CURIO_FILTER
if self.main.config.Rogue_PresetCurioFilter == 'preset-1': string = ""
filter_.load(parse_name(CURIO_PRESET_1)) match self.main.config.Rogue_PresetCurioFilter:
if self.main.config.Rogue_PresetCurioFilter == 'custom': case 'preset-1':
filter_.load(parse_name(self.main.config.Rogue_CustomCurioFilter)) string = CURIO_PRESET_1
case 'custom':
string = self.main.config.Rogue_CustomCurioFilter
string = parse_name(string)
match self.main.config.Rogue_CurioSelectionStrategy:
case 'unrecorded-first':
string = 'unrecorded > ' + string
case 'before-random':
string = string.replace('random', 'unrecorded > random')
filter_.load(string)
self.filter_ = filter_ self.filter_ = filter_

View File

@ -1,6 +1,7 @@
import re import re
from module.ocr.ocr import Digit, Ocr from module.base.utils import area_offset
from module.ocr.ocr import Digit, Ocr, OcrResultButton
from tasks.base.ui import UI from tasks.base.ui import UI
from tasks.rogue.assets.assets_rogue_ui import * from tasks.rogue.assets.assets_rogue_ui import *
from tasks.rogue.keywords import * from tasks.rogue.keywords import *
@ -42,3 +43,10 @@ class RogueUI(UI):
def is_page_event(self): def is_page_event(self):
return self.appear(PAGE_EVENT) return self.appear(PAGE_EVENT)
def is_unrecorded(self, target: OcrResultButton, relative_area):
"""
To check a rogue keyword is not record in game index by finding template
"""
FLAG_UNRECORD.matched_button.search = area_offset(relative_area, target.area[:2])
return self.appear(FLAG_UNRECORD)