mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
rft: wpf领取奖励任务序列化
This commit is contained in:
@@ -2161,32 +2161,6 @@ namespace MaaWpfGui.Main
|
||||
return AsstSetTaskParamsWithEncoding(id, taskParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 领取奖励。
|
||||
/// </summary>
|
||||
/// <param name="award">是否领取每日/每周任务奖励</param>
|
||||
/// <param name="mail">是否领取所有邮件奖励</param>
|
||||
/// <param name="recruit">是否进行每日免费单抽</param>
|
||||
/// <param name="orundum">是否领取幸运墙合成玉奖励</param>
|
||||
/// <param name="mining">是否领取限时开采许可合成玉奖励</param>
|
||||
/// <param name="specialaccess">是否领取五周年赠送月卡奖励</param>
|
||||
/// <returns>是否成功。</returns>
|
||||
public bool AsstAppendAward(bool award, bool mail, bool recruit, bool orundum, bool mining, bool specialaccess)
|
||||
{
|
||||
var taskParams = new JObject
|
||||
{
|
||||
["award"] = award,
|
||||
["mail"] = mail,
|
||||
["recruit"] = recruit,
|
||||
["orundum"] = orundum,
|
||||
["mining"] = mining,
|
||||
["specialaccess"] = specialaccess,
|
||||
};
|
||||
AsstTaskId id = AsstAppendTaskWithEncoding(AsstTaskType.Award, taskParams);
|
||||
_taskStatus.Add(id, TaskType.Award);
|
||||
return id != 0;
|
||||
}
|
||||
|
||||
public bool AsstAppendCloseDown(string clientType)
|
||||
{
|
||||
if (!AsstStop())
|
||||
|
||||
65
src/MaaWpfGui/Models/AsstTasks/AsstAwardTask.cs
Normal file
65
src/MaaWpfGui/Models/AsstTasks/AsstAwardTask.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
// <copyright file="AsstAwardTask.cs" company="MaaAssistantArknights">
|
||||
// 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
|
||||
// </copyright>
|
||||
|
||||
#nullable enable
|
||||
using MaaWpfGui.Services;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MaaWpfGui.Models.AsstTasks;
|
||||
|
||||
/// <summary>
|
||||
/// 领取奖励任务
|
||||
/// </summary>
|
||||
public class AsstAwardTask : AsstBaseTask
|
||||
{
|
||||
public override AsstTaskType TaskType => AsstTaskType.Award;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否领取每日/每周任务奖励
|
||||
/// </summary>
|
||||
[JsonProperty("award")]
|
||||
public bool Award { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否领取所有邮件奖励
|
||||
/// </summary>
|
||||
[JsonProperty("mail")]
|
||||
public bool Mail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否进行每日免费单抽
|
||||
/// </summary>
|
||||
[JsonProperty("recruit")]
|
||||
public bool Recruit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否领取幸运墙合成玉奖励
|
||||
/// </summary>
|
||||
[JsonProperty("orundum")]
|
||||
public bool Orundum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否领取限时开采许可合成玉奖励
|
||||
/// </summary>
|
||||
[JsonProperty("mining")]
|
||||
public bool Mining { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 是否领取五周年赠送月卡奖励
|
||||
/// </summary>
|
||||
[JsonProperty("specialaccess")]
|
||||
public bool SpecialAccess { get; set; }
|
||||
|
||||
public override (AsstTaskType TaskType, JObject Params) Serialize() => (AsstTaskType.Award, JObject.FromObject(this));
|
||||
}
|
||||
@@ -1770,14 +1770,9 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
private static bool AppendAward()
|
||||
{
|
||||
var receiveAward = AwardTask.ReceiveAward;
|
||||
var receiveMail = AwardTask.ReceiveMail;
|
||||
var receiveFreeRecruit = AwardTask.ReceiveFreeRecruit;
|
||||
var receiveOrundum = AwardTask.ReceiveOrundum;
|
||||
var receiveMining = AwardTask.ReceiveMining;
|
||||
var receiveSpecialAccess = AwardTask.ReceiveSpecialAccess;
|
||||
|
||||
return Instances.AsstProxy.AsstAppendAward(receiveAward, receiveMail, receiveFreeRecruit, receiveOrundum, receiveMining, receiveSpecialAccess);
|
||||
// 被RemoteControlService反射调用,暂不移除
|
||||
var (type, param) = AwardTask.Serialize();
|
||||
return Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Award, type, param);
|
||||
}
|
||||
|
||||
private static bool AppendRecruit()
|
||||
|
||||
Reference in New Issue
Block a user