feat(task): 新增升级一张低等级支援卡的任务
This commit is contained in:
parent
7dca24a7a2
commit
a0216ba86d
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -430,6 +430,10 @@ class ClubRewardConfig(ConfigBaseModel):
|
|||
selected_note: DailyMoneyShopItems = DailyMoneyShopItems.AnomalyNoteVisual
|
||||
"""想在社团奖励中获取到的笔记"""
|
||||
|
||||
class UpgradeSupportCardConfig(ConfigBaseModel):
|
||||
enabled: bool = False
|
||||
"""是否启用支援卡升级"""
|
||||
|
||||
class TraceConfig(ConfigBaseModel):
|
||||
recommend_card_detection: bool = False
|
||||
"""跟踪推荐卡检测"""
|
||||
|
@ -472,6 +476,9 @@ class BaseConfig(ConfigBaseModel):
|
|||
club_reward: ClubRewardConfig = ClubRewardConfig()
|
||||
"""领取社团奖励配置"""
|
||||
|
||||
upgrade_support_card: UpgradeSupportCardConfig = UpgradeSupportCardConfig()
|
||||
"""支援卡升级配置"""
|
||||
|
||||
trace: TraceConfig = TraceConfig()
|
||||
"""跟踪配置"""
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
"""升级一张支援卡,优先升级低等级支援卡"""
|
||||
import logging
|
||||
|
||||
from kotonebot import task, device, image, sleep
|
||||
from . import R
|
||||
from .common import conf
|
||||
from .actions.scenes import at_home, goto_home
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@task('升级一张低等级支援卡')
|
||||
def upgrade_support_card():
|
||||
"""
|
||||
升级一张支援卡,优先升级低等级支援卡
|
||||
|
||||
自动化思路是这样的:
|
||||
进入支援卡页面后,一直往下滑,滑倒底部(低等级支援卡区域);
|
||||
然后点击左上角第一张支援卡,将左上角第一张支援卡提升一级。
|
||||
"""
|
||||
|
||||
if not conf().upgrade_support_card.enabled:
|
||||
logger.info('"Upgrade support card" is disabled.')
|
||||
return
|
||||
|
||||
if not at_home():
|
||||
goto_home()
|
||||
|
||||
# 进入支援卡页面
|
||||
logger.info('Entering Support Card page')
|
||||
device.click(image.expect_wait(R.Common.ButtonIdol, timeout=5))
|
||||
device.click(image.expect_wait(R.Common.ButtonIdolSupportCard, timeout=5))
|
||||
sleep(2)
|
||||
|
||||
# TODO: 将下面硬编码的值塞到合适的地方
|
||||
|
||||
# 往下滑,划到最底部
|
||||
for _ in range(5):
|
||||
device.swipe_scaled(0.50, 0.67, 0.50, 0.42, duration=1.0)
|
||||
sleep(1.5)
|
||||
|
||||
# 点击左上角第一张支援卡
|
||||
# 点击位置百分比: (0.18, 0.34)
|
||||
# 720p缩放后的位置: (130, 435)
|
||||
for _ in range(2):
|
||||
device.click(130, 435)
|
||||
sleep(0.5)
|
||||
|
||||
# 点击两次升级按钮(两个按钮的logo不一样,但是文字是一样的,这里资源文件只包含文字)
|
||||
device.click(image.expect_wait(R.Daily.ButtonSupportCardUpgrade, timeout=5))
|
||||
sleep(0.5)
|
||||
device.click(image.expect_wait(R.Daily.ButtonSupportCardUpgrade, timeout=5))
|
||||
sleep(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO, format='[%(asctime)s] [%(levelname)s] [%(name)s] [%(funcName)s] [%(lineno)d] %(message)s')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
upgrade_support_card()
|
||||
|
|
@ -13,11 +13,12 @@ import gradio as gr
|
|||
|
||||
from kotonebot.backend.context import task_registry, ContextStackVars
|
||||
from kotonebot.config.manager import load_config, save_config
|
||||
from kotonebot.tasks import upgrade_support_card
|
||||
from kotonebot.tasks.common import (
|
||||
BaseConfig, APShopItems, ClubRewardConfig, PurchaseConfig, ActivityFundsConfig,
|
||||
PresentsConfig, AssignmentConfig, ContestConfig, ProduceConfig,
|
||||
MissionRewardConfig, PIdol, DailyMoneyShopItems, ProduceAction,
|
||||
RecommendCardDetectionMode, TraceConfig, StartGameConfig
|
||||
RecommendCardDetectionMode, TraceConfig, StartGameConfig, UpgradeSupportCardConfig
|
||||
)
|
||||
from kotonebot.config.base_config import UserConfig, BackendConfig
|
||||
from kotonebot.backend.bot import KotoneBot
|
||||
|
@ -265,6 +266,8 @@ class KotoneBotUI:
|
|||
# club reward
|
||||
club_reward_enabled: bool,
|
||||
selected_note: DailyMoneyShopItems,
|
||||
# upgrade support card
|
||||
upgrade_support_card_enabled: bool,
|
||||
# start game
|
||||
start_game_enabled: bool,
|
||||
start_through_kuyo: bool,
|
||||
|
@ -337,6 +340,9 @@ class KotoneBotUI:
|
|||
enabled=club_reward_enabled,
|
||||
selected_note=selected_note
|
||||
),
|
||||
upgrade_support_card=UpgradeSupportCardConfig(
|
||||
enabled=upgrade_support_card_enabled
|
||||
),
|
||||
start_game=StartGameConfig(
|
||||
enabled=start_game_enabled,
|
||||
start_through_kuyo=start_through_kuyo,
|
||||
|
@ -836,6 +842,15 @@ class KotoneBotUI:
|
|||
|
||||
# 社团奖励设置
|
||||
club_reward_settings = self._create_club_reward_settings()
|
||||
|
||||
# 升级支援卡设置
|
||||
with gr.Column():
|
||||
gr.Markdown("### 升级支援卡设置")
|
||||
upgrade_support_card_enabled = gr.Checkbox(
|
||||
label="启用升级支援卡",
|
||||
value=self.current_config.options.upgrade_support_card.enabled,
|
||||
info=UpgradeSupportCardConfig.model_fields['enabled'].description
|
||||
)
|
||||
|
||||
# 跟踪设置
|
||||
with gr.Column():
|
||||
|
@ -867,6 +882,7 @@ class KotoneBotUI:
|
|||
*produce_settings,
|
||||
mission_reward,
|
||||
*club_reward_settings,
|
||||
upgrade_support_card_enabled,
|
||||
*start_game_settings
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue