auto domain: tp & switch party & artifact salvage

This commit is contained in:
辉鸭蛋 2024-11-24 17:48:23 +08:00
parent 74acb4eb1c
commit d7302b65c3
18 changed files with 416 additions and 75 deletions

View File

@ -17,7 +17,7 @@ public class BigMapMatchTest
SpeedTimer speedTimer = new();
// var mainMap100BlockMat = new Mat(@"D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\Assets\Map\mainMap100Block.png", ImreadModes.Grayscale);
var map2048 = MapAssets.Instance.MainMap2048BlockMat.Value;
var map2048 = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.2\map_52_2048.png", ImreadModes.Grayscale);
var mainMap100BlockMat = ResizeHelper.Resize(map2048, 1d / (4 * 2));
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\mainMap128Block.png", mainMap100BlockMat);

View File

@ -16,7 +16,7 @@ public class MapTeleportPointDraw
// var pList = LoadTeleportPoint(@"E:\HuiTask\更好的原神\地图匹配\地图点位\5.0");
// pList.AddRange(MapAssets.Instance.TpPositions);
var map = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap1024BlockColor.png");
DrawTeleportPoint(map, MapAssets.Instance.TpPositions);
DrawTeleportPoint(map, MapLazyAssets.Instance.TpPositions);
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\传送点_1024_0.34.3.png", map);
}

View File

@ -75,10 +75,10 @@ public class AutoDomainTask : ISoloTask
Init();
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Started().Build()); // TODO: 通知后续需要删除迁移
// // 传送到秘境
// await TpDomain();
// // 切换队伍
// await SwitchParty(_taskParam.PartyName);
// 传送到秘境
await TpDomain();
// 切换队伍
await SwitchParty(_taskParam.PartyName);
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());
@ -133,6 +133,11 @@ public class AutoDomainTask : ISoloTask
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Progress().Build());
}
await Delay(1000, ct);
await Bv.WaitForMainUi(_ct);
await ArtifactSalvage();
}
private void Init()
@ -179,7 +184,7 @@ public class AutoDomainTask : ISoloTask
// 传送到秘境
if (!string.IsNullOrEmpty(_taskParam.DomainName))
{
if (MapAssets.Instance.DomainPositionMap.TryGetValue(_taskParam.DomainName, out var domainPosition))
if (MapLazyAssets.Instance.DomainPositionMap.TryGetValue(_taskParam.DomainName, out var domainPosition))
{
Logger.LogInformation("自动秘境:传送到秘境{Text}", _taskParam.DomainName);
await new TpTask(_ct).Tp(domainPosition.X, domainPosition.Y);
@ -187,7 +192,7 @@ public class AutoDomainTask : ISoloTask
await Bv.WaitForMainUi(_ct);
await Delay(1000, _ct);
var walkKey = User32.VK.VK_W;
if (MapAssets.Instance.DomainBackwardList.Contains(_taskParam.DomainName))
if (MapLazyAssets.Instance.DomainBackwardList.Contains(_taskParam.DomainName))
{
walkKey = User32.VK.VK_S;
}
@ -885,4 +890,19 @@ public class AutoDomainTask : ISoloTask
Logger.LogInformation("剩余:浓缩树脂 {CondensedResinCount} 脆弱树脂 {FragileResinCount}", condensedResinCount, fragileResinCount);
return (condensedResinCount, fragileResinCount);
}
private async Task ArtifactSalvage()
{
if (!_taskParam.AutoArtifactSalvage)
{
return;
}
if (!int.TryParse(_taskParam.MaxArtifactStar, out var star))
{
star = 4;
}
await new ArtifactSalvageTask().Start(star, _ct);
}
}

View File

