mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
feat: 自动编队支持指定使用编队
This commit is contained in:
@@ -205,6 +205,7 @@ namespace MaaWpfGui.Constants
|
||||
public const string ReceiveSpecialAccess = "Mission.ReceiveSpecialAccess";
|
||||
public const string CopilotAddUserAdditional = "Copilot.AddUserAdditional";
|
||||
public const string CopilotUserAdditional = "Copilot.UserAdditional";
|
||||
public const string CopilotSelectFormation = "Copilot.SelectFormation";
|
||||
public const string CopilotLoopTimes = "Copilot.LoopTimes";
|
||||
public const string CopilotTaskList = "Copilot.CopilotTaskList";
|
||||
public const string UpdateProxy = "VersionUpdate.Proxy";
|
||||
|
||||
@@ -77,6 +77,11 @@ public class AsstCopilotTask : AsstBaseTask
|
||||
/// </summary>
|
||||
public List<UserAdditional>? UserAdditionals { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether 信用战斗选择编队
|
||||
/// </summary>
|
||||
public int SelectFormation { get; set; }
|
||||
|
||||
public override (AsstTaskType TaskType, JObject Params) Serialize()
|
||||
{
|
||||
var taskParams = new JObject
|
||||
@@ -89,6 +94,7 @@ public class AsstCopilotTask : AsstBaseTask
|
||||
["is_raid"] = IsRaid,
|
||||
["loop_times"] = LoopTimes,
|
||||
["use_sanity_potion"] = UseSanityPotion,
|
||||
["select_formation"] = SelectFormation,
|
||||
};
|
||||
|
||||
if (UserAdditionals?.Count > 0)
|
||||
|
||||
@@ -33,6 +33,7 @@ using MaaWpfGui.Models.AsstTasks;
|
||||
using MaaWpfGui.Models.Copilot;
|
||||
using MaaWpfGui.Services;
|
||||
using MaaWpfGui.States;
|
||||
using MaaWpfGui.Utilities.ValueType;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
@@ -268,6 +269,27 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
public List<GenericCombinedData<int>> FormationSelectList { get; } =
|
||||
[
|
||||
new() { Display = LocalizationHelper.GetString("Current"), Value = 0 },
|
||||
new() { Display = "1", Value = 1 },
|
||||
new() { Display = "2", Value = 2 },
|
||||
new() { Display = "3", Value = 3 },
|
||||
new() { Display = "4", Value = 4 },
|
||||
];
|
||||
|
||||
private int _selectFormation = ConfigurationHelper.GetValue(ConfigurationKeys.CopilotSelectFormation, 0);
|
||||
|
||||
public int SelectFormation
|
||||
{
|
||||
get => _selectFormation;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _selectFormation, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CopilotSelectFormation, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _useCopilotList;
|
||||
|
||||
/// <summary>
|
||||
@@ -1212,6 +1234,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
IsRaid = model.IsRaid,
|
||||
LoopTimes = Loop ? LoopTimes : 1,
|
||||
UseSanityPotion = _useSanityPotion,
|
||||
SelectFormation = _selectFormation,
|
||||
};
|
||||
var (type, param) = task.Serialize();
|
||||
return Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Copilot, type, param);
|
||||
@@ -1253,6 +1276,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
NeedNavigate = false,
|
||||
LoopTimes = Loop ? LoopTimes : 1,
|
||||
UseSanityPotion = _useSanityPotion,
|
||||
SelectFormation = _selectFormation,
|
||||
};
|
||||
ret = Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Copilot, _taskType, task.Serialize().Params);
|
||||
ret &= Instances.AsstProxy.AsstStart();
|
||||
|
||||
@@ -116,13 +116,13 @@ public class MallSettingsUserControlModel : TaskViewModel
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public List<GenericCombinedData<int>> FormationSelectList { get; } =
|
||||
[
|
||||
new() { Display = LocalizationHelper.GetString("Current"), Value = 0 },
|
||||
new() { Display = "1", Value = 1 },
|
||||
new() { Display = "2", Value = 2 },
|
||||
new() { Display = "3", Value = 3 },
|
||||
new() { Display = "4", Value = 4 },
|
||||
];
|
||||
[
|
||||
new() { Display = LocalizationHelper.GetString("Current"), Value = 0 },
|
||||
new() { Display = "1", Value = 1 },
|
||||
new() { Display = "2", Value = 2 },
|
||||
new() { Display = "3", Value = 3 },
|
||||
new() { Display = "4", Value = 4 },
|
||||
];
|
||||
|
||||
private string _lastCreditVisitFriendsTime = ConfigurationHelper.GetValue(ConfigurationKeys.LastCreditVisitFriendsTime, DateTime.UtcNow.ToYjDate().AddDays(-1).ToFormattedString());
|
||||
|
||||
@@ -306,7 +306,7 @@ public class MallSettingsUserControlModel : TaskViewModel
|
||||
|
||||
public override (AsstTaskType Type, JObject Params) Serialize()
|
||||
{
|
||||
var fightEnable = Instances.TaskQueueViewModel.TaskItemViewModels.Where(x => x.OriginalName == "Combat").FirstOrDefault()?.IsCheckedWithNull is not false;
|
||||
var fightEnable = Instances.TaskQueueViewModel.TaskItemViewModels.FirstOrDefault(x => x.OriginalName == "Combat")?.IsCheckedWithNull is not false;
|
||||
var task = new AsstMallTask()
|
||||
{
|
||||
CreditFight = fightEnable ? (!string.IsNullOrEmpty(FightSettingsUserControlModel.Instance.Stage) && CreditFightTaskEnabled) : CreditFightTaskEnabled,
|
||||
@@ -329,7 +329,8 @@ public class MallSettingsUserControlModel : TaskViewModel
|
||||
return null;
|
||||
}
|
||||
|
||||
var fightStage = ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).FirstOrDefault()?.IsEnable is not false && ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).Cast<FightTask>().FirstOrDefault()?.Stage1 == string.Empty;
|
||||
var fightStage = ConfigFactory.CurrentConfig.TaskQueue.FirstOrDefault(x => x is FightTask)?.IsEnable is not false
|
||||
&& ConfigFactory.CurrentConfig.TaskQueue.Where(x => x is FightTask).Cast<FightTask>().FirstOrDefault()?.Stage1 == string.Empty;
|
||||
if (fightStage)
|
||||
{
|
||||
Log.Warning("刷理智 当前/上次导致无法OF-1");
|
||||
@@ -371,7 +372,7 @@ public class MallSettingsUserControlModel : TaskViewModel
|
||||
ReserveMaxCredit = mall.ReserveMaxCredit,
|
||||
};
|
||||
|
||||
if (taskId is int id)
|
||||
if (taskId is { } id)
|
||||
{
|
||||
return Instances.AsstProxy.AsstSetTaskParamsEncoded(id, task);
|
||||
}
|
||||
|
||||
@@ -115,33 +115,41 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<StackPanel
|
||||
<StackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<CheckBox Content="{DynamicResource AutoSquad}" IsChecked="{Binding Form}" />
|
||||
<controls:TooltipBlock TooltipText="{DynamicResource AutoSquadTip}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox
|
||||
<controls:TooltipBlock TooltipText="{DynamicResource AutoSquadTip}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="5,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Content="{DynamicResource UseCopilotList}"
|
||||
IsChecked="{Binding UseCopilotList}"
|
||||
IsEnabled="{Binding Idle}" />
|
||||
<controls:TooltipBlock TooltipText="{DynamicResource UseCopilotListTip}" />
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{c:Binding Form}">
|
||||
<controls:TextBlock VerticalAlignment="Center" Text="{DynamicResource UseFormation}" />
|
||||
<ComboBox
|
||||
Width="100"
|
||||
Margin="6,0,0,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
DisplayMemberPath="Display"
|
||||
ItemsSource="{Binding FormationSelectList}"
|
||||
SelectedValue="{Binding SelectFormation}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Visibility="{c:Binding Form}">
|
||||
<StackPanel
|
||||
<StackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<CheckBox
|
||||
<CheckBox
|
||||
HorizontalAlignment="Center"
|
||||
Content="{DynamicResource Copilot.IgnoreRequirements}"
|
||||
IsChecked="{Binding IgnoreRequirements}" />
|
||||
@@ -158,34 +166,32 @@
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<CheckBox Content="{DynamicResource AddUserAdditional}" IsChecked="{Binding AddUserAdditional}" />
|
||||
<TextBox
|
||||
<TextBox
|
||||
MinWidth="120"
|
||||
MaxWidth="140"
|
||||
Margin="6,0,0,0"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding UserAdditional, UpdateSourceTrigger=LostFocus}"
|
||||
ToolTip="{DynamicResource AddUserAdditionalTip}"
|
||||
ToolTipService.InitialShowDelay="0"
|
||||
Visibility="{c:Binding AddUserAdditional}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding UserAdditional, UpdateSourceTrigger=LostFocus}"
|
||||
ToolTip="{DynamicResource AddUserAdditionalTip}"
|
||||
ToolTipService.InitialShowDelay="0"
|
||||
Visibility="{c:Binding AddUserAdditional}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
<StackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
IsEnabled="{Binding Idle}"
|
||||
Orientation="Horizontal">
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<CheckBox Content="{DynamicResource UseCopilotList}" IsChecked="{Binding UseCopilotList}" />
|
||||
<controls:TooltipBlock TooltipText="{DynamicResource UseCopilotListTip}" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
<CheckBox
|
||||
Margin="5,0,0,0"
|
||||
Content="{DynamicResource UseSanityPotion}"
|
||||
IsChecked="{Binding UseSanityPotion}"
|
||||
IsEnabled="{Binding Idle}"
|
||||
Visibility="{c:Binding UseCopilotList}" />
|
||||
</StackPanel>
|
||||
Content="{DynamicResource UseSanityPotion}"
|
||||
IsChecked="{Binding UseSanityPotion}"
|
||||
Visibility="{c:Binding UseCopilotList}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="5"
|
||||
|
||||
@@ -49,21 +49,25 @@
|
||||
<controls:TooltipBlock x:Name="CreditFightTipTooltipBlock" TooltipText="{DynamicResource CreditFightTip}" />
|
||||
</StackPanel>
|
||||
|
||||
<ComboBox
|
||||
<StackPanel
|
||||
Margin="0,5"
|
||||
hc:InfoElement.Title="{DynamicResource UseFormation}"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="120"
|
||||
DisplayMemberPath="Display"
|
||||
IsHitTestVisible="{Binding Idle, Source={x:Static setting:TaskQueueViewModel.TaskSettingDataContext}}"
|
||||
ItemsSource="{Binding FormationSelectList}"
|
||||
SelectedValue="{Binding CreditFightSelectFormation}"
|
||||
SelectedValuePath="Value"
|
||||
Visibility="{c:Binding CreditFightTaskEnabledDisplay}" />
|
||||
Orientation="Horizontal"
|
||||
Visibility="{c:Binding CreditFightTaskEnabledDisplay}">
|
||||
<controls:TextBlock Text="{DynamicResource UseFormation}" />
|
||||
<ComboBox
|
||||
Width="100"
|
||||
Margin="6,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
HorizontalContentAlignment="Center"
|
||||
DisplayMemberPath="Display"
|
||||
IsHitTestVisible="{Binding Idle, Source={x:Static setting:TaskQueueViewModel.TaskSettingDataContext}}"
|
||||
ItemsSource="{Binding FormationSelectList}"
|
||||
SelectedValue="{Binding CreditFightSelectFormation}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{c:Binding EnableAdvancedSettings, Source={x:Static setting:TaskQueueViewModel.TaskSettingVisibilities}}">
|
||||
|
||||
<TextBox
|
||||
Margin="0,10"
|
||||
hc:InfoElement.Title="{DynamicResource HighPriority}"
|
||||
@@ -95,7 +99,7 @@
|
||||
<TextBlock
|
||||
Block.TextAlignment="Left"
|
||||
Text="{DynamicResource OnlyBuyDiscount}"
|
||||
TextWrapping="Wrap"/>
|
||||
TextWrapping="Wrap" />
|
||||
</CheckBox>
|
||||
<controls:TooltipBlock x:Name="OnlyBuyDiscountTipsTooltipBlock" TooltipText="{DynamicResource OnlyBuyDiscountTips}" />
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user