Compare commits

..
17 Commits
Author SHA1 Message Date
辉鸭蛋 9748ccd9ea 0.42.0 2025-02-12 23:30:07 +08:00
辉鸭蛋 ccf1c37283 tp: expand non clickable areas 2025-02-12 23:12:26 +08:00
辉鸭蛋 aabd1e0c01 fix kale 2025-02-12 23:02:16 +08:00
辉鸭蛋 3fcc11a617 edit tp config 2025-02-12 22:41:04 +08:00
辉鸭蛋 717bd931f7 edit tp config #1145 2025-02-12 22:13:08 +08:00
Scarlet cb8a743d34 修复因原神更新引起的地图缩放问题 (#1151)
* bugfix: fix map navigation problem caused by Genshin update

* constant adjust
2025-02-12 20:53:41 +08:00
郝凯阳andhaokaiyang dccc116ea8 auto tcg: update character card config to v5.4 (#1148)
Co-authored-by: haokaiyang <[email protected]>
2025-02-12 15:31:20 +08:00
辉鸭蛋 79493b4407 Update README.md 2025-02-11 14:49:42 +08:00
辉鸭蛋 2c554ab2f4 delete debug code 2025-02-09 17:05:11 +08:00
辉鸭蛋 51216d6b84 pathing: auto skip config3 2025-02-09 15:16:22 +08:00
辉鸭蛋 040f40d94b fix notify bug 2025-02-08 22:25:00 +08:00
Houning_YA 3053e1aeb3 支持鼠标虚拟键代码 (#1124) 2025-02-08 20:42:38 +08:00
秋云 6bf0d886ca Merge pull request #1114 from physligl/main
Fix typos.
2025-02-08 13:49:11 +08:00
辉鸭蛋 f1cc1cdb94 Merge pull request #1117 from HZYgrandma/patch-6
添加迪希雅作为主要行走角色
2025-02-08 13:48:51 +08:00
辉鸭蛋 11ac1f3cfa Merge pull request #1119 from Uqbc9/main
Update avatar_macro.json  补充新角色;增加玛薇卡跳喷宏,按住极限平地9次跳喷
2025-02-08 13:47:51 +08:00
Uqbc9 ea8468b999 Update avatar_macro.json 补充新角色;增加玛薇卡跳喷宏,按住极限平地9次跳喷
补充新角色
增加玛薇卡跳喷宏,按住极限平地9次跳喷
2025-02-08 13:30:01 +08:00
洪籽阳外婆 8f5529f79d 添加迪希雅作为主要行走角色 2025-02-07 12:56:00 +08:00
16 changed files with 424 additions and 48 deletions

No files matched your search

@@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
<AssemblyName>BetterGI</AssemblyName>
<AssemblyVersion>0.41.0</AssemblyVersion>
<AssemblyVersion>0.42.0</AssemblyVersion>
<Platforms>x64</Platforms>
<DebugType>embedded</DebugType>
</PropertyGroup>
@@ -43,6 +43,13 @@ public partial class PathingConditionConfig : ObservableObject
Subject = "队伍中角色",
Object = ["钟离"],
Result = "循环长E"
},
new Condition
{
Subject = "队伍中角色",
Object = ["迪希雅"],
Result = "作为主要行走角色"
}
]
};
@@ -6,6 +6,7 @@ using System;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.Common;
using Vanara.PInvoke;
using static Vanara.PInvoke.User32;
namespace BetterGenshinImpact.Core.Script.Dependence;
@@ -20,17 +21,77 @@ public class GlobalMethod
public static void KeyDown(string key)
{
Simulation.SendInput.Keyboard.KeyDown(ToVk(key));
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonDown();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonDown();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonDown();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonDown(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonDown(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyDown(ToVk(key));
break;
}
}
public static void KeyUp(string key)
{
Simulation.SendInput.Keyboard.KeyUp(ToVk(key));
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonUp();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonUp();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonUp();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonUp(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonUp(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyUp(ToVk(key));
break;
}
}
public static void KeyPress(string key)
{
Simulation.SendInput.Keyboard.KeyPress(ToVk(key));
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonClick();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonClick();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonClick();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonClick(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonClick(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyPress(ToVk(key));
break;
}
}
private static User32.VK ToVk(string key)
@@ -676,18 +676,78 @@ public class Avatar
public void KeyDown(string key)
{
var vk = User32Helper.ToVk(key);
Simulation.SendInput.Keyboard.KeyDown(vk);
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonDown();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonDown();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonDown();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonDown(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonDown(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyDown(vk);
break;
}
}
public void KeyUp(string key)
{
var vk = User32Helper.ToVk(key);
Simulation.SendInput.Keyboard.KeyUp(vk);
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonUp();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonUp();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonUp();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonUp(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonUp(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyUp(vk);
break;
}
}
public void KeyPress(string key)
{
var vk = User32Helper.ToVk(key);
Simulation.SendInput.Keyboard.KeyPress(vk);
switch (key)
{
case "VK_LBUTTON":
Simulation.SendInput.Mouse.LeftButtonClick();
break;
case "VK_RBUTTON":
Simulation.SendInput.Mouse.RightButtonClick();
break;
case "VK_MBUTTON":
Simulation.SendInput.Mouse.MiddleButtonClick();
break;
case "VK_XBUTTON1":
Simulation.SendInput.Mouse.XButtonClick(0x0001);
break;
case "VK_XBUTTON2":
Simulation.SendInput.Mouse.XButtonClick(0x0001);
break;
default:
Simulation.SendInput.Keyboard.KeyPress(vk);
break;
}
}
}
@@ -2776,6 +2776,83 @@
}
]
},
{
"id": 1314,
"nameEn": "arlecchino",
"type": "character",
"name": "阿蕾奇诺",
"hp": 10,
"energy": 3,
"element": "火元素",
"weapon": "长柄武器",
"skills": [
{
"nameEn": "invitation_to_a_beheading",
"name": "斩首之邀",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "all_is_ash",
"name": "万相化灰",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 3
}
]
},
{
"nameEn": "balemoon_rising",
"name": "厄月将升",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 3
}
]
},
{
"nameEn": "the_balemoon_alone_may_know",
"name": "唯厄月可知晓",
"skillTag": [
"被动技能"
],
"cost": []
}
]
},
{
"id": 1401,
"nameEn": "fischl",
@@ -5521,6 +5598,75 @@
}
]
},
{
"id": 1709,
"nameEn": "kinich",
"type": "character",
"name": "基尼奇",
"hp": 10,
"energy": 2,
"element": "草元素",
"weapon": "双手剑",
"skills": [
{
"nameEn": "nightsun_style",
"name": "夜阳斗技",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "canopy_hunter_riding_high",
"name": "悬猎·游骋高狩",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
}
]
},
{
"nameEn": "hail_to_the_almighty_dragonlord",
"name": "向伟大圣龙致意",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
}
]
},
{
"id": 2101,
"nameEn": "fatui_cryo_cicin_mage",
@@ -6433,7 +6579,7 @@
"nameEn": "emperor_of_fire_and_iron",
"type": "character",
"name": "铁甲熔火帝皇",
"hp": 6,
"hp": 5,
"energy": 2,
"element": "火元素",
"weapon": "其他武器",
@@ -1001,6 +1001,7 @@ public class PathExecutor
{
_autoSkipTrigger = new AutoSkipTrigger(new AutoSkipConfig
{
Enabled = true,
QuicklySkipConversationsEnabled = true, // 快速点击过剧情
ClosePopupPagedEnabled = true,
ClickChatOption = "优先选择最后一个选项",
@@ -29,26 +29,29 @@ public partial class TpConfig : ObservableObject
[ObservableProperty]
private double _reviveStatueOfTheSevenPointY = -824.4; // 七天神像点位Y坐标
// 地图缩放程度的按钮 间隔 35 和截图有关的,按钮高2
/// <summary>
/// 缩放比例按钮的最上 y 坐标(地图最大化时、且坐标是按钮中心)
/// </summary>
[ObservableProperty]
[property: JsonIgnore]
private int _zoomOutButtonY = 654; // y-coordinate for zoom-out button
private int _zoomStartY = 468; // y-coordinate for zoom start
/// <summary>
/// 缩放比例按钮的最下 y 坐标(地图最小化时、且坐标是按钮中心)
/// </summary>
[ObservableProperty]
[property: JsonIgnore]
private int _zoomInButtonY = 428; // y-coordinate for zoom-in button
private int _zoomEndY = 612; // y-coordinate for zoom end
/// <summary>
/// 缩放比例按钮的 x 坐标
/// </summary>
[ObservableProperty]
[property: JsonIgnore]
private int _zoomButtonX = 49; // x-coordinate for zoom button
[ObservableProperty]
[property: JsonIgnore]
private int _zoomStartY = 453; // y-coordinate for zoom start
[ObservableProperty]
[property: JsonIgnore]
private int _zoomEndY = 628; // y-coordinate for zoom end
private int _zoomButtonX = 47; // x-coordinate for zoom button
[ObservableProperty]
private double _tolerance = 200; // 允许的移动误差
@@ -37,6 +37,17 @@ public class TpTask(CancellationToken ct)
private readonly double _zoomOutMax1080PRatio = TaskContext.Instance().SystemInfo.ZoomOutMax1080PRatio;
private readonly TpConfig _tpConfig = TaskContext.Instance().Config.TpConfig;
/// <summary>
/// 直接通过缩放比例按钮计算放大按钮的Y坐标
/// </summary>
private readonly int _zoomInButtonY = TaskContext.Instance().Config.TpConfig.ZoomStartY - 24; // y-coordinate for zoom-in button = _zoomStartY - 24
/// <summary>
/// 直接通过缩放比例按钮计算缩小按钮的Y坐标
/// </summary>
private readonly int _zoomOutButtonY = TaskContext.Instance().Config.TpConfig.ZoomEndY + 24; // y-coordinate for zoom-out button = _zoomEndY + 24
private const double DisplayTpPonitRatio = 4.4; // 传送点显示的时候的地图比例
/// <summary>
/// 传送到须弥七天神像
/// </summary>
@@ -46,9 +57,9 @@ public class TpTask(CancellationToken ct)
if (_tpConfig.MapZoomEnabled)
{
double currentZoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
if (currentZoomLevel > 4.5)
if (currentZoomLevel > DisplayTpPonitRatio)
{
await AdjustMapZoomLevel(currentZoomLevel, 4.5);
await AdjustMapZoomLevel(currentZoomLevel, DisplayTpPonitRatio);
}
else if (currentZoomLevel < 3)
{
@@ -84,12 +95,12 @@ public class TpTask(CancellationToken ct)
double zoomLevel = GetBigMapZoomLevel(CaptureToRectArea());
if (_tpConfig.MapZoomEnabled)
{
if (zoomLevel > 4.5)
if (zoomLevel > DisplayTpPonitRatio)
{
// 显示传送锚点和秘境的缩放等级
await AdjustMapZoomLevel(zoomLevel, 4.5);
zoomLevel = 4.5;
Logger.LogInformation("当前缩放等级过大,调整为 {zoomLevel:0.00}", 4.5);
await AdjustMapZoomLevel(zoomLevel, DisplayTpPonitRatio);
zoomLevel = DisplayTpPonitRatio;
Logger.LogInformation("当前缩放等级过大,调整为 {zoomLevel:0.00}", DisplayTpPonitRatio);
}
}
@@ -165,8 +176,8 @@ public class TpTask(CancellationToken ct)
}
var (clickX, clickY) = ConvertToGameRegionPosition(bigMapInAllMapRect, x, y);
// 屏蔽左上角350x400区域
if (clickX < 350 * _zoomOutMax1080PRatio && clickY < 400 * _zoomOutMax1080PRatio)
// 屏蔽左上角360x400区域
if (clickX < 360 * _zoomOutMax1080PRatio && clickY < 400 * _zoomOutMax1080PRatio)
{
return false;
}
@@ -336,7 +347,7 @@ public class TpTask(CancellationToken ct)
bool zoomIn = mouseDistance < _tpConfig.MapZoomInDistance;
if (zoomIn)
{
if (currentZoomLevel > _tpConfig.MinZoomLevel + 1.0)
if (currentZoomLevel > minZoomLevel + 1.0)
{
await AdjustMapZoomLevel(zoomIn);
await Delay(50, ct);
@@ -423,11 +434,11 @@ public class TpTask(CancellationToken ct)
{
if (zoomIn)
{
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _tpConfig.ZoomInButtonY * scale));
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _zoomInButtonY * scale));
}
else
{
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _tpConfig.ZoomOutButtonY * scale));
GameCaptureRegion.GameRegionClick((rect, scale) => (_tpConfig.ZoomButtonX * scale, _zoomOutButtonY * scale));
}
await Delay(50, ct);
@@ -120,9 +120,9 @@ public static partial class Bv
throw new Exception("当前未处于大地图界面,不能使用GetBigMapScale方法");
}
// 452 ~ 627 间隔 35 和截图有关的,截图高24
var start = QuickTeleportAssets.MapScaleButton1080StartY;
var end = QuickTeleportAssets.MapScaleButton1080EndY;
// 原先这里的起止区间和config里写死的值差1
var start = TaskContext.Instance().Config.TpConfig.ZoomStartY;
var end = TaskContext.Instance().Config.TpConfig.ZoomEndY;
var cur = (scaleRa.Y + scaleRa.Height / 2.0) * TaskContext.Instance().SystemInfo.ZoomOutMax1080PRatio; // 转换到1080p坐标系,主要是小于1080p的情况
return (end * 1.0 - cur) / (end - start);
@@ -199,6 +199,11 @@ public class TaskControl
return bitmap;
}
}
public static Bitmap? CaptureGameBitmapNoRetry(IGameCapture? gameCapture)
{
return gameCapture?.Capture();
}
// private static CaptureContent CaptureToContent(IGameCapture? gameCapture)
// {
@@ -18,9 +18,6 @@ public class QuickTeleportAssets : BaseAssets<QuickTeleportAssets>
public RecognitionObject MapUndergroundSwitchButtonRo;
public RecognitionObject MapUndergroundToGroundButtonRo;
public const int MapScaleButton1080StartY = 452;
public const int MapScaleButton1080EndY = 627;
private QuickTeleportAssets()
{
@@ -5,6 +5,7 @@ using System.Drawing;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.Service.Notification.Converter;
using Microsoft.Extensions.Logging;
namespace BetterGenshinImpact.Service.Notification.Model;
@@ -21,13 +22,13 @@ public class BaseNotificationData
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public NotificationEventResult Result { get; set; }
/// <summary>
/// 事件触发时间
/// </summary>
[JsonConverter(typeof(DateTimeJsonConverter))]
public DateTime Timestamp { get; set; } = DateTime.Now;
/// <summary>
/// 事件触发时的截图
/// </summary>
@@ -46,14 +47,16 @@ public class BaseNotificationData
public void Send()
{
if (TaskContext.Instance().Config.NotificationConfig.IncludeScreenShot)
try
{
Screenshot = (Bitmap)TaskControl.CaptureToRectArea().SrcBitmap.Clone();
NotificationService.Instance().NotifyAllNotifiers(this);
}
catch (Exception e)
{
TaskControl.Logger.LogDebug(e, "发送通知失败");
}
NotificationService.Instance().NotifyAllNotifiers(this);
}
public void Send(string message)
{
Message = message;
@@ -4,12 +4,14 @@ using BetterGenshinImpact.Service.Notifier.Exception;
using BetterGenshinImpact.Service.Notifier.Interface;
using Microsoft.Extensions.Hosting;
using System;
using System.Drawing;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.Service.Notification.Model.Enum;
using Microsoft.Extensions.Logging;
namespace BetterGenshinImpact.Service.Notification;
@@ -118,6 +120,22 @@ public class NotificationService : IHostedService
}
}
try
{
if (TaskContext.Instance().Config.NotificationConfig.IncludeScreenShot)
{
var bitmap = TaskControl.CaptureGameBitmapNoRetry(TaskTriggerDispatcher.GlobalGameCapture);
if (bitmap != null)
{
notificationData.Screenshot = (Bitmap)bitmap.Clone();
}
}
}
catch (Exception e)
{
TaskControl.Logger.LogDebug(e, "补充通知截图失败");
}
await _notifierManager.SendNotificationToAllAsync(notificationData);
}
+3 -3
View File
@@ -49,9 +49,9 @@ public class UpdateService : IUpdateService
{
string newVersion = await GetLatestVersionAsync();
#if DEBUG && true
newVersion = "256.256.256.256";
#endif
// #if DEBUG && true
// newVersion = "256.256.256.256";
// #endif
if (string.IsNullOrWhiteSpace(newVersion))
{
@@ -321,5 +321,69 @@
{
"name": "闲云",
"scriptContent1": ""
},
{
"name": "千织",
"scriptContent1": ""
},
{
"name": "希格雯",
"scriptContent1": ""
},
{
"name": "阿蕾奇诺",
"scriptContent1": ""
},
{
"name": "赛索斯",
"scriptContent1": ""
},
{
"name": "克洛琳德",
"scriptContent1": ""
},
{
"name": "艾梅莉埃",
"scriptContent1": ""
},
{
"name": "卡齐娜",
"scriptContent1": ""
},
{
"name": "基尼奇",
"scriptContent1": ""
},
{
"name": "玛拉妮",
"scriptContent1": ""
},
{
"name": "希诺宁",
"scriptContent1": ""
},
{
"name": "恰斯卡",
"scriptContent1": ""
},
{
"name": "欧洛伦",
"scriptContent1": ""
},
{
"name": "玛薇卡",
"scriptContent1": "keydown(space),keyup(space),wait(0.08),keydown(space),keyup(space),wait(0.08),keydown(space),keyup(space),wait(1.3)"
},
{
"name": "茜特菈莉",
"scriptContent1": ""
},
{
"name": "蓝砚",
"scriptContent1": ""
},
{
"name": "梦见月瑞希",
"scriptContent1": ""
}
]
+1 -1
View File
@@ -115,4 +115,4 @@ BetterGI · 更好的原神, 一个基于计算机视觉技术,意图让原
## 问题反馈
提 [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)
提 [Issue](https://github.com/babalae/better-genshin-impact/issues) 或 QQ群[1029539994](https://qm.qq.com/q/vCOphnHFK2)