@ -347,7 +347,7 @@ public class TpTask(CancellationToken ct)
double recentX = 0;
double recentY = 0;
var minDistance = double.MaxValue;
foreach (var tpPosition in MapAssets.Instance.TpPositions)
foreach (var tpPosition in MapLazyAssets.Instance.TpPositions)
{
var distance = Math.Sqrt(Math.Pow(tpPosition.X - x, 2) + Math.Pow(tpPosition.Y - y, 2));
if (distance < minDistance)
@ -388,7 +388,7 @@ public class TpTask(CancellationToken ct)
}
var minCountry = "当前位置";
foreach (var (country, position) in MapAssets.Instance.CountryPositions)
foreach (var (country, position) in MapLazyAssets.Instance.CountryPositions)
{
var distance = Math.Sqrt(Math.Pow(position[0] - x, 2) + Math.Pow(position[1] - y, 2));
if (distance < minDistance)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,5 +1,6 @@
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.GameTask.Model;
using BetterGenshinImpact.Helpers.Extensions;
using OpenCvSharp;
namespace BetterGenshinImpact.GameTask.Common.Element.Assets;
@ -28,6 +29,11 @@ public class ElementAssets : BaseAssets<ElementAssets>
public RecognitionObject CraftCondensedResin;
public RecognitionObject BagArtifactUnchecked;
public RecognitionObject BagArtifactChecked;
public RecognitionObject BtnArtifactSalvage;
public RecognitionObject BtnArtifactSalvageConfirm;
private ElementAssets()
{
// 按钮
@ -162,5 +168,39 @@ public class ElementAssets : BaseAssets<ElementAssets>
RegionOfInterest = new Rect(CaptureRect.Width / 2, 0, CaptureRect.Width / 2, CaptureRect.Height / 3 * 2),
DrawOnWindow = false
}.InitTemplate();
// 分解圣遗物
BagArtifactUnchecked = new RecognitionObject
{
Name = "BagArtifactUnchecked",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "bag_artifact_unchecked.png"),
RegionOfInterest = CaptureRect.CutTop(0.1),
DrawOnWindow = false
}.InitTemplate();
BagArtifactChecked = new RecognitionObject
{
Name = "BagArtifactChecked",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "bag_artifact_checked.png"),
RegionOfInterest = CaptureRect.CutTop(0.1),
DrawOnWindow = false
}.InitTemplate();
BtnArtifactSalvage = new RecognitionObject
{
Name = "BtnArtifactSalvage",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_artifact_salvage.png"),
RegionOfInterest = CaptureRect.CutBottom(0.1),
DrawOnWindow = false
}.InitTemplate();
BtnArtifactSalvageConfirm = new RecognitionObject
{
Name = "BtnArtifactSalvageConfirm",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_artifact_salvage_confirm.png"),
RegionOfInterest = CaptureRect.CutBottom(0.1),
DrawOnWindow = false
}.InitTemplate();
}
}
}

View File

