mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
Merge branch 'main' of github.com:atiasn/better-genshin-impact
This commit is contained in:
@@ -329,7 +329,7 @@ public class AutoDomainTask : ISoloTask
|
||||
await Delay(1000, _ct);
|
||||
}
|
||||
|
||||
await Delay(1500, _ct);
|
||||
await Delay(2000, _ct);
|
||||
}
|
||||
|
||||
private List<CombatCommand> FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes)
|
||||
@@ -354,7 +354,7 @@ public class AutoDomainTask : ISoloTask
|
||||
await Task.Run((Action)(() =>
|
||||
{
|
||||
_simulator.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
Sleep(20);
|
||||
Sleep(30, _ct);
|
||||
// 组合键好像不能直接用 postmessage
|
||||
if (!_config.WalkToF)
|
||||
{
|
||||
|
||||
@@ -174,14 +174,11 @@ public class TpTask(CancellationToken ct)
|
||||
await Delay(500, ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<(double, double)> Tp(double tpX, double tpY, bool force = false)
|
||||
{
|
||||
|
||||
await checkInBigMapUi();
|
||||
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
try
|
||||
@@ -259,30 +256,34 @@ public class TpTask(CancellationToken ct)
|
||||
double mouseDistance = Math.Sqrt(totalMoveMouseX * totalMoveMouseX + totalMoveMouseY * totalMoveMouseY);
|
||||
// 调整地图缩放
|
||||
// mapZoomLevel<5 才显示传送锚点和秘境;
|
||||
// mapZoomLevel<3 是为了避免部分锚点过于接近导致选错锚点;
|
||||
// mapZoomLevel<2.5 是为了避免部分锚点过于接近导致选错锚点;
|
||||
// 风龙废墟无法避免,但是目前没有风龙废墟的脚本吧。:)
|
||||
// https://github.com/babalae/better-genshin-impact/issues/318
|
||||
if (mouseDistance < tolerance && currentZoomLevel < 2.5)
|
||||
{
|
||||
Logger.LogInformation($"移动 {iteration} 次鼠标后,已经接近目标点,不再进一步调整。");
|
||||
break;
|
||||
}
|
||||
|
||||
// 距离过远,缩小地图
|
||||
while (mouseDistance > 5 * tolerance && currentZoomLevel < 4)
|
||||
{ // 缩小地图
|
||||
{
|
||||
await AdjustMapZoomLevel(false);
|
||||
totalMoveMouseX *= (currentZoomLevel) / (currentZoomLevel + 1);
|
||||
totalMoveMouseY *= (currentZoomLevel) / (currentZoomLevel + 1);
|
||||
mouseDistance *= (currentZoomLevel) / (currentZoomLevel + 1);
|
||||
currentZoomLevel++;
|
||||
}
|
||||
while (mouseDistance < 2 * tolerance && currentZoomLevel > 2)
|
||||
{ // 放大地图
|
||||
// 距离过近,放大地图
|
||||
while (mouseDistance < 2 * tolerance && currentZoomLevel > 2.5)
|
||||
{
|
||||
await AdjustMapZoomLevel(true);
|
||||
totalMoveMouseX *= (currentZoomLevel) / (currentZoomLevel - 1);
|
||||
totalMoveMouseY *= (currentZoomLevel) / (currentZoomLevel - 1);
|
||||
mouseDistance *= (currentZoomLevel) / (currentZoomLevel - 1);
|
||||
currentZoomLevel--;
|
||||
}
|
||||
// 非常接近目标点,不再进一步调整
|
||||
if (mouseDistance < tolerance)
|
||||
{
|
||||
Logger.LogInformation("移动 {I} 次鼠标后,已经接近目标点,不再移动地图。", iteration + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// 单次移动最大距离为 maxMouseMove
|
||||
moveMouseX = (int)Math.Min(totalMoveMouseX, maxMouseMove * totalMoveMouseX / mouseDistance) * Math.Sign(xOffset);
|
||||
@@ -297,7 +298,6 @@ public class TpTask(CancellationToken ct)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 调整地图缩放级别以加速移动
|
||||
/// </summary>
|
||||
@@ -473,8 +473,6 @@ public class TpTask(CancellationToken ct)
|
||||
country = tpPosition.Country;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: 识别当前国家
|
||||
return (recentX, recentY, country);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace LogParse
|
||||
}
|
||||
|
||||
// 定义文件名匹配的正则表达式
|
||||
string pattern = @"^better-genshin-impact(\d{8})\.log$";
|
||||
string pattern = @"^better-genshin-impact(\d{8})(_\d{3})*\.log$";
|
||||
Regex regex = new Regex(pattern);
|
||||
|
||||
// 遍历文件夹中的所有文件
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BetterGenshinImpact.Genshin.Paths;
|
||||
/// </summary>
|
||||
public partial class UnityLogGameLocator
|
||||
{
|
||||
[GeneratedRegex(@".:/.+(?:GenshinImpact|YuanShen)(?=_Data)", RegexOptions.IgnoreCase)]
|
||||
[GeneratedRegex(@".:(?:\\|/).+(?:GenshinImpact|YuanShen)(?=_Data)", RegexOptions.IgnoreCase)]
|
||||
private static partial Regex WarmupFileLine();
|
||||
|
||||
public static async ValueTask<string?> LocateSingleGamePathAsync()
|
||||
@@ -23,28 +23,19 @@ public partial class UnityLogGameLocator
|
||||
string logFilePathOversea = Path.Combine(appDataPath, @"..\LocalLow\miHoYo\Genshin Impact\output_log.txt");
|
||||
string logFilePathChinese = Path.Combine(appDataPath, @"..\LocalLow\miHoYo\原神\output_log.txt");
|
||||
|
||||
if (File.Exists(logFilePathChinese))
|
||||
var p1 = await LocateGamePathAsync(logFilePathChinese).ConfigureAwait(false);
|
||||
if (p1 is not null)
|
||||
{
|
||||
var p1 = await LocateGamePathAsync(logFilePathChinese).ConfigureAwait(false);
|
||||
if (p1 is not null && File.Exists(p1))
|
||||
{
|
||||
return p1;
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(logFilePathOversea))
|
||||
{
|
||||
var p2 = await LocateGamePathAsync(logFilePathOversea).ConfigureAwait(false);
|
||||
if (p2 is not null && File.Exists(p2))
|
||||
{
|
||||
return p2;
|
||||
}
|
||||
return p1;
|
||||
}
|
||||
|
||||
return await LocateGamePathAsync(logFilePathOversea).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TaskControl.Logger.LogDebug(e, "Failed to locate game path.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -73,8 +64,12 @@ public partial class UnityLogGameLocator
|
||||
return null;
|
||||
}
|
||||
|
||||
string entryName = $"{matchResult.Value}.exe";
|
||||
string fullPath = Path.GetFullPath(Path.Combine(matchResult.Value, "..", entryName));
|
||||
string fullPath = Path.GetFullPath($"{matchResult.Value}.exe");
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
}
|
||||
@@ -702,35 +702,6 @@
|
||||
MinWidth="120"
|
||||
Text="{Binding Config.AutoFightConfig.Timeout}" />
|
||||
</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>
|
||||
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
@@ -1020,34 +991,6 @@
|
||||
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" />
|
||||
|
||||
@@ -322,34 +322,6 @@
|
||||
</b:Interaction.Triggers>
|
||||
</ComboBox>
|
||||
</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 PathingConfig.AutoFightConfig.TeamNames, Mode=TwoWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
|
||||
@@ -47,10 +47,10 @@ internal class Program
|
||||
option.IsInstallCertificate = false;
|
||||
option.OverlayInstallRemoveExt = "exe,dll,pdb";
|
||||
option.UnpackingPassword = null!;
|
||||
option.ExeName = @"BetterGI\BetterGI.exe";
|
||||
option.ExeName = @"BetterGI.exe";
|
||||
option.KeyName = "BetterGI";
|
||||
option.DisplayName = "BetterGI";
|
||||
option.DisplayIcon = @"BetterGI\BetterGI.exe";
|
||||
option.DisplayIcon = @"BetterGI.exe";
|
||||
option.DisplayVersion = "0.0.0.0";
|
||||
option.Publisher = "babalae";
|
||||
option.AppName = "BetterGI";
|
||||
|
||||
@@ -41,10 +41,10 @@ internal class Program
|
||||
option.IsAllowFirewall = true;
|
||||
option.IsRefreshExplorer = true;
|
||||
option.IsInstallCertificate = false;
|
||||
option.ExeName = @"BetterGI\BetterGI.exe";
|
||||
option.ExeName = @"BetterGI.exe";
|
||||
option.KeyName = "BetterGI";
|
||||
option.DisplayName = "BetterGI";
|
||||
option.DisplayIcon = @"BetterGI\BetterGI.exe";
|
||||
option.DisplayIcon = @"BetterGI.exe";
|
||||
option.DisplayVersion = "0.0.0.0";
|
||||
option.Publisher = "babalae";
|
||||
option.AppName = "BetterGI";
|
||||
|
||||
@@ -30,13 +30,13 @@ cd /d %~dp0
|
||||
del /f /q %tmpfolder%\*.lib
|
||||
del /f /q %tmpfolder%\*ffmpeg*.dll
|
||||
|
||||
:: 添加一些配置文件开始(大文件不适合放在Github)
|
||||
:: 添加一些配置文件开始(大文件不适合放在Github)
|
||||
if exist "E:\HuiTask\BetterGIBuild\BetterGI" (
|
||||
xcopy "E:\HuiTask\BetterGIBuild\BetterGI\*" "%tmpfolder%" /E /C /I /Y
|
||||
)
|
||||
:: 添加一些配置文件结束
|
||||
:: 添加一些配置文件结束
|
||||
|
||||
MicaSetup.Tools\7-Zip\7z a publish.7z %tmpfolder%\ -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
MicaSetup.Tools\7-Zip\7z a publish.7z %tmpfolder%\* -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
copy /y publish.7z .\MicaSetup\Resources\Setups\publish.7z
|
||||
if exist "%zipFile%" ( del /f /q "%zipfile%" )
|
||||
rename publish.7z %archiveFile%
|
||||
|
||||
@@ -29,7 +29,7 @@ xcopy * "%tmpfolder%" /E /C /I /Y
|
||||
cd /d %~dp0
|
||||
del /f /q %tmpfolder%\*.lib
|
||||
del /f /q %tmpfolder%\*ffmpeg*.dll
|
||||
MicaSetup.Tools\7-Zip\7z a publish.7z %tmpfolder%\ -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
MicaSetup.Tools\7-Zip\7z a publish.7z %tmpfolder%\* -t7z -mx=5 -mf=BCJ2 -r -y
|
||||
copy /y publish.7z .\MicaSetup\Resources\Setups\publish.7z
|
||||
if exist "%zipFile%" ( del /f /q "%zipfile%" )
|
||||
rename publish.7z %archiveFile%
|
||||
|
||||
@@ -107,4 +107,4 @@ BetterGI · 更好的原神, 一个基于计算机视觉技术,意图让原
|
||||
|
||||
## 问题反馈
|
||||
|
||||
提 [Issue](https://github.com/babalae/better-genshin-impact/issues) 或 QQ群[783846140](https://qm.qq.com/q/lVzxCCKEko)
|
||||
提 [Issue](https://github.com/babalae/better-genshin-impact/issues) 或 QQ群[960900268](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=faj5hQWJwrWtl9PG8sSAlN2jlQMQfoU1&authKey=QXFi8LYERO4j8TBnO%2FuDtazKXJdMDZaO%2FV2fXmm3USsjpeU8dJgi7Bha9mdfdXy5&noverify=0&group_code=960900268)
|
||||
|
||||
Reference in New Issue
Block a user