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(); } }