@ -13,46 +13,10 @@ namespace BetterGenshinImpact.GameTask.Common.Element.Assets;
public class MapAssets : BaseAssets<MapAssets>
{
public Lazy<Mat> MainMap2048BlockMat { get; } = new(() => new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.2\map_52_2048.png", ImreadModes.Grayscale));
public Lazy<Mat> MainMap256BlockMat { get; } = new(() => new Mat(Global.Absolute(@"Assets\Map\mainMap256Block.png"), ImreadModes.Grayscale));
// 2048 区块下,存在传送点的最大面积,识别结果比这个大的话,需要点击放大
// 传送点信息
public List<GiWorldPosition> TpPositions;
// 每个地区点击后处于的中心位置
public readonly Dictionary<string, double[]> CountryPositions = new()
{
{ "蒙德", [-876, 2278] },
{ "璃月", [270, -666] },
{ "稻妻", [-4400, -3050] },
{ "须弥", [2877, -374] },
{ "枫丹", [4515, 3631] },
{ "纳塔", [8973.5, -1879.1] },
};
public readonly Dictionary<string, GiWorldPosition> DomainPositionMap = new();
public readonly List<GiWorldPosition> DomainPositionsList = [];
// 反方向行走的副本
public readonly List<string> DomainBackwardList = ["无妄引咎密宫", "芬德尼尔之顶"];
public Rect MimiMapRect { get; }
public MapAssets()
{
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoTrackPath\Assets\tp.json"));
TpPositions = JsonSerializer.Deserialize<List<GiWorldPosition>>(json, ConfigService.JsonOptions) ?? throw new System.Exception("tp.json deserialize failed");
// 取出秘境 description=Domain
foreach (var tp in TpPositions.Where(tp => tp.Description == "Domain"))
{
DomainPositionMap[tp.Name] = tp;
DomainPositionsList.Add(tp);
}
MimiMapRect = new Rect((int)Math.Round(62 * AssetScale), (int)Math.Round(19 * AssetScale), (int)Math.Round(212 * AssetScale), (int)Math.Round(212 * AssetScale));
}
}

View File

@ -0,0 +1,52 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.AutoTrackPath.Model;
using BetterGenshinImpact.Service;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using BetterGenshinImpact.Model;
namespace BetterGenshinImpact.GameTask.Common.Element.Assets;
public class MapLazyAssets : Singleton<MapLazyAssets>
{
// 2048 区块下,存在传送点的最大面积,识别结果比这个大的话,需要点击放大
// 传送点信息
public List<GiWorldPosition> TpPositions;
// 每个地区点击后处于的中心位置
public readonly Dictionary<string, double[]> CountryPositions = new()
{
{ "蒙德", [-876, 2278] },
{ "璃月", [270, -666] },
{ "稻妻", [-4400, -3050] },
{ "须弥", [2877, -374] },
{ "枫丹", [4515, 3631] },
{ "纳塔", [8973.5, -1879.1] },
};
public readonly Dictionary<string, GiWorldPosition> DomainPositionMap = new();
public readonly List<String> DomainNameList = [];
// 反方向行走的副本
public readonly List<string> DomainBackwardList = ["无妄引咎密宫", "芬德尼尔之顶"];
public MapLazyAssets()
{
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoTrackPath\Assets\tp.json"));
TpPositions = JsonSerializer.Deserialize<List<GiWorldPosition>>(json, ConfigService.JsonOptions) ?? throw new System.Exception("tp.json deserialize failed");
// 取出秘境 description=Domain
foreach (var tp in TpPositions.Where(tp => tp.Description == "Domain"))
{
DomainPositionMap[tp.Name] = tp;
DomainNameList.Add(tp.Name);
}
}
}

View File

@ -2,27 +2,118 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.Common.Element.Assets;
using BetterGenshinImpact.Helpers.Extensions;
using Microsoft.Extensions.Logging;
using Vanara.PInvoke;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
namespace BetterGenshinImpact.GameTask.Common.Job;
/// <summary>
/// 圣遗物自动分解
/// </summary>
public class ArtifactSalvageTask
{
public async Task Start(CancellationToken ct)
private readonly ReturnMainUiTask _returnMainUiTask = new();
public async Task Start(int star, CancellationToken ct)
{
await _returnMainUiTask.Start(ct);
// B键打开背包
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_B);
await Delay(800, ct);
// 选择圣遗物
using var ra = CaptureToRectArea();
using var artifactBtn = ra.Find(ElementAssets.Instance.BagArtifactChecked);
if (artifactBtn.IsEmpty())
{
using var artifactBtn2 = ra.Find(ElementAssets.Instance.BagArtifactUnchecked);
if (artifactBtn2.IsExist())
{
artifactBtn2.Click();
await Delay(800, ct);
}
else
{
Logger.LogError("未找到背包中圣遗物菜单按钮");
return;
}
}
// 点击分解按钮打开分解界面
using var ra2 = CaptureToRectArea();
using var salvageBtn = ra2.Find(ElementAssets.Instance.BtnArtifactSalvage);
if (salvageBtn.IsExist())
{
salvageBtn.Click();
await Delay(1000, ct);
}
else
{
Logger.LogError("未找到圣遗物分解按钮");
return;
}
// 快速选择
// 点击分解按钮
using var ra3 = CaptureToRectArea();
var ocrList = ra3.FindMulti(RecognitionObject.Ocr(ra3.ToRect().CutLeftBottom(0.25, 0.1)));
foreach (var ocr in ocrList)
{
if (ocr.Text.Contains("快速选择"))
{
ocr.Click();
await Delay(500, ct);
break;
}
}
// 确认选择
using var ra4 = CaptureToRectArea();
var ocrList2 = ra4.FindMulti(RecognitionObject.Ocr(ra3.ToRect().CutLeft(0.35)));
for (var i = 1; i <= star; i++)
{
foreach (var ocr in ocrList2)
{
if (ocr.Text.Contains(i + "星"))
{
ocr.Click();
await Delay(500, ct);
break;
}
}
}
Bv.ClickWhiteConfirmButton(ra4);
await Delay(500, ct);
// 点击分解
using var ra5 = CaptureToRectArea();
var salvageBtnConfirm = ra5.Find(ElementAssets.Instance.BtnArtifactSalvageConfirm);
if (salvageBtnConfirm.IsExist())
{
salvageBtnConfirm.Click();
await Delay(800, ct);
}
else
{
Logger.LogError("未找到圣遗物分解按钮");
return;
}
// 点击确认
using var ra6 = CaptureToRectArea();
Bv.ClickBlackConfirmButton(ra6);
await Delay(400, ct);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
await _returnMainUiTask.Start(ct);
}
}

