feat(task): 培育开始时若 AP 不足自动使用饮料
This commit is contained in:
parent
c56f9c128f
commit
3585d5ff99
|
@ -0,0 +1 @@
|
|||
{"definitions":{"cfc9c8e8-cbe1-49f0-9afa-ead7f9455a2e":{"name":"Produce.ButtonUse","displayName":"按钮「使う」","type":"template","annotationId":"cfc9c8e8-cbe1-49f0-9afa-ead7f9455a2e","useHintRect":false,"description":"用于培育开始时,AP 不足对话框中的使用饮料按钮"}},"annotations":[{"id":"cfc9c8e8-cbe1-49f0-9afa-ead7f9455a2e","type":"rect","data":{"x1":546,"y1":929,"x2":595,"y2":954}}]}
|
Binary file not shown.
After Width: | Height: | Size: 237 KiB |
|
@ -366,6 +366,10 @@ class ProduceConfig(ConfigBaseModel):
|
|||
|
||||
严格模式下,识别速度会降低,但识别准确率会提高。
|
||||
"""
|
||||
use_ap_drink: bool = False
|
||||
"""
|
||||
AP 不足时自动使用 AP 饮料
|
||||
"""
|
||||
|
||||
class MissionRewardConfig(ConfigBaseModel):
|
||||
enabled: bool = False
|
||||
|
|
|
@ -195,9 +195,27 @@ def do_produce(
|
|||
.until(R.Produce.TextAPInsufficient, result=False)
|
||||
).run()
|
||||
if not result:
|
||||
logger.info('AP insufficient. Exiting produce.')
|
||||
device.click(image.expect_wait(R.InPurodyuusu.ButtonCancel))
|
||||
return False
|
||||
if conf().produce.use_ap_drink:
|
||||
# [kotonebot-resource\sprites\jp\produce\screenshot_no_enough_ap_1.png]
|
||||
# [kotonebot-resource\sprites\jp\produce\screenshot_no_enough_ap_2.png]
|
||||
# [kotonebot-resource\sprites\jp\produce\screenshot_no_enough_ap_3.png]
|
||||
logger.info('AP insufficient. Try to use AP drink.')
|
||||
it = Interval()
|
||||
while True:
|
||||
if image.find(R.Produce.ButtonUse):
|
||||
device.click()
|
||||
elif image.find(R.Produce.ButtonRefillAP):
|
||||
device.click()
|
||||
elif ocr.find(contains(mode_text)):
|
||||
device.click()
|
||||
elif image.find(R.Produce.ButtonPIdolOverview):
|
||||
break
|
||||
device.screenshot()
|
||||
it.wait()
|
||||
else:
|
||||
logger.info('AP insufficient. Exiting produce.')
|
||||
device.click(image.expect_wait(R.InPurodyuusu.ButtonCancel))
|
||||
return False
|
||||
# 1. 选择 PIdol [screenshots/produce/select_p_idol.png]
|
||||
select_idol(idol_skin_id)
|
||||
device.click(image.expect_wait(R.Common.ButtonNextNoIcon))
|
||||
|
|
|
@ -265,6 +265,7 @@ class KotoneBotUI:
|
|||
prefer_lesson_ap: bool,
|
||||
actions_order: List[str],
|
||||
recommend_card_detection_mode: str,
|
||||
use_ap_drink: bool,
|
||||
mission_reward_enabled: bool,
|
||||
# club reward
|
||||
club_reward_enabled: bool,
|
||||
|
@ -341,7 +342,8 @@ class KotoneBotUI:
|
|||
self_study_lesson=self_study_lesson,
|
||||
prefer_lesson_ap=prefer_lesson_ap,
|
||||
actions_order=[ProduceAction(action) for action in actions_order],
|
||||
recommend_card_detection_mode=RecommendCardDetectionMode(recommend_card_detection_mode)
|
||||
recommend_card_detection_mode=RecommendCardDetectionMode(recommend_card_detection_mode),
|
||||
use_ap_drink=use_ap_drink
|
||||
),
|
||||
mission_reward=MissionRewardConfig(
|
||||
enabled=mission_reward_enabled
|
||||
|
@ -743,8 +745,6 @@ class KotoneBotUI:
|
|||
info="设置每周行动的优先级顺序",
|
||||
multiselect=True
|
||||
)
|
||||
|
||||
# 添加推荐卡检测模式设置
|
||||
recommend_card_detection_mode = gr.Dropdown(
|
||||
choices=[
|
||||
(RecommendCardDetectionMode.NORMAL.display_name, RecommendCardDetectionMode.NORMAL.value),
|
||||
|
@ -754,6 +754,11 @@ class KotoneBotUI:
|
|||
label="推荐卡检测模式",
|
||||
info=ProduceConfig.model_fields['recommend_card_detection_mode'].description
|
||||
)
|
||||
use_ap_drink = gr.Checkbox(
|
||||
label="AP 不足时自动使用 AP 饮料",
|
||||
value=self.current_config.options.produce.use_ap_drink,
|
||||
info=ProduceConfig.model_fields['use_ap_drink'].description
|
||||
)
|
||||
recommend_card_detection_mode.change(
|
||||
fn=update_kotone_warning,
|
||||
inputs=[produce_idols, recommend_card_detection_mode],
|
||||
|
@ -776,7 +781,7 @@ class KotoneBotUI:
|
|||
inputs=[auto_set_memory],
|
||||
outputs=[memory_sets_group]
|
||||
)
|
||||
return produce_enabled, produce_mode, produce_count, produce_idols, memory_sets, auto_set_memory, auto_set_support, use_pt_boost, use_note_boost, follow_producer, self_study_lesson, prefer_lesson_ap, actions_order, recommend_card_detection_mode
|
||||
return produce_enabled, produce_mode, produce_count, produce_idols, memory_sets, auto_set_memory, auto_set_support, use_pt_boost, use_note_boost, follow_producer, self_study_lesson, prefer_lesson_ap, actions_order, recommend_card_detection_mode, use_ap_drink
|
||||
|
||||
def _create_club_reward_settings(self) -> Tuple[gr.Checkbox, gr.Dropdown]:
|
||||
with gr.Column():
|
||||
|
|
Loading…
Reference in New Issue