针对 #1797 新增的尘歌壶进入方式添加配置

This commit is contained in:
辉鸭蛋
2025-07-06 12:29:09 +08:00
parent 1e18bbffb2
commit 38a7cfce0b
5 changed files with 57 additions and 8 deletions

View File

@@ -3,4 +3,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=enkanomiya/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=enkanomiya/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorchan/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorchan/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=onslaugh/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=onslaugh/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=serenitea/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -51,6 +51,10 @@ public partial class OneDragonFlowConfig : ObservableObject
[ObservableProperty] [ObservableProperty]
private string _sundaySelectedValue = "0"; private string _sundaySelectedValue = "0";
// 尘歌壶传送方式1. 地图传送 2. 尘歌壶道具
[ObservableProperty]
private string _sereniteaPotTpType = "地图传送";
// 尘歌壶洞天购买商品 // 尘歌壶洞天购买商品
[ObservableProperty] [ObservableProperty]
private List<string> _secretTreasureObjects = new(); private List<string> _secretTreasureObjects = new();

View File

@@ -68,9 +68,13 @@ internal class GoToSereniteaPotTask
Logger.LogDebug(e, "领取尘歌壶奖励异常"); Logger.LogDebug(e, "领取尘歌壶奖励异常");
Logger.LogError("领取尘歌壶奖励异常: {Msg}", e.Message); Logger.LogError("领取尘歌壶奖励异常: {Msg}", e.Message);
} }
finally
{
Simulation.ReleaseAllKey();
}
} }
private async Task IntoSereniteaPot(CancellationToken ct) private async Task<bool> IntoSereniteaPot(CancellationToken ct)
{ {
// 退出到主页面 // 退出到主页面
await new ReturnMainUiTask().Start(ct); await new ReturnMainUiTask().Start(ct);
@@ -167,9 +171,8 @@ internal class GoToSereniteaPotTask
if (attempt == 9) if (attempt == 9)
{ {
fail = true;
Logger.LogWarning("领取尘歌壶奖励:{text}", "传送至尘歌壶失败"); Logger.LogWarning("领取尘歌壶奖励:{text}", "传送至尘歌壶失败");
return; return false;
} }
Logger.LogInformation("领取尘歌壶奖励:{text}", "传送按钮、传送住宅按钮未找到,重试"); Logger.LogInformation("领取尘歌壶奖励:{text}", "传送按钮、传送住宅按钮未找到,重试");
@@ -177,6 +180,7 @@ internal class GoToSereniteaPotTask
} }
await NewRetry.WaitForAction(() => Bv.IsInMainUi(CaptureToRectArea()), ct); await NewRetry.WaitForAction(() => Bv.IsInMainUi(CaptureToRectArea()), ct);
return true;
} }
/// <summary> /// <summary>
@@ -335,7 +339,7 @@ internal class GoToSereniteaPotTask
} }
await Delay(300, ct); await Delay(300, ct);
} }
await Delay(100, ct); await Delay(500, ct); // 默认开启动态模糊,停顿时间太短的情况下,截图可能会模糊,导致识别失败
if (continuousCount > 180) if (continuousCount > 180)
{ {
fail = true; fail = true;
@@ -442,7 +446,6 @@ internal class GoToSereniteaPotTask
CaptureToRectArea().Find(ElementAssets.Instance.PageCloseWhiteRo).Click(); CaptureToRectArea().Find(ElementAssets.Instance.PageCloseWhiteRo).Click();
} }
InitConfigList();
await Delay(900, ct); await Delay(900, ct);
// 商店购买 // 商店购买
if (SelectedConfig.SecretTreasureObjects.Count == 0) if (SelectedConfig.SecretTreasureObjects.Count == 0)
@@ -630,6 +633,7 @@ internal class GoToSereniteaPotTask
public async Task DoOnce(CancellationToken ct) public async Task DoOnce(CancellationToken ct)
{ {
InitConfigList();
// /** // /**
// * 1. 首先退出到主页面 // * 1. 首先退出到主页面
// * 2. 进入尘歌壶 // * 2. 进入尘歌壶
@@ -638,10 +642,21 @@ internal class GoToSereniteaPotTask
// * 5. 领取奖励 // * 5. 领取奖励
// */ // */
// 进入尘歌壶 // 进入尘歌壶
if (!await IntoSereniteaPotByBag(ct)) var success = false;
if (SelectedConfig!.SereniteaPotTpType == "地图传送")
{ {
await IntoSereniteaPot(ct); success = await IntoSereniteaPot(ct);
} }
else
{
success = await IntoSereniteaPotByBag(ct);
}
if (!success)
{
await Finished(ct);
return;
}
// 寻找阿圆并靠近 // 寻找阿圆并靠近
await FindAYuan(ct); await FindAYuan(ct);
// 领取奖励 // 领取奖励

View File

@@ -11,7 +11,7 @@
xmlns:pages="clr-namespace:BetterGenshinImpact.ViewModel.Pages" xmlns:pages="clr-namespace:BetterGenshinImpact.ViewModel.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
d:DataContext="{d:DesignInstance Type=pages:OneDragonFlowViewModel}" d:DataContext="{d:DesignInstance Type=pages:OneDragonFlowViewModel}"
d:DesignHeight="600" d:DesignHeight="1000"
d:DesignWidth="800" d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}" ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}" ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
@@ -1014,6 +1014,33 @@
FontSize="14" FontSize="14"
Foreground="{DynamicResource SystemAccentColorPrimaryBrush}" Foreground="{DynamicResource SystemAccentColorPrimaryBrush}"
Text="尘歌壶奖励" /> Text="尘歌壶奖励" />
<ui:CardControl Margin="0,0,0,12">
<ui:CardControl.Icon>
<ui:FontIcon Glyph="&#xf07a;" Style="{StaticResource FaFontIconStyle}" />
</ui:CardControl.Icon>
<ui:CardControl.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<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" />
</Grid>
</ui:CardControl.Header>
<ComboBox MinWidth="100"
Margin="0,0,28,0"
SelectedItem="{Binding SelectedConfig.SereniteaPotTpType, Mode=TwoWay}"
ItemsSource="{Binding SereniteaPotTpTypes}" />
</ui:CardControl>
<ui:CardControl Margin="0,0,0,12"> <ui:CardControl Margin="0,0,0,12">
<ui:CardControl.Icon> <ui:CardControl.Icon>
<ui:FontIcon Glyph="&#xf07a;" Style="{StaticResource FaFontIconStyle}" /> <ui:FontIcon Glyph="&#xf07a;" Style="{StaticResource FaFontIconStyle}" />

View File

@@ -390,6 +390,8 @@ public partial class OneDragonFlowViewModel : ViewModel
[ObservableProperty] private List<string> _secretTreasureObjectList = ["布匹","须臾树脂","大英雄的经验","流浪者的经验","精锻用魔矿","摩拉","祝圣精华","祝圣油膏"]; [ObservableProperty] private List<string> _secretTreasureObjectList = ["布匹","须臾树脂","大英雄的经验","流浪者的经验","精锻用魔矿","摩拉","祝圣精华","祝圣油膏"];
[ObservableProperty] private List<string> _sereniteaPotTpTypes = ["地图传送", "尘歌壶道具"];
public AllConfig Config { get; set; } = TaskContext.Instance().Config; public AllConfig Config { get; set; } = TaskContext.Instance().Config;
public OneDragonFlowViewModel() public OneDragonFlowViewModel()