View File

@ -62,6 +62,9 @@ public class SwitchPartyTask
if (currTeamName == partyName)
{
Logger.LogInformation("切换队伍,当前队伍[{Name}]即为目标队伍,无需切换", partyName);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
await Delay(500, ct);
await _returnMainUiTask.Start(ct);
return true;
}
@ -156,4 +159,4 @@ public class SwitchPartyTask
await Delay(500, ct);
await _returnMainUiTask.Start(ct);
}
}
}

View File

@ -125,7 +125,7 @@ internal class GameTaskManager
ElementAssets.DestroyInstance();
QuickSereniteaPotAssets.DestroyInstance();
GameLoadingAssets.DestroyInstance();
MapAssets.DestroyInstance();
MapLazyAssets.DestroyInstance();
}
/// <summary>

View File

@ -0,0 +1,51 @@
using OpenCvSharp;
namespace BetterGenshinImpact.Helpers.Extensions;
/// <summary>
/// 按比列切割出对应比例区域的矩形
/// </summary>
public static class RectCutExtension
{
public static Rect CutLeft(this Rect rect, double ratio)
{
return new Rect(0, 0, (int)(rect.Width * ratio), rect.Height);
}
public static Rect CutRight(this Rect rect, double ratio)
{
return new Rect(0 + (int)(rect.Width * (1 - ratio)), 0, (int)(rect.Width * ratio), rect.Height);
}
public static Rect CutTop(this Rect rect, double ratio)
{
return new Rect(0, 0, rect.Width, (int)(rect.Height * ratio));
}
public static Rect CutBottom(this Rect rect, double ratio)
{
return new Rect(0, 0 + (int)(rect.Height * (1 - ratio)), rect.Width, (int)(rect.Height * ratio));
}
public static Rect CutLeftTop(this Rect rect, double ratioLeft, double ratioTop)
{
return new Rect(0, 0, (int)(rect.Width * ratioLeft), (int)(rect.Height * ratioTop));
}
public static Rect CutRightTop(this Rect rect, double ratioRight, double ratioTop)
{
return new Rect(0 + (int)(rect.Width * (1 - ratioRight)), 0, (int)(rect.Width * ratioRight), (int)(rect.Height * ratioTop));
}
public static Rect CutLeftBottom(this Rect rect, double ratioLeft, double ratioBottom)
{
return new Rect(0, 0 + (int)(rect.Height * (1 - ratioBottom)), (int)(rect.Width * ratioLeft), (int)(rect.Height * ratioBottom));
}
public static Rect CutRightBottom(this Rect rect, double ratioRight, double ratioBottom)
{
return new Rect(0 + (int)(rect.Width * (1 - ratioRight)), 0 + (int)(rect.Height * (1 - ratioBottom)), (int)(rect.Width * ratioRight), (int)(rect.Height * ratioBottom));
}
}

