From 564f9e5dce30ca0eb0b4db6fd45d3d9b75b8e8b2 Mon Sep 17 00:00:00 2001
From: status102 <102887808+status102@users.noreply.github.com>
Date: Sun, 2 Mar 2025 11:51:19 +0800
Subject: [PATCH] =?UTF-8?q?rft:=20wpf=E7=94=9F=E6=81=AF=E6=BC=94=E7=AE=97?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BA=8F=E5=88=97=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Models/AsstTasks/AsstReclamationTask.cs | 76 +++++++++++++++++++
.../ReclamationSettingsUserControlModel.cs | 16 ++--
2 files changed, 84 insertions(+), 8 deletions(-)
create mode 100644 src/MaaWpfGui/Models/AsstTasks/AsstReclamationTask.cs
diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstReclamationTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstReclamationTask.cs
new file mode 100644
index 0000000000..63d8d9e9d4
--- /dev/null
+++ b/src/MaaWpfGui/Models/AsstTasks/AsstReclamationTask.cs
@@ -0,0 +1,76 @@
+//
+// MaaWpfGui - A part of the MaaCoreArknights project
+// Copyright (C) 2021 MistEO and Contributors
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License v3.0 only as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY
+//
+
+#nullable enable
+using System.Collections.Generic;
+using MaaWpfGui.Services;
+using Newtonsoft.Json.Linq;
+
+namespace MaaWpfGui.Models.AsstTasks;
+
+///
+/// 自动生息演算。
+///
+public class AsstReclamationTask : AsstBaseTask
+{
+ public override AsstTaskType TaskType => AsstTaskType.Reclamation;
+
+ ///
+ /// Gets or sets 生息演算主题
+ ///
+ public string Theme { get; set; } = "Tales";
+
+ ///
+ /// Gets or sets 生息演算模式
+ ///
+ /// -
+ /// 0
+ /// 无存档时通过进出关卡刷生息点数
+ ///
+ /// -
+ /// 1
+ /// 有存档时通过合成支援道具刷生息点数
+ ///
+ ///
+ ///
+ public int Mode { get; set; } = 0;
+
+ ///
+ /// Gets or sets 点击类型:0 连点;1 长按
+ ///
+ public int IncrementMode { get; set; } = 0;
+
+ ///
+ /// Gets or sets 单次最大制造轮数
+ ///
+ public int MaxCraftCountPerRound { get; set; } = 1;
+
+ ///
+ /// Gets or sets 要组装的支援道具。
+ ///
+ public List ToolToCraft { get; set; } = [];
+
+ public override (AsstTaskType TaskType, JObject Params) Serialize()
+ {
+ var data = new JObject
+ {
+ ["theme"] = Theme,
+ ["mode"] = Mode,
+ ["increment_mode"] = IncrementMode,
+ ["num_craft_batches"] = MaxCraftCountPerRound,
+ ["tools_to_craft"] = new JArray(ToolToCraft),
+ };
+
+ return (TaskType, data);
+ }
+}
diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/ReclamationSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/ReclamationSettingsUserControlModel.cs
index 44db44f1af..58c6469f4e 100644
--- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/ReclamationSettingsUserControlModel.cs
+++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/ReclamationSettingsUserControlModel.cs
@@ -16,6 +16,7 @@ using System.Collections.Generic;
using System.Linq;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
+using MaaWpfGui.Models.AsstTasks;
using MaaWpfGui.Services;
using MaaWpfGui.Utilities.ValueType;
using MaaWpfGui.ViewModels.UI;
@@ -158,14 +159,13 @@ public class ReclamationSettingsUserControlModel : TaskViewModel
/// 返回(Asst任务类型, 参数)
public override (AsstTaskType Type, JObject Params) Serialize()
{
- var data = new JObject
+ return new AsstReclamationTask()
{
- ["theme"] = ReclamationTheme,
- ["mode"] = ReclamationMode,
- ["increment_mode"] = ReclamationIncrementMode,
- ["num_craft_batches"] = ReclamationMaxCraftCountPerRound,
- ["tools_to_craft"] = new JArray(ReclamationToolToCraft.Split(';').Select(s => s.Trim())),
- };
- return (AsstTaskType.Reclamation, data);
+ Theme = ReclamationTheme,
+ Mode = ReclamationMode,
+ IncrementMode = ReclamationIncrementMode,
+ MaxCraftCountPerRound = ReclamationMaxCraftCountPerRound,
+ ToolToCraft = ReclamationToolToCraft.Split(';').Select(s => s.Trim()).ToList(),
+ }.Serialize();
}
}