Skip to content

Commit

Permalink
feat: 配置工具支持设置心悦战场固定队默认数目
Browse files Browse the repository at this point in the history
  • Loading branch information
fzls committed Jan 3, 2025
1 parent 9830197 commit 5164581
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,8 @@ def __init__(self):
self.retry = RetryConfig()
# 心悦相关配置
self.xinyue = XinYueConfig()
# 心悦固定队默认配置数目
self.xinyue_fixed_team_default_team_count = 5
# 固定队相关配置。用于本地两个号来组成一个固定队伍,完成心悦任务。
self.fixed_teams: list[FixedTeamConfig] = []
# 赛利亚活动拜访目标QQ列表
Expand Down Expand Up @@ -1427,9 +1429,8 @@ def on_config_update(self, raw_config: dict):
self.netdisk_link_for_report = LanZouCloud().get_latest_url_before_shuffle(self.netdisk_link)

# 心悦固定队添加一些默认配置
xinyue_fixed_team_default_count = 5
xinyue_fixed_team_current_count = len(self.fixed_teams)
for idx in range(xinyue_fixed_team_default_count):
for idx in range(self.xinyue_fixed_team_default_team_count):
if idx < xinyue_fixed_team_current_count:
continue

Expand Down
16 changes: 15 additions & 1 deletion config_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,10 +1614,23 @@ def from_config(self, cfg: CommonConfig):
self.lineedit_xinyue_send_card_target_qq.setValidator(QQValidator())
add_row(
form_layout,
"心悦集卡赠送卡片目标QQ(这个QQ将接收来自其他QQ赠送的卡片)",
(
"心悦集卡赠送卡片目标QQ\n"
"(这个QQ将接收来自其他QQ赠送的卡片)"
),
self.lineedit_xinyue_send_card_target_qq,
)

self.spinbox_xinyue_fixed_team_default_team_count = create_spin_box(cfg.xinyue_fixed_team_default_team_count, minimum=1)
add_row(
form_layout,
(
"心悦战场固定队默认配置数目\n"
"(修改后下次启动,会尝试扩张到设定的数目)"
),
self.spinbox_xinyue_fixed_team_default_team_count,
)

self.fixed_teams = []
for team in cfg.fixed_teams:
self.fixed_teams.append(FixedTeamConfigUi(form_layout, team))
Expand Down Expand Up @@ -1810,6 +1823,7 @@ def update_config(self, cfg: CommonConfig):
team.update_config(cfg.fixed_teams[idx])

cfg.xinyue_send_card_target_qq = self.lineedit_xinyue_send_card_target_qq.text()
cfg.xinyue_fixed_team_default_team_count = self.spinbox_xinyue_fixed_team_default_team_count.value()

# 特殊处理基于标记文件的开关
if self.checkbox_disable_sync_configs.isChecked():
Expand Down

0 comments on commit 5164581

Please sign in to comment.