View File

@ -11,7 +11,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="TaskSettingsPage"
d:DataContext="{d:DesignInstance Type=pages:TaskSettingsPageViewModel}"
d:DesignHeight="850"
d:DesignHeight="1150"
d:DesignWidth="750"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
@ -74,7 +74,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
全自动打牌 -<Hyperlink Command="{Binding GoToAutoGeniusInvokationUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
全自动打牌 -
<Hyperlink Command="{Binding GoToAutoGeniusInvokationUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -118,7 +120,8 @@
SelectedItem="{Binding Config.AutoGeniusInvokationConfig.StrategyName, Mode=TwoWay}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="DropDownOpened">
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}" CommandParameter="GeniusInvocation" />
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}"
CommandParameter="GeniusInvocation" />
</b:EventTrigger>
</b:Interaction.Triggers>
</ComboBox>
@ -177,7 +180,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
装备「王树瑞佑」,通过循环重启游戏刷新并收集木材 -<Hyperlink Command="{Binding GoToAutoWoodUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
装备「王树瑞佑」,通过循环重启游戏刷新并收集木材 -
<Hyperlink Command="{Binding GoToAutoWoodUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -348,7 +353,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
自动执行选择的战斗策略 -<Hyperlink Command="{Binding GoToAutoFightUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
自动执行选择的战斗策略 -
<Hyperlink Command="{Binding GoToAutoFightUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -399,7 +406,8 @@
SelectedItem="{Binding Config.AutoFightConfig.StrategyName, Mode=TwoWay}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="DropDownOpened">
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}" CommandParameter="Combat" />
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}"
CommandParameter="Combat" />
</b:EventTrigger>
</b:Interaction.Triggers>
</ComboBox>
@ -509,7 +517,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
基于钟离的自动循环刷本 -<Hyperlink Command="{Binding GoToAutoDomainUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
基于钟离的自动循环刷本 -
<Hyperlink Command="{Binding GoToAutoDomainUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -560,11 +570,13 @@
SelectedItem="{Binding Config.AutoFightConfig.StrategyName, Mode=TwoWay}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="DropDownOpened">
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}" CommandParameter="Combat" />
<b:InvokeCommandAction Command="{Binding StrategyDropDownOpenedCommand}"
CommandParameter="Combat" />
</b:EventTrigger>
</b:Interaction.Triggers>
</ComboBox>
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -577,22 +589,86 @@
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="强制指定队伍"
Text="自动切换到指定队伍"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="队伍无法被识别时,请按顺序填写队伍内角色名称,逗号分割"
Text="注意队伍名称是游戏内你手动设置的名称"
TextWrapping="Wrap" />
<ui:TextBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
MinWidth="180"
MaxWidth="800"
Margin="0,0,36,0"
Text="{Binding Config.AutoFightConfig.TeamNames, Mode=TwoWay}"
TextWrapping="Wrap" />
Text="{Binding Config.AutoDomainConfig.PartyName, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="指定要前往的秘境"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="自动传送到刷取的秘境"
TextWrapping="Wrap" />
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Width="180"
Margin="0,0,36,0"
ItemsSource="{Binding DomainNameList}"
SelectedItem="{Binding Config.AutoDomainConfig.DomainName, Mode=TwoWay}">
</ComboBox>
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="结束后自动分解圣遗物"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="可以选择要分解到圣遗物的最高星级"
TextWrapping="Wrap" />
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Width="80"
Margin="0,0,10,0"
ItemsSource="{Binding ArtifactSalvageStarList, Mode=TwoWay}"
SelectedItem="{Binding Config.AutoDomainConfig.MaxArtifactStar, Mode=TwoWay}">
</ComboBox>
<ui:ToggleSwitch Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="2"
Margin="0,0,36,0"
IsChecked="{Binding Config.AutoDomainConfig.AutoArtifactSalvage, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -695,6 +771,34 @@
Margin="0,0,36,0"
Text="{Binding Config.AutoDomainConfig.LeftRightMoveTimes, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="强制指定队伍(非特殊情况无需使用)"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="队伍无法被识别时,请按顺序填写队伍内角色名称,逗号分割"
TextWrapping="Wrap" />
<ui:TextBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
MinWidth="180"
MaxWidth="800"
Margin="0,0,36,0"
Text="{Binding Config.AutoFightConfig.TeamNames, Mode=TwoWay}"
TextWrapping="Wrap" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -777,7 +881,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
自动走路跟踪剧情任务,不支持每日任务 -<Hyperlink Command="{Binding GoToAutoTrackUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
自动走路跟踪剧情任务,不支持每日任务 -
<Hyperlink Command="{Binding GoToAutoTrackUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -841,7 +947,9 @@
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap">
进入演奏界面使用,下落模式必须选择垂落模式 -<Hyperlink Command="{Binding GoToAutoMusicGameUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
进入演奏界面使用,下落模式必须选择垂落模式 -
<Hyperlink Command="{Binding GoToAutoMusicGameUrlCommand}"
Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
点击查看使用教程
</Hyperlink>
</ui:TextBlock>
@ -853,7 +961,6 @@
</ui:CardControl>
<!--<ui:CardExpander Margin="0,0,0,12" ContentPadding="0" Icon="{ui:SymbolIcon Accessibility24}">
<ui:CardExpander.Header>
<Grid>

View File

@ -556,8 +556,11 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
// SwitchPartyTask switchPartyTask = new SwitchPartyTask();
// Task.Run(async () => { await switchPartyTask.Start("三保一", new CancellationToken()); });
GoToAdventurersGuildTask goToAdventurersGuildTask = new GoToAdventurersGuildTask();
Task.Run(async () => { await goToAdventurersGuildTask.Start("枫丹", new CancellationToken()); });
// GoToAdventurersGuildTask goToAdventurersGuildTask = new GoToAdventurersGuildTask();
// Task.Run(async () => { await goToAdventurersGuildTask.Start("枫丹", new CancellationToken()); });
ArtifactSalvageTask artifactSalvageTask = new ArtifactSalvageTask();
Task.Run(async () => { await artifactSalvageTask.Start(4, new CancellationToken()); });
}
));
debugDirectory.Children.Add(new HotKeySettingModel(

View File

@ -14,11 +14,13 @@ using BetterGenshinImpact.View.Pages;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Windows.System;
using BetterGenshinImpact.GameTask.Common.Element.Assets;
using BetterGenshinImpact.GameTask.Model.Enum;
using Wpf.Ui;
using Wpf.Ui.Controls;
@ -84,6 +86,12 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw
[ObservableProperty]
private string _switchAutoMusicGameButtonText = "启动";
[ObservableProperty]
private List<string> _domainNameList;
[ObservableProperty]
private List<string> _artifactSalvageStarList = ["4", "3", "2", "1"];
public TaskSettingsPageViewModel(IConfigService configService, INavigationService navigationService, TaskTriggerDispatcher taskTriggerDispatcher)
{
Config = configService.Get();
@ -93,6 +101,8 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw
_strategyList = LoadCustomScript(Global.Absolute(@"User\AutoGeniusInvokation"));
_combatStrategyList = ["根据队伍自动选择", .. LoadCustomScript(Global.Absolute(@"User\AutoFight"))];
_domainNameList = MapLazyAssets.Instance.DomainNameList;
}
private string[] LoadCustomScript(string folder)
@ -365,4 +375,4 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw
{
await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/task/music.html"));
}
}
}