Compare commits

...
864 Commits
Author SHA1 Message Date
辉鸭蛋 98b46e8f1b 0.44.0 2025-03-31 10:54:22 +08:00
FishmanTheMurloc 8f8aad4130 分解圣遗物支持多语言,顺便修了一下5.5版本快速选择筛选星级逻辑 (#1369) 2025-03-30 16:23:08 +08:00
辉鸭蛋 ad73198125 js 图像识别的补充 2025-03-30 15:34:25 +08:00
辉鸭蛋 f7e7320461 #1366 2025-03-30 13:26:07 +08:00
Feiran Zhang 470eb364db 通过调度器启动时,添加sleep防止闪退 (#1366)
发现通过调度器直接原神启动时,进入主界面前有概率闪退,可能是while (true)里的截图太频繁导致,添加sleep后测试该问题已解决
2025-03-30 13:23:57 +08:00
辉鸭蛋 282f664c27 Merge remote-tracking branch 'origin/main' 2025-03-30 01:18:44 +08:00
辉鸭蛋 bae42f84c6 typo 2025-03-30 01:07:14 +08:00
起个名字好难的喵 79d379f579 Add 安饶之野 Teleport (#1365) 2025-03-29 19:41:17 +08:00
辉鸭蛋 2e5a933a61 修复自动秘境选择火本(无妄引咎密宫)后,行走配置不正确的问题 #1345 2025-03-29 16:44:41 +08:00
辉鸭蛋 84cea2d2e0 update ui 2025-03-29 16:16:16 +08:00
辉鸭蛋 535e879446 调度器设置中的战斗配置,如果开启则自动开启上面的地图追踪配置 2025-03-29 14:32:36 +08:00
辉鸭蛋 4f0af583c2 0.43.6 2025-03-29 13:07:19 +08:00
FishmanTheMurloc 40cd76fbdc Feat/multi lan (#1364)
* 多语言下拉框挪到其他设置下

* 使用正经的Fixture写法,杜绝并行测试时paddle崩溃的问题

* 适配不同主城的合成台的不同法语名

* 修正语言资源的正则表达式,好久没用了写错了好多;为AutoDomainTask新增的“地脉异常”、“点击任意位置关闭”添加多语言适配
2025-03-29 12:54:27 +08:00
辉鸭蛋 8240748c95 remove MicaSetup, it's in https://github.com/babalae/bettergi-publish 2025-03-29 12:53:37 +08:00
辉鸭蛋 1538b3f8fb 5.5 avatar model 2025-03-29 12:47:08 +08:00
辉鸭蛋 11f0a8528d Merge remote-tracking branch 'origin/main' 2025-03-28 21:23:21 +08:00
FishmanTheMurloc 2cfaf9335e 多语言下拉框挪到其他设置下 (#1362) 2025-03-28 14:01:38 +08:00
郝凯阳 bd67d4df30 auto tcg: update character card config to v5.5 (#1359) 2025-03-28 12:11:14 +08:00
FishmanTheMurloc 6d4f8b80e8 Feat/multi lan (#1336)
* 记录一次对hutaofisher的访谈,帮助开发者理解其算法

* 本地化HelloWorld

* .csproj取消windows版本号,此处导致了IDE在新建代码文件和自动生成代码时,默认命名空间丢失的问题。已知VisualStudio和ReSharper存在这个问题。

* 优化扩展方法写法,改为从localizer扩展;Converter优化写法,避免冲突;新增两种语言,待测试ocr效果

* Revert ".csproj取消windows版本号,此处导致了IDE在新建代码文件和自动生成代码时,默认命名空间丢失的问题。已知VisualStudio和ReSharper存在这个问题。"

This reverts commit 8bd7ee74c5.

* localizer改为由构造函数传入以支持单元测试;一个英语上钩的单元测试

* 传送任务支持英语游戏界面;本地化参数挪至OtherConfig类下,但界面位置暂不挪动,待定

* 调整resx位置风格,放在直接使用字符串的类下;一条龙合成树脂及领取每日奖励支持游戏内中英双语

* 删除无用碎片文件

* 删去两个不必要的Sdcb包引用

* Paddle服务类去掉分类模型;检测和识别新增支持繁中和法语,配有单元测试;因小语种识别效果不理想,使用正则匹配替换多处识别文本相等或包含判断;钓鱼、一条龙合成树脂及领取每日奖励支持游戏内繁中和法语;

* 检查今日奖励任务的多语言化;右侧联机的P图标检测区域宽度缩减,避免英语角色名被误识别成P

* AutoDomainTask的游戏多语言化,由于我的游戏账号无法测试,仅配一些测试用例

* 修复有3个Mizuki导致异常的bug,临时用拼音代替新角色英文名,并为该数据初始化方法添加单元测试

* 瓦雷莎删去别名“牛牛”,因荒泷一斗已占用此别名;别名加载和读取优化

* 加个锁避免单元测试中多线程初始化paddle崩溃
2025-03-28 11:00:08 +08:00
辉鸭蛋 47ffbe9c89 5.5 avatar 2025-03-28 01:07:59 +08:00
辉鸭蛋 de50acd758 1024 map 2025-03-28 00:46:34 +08:00
起个名字好难 b6a54c5272 ElementalCollect Electro:Varesa (#1355) 2025-03-27 22:06:47 +08:00
秋云 2423e36456 自动秘境添加【荒废砌造坞】,仅供临时使用 (#1354)
* fix: typos

* fix: 自动秘境添加【荒废砌造坞】,仅供临时使用
2025-03-27 20:30:52 +08:00
秋云 325b54ef9c fix: typos (#1353) 2025-03-27 09:53:39 +08:00
辉鸭蛋 055f46f4c0 +5.5 avatar 2025-03-27 01:52:56 +08:00
辉鸭蛋 1e288ffda4 0.43.5 2025-03-27 01:32:55 +08:00
辉鸭蛋 892f0f0fa6 ui: 迁移按键绑定页面到设置中 2025-03-27 01:03:19 +08:00
辉鸭蛋 d000981be5 about page #317 2025-03-27 00:15:19 +08:00
辉鸭蛋 55a7dec210 Add About option to settings page (#1348)
---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/babalae/better-genshin-impact?shareId=XXXX-XXXX-XXXX-XXXX).
2025-03-26 22:36:39 +08:00
辉鸭蛋 d3b2f62083 抽离出方法给脚本调用 #1349 2025-03-26 22:32:20 +08:00
辉鸭蛋 917e412d49 5.5 分解功能变成反选 2025-03-26 22:00:27 +08:00
秋云 5a8f38e121 feat: new action exit and relogin and 5.5 fix. (#1349)
* feat: new action exit and relogin and 5.5 fix.

* fix: confirm exit button.
2025-03-26 16:39:09 +08:00
秋云 c79e919d17 fix: 日志分析修改namespace,修改配色,code clean。 (#1346) 2025-03-25 21:01:22 +08:00
Takaranoaoand辉鸭蛋 00304d48c4 增加对WaypointForTrack的DisablePickupAround属性支持,可以关闭挖矿动作的周围拾取 (#1322)
* 增加对WaypointForTrack的DisablePickupAround属性支持,可以关闭挖矿动作的周围拾取

* 移动变量解析位置

---------

Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-25 00:55:05 +08:00
辉鸭蛋 e5629f1bb4 5.5 map 2025-03-25 00:37:58 +08:00
辉鸭蛋 e77c143f6b Merge branch 'pr/1320'
# Conflicts:
#	BetterGenshinImpact/GameTask/GameTaskManager.cs
2025-03-23 23:35:22 +08:00
辉鸭蛋 0d5d1292c8 code clean 2025-03-23 23:33:40 +08:00
辉鸭蛋 dfbc05599f 秘境走到最后领取奖励超时将会自动重试秘境 #1202 #1270 2025-03-23 22:52:33 +08:00
辉鸭蛋 33e9ebbc91 体力不足时,放弃继续进行自动秘境 #1008 #1134 2025-03-23 22:28:23 +08:00
辉鸭蛋 9bfdfd041e 一些优化
1. 一条龙未选择要刷的秘境时,直接提示
2. 修复独立任务运行时,实时任务仍在运行的问题
2025-03-23 22:04:43 +08:00
秋云 ad3f4c3915 feat: 日志分析界面添加排序逻辑,添加单个任务拾取物显示,添加表头锁定,更换现代化配色方案 (#1341)
* feat: 添加排序逻辑,添加单个任务拾取物显示

* feat: 表头锁定

* feat: 优化样式,修改排序

* feat: 文件过大时会进行保存,并提示保存的路径

* fix: 错误的弹窗

* fix: 修复表头固定

* feat: 修改配色

* fix: 优化显示

* fix: 删除重复分析。

* add: 增加单日分析
2025-03-23 21:12:59 +08:00
niuhuanand辉鸭蛋 f81f628046 ✨ 飞书通知时带有图片(需要配置app,并且在飞书后台增加上传图片权限) (#1334)
* ✨ feishu image notify

* typo

---------

Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-20 22:11:42 +08:00
辉鸭蛋 cbcd9a114e fix NPE 2025-03-19 23:34:51 +08:00
辉鸭蛋 e4163e773c 修复4k自动秘境不生效的问题 2025-03-18 23:49:39 +08:00
FishmanTheMurlocand辉鸭蛋 57d33c4312 又一波钓鱼优化 (#1301)
* GetFishBarRect方法添加更复杂的算法,并为其配备独立的单元测试,和分离难度较大的测试用例(未熟练时两侧出现黄色动态折线的情况);GetFishBoxArea行为去掉拉条框初始位置必须位于屏幕中轴线的条件,并添加其后续Fishing行为的单元测试来验证可行性;EnterFishingMode行为使用结束时间来代替Sleep,并添加整体超时时间;添加一个鱼咬钩的假阳性测试用例仅供娱乐

* 补充GetFishBarRect算法,使通过遗漏的测试"20250314002439020_Fishing_Succeeded.png"

* 拉条增加1秒未检测持续时间以应对瞬间丢失拉条框的情况;新增一个检查提竿结果的行为;新增一个检查开始钓一条鱼的初始状态的方法,以应对行为状态错配的情况;一些行为将Sleep优化为DateTime;修改上述改动对应的单元测试

* 解决合并冲突剩余问题,删掉ImageRegion的Bitmap构造函数重载

* 提供给测试用例初始化的 SystemInfo、TaskContext 方法,使用 InitForTest 即可

* InitForTest

* 和鸭蛋昨夜的提交撞车了。。。抽象了ISystemInto供单元测试实例化Fake类;给BaseAssets类定义了成员字段systemInfo(我想,既然都是图片模板数据集,如此定义是合理的),供继承类AutoFishingAssets使用,并定义了其在单元测试的派生类;添加了一个900p的选取鱼饵测试用例;blackboard改为负责携带AutoFishingAssets,并将其实例化时机挪到独立任务的Start方法中,避免由于TaskContext尚未初始化导致获取到的SystemInfo为空

* 一个特殊的测试用例:抛竿的瞬间、开始检测咬杆时遇到了假阳性

* Revert "InitForTest"

This reverts commit 225e9783a7.

* Revert "提供给测试用例初始化的 SystemInfo、TaskContext 方法,使用 InitForTest 即可"

This reverts commit 610c57263a.

* 为始终没有找到落点的情况添加计数,在第3次时直接退出,并添加此情况的单元测试

---------

Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-18 19:51:42 +08:00
起个名字好难 f5dbe30e25 企业微信通知增加时间戳 (#1326)
* 凝光Mining+伐木增加木材

* 企业微信通知增加时间戳
2025-03-18 17:45:55 +08:00
Takaranoao 58aedbf9d6 修复AddTimer方法中的异常处理,保持js脚本兼容性 2025-03-16 20:06:21 +08:00
Takaranoao 2aefabe09c 添加实时任务,不会清理之前的任务 2025-03-16 20:00:25 +08:00
DR-lin-engandDR-lin-eng cbe90a7003 优化推送逻辑,加入异步推送策略,降低在多开渠道下的瞬间性能负载。提升推送速度。 (#1315)
Signed-off-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-16 14:30:11 +08:00
929f4a30b3 添加dingding通知 (#1312)
* 新增图片作为email附件发送功能

* feat(notification): 为 WebhookNotifier 添加 send_to 功能

- 在 WebhookNotifier 类中添加 send_to 属性
- 修改 TransformData 方法,增加 send_to 字段
- 在 NotificationConfig 中添加 webhook_endpoint 和 websocket_endpoint 属性

* refactor(WebhookNotifier): 添加 send_to 属性并调整访问修饰符

* refactor(notification): 重构 WebhookNotifier 并更新 NotificationConfig

- 在 NotificationConfig 中添加 WebhookSendTo 属性
- 重构 WebhookNotifier 构造函数,使用 NotificationConfig 对象进行初始化
- 更新 WebhookNotifier 发送逻辑,使用新的配置属性

* feat: add webhook ui.

* refactor(WebhookNotifier): 重构 TransformData 方法以优化数据结构- 将 notification_data 的内容合并到外层字典,以便于 webhook 接收端获取数据- 新增 event、result、timestamp 等字段,使数据结构

* fix(WebSocketNotifier): 添加消息发送后关闭连接的功能

- 在 SendAsync 方法中添加了 CloseAsync() 调用,确保消息发送后关闭 WebSocket 连接
- 此修改解决了消息发送后未关闭连接的问题,提高了资源利用率和系统稳定性

* fix: implement unified webhook ui

* fix: typos.

* 优化通知前端显示

* feat(notification): 添加钉钉 Webhook 通知支持

- 实现了钉钉 Webhook 通知的发送功能
- 在通知配置中添加了钉钉 Webhook URL 和密钥的设置选项
- 在通知服务中集成了钉钉通知的初始化和注册
- 优化了 WebhookNotifier 类的代码结构

* 新增钉钉通知ui

Signed-off-by: DR-lin-eng <@DR-lin-eng>

* 修正图标

Signed-off-by: DR-lin-eng <@DR-lin-eng>

---------

Signed-off-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: 秋云 <[email protected]>
Co-authored-by: DR-lin-eng <[email protected]>
Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-16 03:18:02 +08:00
辉鸭蛋 2cb2604de0 Merge remote-tracking branch 'origin/main' 2025-03-16 03:09:25 +08:00
辉鸭蛋 11421cbd63 + MapPuzzleOther 2025-03-16 03:09:15 +08:00
DR-lin-engandDR-lin-eng f66c9a2aab 修正变量正确性,修正api端点反代使用 (#1314)
Signed-off-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-16 03:01:53 +08:00
辉鸭蛋 0bbc851ba0 优化合成树脂,不阻塞任务 2025-03-16 01:49:37 +08:00
辉鸭蛋 377326f492 卡齐娜e 2025-03-16 01:29:43 +08:00
DR-lin-engandDR-lin-eng 8d3acfc668 优化通知前端显示 (#1311)
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-16 01:18:57 +08:00
Takaranoao a9150054c4 从命令行启动调度器,暂不支持URL(--startGroups 组1 组2 ...) (#1309)
* 从命令行启动调度器,暂不支持URL(--startGroups 组1 组2 ...)

* 修改:log&执行顺序和传入顺序相同
2025-03-16 00:20:33 +08:00
DR-lin-engandDR-lin-eng de0a77b655 优化前端显示 (#1310)
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-16 00:19:20 +08:00
Takaranoao 315318e2fe 配置组增加ShellTask配置的UI (#1308)
* Shell抽象成为一个Task,并抽出Config

* 代码格式化

* 格式化代码

* 配置组增加ShellTask配置的UI
2025-03-15 20:35:53 +08:00
Takaranoao 981068b38c draft:执行shell抽成task,并支持配置 (#1306)
* Shell抽象成为一个Task,并抽出Config

* 代码格式化

* 格式化代码
2025-03-15 20:09:59 +08:00
DR-lin-engandDR-lin-eng 6eb1d33965 新增xxtui通知方法 (#1305)
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-15 20:06:28 +08:00
辉鸭蛋 e1bd3393b8 WGC 去掉HDR处理,增加处理帧率限制 2025-03-15 19:54:53 +08:00
辉鸭蛋 12617e18e9 0.43.3 2025-03-15 13:19:45 +08:00
辉鸭蛋 807288ab90 重构底层截图器,大幅提升截图器耗时 (#1302)
* to mat init

* BitBlt 加锁

* 使用读写锁重构 Windows.Graphics.Capture,删除BGI自己命名的缓存设置

* dwm加锁并返回mat

* 队伍中没有对应元素角色修复日志问题

* 清除所有 DispatcherTimerOperationEnum 内容

* 修复单测的编译错误

* HDR Support

* 清理无用的截图器模式
2025-03-15 13:18:19 +08:00
f7903f8e9b webhook添加了sendto发送对象,修复了webhook通知ui显示错误问题,修复了websocket服务端错误关闭链接问题 (#1300)
* 新增图片作为email附件发送功能

* feat(notification): 为 WebhookNotifier 添加 send_to 功能

- 在 WebhookNotifier 类中添加 send_to 属性
- 修改 TransformData 方法,增加 send_to 字段
- 在 NotificationConfig 中添加 webhook_endpoint 和 websocket_endpoint 属性

* refactor(WebhookNotifier): 添加 send_to 属性并调整访问修饰符

* refactor(notification): 重构 WebhookNotifier 并更新 NotificationConfig

- 在 NotificationConfig 中添加 WebhookSendTo 属性
- 重构 WebhookNotifier 构造函数,使用 NotificationConfig 对象进行初始化
- 更新 WebhookNotifier 发送逻辑,使用新的配置属性

* feat: add webhook ui.

* refactor(WebhookNotifier): 重构 TransformData 方法以优化数据结构- 将 notification_data 的内容合并到外层字典,以便于 webhook 接收端获取数据- 新增 event、result、timestamp 等字段,使数据结构

* fix(WebSocketNotifier): 添加消息发送后关闭连接的功能

- 在 SendAsync 方法中添加了 CloseAsync() 调用,确保消息发送后关闭 WebSocket 连接
- 此修改解决了消息发送后未关闭连接的问题,提高了资源利用率和系统稳定性

* fix: implement unified webhook ui

* fix: typos.

---------

Co-authored-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: 秋云 <[email protected]>
2025-03-15 10:33:33 +08:00
DR-lin-engandDR-lin-eng 45fc9fe7f4 新增图片作为email附件发送功能 (#1298)
Co-authored-by: DR-lin-eng <@DR-lin-eng>
2025-03-15 10:33:13 +08:00
a662791b6b Tgbot推送机器人 (#1296)
* feat: add email and websocket notification

* fix typos.

* refactor(notifiers): 重构邮件和 WebSocket 通知器

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性

* Create BarkNotifier.cs

* Update NotificationConfig.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/Notifier/BarkNotifier.cs

* Add files via upload

* Update BarkNotifier.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/BarkNotifier.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* fix: 回退部分代码,修复了程序崩溃的错误

* fix: remove api.day.app

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Update CommonSettingsPage.xaml

* Update CommonSettingsPageViewModel.cs

* Update EmailNotifier.cs

* Update EmailNotifier.cs

* Update BarkNotifier.cs

* 修正并更新前端介绍

* Revert "1"

* 修正公益服务器请求兼容性

* Revert "Revert "1""

This reverts commit 8c6effb1

* 新增tg推送但是有发送问题?(疑似我的电脑问题,稍后解决)

Signed-off-by: DR-lin-eng <@DR-lin-eng>

* feat: Telegram notification and ui.

* 修正tgbot推送,修正变量

Signed-off-by: DR-lin-eng <@DR-lin-eng>

---------

Signed-off-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: 秋云 <[email protected]>
Co-authored-by: 禹仔二号 <[email protected]>
Co-authored-by: yuzai <[email protected]>
Co-authored-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-14 19:39:16 +08:00
秋云 76445ab19d fix: 修复换队时爬七天神像导致换队失败的问题 (#1295) 2025-03-14 11:43:58 +08:00
起个名字好难 3df45ea6ed 统计增加卡死和异常 (#1293) 2025-03-14 09:50:24 +08:00
辉鸭蛋 616293432d Update README.md 2025-03-14 00:39:59 +08:00
辉鸭蛋 7250ef111d Update README.md 2025-03-14 00:37:23 +08:00
辉鸭蛋 19fb0022c1 Merge remote-tracking branch 'origin/main' 2025-03-14 00:26:45 +08:00
辉鸭蛋 f284a5331a 0.43.2 2025-03-14 00:23:27 +08:00
FishmanTheMurloc 29a2c0069e bug fix:拉条过程中内存没有及时释放 (#1266)
* bug fix:拉条过程中内存没有及时释放

* 新增LiftAndHold行为用于举竿、检测预抛竿时鼠标左键是否被意外松开、终止任务;抛竿开始后5秒内如从未找到落点,则返回失败,并配有单元测试;添加抛竿时无鱼饵适用鱼的单元测试;调整变量名

* 新增一个钓鱼昼夜设置枚举DontChange及其逻辑(枚举值为3),表示不调整时间直接开钓

* 针对可能是游戏中的雾气/滤镜/小黄鸭之类不明原因干扰了钓鱼拉条框的识别,修改了CV算法,使其不严格按照黄色(255,255,192)找矩形,而是按一定HSV范围寻找,并加强过滤;添加上述不明原因案例的测试用例

* 将MySimpleParallel改造为支持两个以上子行为;将“检查抛竿结果”行为合并到“下杆中”并行节点,以去除检查的等待时间,由此希望能应对鱼过快上钩的情况
2025-03-14 00:17:37 +08:00
秋云and辉鸭蛋 22fe431880 feat: add action_params(StopFlyingWaitTime) to stop_flying (#1277)
* feat: add action_params(StopFlyingWaitTime) to stop_flying;
fix: ensure next step only proceeds after stop_flying.

* add StopFlyingHandler

* use int.TryParse

---------

Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-14 00:15:17 +08:00
a172ba6941 修正bark推送参数和前端 (#1289)
* feat: add email and websocket notification

* fix typos.

* refactor(notifiers): 重构邮件和 WebSocket 通知器

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性

* Create BarkNotifier.cs

* Update NotificationConfig.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/Notifier/BarkNotifier.cs

* Add files via upload

* Update BarkNotifier.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/BarkNotifier.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* fix: 回退部分代码,修复了程序崩溃的错误

* fix: remove api.day.app

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Update CommonSettingsPage.xaml

* Update CommonSettingsPageViewModel.cs

* Update EmailNotifier.cs

* Update EmailNotifier.cs

* Update BarkNotifier.cs

* 修正并更新前端介绍

* Revert "1"

* 修正公益服务器请求兼容性

* Revert "Revert "1""

This reverts commit 8c6effb1

---------

Co-authored-by: 秋云 <[email protected]>
Co-authored-by: 禹仔二号 <[email protected]>
Co-authored-by: yuzai <[email protected]>
Co-authored-by: DR-lin-eng <@DR-lin-eng>
Co-authored-by: 辉鸭蛋 <[email protected]>
2025-03-14 00:04:58 +08:00
80b8c968d4 校对修复所有邀约文本 (#1290)
* feat: add email and websocket notification

* fix typos.

* refactor(notifiers): 重构邮件和 WebSocket 通知器

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性

* Create BarkNotifier.cs

* Update NotificationConfig.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/Notifier/BarkNotifier.cs

* Add files via upload

* Update BarkNotifier.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/BarkNotifier.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* fix: 回退部分代码,修复了程序崩溃的错误

* fix: remove api.day.app

---------

Co-authored-by: 秋云 <[email protected]>
Co-authored-by: DR-lin-eng <[email protected]>
2025-03-13 22:48:02 +08:00
辉鸭蛋 bad6db6e8a WPF-UI.Violeta 4.0.0 2025-03-13 22:44:20 +08:00
辉鸭蛋 46ebdfc452 wpfui 4.0.0 (#1255)
* new INavigationAware, remove PageService

* fix run

* fix title bar

* override OnNavigatedTo

* try fix WindowStartupLocation
2025-03-13 00:33:31 +08:00
6becb9dd5a 添加websocket和smtp通知方法,添加bark通知,websocket为qq机器人预留。 (#1254)
* feat: add email and websocket notification

* fix typos.

* refactor(notifiers): 重构邮件和 WebSocket 通知器

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性

* Create BarkNotifier.cs

* Update NotificationConfig.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/Notifier/BarkNotifier.cs

* Add files via upload

* Update BarkNotifier.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/BarkNotifier.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* fix: 回退部分代码,修复了程序崩溃的错误

* fix: remove api.day.app

---------

Co-authored-by: 秋云 <[email protected]>
Co-authored-by: DR-lin-eng <[email protected]>
2025-03-13 00:06:09 +08:00
辉鸭蛋 3312837129 Merge pull request #1274 from MisakaAldrich/main
小改正则表达以支持JS脚本统计
2025-03-13 00:02:10 +08:00
起个名字好难 5272c44a44 Mining新增凝光平A 2025-03-12 23:16:44 +08:00
起个名字好难 61d635d2e2 日志分析:小改正则表达以支持JS脚本统计 2025-03-11 23:53:26 +08:00
辉鸭蛋 8298e5f827 0.43.1 2025-03-11 23:07:37 +08:00
辉鸭蛋 51ee8dc54e 修复地图追踪中的 up_down_grab_leaf 四叶印 action 不生效的问题 2025-03-11 23:04:55 +08:00
辉鸭蛋 b0c12d567b 暴力GC 2025-03-11 22:12:29 +08:00
辉鸭蛋 14a55c1204 Revert "添加暴力GC"
This reverts commit 203ae22e7b.
2025-03-11 21:16:49 +08:00
辉鸭蛋 9724b158a7 Merge pull request #1263 from Takaranoao/main-fix1262
修复 #1262 自动拾取按文档指引改键无效
2025-03-11 21:11:14 +08:00
Takaranoao a01cc93ba7 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2025-03-11 20:14:23 +08:00
Takaranoao 40f8f191a0 格式化代码 2025-03-11 20:13:18 +08:00
辉鸭蛋 4cf2085e90 Merge pull request #1267 from physligl/main
fix: move mouse to center after adjust zoom level
2025-03-11 15:42:39 +08:00
辉鸭蛋 5bfbe7f8a2 Merge pull request #1269 from Daydreamer114/patch-1
docs(fix): readme 中失效链接、跳转链接;自动钓鱼拆分
2025-03-11 15:39:23 +08:00
晓丶梦丶仁 99a769f3fc docs(fix): 失效链接、拆分(半|全)自动钓鱼 2025-03-11 13:57:22 +08:00
晓丶梦丶仁 7a9f0c68bc fix: readme 中 自动秘境 链接失效 2025-03-11 13:47:46 +08:00
秋云 54e3db9228 fix: move mouse to center after adjust zoom level 2025-03-11 11:57:03 +08:00
辉鸭蛋 203ae22e7b 添加暴力GC 2025-03-11 02:18:08 +08:00
Takaranoao f3e0c68f3e fix: update pick button names binding and initialize pick button list 2025-03-11 02:02:56 +08:00
辉鸭蛋 807dd28c04 Merge pull request #1252 from FishmanTheMurloc/main
咬钩后拉扯框识别的优化,以及着手优化抛竿
2025-03-10 20:12:40 +08:00
FishmanTheMurloc c5dd67e854 bug fix 严重的内存占用暴涨 2025-03-10 18:54:00 +08:00
FishmanTheMurloc 79257b3d3a Merge branch 'babalae:main' into main 2025-03-10 18:34:55 +08:00
FishmanTheMurloc 699ed8fc0b 选择鱼饵失败超限后不再直接判定没有鱼;抛竿逻辑不再使用prevTargetFishRect设计,改为直接取离落点最近的鱼,并由此通过了先前的三条炮鲀鱼单元测试;抛竿也采取在无目标鱼时记录失败鱼饵的设计;获取鱼群时,忽略选择鱼饵失败超限及抛竿无目标鱼超限的鱼,配有忽略时的单元测试 2025-03-10 18:25:46 +08:00
FishmanTheMurloc 34e6f4741a 钓鱼添加逻辑:选择鱼饵失败2次后,忽略该种鱼饵,且如果鱼塘中所有鱼的鱼饵被忽略就当没有鱼退出任务;并配有单元测试 2025-03-10 09:59:22 +08:00
辉鸭蛋 ad5aa1b118 fix script bug 2025-03-10 02:15:44 +08:00
辉鸭蛋 94ae0e216f update ui 2025-03-09 22:53:20 +08:00
辉鸭蛋 991da1cb69 fix fish js object 2025-03-09 22:14:27 +08:00
辉鸭蛋 fe8aeb610d fix js fish anonymous class input 2025-03-09 21:31:46 +08:00
辉鸭蛋 60b4d65f21 0.43.0 2025-03-09 20:34:59 +08:00
辉鸭蛋 abfddea2e5 暴露钓鱼的参数给脚本 2025-03-09 20:33:51 +08:00
辉鸭蛋 366e5d140a add WelcomeDialog 2025-03-09 18:55:25 +08:00
辉鸭蛋 4fc2417f26 增加自动钓鱼的提示 2025-03-08 23:57:30 +08:00
辉鸭蛋 7d0649b358 一些自动钓鱼的优化 2025-03-08 23:41:48 +08:00
FishmanTheMurloc 5bb0144c30 由于偶尔观测到抛竿时“摇摆”行为的出现,设计了一种单元测试来为修改算法做准备。此commit中,改新添加的单元测试是通过不了的。 2025-03-08 23:28:04 +08:00
辉鸭蛋 df9c4e106e 修改shell的部分内容 2025-03-08 21:55:24 +08:00
辉鸭蛋 4c820d09c5 replace: 路径追踪 -> 地图追踪 2025-03-08 20:56:36 +08:00
FishmanTheMurloc b575474cb1 获取钓鱼框成功以及超时失败的两个单元测试 2025-03-08 17:11:23 +08:00
FishmanTheMurloc b76974aa73 给钓鱼框识别增加5秒的超时限制,以应对在雷鸣仙鱼池提竿识别了假阳性而卡在钓鱼框的情况;将抛竿行为中的由于修改代码失误而实际没有起效的prevTargetFishRect变量及其逻辑恢复,并在运行中将其绘制出以观察效果;因“获得”的图标消散速度实在太慢,抛竿时改为前6秒也对其进行忽略 2025-03-08 15:29:42 +08:00
辉鸭蛋 e7ceaa7486 Merge pull request #1248 from Takaranoao/main-baolan
给配置组增加执行shell的功能,可以调用外部程序实现复杂调度
2025-03-08 15:05:23 +08:00
辉鸭蛋 f356c61051 delete no usage code 2025-03-08 14:37:57 +08:00
Takaranoao 90590b68b8 给配置组增加执行shell的功能,可以调用外部程序实现复杂调度 2025-03-07 16:39:21 +08:00
辉鸭蛋 2a173e734d Merge pull request #1245 from FishmanTheMurloc/feat/fishing_config
给js脚本的genshin.autofishing方法暴露参数 等一波优化
2025-03-06 20:51:37 +08:00
FishmanTheMurloc 2a548ecb1b 过滤“获得”图标的条件数值优化,配有单元测试用例;完善超时收杆行为,使能应对收杆的同时鱼咬杆的情况,并配有单元测试; 2025-03-06 20:32:17 +08:00
FishmanTheMurloc 462e89731d 给js脚本的genshin.autofishing方法暴露了昼夜参数、两个超时参数取独立任务页面中配置的值、关键帧截图开关常关;将BaseBehaviour<TImageRegion>中saveScreenshotOnTerminate字段由不合理的静态字段改为构造函数传入,修复关键帧截图开关在不同入口交替使用的情况下错乱的bug 2025-03-06 12:11:12 +08:00
辉鸭蛋 4305310d2d js settings ui 2025-03-06 01:26:16 +08:00
辉鸭蛋 785f5b7903 fix MessageBox ui location 2025-03-06 01:02:46 +08:00
辉鸭蛋 e602995b07 缩减单个脚本解析异常产生的影响 #1235 2025-03-06 00:54:31 +08:00
辉鸭蛋 c63439bb29 fix #1131 2025-03-06 00:35:52 +08:00
辉鸭蛋 5b5eeee9e0 Merge pull request #1237 from FishmanTheMurloc/feat/fishing_config
钓鱼任务添加整个任务的超时参数、昼夜参数
2025-03-06 00:27:47 +08:00
辉鸭蛋 8246d1a2f2 Merge remote-tracking branch 'origin/main' 2025-03-06 00:25:11 +08:00
辉鸭蛋 fc2c809702 release all key before tp & release all key after auto fight 2025-03-06 00:22:12 +08:00
FishmanTheMurloc 939c0a5106 添加了一个开关来控制是否在钓鱼的关键帧上保存截图 2025-03-05 21:32:43 +08:00
FishmanTheMurloc f8c05d2c33 合并代码修补;将退出钓鱼模式封装成行为并优化;将许多行为的日志时机从每次Tick时精简为初始化时;联机时不使用昼夜设置 2025-03-05 16:10:58 +08:00
FishmanTheMurloc d3659f3b43 Merge branch 'main' into feat/fishing_config 2025-03-05 10:26:20 +08:00
辉鸭蛋 612474e367 Merge pull request #1240 from physligl/main
feat: add _autoPickEnabled to script group
2025-03-05 09:55:42 +08:00
秋云 6f6ddf129b feat: add _autoPickEnabled to script group 2025-03-05 05:34:28 +08:00
秋云 4e44bb0e78 fix: resolve mouse simulation issue due to resolution change on screen off (#1230)
* fix: resolve mouse simulation issue due to resolution change on screen off

* fix: typo
2025-03-05 00:30:35 +08:00
FishmanTheMurloc aead279c78 单元测试HelloWorld (#1219)
* AutoFishing为单元测试重构;一个简单的单元测试GetFishpondTest

* 将鼠标操作的注入挪到DesktopRegion中;提供LoadAssetImage的一个不依赖配置的重载;ChooseBait的代码中将Bv的方法替换成不依赖配置的写法;完成ChooseBait的单元测试

* 使用TimeProvider改写ChooseBait以适用单元测试;添加假的绘图上下文类;添加抛竿行为的单元测试

* 选择鱼饵行为比对上次选择的鱼饵,如果相同则直接抛竿(之前的版本曾有此逻辑),但测下来有时会选错饵导致无限抛竿,调整了相关步骤的等待间隔,希望能简单地压制此bug

* 获取鱼群时过滤“获得”界面的鱼图标:1、在Fishpond构造函数中实现。2、配有此类情况的单元测试。3、并由此降低鱼钓上后的等待时间;
修复绘制鱼群时索引不正确导致遗漏的bug;获取鱼群时绘制鱼群供分析
2025-03-05 00:30:11 +08:00
FishmanTheMurloc e634a54913 钓鱼任务添加整个任务的超时参数、昼夜参数 2025-03-04 21:06:16 +08:00
辉鸭蛋 99df54607d 0.42.4 2025-03-02 17:14:09 +08:00
辉鸭蛋 052d8f095a fix bug 2025-03-02 13:11:46 +08:00
辉鸭蛋 ec9c17209f Merge remote-tracking branch 'origin/main' 2025-03-02 12:36:01 +08:00
辉鸭蛋 e96214f5c4 新增结束后的操作 2025-03-02 12:35:48 +08:00
秋云 1adad8149b Fix: Update tp.json configuration and fix _selectedArea update (#1227)
* fix: new tp.json

* fix: _selectedArea only update when _selecteCountry change.

* fix(config): Change default _shouldMove from true to false
2025-03-02 09:41:31 +08:00
辉鸭蛋 62c4d3e54e 新增检查每日奖励任务 2025-03-02 01:47:44 +08:00
辉鸭蛋 9c55a929ef 调度器清空所有任务添加提示 2025-03-01 23:06:59 +08:00
辉鸭蛋 31332f76b3 fix compilation errors 2025-03-01 22:27:18 +08:00
辉鸭蛋 f9c4298fac 修复火元素采集不生效的问题 2025-03-01 22:18:47 +08:00
秋云 62da52d5d8 feat: add configurable HP restoration options at Statue of the Seven (#1223)
* feat: add configurable HP restoration options at Statue of the Seven

* fix: Create GiTpPosition as subclass of GiWorldPosition

* fix: Update teleport point selection logic in ViewModel

* fix: Change log info
2025-03-01 22:04:16 +08:00
辉鸭蛋 b46836741d Merge remote-tracking branch 'origin/main' 2025-03-01 21:31:30 +08:00
辉鸭蛋 8e3f26f45c 5.4 model 2025-03-01 21:31:16 +08:00
起个名字好难 f70524b0a2 添加企业微信图片通知 (#1222)
* 添加企业微信图片通知

* 移除多余代码,修复CA1850规则
2025-02-28 13:03:58 +08:00
秋云 4932c52af9 fix: remove while loop in TpTask (#1221)
* fix: prevent infinite loop in TpTask.cs

* fix: prevent redundant zoom operation

* fix: handle party switching failures in PathExecutor; add pre-switch check for switch party task

* fix: typos.
2025-02-28 10:00:59 +08:00
辉鸭蛋 4dceb19bbe add Mizuki 5.4 2025-02-27 00:19:27 +08:00
辉鸭蛋 509ff4dce6 fix bug
1. 修复自动伐木空指针
2. 修复火神秘境
2025-02-25 01:09:49 +08:00
辉鸭蛋 5fbd10e1a9 CheckAndActivateGameWindow opt 2025-02-25 00:42:03 +08:00
mfkvfhpdx 91a0e771b9 修改调度器任务和部分独立任务失去焦点时,强制切换回游戏窗口,如果用常规的方式无法激活窗口,则第10次会尝试最小化所有窗口后激活游戏。 (#1185)
* 修改调度器任务和部分独立任务失去焦点时,强制切换回游戏窗口,如果用常规的方式无法激活窗口,则第10次会尝试最小化所有窗口后激活游戏。

* 去除未引入的类引用

* 修正战斗结束后,大概率打开队伍界面的问题

* 修复有些电脑上因未知原因,战斗0秒打断

* 把失焦激活放入了设置-通用设置-其他设置中,默认关闭。暂停恢复时,重置移动的起始时间,防止因暂停而导致超时放弃任务。
2025-02-25 00:01:33 +08:00
辉鸭蛋 75741cd115 fix bug 2025-02-24 01:26:34 +08:00
辉鸭蛋 7efcf02051 修改 切换队伍前强制前往安全的神像区域 的默认配置 2025-02-24 00:08:10 +08:00
辉鸭蛋 2b233b7e8e pathing: 延长回到神像回血的时间 #1213 2025-02-23 23:45:45 +08:00
秋云 a9896f0ff1 修改部分细节 (#1189)
* 1. MoveMapTo之前保证缩放大于2,以保证初始中心点识别不会出错;
2. 重构MoveMapTo,主要去除了首次的试探过程(由于直接使用游戏坐标来确定需要移动的距离,试探已经不再需要)。

* 直接抛出异常而不是break

* 首次切换队伍时不会触发传送,而后续切换其他队伍时(RunnerContext.Instance.PartyName 已非空)才会触发传送。修改为任何时候都触发传送。

* 打开编队前添加少许延时

* 添加配置项 切换队伍前是否前往须弥七天神像
2025-02-23 23:39:57 +08:00
辉鸭蛋 e00f0b3fa0 change project structure 2025-02-23 22:03:52 +08:00
辉鸭蛋 55442418aa 设置时间结束时,立即关闭退出 2025-02-23 21:17:16 +08:00
辉鸭蛋 82eaa86121 异常场景处理添加 遇到 x 按钮时候 按下esc 2025-02-23 20:38:34 +08:00
辉鸭蛋 56d0463510 fishing: UI调整与优化
1. 实时任务只支持半自动
2. 半自动钓鱼恢复自动提杆的能力
3. UI调整
4. 添加自动钓鱼独立任务快捷键
2025-02-23 20:33:16 +08:00
辉鸭蛋 b63ceaa88a refactor: duplicated code 2025-02-23 18:21:43 +08:00
辉鸭蛋 8babe59066 fix throw 2025-02-23 17:10:23 +08:00
辉鸭蛋 7ec2e08d3a pathing: 修复简易策略脚本异常时,RetryException没有向外抛出的问题 2025-02-23 15:58:46 +08:00
辉鸭蛋 375d796db4 more log
地图追踪中当前配队无法满足简易策略脚本时,日志提示所需角色
2025-02-22 19:10:12 +08:00
可耐的小伙纸 9f6299df88 add:使用Starward记录游戏时间 (#1164)
* add:使用Starward记录游戏时间

* feat:修复了多余的参数(手滑

* add:添加了Starward协议检测
feat:使用正则解析ini
feat:删去RegistryGameLocator.GameServer

* feat:将重复操作分离为方法

* feat:从文件读取不启动记录
2025-02-22 18:56:25 +08:00
Scarlet ad2c61590e bugfix: handle unhandled cases (#1203) 2025-02-21 13:33:38 +08:00
秋云 b82395cc3a 1. MoveMapTo之前保证缩放大于2,以保证初始中心点识别不会出错; (#1187)
2. 重构MoveMapTo,主要去除了首次的试探过程(由于直接使用游戏坐标来确定需要移动的距离,试探已经不再需要)。
2025-02-19 09:56:05 +08:00
Ayu0K 675206e9da fix #1178 修复保存键鼠脚本时丢失最后一个MacroEvent的问题 (#1188) 2025-02-19 09:55:04 +08:00
Ayu0K 7abd066b15 feat: 全局按键映射支持 (#1159)
* 更改了按键绑定UI的相关文本,增加通用设置项“启用全局按键映射”

* 全局改键功能实现
2025-02-17 22:02:39 +08:00
辉鸭蛋 95e17bdef0 fix ra 2025-02-17 21:55:57 +08:00
Scarlet 1aa23df648 feat: Chasca charged attack support (#1175) 2025-02-17 13:34:28 +08:00
辉鸭蛋andFishmanTheMurloc 2135189bf6 新版本自动钓鱼 @FishmanTheMurloc (#1176)
* Revert "Revert #1059"

This reverts commit 4b65370e9f.

* natlan fish model

* 新增调整时间的功能

* test

* Feat/new fishing (#1060)

* 没有找到鱼饵时不再抛异常而是返回行为失败;细小优化;测试分支是否配置正确

* 恢复半自动钓鱼功能(仅自动拉条);将CheckFishingUserInterface方法添加到行为树,使其直接控制启停;PutRects方法增加筛选,避免画出没有高度的框框导致残留红点在画布上;去掉局部变量_currContent;钓鱼结束不再依据_noRectsCount判断

* 添加一步抛竿后检查,避免往红色靶点抛竿导致失败

* 大家终于炼出了好用的适用纳塔版本的鱼模型;实现注释描述的“选择最多鱼吃的饵料”;添加koihead鱼类,进入抛竿时忽略koi,只看koihead;Fishpond.TargetRect补上空值处理;去掉_switchBaitContinuouslyFrameNum,目前该段代码有时候会导致发呆;钓鱼结束时多等5秒,避免“获得鱼”的提示图被错误地计入下一次抛竿找鱼的预测

* 注释了AutoFishingTrigger中,FishBite和Fishing方法中的一些代码,解除了对CaptureContent.FrameRate的引用以方便开新坑;开了个新坑AutoFishingTask

* 新增全自动钓鱼独立任务的ui界面

* 封装了所有钓鱼行为,消灭了AutoFishingTrigger中大部分私有变量,剩余一些用来在行为之间传递信息的变量被丢到Blackboard中

* 代码清理:删除AutoFishingTrigger中被注释的私有变量;行为树扩展方法移动到单独的文件中

* 封装好的行为都搬家到Behaviours.cs去了;钓鱼独立任务基本完成;Blackboard添加chooseBaitUIOpening字段以避免在选择鱼饵界面时因图标被灰色遮罩而影响图像匹配;抛竿行为添加OnTerminate方法修复合并预抛竿和抛竿行为时产生的bug

* 优化VisionContext框框的代码

* AutoFishingTask加了个转圈圈找鱼的动作

* 钓鱼任务时如果有F键以及确认键,就交互一下进入钓鱼模式

* 添加供js调用的钓鱼任务方法

* 调整视角时也调整游戏角色的朝向;因为错误率较高,抛竿前找鱼时不再对右下角图标进行模板匹配检查

* 把MoveViewpointDown封装成行为了,黑板新增字段pitchReset,改进了流程中调整视角俯仰的部分;钓鱼任务中为了避免人物待机动作吃掉钓鱼F键,ChangeView方法改成始终都按S和W键

* ThrowRod行为删去对鱼群位置的校验,该段校验经常导致发呆;并将该行为更名为GetFishpond

* 对EnterFishingMode行为进行优化并修复bug;钓鱼循环修正

* 将螺旋视角找鱼的行为简化为低头转圈找,以适应路径任务完成时经常无法朝向鱼的情况;按下钓鱼键后等待界面出现时间延长至2秒

* 添加js独立任务调用自动钓鱼

* 新增`fishing`的Action用于触发钓鱼

* AutoFishingTask删去右下角ExitFishingButtonRo的模板匹配校验,因为错误的未识别有点多;添加当前焦点窗口校验

* AutoFishingTask增加设置昼夜功能,在7点和19点各钓一轮

---------

Co-authored-by: 辉鸭蛋 <[email protected]>

---------

Co-authored-by: FishmanTheMurloc <[email protected]>
2025-02-17 11:36:10 +08:00
Scarlet 1f2ed388d6 feature:自动战斗增加换队延迟 (#1174)
* feat: increase the delay before switching party

* feat: expose the delay before checking fight ended to user

* add example value to prompt text
2025-02-17 11:33:48 +08:00
辉鸭蛋 56853c541b update 2025-02-16 00:47:00 +08:00
af8562327f 添加了项目结构说明书 (#1163)
* 添加了项目结构说明图

* 添加了项目结构说明图

* Update README.md

* Delete ProjectStructureWord/Structure.md

* 更新

* 完善了项目结构图说明书

* Update README.md

* Update README.md

* replace

---------

Co-authored-by: Because66666 <[email protected]>
Co-authored-by: 辉鸭蛋 <[email protected]>
2025-02-16 00:44:54 +08:00
Scarlet 73c73b63dd feat: drop climbing before actions that could be blocked (#1150) 2025-02-15 12:16:43 +08:00
辉鸭蛋 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
辉鸭蛋 0351cc7410 0.41.0 2025-02-06 16:51:00 +08:00
辉鸭蛋 33dc5f7d42 fix tptask 2025-02-06 14:11:19 +08:00
辉鸭蛋 bb49feb19e offline package 2025-02-06 02:38:46 +08:00
辉鸭蛋 749cae4dc2 improve the recognition rate of orange option text 2025-02-06 02:16:57 +08:00
辉鸭蛋 472c169603 use R2 to distribute script files 2025-02-06 01:37:42 +08:00
辉鸭蛋 f76c877882 support only local script repo 2025-02-05 22:23:31 +08:00
辉鸭蛋 328b5f21cc add pyro_collect 2025-02-05 21:59:42 +08:00
辉鸭蛋 5118308e9d fight: kazuha cd opt 2025-02-05 21:43:05 +08:00
辉鸭蛋 d3bd62b2c4 fix party switch task
修复切换队伍时,第五个队伍无法被选中的问题
2025-02-05 21:10:08 +08:00
辉鸭蛋 9463827582 new banner 2025-02-05 10:51:05 +08:00
辉鸭蛋 445e9b8030 Merge remote-tracking branch 'origin/main' 2025-02-05 10:32:51 +08:00
辉鸭蛋 7fb04270b1 update warning text 2025-02-05 10:30:18 +08:00
辉鸭蛋 46d4045fd5 Merge pull request #1106 from MisakaAldrich/main
添加企业微信通知
2025-02-05 10:26:54 +08:00
起个名字好难 2c59fe70ad Merge branch 'babalae:main' into main 2025-02-05 00:10:12 +08:00
起个名字好难 8afcf9ddff 添加企业微信通知 2025-02-05 00:08:52 +08:00
起个名字好难 184d186c9c 添加企业微信通知 2025-02-04 23:10:58 +08:00
辉鸭蛋 eeecb5b44f pathing: auto skip config2 2025-02-04 21:48:25 +08:00
辉鸭蛋 31fcf9cedf fix WindowStartupLocation without Owner
修复脚本订阅和配置组运行的提示框在高DPI显示屏下跑到屏幕外的问题
2025-02-04 21:06:13 +08:00
辉鸭蛋 75449f8ced pathing: auto skip config 2025-02-04 20:46:14 +08:00
辉鸭蛋 202ac61242 fix #1100 2025-02-04 20:25:31 +08:00
辉鸭蛋 7ec0d649cb Merge pull request #1054 from Scarlet1ssimo/webhook
[Test In Progress] Feature: Notification-based Webhook Infrastructure
2025-02-04 17:12:55 +08:00
辉鸭蛋 92516c26d2 支持配置要通知的事件 2025-02-04 17:11:53 +08:00
辉鸭蛋 151b383c40 添加飞书通知 2025-02-03 19:28:09 +08:00
辉鸭蛋 644c3d0193 更多任务支持 2025-02-03 15:54:19 +08:00
辉鸭蛋 1efd8d9454 重构通知模块 2025-02-03 15:02:25 +08:00
辉鸭蛋 f8bcbcedf7 Merge pull request #1098 from Scighost/main
Fix the issue of WebView2 UserDataFolder cannot be created
2025-02-02 23:15:10 +08:00
Scighost e44c55eb03 Fix the issue of WebView2 UserDataFolder cannot be created 2025-02-02 22:46:43 +08:00
辉鸭蛋 7040a441f2 Merge pull request #1086 from Yang-z/main
auto pathing: add `Orientation` to `WaypointType`
2025-02-02 15:07:00 +08:00
辉鸭蛋 297618b95f fix windows notify 2025-02-01 23:03:25 +08:00
辉鸭蛋 33d742bd4d Merge branch 'main' into pr/1054 2025-02-01 22:16:36 +08:00
辉鸭蛋 1eee073adb 1. 修正 Orientation 大写的问题
2. 美化了是否作为 target 点位接近的
2025-02-01 18:11:51 +08:00
辉鸭蛋 0fe4e86bc0 more genshin settings check 2025-02-01 16:01:07 +08:00
辉鸭蛋 c2709544fa allow full folder security 2025-02-01 13:33:05 +08:00
辉鸭蛋 f109ac5a14 MSIAfterburner warning 2025-02-01 10:43:52 +08:00
辉鸭蛋 e735cacb17 fix bettergi://start not valid 2025-02-01 10:23:05 +08:00
辉鸭蛋 06b142b8b2 more check for script repo 2025-02-01 08:59:24 +08:00
辉鸭蛋 98ef56b233 Merge pull request #1087 from Scarlet1ssimo/ffopt
bugfix: 战斗结束检测
2025-02-01 07:58:28 +08:00
Scarlet c2e028c529 optimize: fight finish detection 2025-01-31 16:41:42 -06:00
Yang-z 90b8a37389 auto pathing: add Orientation to WaypointType 2025-01-31 22:19:02 +08:00
辉鸭蛋 09a520a92f remove invalid link 2025-01-31 19:06:28 +08:00
辉鸭蛋 a9f9946db6 Merge remote-tracking branch 'origin/main' 2025-01-31 19:03:10 +08:00
辉鸭蛋 982aa7834b Merge pull request #1085 from Yang-z/main
auto pathing: reduce the startup time of `MoveCloseTo`
2025-01-31 19:02:53 +08:00
辉鸭蛋 dfa0c75a15 0.40.1 2025-01-31 18:13:21 +08:00
辉鸭蛋 854baad420 test code 2025-01-31 18:13:09 +08:00
Yang-z 547a56b932 auto pathing: reduce the startup time of MoveCloseTo 2025-01-31 18:03:48 +08:00
辉鸭蛋 7d7289ac16 release all key after fight #1073 2025-01-30 10:36:49 +08:00
辉鸭蛋 70a8d544fd ui: win10 not display switch blur button 2025-01-30 10:29:14 +08:00
辉鸭蛋 137ba4384a new e detect 2025-01-30 09:55:52 +08:00
辉鸭蛋 99932e972d Merge remote-tracking branch 'origin/main' 2025-01-30 08:08:09 +08:00
辉鸭蛋 b14de9ed20 auto domain: SendInput instead of PostMessage 2025-01-30 08:07:51 +08:00
辉鸭蛋 bc286d3b47 Merge pull request #1066 from mfkvfhpdx/main
修改了几个warning警告的地方,添加路径追踪任务时,增加排除已选择目录的筛选条件,调度器任务右键新增根据文件夹移除功能。
2025-01-29 22:59:56 +08:00
辉鸭蛋 2536b14af1 fist run not init key binding 2025-01-29 22:58:23 +08:00
辉鸭蛋 c3cffff4f3 fix CheckInBigMapUi 2025-01-29 22:23:12 +08:00
辉鸭蛋 8cffb01f0a fix method confusion 2025-01-29 17:44:38 +08:00
辉鸭蛋 9694919759 new orange option judge 2025-01-29 16:17:52 +08:00
辉鸭蛋 67df9f298a if it is a target waypoint type, it will continue to approach the target after a falling attack
如果是target路径点类型,下落攻击后会继续靠近目标
2025-01-29 15:03:37 +08:00
辉鸭蛋 47d88e67c9 opt 2025-01-29 14:34:07 +08:00
辉鸭蛋 b130351d8d bgi.huiyadan.com -> bettergi.com 2025-01-29 08:41:11 +08:00
辉鸭蛋 8b52aea9a3 ui dispatcher 2025-01-29 08:12:48 +08:00
辉鸭蛋 efde38439d tp exception 2025-01-29 08:12:32 +08:00
辉鸭蛋 e42c886bbe fix domain tp 2025-01-28 16:23:43 +08:00
辉鸭蛋 3e114ad358 添加windows通知 2025-01-28 13:12:14 +08:00
辉鸭蛋 4196f05f21 replace HttpContent with another data structure 2025-01-28 08:49:24 +08:00
辉鸭蛋 2cdabcf689 Merge pull request #1071 from physligl/main
修改传送任务中大地图移动的逻辑
2025-01-28 06:56:12 +08:00
秋云 f7cbc03f3d Merge branch 'babalae:main' into main 2025-01-28 02:39:58 +08:00
秋云 ce7c88f8e8 根据临近传送点的距离确定地图缩放,根据缩放等级确定当前剩余的距离。 2025-01-28 02:38:26 +08:00
辉鸭蛋 670bb3adad 修改序列化方式,添加测试数据 2025-01-27 20:47:17 +08:00
辉鸭蛋 6c16296b1b 修改 notify config 的获取方式 2025-01-27 20:13:53 +08:00
mfkvfhpdx 770edfab8a Merge branch 'babalae:main' into main 2025-01-27 15:15:26 +08:00
zjl 6a14a8c342 修改了几个warning警告的地方,添加路径追踪任务时,增加排除已选择目录的筛选条件,调度器任务右键新增根据文件夹移除功能。 2025-01-27 15:14:28 +08:00
辉鸭蛋 f19ee557b2 Merge branch 'main' into webhook 2025-01-27 13:57:23 +08:00
辉鸭蛋 2d0a7b5da8 typo 2025-01-27 13:56:27 +08:00
辉鸭蛋 ff92365bb4 Merge remote-tracking branch 'origin/main' 2025-01-27 12:32:16 +08:00
辉鸭蛋 81c84b94a5 Merge pull request #984 from babalae/readme-fix
Update README.md
2025-01-27 10:44:37 +08:00
辉鸭蛋 3fea7963ce Update README.md 2025-01-27 10:44:19 +08:00
辉鸭蛋 3ce54801c6 notify icon: check update 2025-01-27 09:22:11 +08:00
mfkvfhpdx 7b259e0329 Merge branch 'babalae:main' into main 2025-01-27 08:43:31 +08:00
zjl 8fdc664400 恢复版本 2025-01-27 08:42:33 +08:00
zjl 247580c04f Merge remote-tracking branch 'origin/main' 2025-01-27 08:28:21 +08:00
zjl 9de4fd4dfa 恢复代码 1 2025-01-27 08:17:41 +08:00
zjl bdaace9c8b 修正一个可能引发空指针的问题 2025-01-27 08:16:23 +08:00
辉鸭蛋 e30e919539 fix NullReferenceException #1063 2025-01-27 08:14:23 +08:00
zjl 3019d1aefa 修正一个可能引发空指针的问题 2025-01-27 08:14:14 +08:00
辉鸭蛋 8d4038d2e8 new appveyor build 2025-01-27 08:03:16 +08:00
辉鸭蛋 489d13dbcf add 蓝砚 in ElementalCollectAvatarConfigs 2025-01-26 23:48:13 +08:00
辉鸭蛋 7091da2c9f Merge remote-tracking branch 'origin/main' 2025-01-26 23:20:13 +08:00
辉鸭蛋 945085c34c typo 2025-01-26 23:10:17 +08:00
mfkvfhpdx 5513931fb6 Merge branch 'babalae:main' into main 2025-01-26 22:19:14 +08:00
辉鸭蛋 9a421860d0 Merge pull request #1062 from cx05121/main
拾取黑名单添加“蓝砚”
2025-01-26 21:43:51 +08:00
曦 edaf5ac443 more pick black item 2025-01-26 21:35:20 +08:00
mfkvfhpdx 8e9776f17c Merge branch 'babalae:main' into main 2025-01-26 18:49:27 +08:00
zjl 54e062d490 恢复上一个版本 2025-01-26 18:48:28 +08:00
辉鸭蛋 0468854ac5 fix auto fight NPE 2025-01-26 18:47:35 +08:00
zjl 10cb31af57 修正当战斗脚本中人员不在队伍是引发的异常 2025-01-26 18:46:42 +08:00
mfkvfhpdx 3cca2f329d Merge branch 'babalae:main' into main 2025-01-26 18:42:50 +08:00
辉鸭蛋 af0a869c70 shutdown when user config migrate 2025-01-26 17:09:19 +08:00
辉鸭蛋 f0baf74dc8 0.40.0 2025-01-26 14:02:17 +08:00
辉鸭蛋 8862f57958 Merge remote-tracking branch 'origin/main' 2025-01-26 12:56:21 +08:00
辉鸭蛋 bd72e6420d fist run old version clear 2025-01-26 12:55:57 +08:00
mfkvfhpdx 8c45a02deb 调整日志分析一些字段为0时显示为空,增加了异常情况统计(复活、重试、传送失败、战斗超时)。 (#1056)
* 调整日志分析一些字段为0时显示为空,增加了异常情况统计(复活、重试、传送失败、战斗超时)。

* 修正一个赋值错误

* 日志分析表格,使隔行颜色样式不一样

* 增加了锄地延时,通过控制延时相对精确的显示怪物数量

* 删除不必要的输出

* 调度器任务,增加 任务倒序排列功能。调度器配置增加“不在某时执行”,当执行完一个路线后,如果时间为当前配置的时间(范围:0-23),则此路径追踪任务后续都将都跳过,适用于连续执行的兜底任务,例如想通宵挂机,并且在4点后,开始执行新的任务。
2025-01-26 11:17:19 +08:00
mfkvfhpdx 0dd1dffccb Merge branch 'babalae:main' into main 2025-01-26 08:55:08 +08:00
辉鸭蛋 9ba3447ab1 modify the position of the UI for map teleportation settings
修改地图传送设置ui的位置
2025-01-26 00:20:01 +08:00
辉鸭蛋 218029b2e6 0.39.7 2025-01-25 23:53:15 +08:00
辉鸭蛋 718db28e51 update ui icon 2025-01-25 23:48:14 +08:00
辉鸭蛋 b639b1902e fix solo task run 2025-01-25 23:36:24 +08:00
辉鸭蛋 e97e04f9db auto music: more config
千音雅集支持更多的参数控制,以及文案和界面优化
2025-01-25 23:03:50 +08:00
mfkvfhpdx 7a07719bf8 Merge branch 'babalae:main' into main 2025-01-25 22:30:57 +08:00
zjl d0f985408e 调度器任务,增加 任务倒序排列功能。调度器配置增加“不在某时执行”,当执行完一个路线后,如果时间为当前配置的时间(范围:0-23),则此路径追踪任务后续都将都跳过,适用于连续执行的兜底任务,例如想通宵挂机,并且在4点后,开始执行新的任务。 2025-01-25 22:29:37 +08:00
辉鸭蛋 4b65370e9f Revert #1059 2025-01-25 16:54:37 +08:00
辉鸭蛋 5259b1f351 startOneDragon command line #998 2025-01-25 16:49:05 +08:00
辉鸭蛋 1afeb0818a #974 2025-01-25 15:55:36 +08:00
辉鸭蛋 99ab38d950 Merge remote-tracking branch 'origin/main' 2025-01-25 13:57:59 +08:00
辉鸭蛋 1d5f5c772e update ui 2025-01-25 13:55:19 +08:00
辉鸭蛋 869050283b Merge pull request #1045 from FishmanTheMurloc/main
使用行为树对自动钓鱼进行了改写,以利往后的优化
2025-01-25 13:53:15 +08:00
FishmanTheMurloc bb692a476e 添加纳塔鱼和鱼饵;添加鱼大类ray以合并两种细分的formalo ray和divda ray 2025-01-25 13:06:04 +08:00
FishmanTheMurloc 518ed95dbe Merge branch 'babalae:main' into main 2025-01-25 12:05:46 +08:00
辉鸭蛋 987e723b8c BetterGI.exe startOneDragon 2025-01-25 10:31:30 +08:00
辉鸭蛋 3c84f3817d auto tcg: fix error 2025-01-24 22:48:25 +08:00
mfkvfhpdx 319e88bb0c Merge branch 'babalae:main' into main 2025-01-24 22:39:45 +08:00
辉鸭蛋 6beb9fddba Merge pull request #1058 from physligl/main
增加了地图移动的相关参数设置的界面
2025-01-24 22:00:18 +08:00
秋云 020c841bc2 Merge branch 'babalae:main' into main 2025-01-24 20:42:18 +08:00
秋云 b445c71e52 增加了地图移动的相关参数设置。 2025-01-24 20:38:45 +08:00
mfkvfhpdx 56e110d11f Merge branch 'babalae:main' into main 2025-01-24 20:30:14 +08:00
辉鸭蛋 a5e1478ecf revert & dash 2025-01-24 19:48:45 +08:00
zjl 72cc9d8d01 Merge remote-tracking branch 'origin/main' 2025-01-24 19:20:59 +08:00
zjl 39b7176b4d 删除不必要的输出 2025-01-24 19:20:47 +08:00
mfkvfhpdx 6fcf213631 Merge branch 'babalae:main' into main 2025-01-24 19:20:08 +08:00
zjl 7c620429c3 增加了锄地延时,通过控制延时相对精确的显示怪物数量 2025-01-24 19:19:09 +08:00
辉鸭蛋 158688d435 fix patch 1 2025-01-24 18:08:56 +08:00
辉鸭蛋 8caa52e988 Acrylic first 2025-01-24 01:21:09 +08:00
辉鸭蛋 82275bd1e5 Merge remote-tracking branch 'origin/main' 2025-01-24 00:16:49 +08:00
辉鸭蛋 4129510029 0.39.6 2025-01-24 00:16:25 +08:00
辉鸭蛋 917ba1460d fix some bug 2025-01-24 00:16:11 +08:00
zjl d70ed4314a 日志分析表格,使隔行颜色样式不一样 2025-01-23 23:04:58 +08:00
秋云 3cc3eb44a4 fix typos. 2025-01-23 23:00:57 +08:00
zjl 07efcbde4f 修正一个赋值错误 2025-01-23 22:58:38 +08:00
zjl d33e54c50f Merge remote-tracking branch 'origin/main' 2025-01-23 22:54:15 +08:00
zjl f7779af01b 调整日志分析一些字段为0时显示为空,增加了异常情况统计(复活、重试、传送失败、战斗超时)。 2025-01-23 22:53:59 +08:00
辉鸭蛋 29f219aee9 Merge pull request #1055 from mfkvfhpdx/main
调整删除逻辑,软链接目录直接删除目录而非文件递归删除,方便引入自己的目录,防止订阅全部时被删除。
2025-01-23 12:50:36 +08:00
Scarlet cb84ae36d0 feat: integrate send() method into notification to allow for shorter call 2025-01-22 12:34:42 -06:00
zjl 1af75ecc64 调整删除逻辑,软链接目录直接删除目录而非文件递归删除,方便引入自己的目录,防止订阅全部时被删除。 2025-01-22 22:31:19 +08:00
Scarlet 2181e74a30 feat: unify factories; allow creating from actual params to instantiate a builder 2025-01-21 23:42:31 -06:00
Scarlet ec7ecbf9e0 remove unused references 2025-01-21 22:54:51 -06:00
Scarlet 50513613de feature: notification-based webhook 2025-01-21 22:22:27 -06:00
辉鸭蛋 39d7422ab9 new world model 2025-01-21 23:09:47 +08:00
辉鸭蛋 12cc958705 updater 2025-01-21 23:01:35 +08:00
辉鸭蛋 197e991a89 0.39.5 2025-01-21 22:51:57 +08:00
辉鸭蛋 6ee4318d24 Merge pull request #1036 from mfkvfhpdx/main
调整“按日锄地摩拉统计”为“按日摩拉收益统计”,并增加统计突发事件委托收益。
2025-01-21 22:47:09 +08:00
mfkvfhpdx 6fcc0685e6 Merge branch 'babalae:main' into main 2025-01-21 08:33:33 +08:00
辉鸭蛋 7f7d28825e fixed #1043 #1044 2025-01-21 02:00:26 +08:00
辉鸭蛋 ccb8025676 auto start capture on solo task start2 #1048 2025-01-21 01:56:42 +08:00
辉鸭蛋 2ff5a8930d Revert "auto start capture on solo task start #1048"
This reverts commit ef92586af6.
2025-01-21 01:46:53 +08:00
辉鸭蛋 ef92586af6 auto start capture on solo task start #1048 2025-01-21 01:43:48 +08:00
辉鸭蛋 bd1702af23 quick tp: support Obsidian Totem Pole 2025-01-21 00:03:05 +08:00
辉鸭蛋 23c922d67a Merge pull request #1039 from Scarlet1ssimo/betterscan
优化锄地战斗后捡掉落物的逻辑
2025-01-20 23:46:23 +08:00
辉鸭蛋 89acd1fc65 fix daily reward 2025-01-20 23:17:59 +08:00
mfkvfhpdx 0b17dc30fe Merge branch 'babalae:main' into main 2025-01-20 13:39:56 +08:00
辉鸭蛋 c61691ec1e init key binding on first run 2025-01-20 00:56:12 +08:00
辉鸭蛋 ca96204e01 install path 2025-01-20 00:22:40 +08:00
zjl 919818a424 调度器配置增加 “根据技能CD优化出招人员”配置。根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查(或填入数字也小于0),如果是人名和数字,则把数字当做出招cd(秒)。 2025-01-19 22:11:47 +08:00
FishmanTheMurloc 28cc3fb3e3 使用行为树对自动钓鱼进行了改写,以利往后的优化 2025-01-19 17:46:11 +08:00
Scarlet fb61b83df5 remove extra logging; refine comments 2025-01-18 21:30:30 -06:00
Scarlet 79aa1505d3 feature: better scan pick 2025-01-18 21:20:02 -06:00
zjl ae954fceb8 调整“按日锄地摩拉统计”为“按日摩拉收益统计”,并增加统计突发事件委托收益。 2025-01-18 22:37:57 +08:00
辉鸭蛋 dcafd64139 save theme 2025-01-18 17:54:59 +08:00
辉鸭蛋 5ab63a9e76 retry for open party choose ui 2025-01-18 15:53:40 +08:00
辉鸭蛋 9ddd3c5564 code clean 2025-01-18 15:12:35 +08:00
辉鸭蛋 a36f938e8a Merge pull request #1025 from mfkvfhpdx/main
路径追踪增加增加  允许在jsScript脚本中启用此路径追踪配置、覆盖JS中的自动战斗配置 。
2025-01-18 15:06:58 +08:00
辉鸭蛋 5a7721c534 Merge pull request #1022 from physligl/main
修复传送时遇到的部分问题
2025-01-18 15:06:49 +08:00
辉鸭蛋 12beabc6a2 fixed #971 2025-01-18 12:25:08 +08:00
辉鸭蛋 3da43f3543 fixed #997 2025-01-18 12:05:58 +08:00
辉鸭蛋 ba3f97c63f pathing: run -> dash
持续跑动改成多次冲刺
2025-01-18 11:16:12 +08:00
zjl f14c61145f 重试时战斗策略不跳过 2025-01-18 09:15:41 +08:00
辉鸭蛋 daf6525172 pathing opt
stop_flying下落后都会有个类似target逼近的过程,path类型节点可以取消这个表现
2025-01-18 01:13:28 +08:00
辉鸭蛋 38ea7833c1 opt
优化月卡的的领取
减少获取历练点的点击次数
2025-01-18 01:08:39 +08:00
辉鸭蛋 39da7b489f lock start 2025-01-18 00:53:47 +08:00
辉鸭蛋 e08b0875ee fix lag 2025-01-17 23:12:14 +08:00
zjl e2d0ca5974 去掉战斗部分,主界面判断,减少误判 2025-01-17 14:07:47 +08:00
秋云 89e00207cb 优化传送到七天神像回血的体验。 2025-01-17 03:27:58 +08:00
辉鸭蛋 02f6309a11 fix auto domain dont walk to F 2025-01-17 01:52:43 +08:00
zjl 1a0d61ac94 路径追踪增加 允许在jsScript脚本中启用此路径追踪配置、覆盖JS中的自动战斗配置 。默认为否,开启后可以使JS脚本中的路径追踪和自动战斗,使用该调度器所配置的参数运行 2025-01-16 23:53:17 +08:00
秋云 1538445990 把原本删除的INF级别时间显示回复,并改为DBG级别。 2025-01-16 10:16:43 +08:00
秋云 8a63ac8914 fix typo. 2025-01-16 08:24:08 +08:00
秋云 c87ba278e9 修复了影向山和太山府附近点错传送锚点的问题。 2025-01-16 08:18:50 +08:00
秋云 55b2b48e43 修改日志中时间的时间显示格式。 2025-01-16 08:16:39 +08:00
秋云 30a1b4d40f Merge branch 'main' of https://github.com/physligl/better-genshin-impact 2025-01-16 01:27:37 +08:00
辉鸭蛋 4f6724613a fix some bug 2025-01-16 01:13:05 +08:00
辉鸭蛋 04399c1780 fix log 2025-01-15 23:44:02 +08:00
辉鸭蛋 48ddd1751c + elemental collect avatar
早柚
2025-01-15 23:18:41 +08:00
辉鸭蛋 ccc5c68c1c auto tcg force check resolution 2025-01-15 01:05:28 +08:00
辉鸭蛋 340c4caf49 fix 4 am skip blessing of the welkin moon 2025-01-15 01:03:16 +08:00
辉鸭蛋 9ef5cff886 0.39.3 2025-01-13 22:55:10 +08:00
秋云 ad4993c3cf Add some comments 2025-01-13 08:38:10 +08:00
秋云 01fe05e0c8 Remove unused code from FeatureStorage.cs 2025-01-13 08:36:03 +08:00
辉鸭蛋 a22002966e auto update 2025-01-13 01:17:11 +08:00
辉鸭蛋 8666c931d9 auto path opt
1. 超时直接放弃路径点
2. 所有时间都现取现用
2025-01-12 22:55:51 +08:00
辉鸭蛋 1b7ea8b16b Merge remote-tracking branch 'origin/main' 2025-01-12 22:29:37 +08:00
辉鸭蛋 5552813d61 more pick black item 2025-01-12 22:08:18 +08:00
辉鸭蛋 5e03a29a8e Merge pull request #996 from mfkvfhpdx/main
功能调整和日志分析增加锄地统计
2025-01-12 22:00:05 +08:00
辉鸭蛋 dd9e700485 more game resolution check 2025-01-12 21:45:02 +08:00
辉鸭蛋 d5838017d7 fix script import bug 2025-01-12 21:09:48 +08:00
mfkvfhpdx 64feced367 Merge branch 'babalae:main' into main 2025-01-11 22:43:53 +08:00
辉鸭蛋 9d504443f7 Merge pull request #1001 from physligl/main
添加路径追踪中输出日志的功能。
2025-01-11 11:04:39 +08:00
秋云 1f70cfb364 Merge branch 'main' of https://github.com/physligl/better-genshin-impact 2025-01-11 01:58:30 +08:00
秋云 5f18901e22 添加路径追踪中输出日志的功能。 2025-01-11 01:58:23 +08:00
mfkvfhpdx c4e2f49f4b Merge branch 'babalae:main' into main 2025-01-11 00:33:16 +08:00
辉鸭蛋 1fe5281018 Merge pull request #994 from atiasn/auto-music
增加所有乐曲达成【大音天籁】
2025-01-11 00:06:03 +08:00
辉鸭蛋 dfc8c61c8d test code 2025-01-11 00:01:02 +08:00
NextKale 21bef81374 remove old code 2025-01-10 22:55:26 +08:00
NextKale a90f22a8d5 music level 2025-01-10 22:52:18 +08:00
mfkvfhpdx 31994ce2f4 更多功能增加脚本仓库入口,方便订阅更新。 2025-01-10 22:00:21 +08:00
mfkvfhpdx b0f0b26092 增加了复制组功能,和根据文件夹更新功能 2025-01-10 21:52:01 +08:00
mfkvfhpdx 58db3ad04c 修正分析计时 2025-01-10 17:54:49 +08:00
mfkvfhpdx b686d88134 日志分析开放更多的天数选择 2025-01-10 17:13:59 +08:00
mfkvfhpdx 017f8ed5b0 调整统计排序 2025-01-10 15:07:30 +08:00
mfkvfhpdx 2c727d5e6d 调整使用真正的gameinfo 2025-01-10 11:08:16 +08:00
mfkvfhpdx ebd8031f2c Merge branch 'main' into main 2025-01-10 10:29:53 +08:00
mfkvfhpdx 7d872704c2 日志分析增加锄地分析,锄地分析基于米游社旅行札记,需要输入token才能看到锄地分析地数据。 2025-01-10 10:25:30 +08:00
辉鸭蛋 6e7c7fb78e eye catching tips 2025-01-10 01:56:19 +08:00
辉鸭蛋 1469da4699 ui #936 2025-01-10 01:32:21 +08:00
辉鸭蛋 fcac4aa811 tp wait 1 min #932 2025-01-10 01:18:40 +08:00
辉鸭蛋 072943baf9 #955 2025-01-10 01:07:15 +08:00
辉鸭蛋 6591c8a387 fixed #951 2025-01-10 01:04:31 +08:00
辉鸭蛋 9f11fc984d add no select domain option 2025-01-10 00:59:31 +08:00
辉鸭蛋 902b319211 触发器触发频率必须大于0 2025-01-10 00:51:35 +08:00
辉鸭蛋 2e27154871 mandatory verification of game resolution
自动战斗 秘境 强制校验游戏分辨率
2025-01-10 00:11:22 +08:00
辉鸭蛋 e2afabc7f6 fixed #988
修复战斗策略参数校验提示在()不存在时未正确展示的问题
2025-01-10 00:04:14 +08:00
辉鸭蛋 7853901137 log text optimization
文本优化(战斗策略文件不存在、sendInput被拦截、路径追踪中战斗策略日志打印修改)
2025-01-09 23:58:28 +08:00
辉鸭蛋 cd3713175a auto pathing: don't get close during the battle.
战斗时不需要接近点位
2025-01-09 23:49:49 +08:00
辉鸭蛋 3f2a3b118a auto pathing: add auto run config
并且枫丹合成台不自动跑步
2025-01-09 23:41:53 +08:00
NextKale 7edd0c2565 music 2025-01-09 21:16:31 +08:00
NextKale 66fc5fc080 music 2025-01-09 21:10:19 +08:00
NextKale a52dddb70a Merge branch 'main' into auto-music 2025-01-09 21:00:53 +08:00
NextKale 2df7598304 Merge branch 'main' of github.com:atiasn/better-genshin-impact 2025-01-09 21:00:18 +08:00
mfkvfhpdx a9d8659be7 界面去除了偏色调整,战斗识别颜色调整为范围白和范围黄。当万叶技能cd大于3秒或当前一人次就结束了战斗(基本为没有怪物情况),则跳过此次万叶也拾取。未知界面检查,支持暂停情况。 2025-01-09 19:25:42 +08:00
辉鸭蛋 74f0aa71c3 Merge pull request #989 from physligl/main
添加日志分析匹配日志文件带后缀的情况。
2025-01-08 23:57:56 +08:00
秋云 3239003b22 Merge branch 'babalae:main' into main 2025-01-08 22:33:35 +08:00
秋云 4415e85856 添加匹配日志文件带后缀的情况。 2025-01-08 22:29:46 +08:00
NextKale 291652d75f Merge branch 'babalae:main' into auto-music 2025-01-08 11:46:38 +08:00
辉鸭蛋 a6fc3aac76 Update README.md 2025-01-08 01:21:56 +08:00
辉鸭蛋 828d673509 Merge pull request #983 from physligl/main
修复地图移动的一些已知问题
2025-01-08 01:16:07 +08:00
秋云 b92c52cb5c 合并。 2025-01-08 00:56:31 +08:00
秋云 e11af29b45 Merge branch 'main' of https://github.com/physligl/better-genshin-impact 2025-01-08 00:54:03 +08:00
秋云 b9dd66f87a 合并。 2025-01-08 00:53:49 +08:00
秋云 65e2da4123 Merge branch 'babalae:main' into main 2025-01-08 00:47:42 +08:00
秋云 a85129b087 修复移动地图时概率持续点击标记。 2025-01-08 00:47:07 +08:00
辉鸭蛋 be31d0962f Merge pull request #976 from Womsxd/fix/nested-directories-installer
fix(Setup): 修复BGI安装包多一层文件夹
2025-01-07 23:34:26 +08:00
NextKale 64efabde8f auto music 2025-01-07 23:06:51 +08:00
NextKale a0993b172b Merge branch 'main' of github.com:atiasn/better-genshin-impact 2025-01-07 22:41:00 +08:00
辉鸭蛋 2a6f8fcab2 Merge pull request #980 from HZYgrandma/patch-5
Update README.md
2025-01-07 16:18:00 +08:00
洪籽阳外婆 887e812b28 Update README.md 2025-01-07 14:57:05 +08:00
Womsxd 48b51a60e1 fix(Setup): 修复BGI安装包多一层文件夹 2025-01-07 11:49:05 +08:00
辉鸭蛋 3fb35051d1 update UnityLogGameLocator 2025-01-07 01:08:52 +08:00
秋云 e2530a1001 Merge branch 'main' of https://github.com/physligl/better-genshin-impact 2025-01-07 01:03:20 +08:00
辉鸭蛋 07b8899a51 auto domain: extend the waiting time 2025-01-07 00:33:21 +08:00
辉鸭蛋 55fb63782e remove force team names 2025-01-07 00:22:51 +08:00
辉鸭蛋 1b46502374 0.39.2 2025-01-07 00:19:07 +08:00
辉鸭蛋 580c4754a4 Merge pull request #914 from mfkvfhpdx/main
路径追踪支持 未知界面检查关闭,主要用来解决狗粮、或锄地捡物品,有小概率误触烹饪界面的问题。
2025-01-07 00:17:03 +08:00
辉鸭蛋 30827b2ff4 fix conflicts 2025-01-07 00:14:39 +08:00
辉鸭蛋 9f46fb00be Merge branch 'main' into main 2025-01-07 00:12:41 +08:00
辉鸭蛋 b0236a7a04 Merge pull request #956 from Ayu0K/feat/key-binding-config
[feature] 添加按键绑定自定义功能
2025-01-07 00:09:38 +08:00
Ayu0K 608f135640 mod: 修改打开派蒙界面的按键,使其支持改键 2025-01-06 23:59:55 +08:00
辉鸭蛋 b776ec73a4 Merge pull request #973 from chisato2233/main
美化了部分窗口表现
2025-01-06 23:46:51 +08:00
Ayu0K 2bf74c466b fix: 删除了中途更改全局改键功能的实现方式时遗留的无用代码 2025-01-06 23:30:36 +08:00
辉鸭蛋 76829bd3e1 Merge branch 'main' into feat/key-binding-config 2025-01-06 23:24:09 +08:00
Ayu0K 00ece6ce7a mod: 修改了界面绑定设置UI的描述 2025-01-06 22:55:08 +08:00
Ayu0K 71876a5e65 mod: 更改开书按键 2025-01-06 22:55:08 +08:00
Ayu0K 89109958a2 mod: 更改纪行按键 2025-01-06 22:55:08 +08:00
Ayu0K d179eb9949 mod: 修改剧情选项交互按键 2025-01-06 22:55:08 +08:00
Ayu0K be98f10851 mod: 修改按键方式 2025-01-06 22:55:08 +08:00
Ayu0K 6067058530 mod: 更改移动、跳跃、下落的方式 2025-01-06 22:55:08 +08:00
Ayu0K 19f1315d0a mod: 更改打开任务菜单、开启任务追踪、控制角色前进的方法 2025-01-06 22:55:08 +08:00
Ayu0K 56e4dc2dd6 mod: 修改控制角色前进的方法 2025-01-06 22:55:08 +08:00
Ayu0K e37be52f0e mod: 修改向前移动和跳起的方式 2025-01-06 22:55:08 +08:00
Ayu0K 543e36f77e mod: 更改打开地图的方式 2025-01-06 22:55:08 +08:00
Ayu0K 3b54844e6b mod: 修改打开背包的方式 2025-01-06 22:55:08 +08:00
Ayu0K 8822346f3b mod: 修改ScanPickTask控制角色向前的方式 2025-01-06 22:55:08 +08:00
Ayu0K d54d31454d mod: 修改SwitchPartyTask打开编队界面的方式 2025-01-06 22:55:08 +08:00
Ayu0K 5f525f82d7 mod: 修改QuickSereniteaPotTask发送虚拟按键的方式 2025-01-06 22:55:08 +08:00
Ayu0K f78d7bfcec mod: 修改PathExecutor发送虚拟按键的方式 2025-01-06 22:55:08 +08:00
Ayu0K 2e331dbbc6 fix: 修改了KeyBindingSettingModel的命名空间 2025-01-06 22:55:08 +08:00
Ayu0K f77251551e mod: 修改115行中写死的VK_F为PickVK 2025-01-06 22:55:08 +08:00
Ayu0K 68d6cb18ef mod: 替换为使用扩展方法,不直接调用SimulateKeyHelper 2025-01-06 22:55:07 +08:00
Ayu0K 6d430429f7 add: 为GIActions扩展转换为KeyId的方法 2025-01-06 22:55:07 +08:00
Ayu0K bd811b1bdf mod: 使用新方案替代直接从KeyBindingsConfig中取值 2025-01-06 22:55:07 +08:00
Ayu0K 15f363196c mod: 使用新方案替代直接从KeyBindings中读取按键 2025-01-06 22:55:07 +08:00
Ayu0K c904ae5150 mod: 使用新方案改写自动战斗逻辑Avatar 2025-01-06 22:55:07 +08:00
Ayu0K c7e2d83fb8 mod: 使用新方案改写AutoFightTask 2025-01-06 22:55:07 +08:00
Ayu0K a11639f243 mod: 使用新的方案改写AutoDomain 2025-01-06 22:55:07 +08:00
Ayu0K 19558c9c53 add&mod: 将SimulateAction改为扩展方法,不再继承PostMessageSimulator和InputSimulatorExtension;对于部分不支持的按键和功能(如PostMessageSimulator中的鼠标侧键)予以忽略处理 2025-01-06 22:55:07 +08:00
Ayu0K b183762df7 行尾字符标准化 2025-01-06 22:55:07 +08:00
Ayu0K b32b0f8af1 fix: 监听按键松开时未使用配置的值 2025-01-06 22:55:07 +08:00
Ayu0K daf2b3d1ba add: 添加Simulation2用于根据需要的操作进行按键 2025-01-06 22:55:07 +08:00
Ayu0K c4b705c350 mod: 修改UpDownGrabLeaf中的抓取四叶印(某些模式下的交互)按键,直接使用KeyBindingsConfig中的值 2025-01-06 22:55:07 +08:00
Ayu0K e7d76cdae1 mod: 修改PickAroundHandler,直接使用KeyBindings中的值 2025-01-06 22:55:07 +08:00
Ayu0K 8d577050d1 mod: 修改NahidaCollectHandler中元素战技的按键,直接从KeyBindingsConfig中获取值 2025-01-06 22:55:07 +08:00
Ayu0K 242832edc9 mod: 修改ElementalSkillHandler使用的按键,直接获取KeyBindingsConfig中的值 2025-01-06 22:55:07 +08:00
Ayu0K e39eb9ef93 mod: 修改AutoFight下Avatar(角色战斗逻辑)中的按键,由于该类不是Base On ISoloTask接口的,因此将读取配置文件的操作放在构造函数中。 2025-01-06 22:55:07 +08:00
Ayu0K 2db2c1957a mod: 为连发功能提供改键支持 2025-01-06 22:55:07 +08:00
Ayu0K 60ccbfbace fix: 删除不需要的异常处理结构 2025-01-06 22:55:07 +08:00
Ayu0K 5786ba7634 mod: 修改提示文本 2025-01-06 22:55:07 +08:00
Ayu0K bc6970b6c5 mod: 更改KeyBindingTextBox的行为,在获得焦点时显示输入提示,并忽略取得焦点前的鼠标左键单击事件 2025-01-06 22:55:07 +08:00
Ayu0K 06ee8ab1cc mod: 修改了注释 2025-01-06 22:55:07 +08:00
Ayu0K ac866f9293 fix: 按键名称Unknown 2025-01-06 22:55:07 +08:00
Ayu0K ca3b31f84e mod: 将按键设置与VK解耦合,并提供KeyId向WPF按键、WPF鼠标按键以及VK的互相转换。 2025-01-06 22:55:07 +08:00
Ayu0K a80f6fc423 fix: 修改VK_OEM_PLUS对应的按键名称 2025-01-06 22:55:07 +08:00
Ayu0K 4cfff57b2c mod: 修改AutoFightTask中检测战斗结束使用的打开编队界面和取消攀爬的按键为KeyBindingsConfig记录的按键;修改方案参考AutoWood,在调用Start方法时将该模块需要用到的按键从KeyBindingsConfig中取出 2025-01-06 22:55:07 +08:00
Ayu0K 114a84a9e8 fix: 修正默认的编队键位 2025-01-06 22:55:07 +08:00
Ayu0K 9fa2bcb5a7 mod: 将AutoDomain启动秘境与领取奖励的识别目标和拾取按键与AutoPick统一 2025-01-06 22:55:07 +08:00
Ayu0K 5d80d6d53b mod: 修改AutoDomain中角色移动(用于支持非QWERTY布局的键盘)、冲刺、吃药的按键为KeyBindingsConfig记录的按键;修改方案参考AutoWood,在调用Start方法时将该模块需要用到的按键从KeyBindingsConfig中取出 2025-01-06 22:55:07 +08:00
Ayu0K 5a19b7d2ef mod: 将AutoDomain启动秘境与领取奖励的识别目标和拾取按键与AutoPick统一 2025-01-06 22:55:07 +08:00
Ayu0K accd0280bb add: 添加从注册表中读取按键的功能(待完善:星之归还、隐藏UI按键无法获取;拾取按键、派蒙菜单按键可能存在错误) 2025-01-06 22:55:07 +08:00
Ayu0K 317a526f16 add: 按键绑定的GUI实现(初步) 2025-01-06 22:55:07 +08:00
Ayu0K 8dd6131c94 add: 集成按键绑定配置 2025-01-06 22:55:07 +08:00
Feiran Zhang 0a04734a40 添加茜特菈莉作为循环短E角色 2025-01-06 22:55:07 +08:00
辉鸭蛋 38e5de35a2 Delete 1岩水雷火四神.txt 2025-01-06 22:55:07 +08:00
洪籽阳外婆 5353231810 Update README.md
Update Screenshot
2025-01-06 22:55:07 +08:00
秋云 476f36a19a 确保传送任务开始前一定位于地图界面。 2025-01-06 22:55:07 +08:00
Baisbt 8a6bb597c4 Add files via upload 2025-01-06 22:55:07 +08:00
masm611 b90a6c4227 修正windows10_1909版本WGC故障
windows10_1909版本的WGC不支持IsCursorCaptureEnabled,加了个动态判断防止异常与抓屏失败等。
但是这样就有可能会抓到光标导致图像识别失败,但是个人认为瘦死的骆驼比马大,没有这个api就不调用即可,好歹还能用一下
如果有必要,后面可以考虑加一个弹窗警告一下啥的,但是这样可能会让用户糟心,总不能逼人家换个系统吧?但是不弹窗呢又好像向用户隐藏了某些可能存在的错误,好像又不太对啥的。
只能说云原神的限制还是大了一点,要不要加弹窗我无法决策,还是由大佬来吧
2025-01-06 22:55:07 +08:00
辉鸭蛋 0650bebefa fix genshin install path get 2025-01-06 22:55:07 +08:00
__Chisato__ 6536cad9fd 增加了更改窗口模糊的选项 2025-01-06 20:11:51 +08:00
__Chisato__ 63d7d230dc 优化了PickerWindow的表现效果 2025-01-06 18:35:11 +08:00
zjl abea63bcda Merge branch 'main' of https://github.com/mfkvfhpdx/better-genshin-impact 2025-01-06 14:24:16 +08:00
zjl 653df2f7cc 去掉一个信息提示 2025-01-06 14:22:34 +08:00
zjl ebc8870478 调度器,更多功能中增加日志分析,以列表形式展示配置组耗时和拾取物。 2025-01-06 14:20:05 +08:00
mfkvfhpdx 958c5ab7cd Merge branch 'babalae:main' into main 2025-01-06 14:08:08 +08:00
秋云 99831beb40 修复了地图移动的时候狂点标记问题,修复了移动次数从0开始计算的问题。 2025-01-06 11:51:14 +08:00
辉鸭蛋 a7fae09464 Merge pull request #969 from zhangfeiran/patch-1
添加茜特菈莉作为循环短E角色
2025-01-06 03:22:11 +08:00
Feiran Zhang 57a83cc171 添加茜特菈莉作为循环短E角色 2025-01-06 03:00:04 +08:00
辉鸭蛋 f0af8134ce Delete 1岩水雷火四神.txt 2025-01-05 19:09:59 +08:00
辉鸭蛋 463555c054 Merge pull request #960 from HZYgrandma/patch-3
Update README.md
2025-01-05 18:58:19 +08:00
洪籽阳外婆 01eaa190d8 Update README.md
Update Screenshot
2025-01-05 18:54:35 +08:00
辉鸭蛋 0c487dafd4 Merge pull request #948 from physligl/main
确保传送任务开始前一定位于地图界面。
2025-01-05 17:39:48 +08:00
zjl 1f6e3b78a5 去掉异常处理中的派蒙检查,对于战斗脚本,结束后会误触发 2025-01-05 15:08:50 +08:00
辉鸭蛋 a7da741342 Merge remote-tracking branch 'origin/main' 2025-01-05 14:58:58 +08:00
辉鸭蛋 a57aed9ce7 fix genshin install path get 2025-01-05 14:57:54 +08:00
zjl aa164adb52 Merge remote-tracking branch 'origin/main' 2025-01-05 14:57:46 +08:00
zjl e8b939fbee 未知界面检查常驻于pathing中,去除了该可配置项,以支持js中的路径追踪。pathing逻辑用try块包了起来,最后finally保证,额外开启的线程必定关闭。异常界面检查,当不存在派蒙时尝试按ESC(即使判断错误,也会由未知界面检查,关闭该弹出)。 2025-01-05 14:57:32 +08:00
mfkvfhpdx d872b511d0 Merge branch 'babalae:main' into main 2025-01-05 14:31:16 +08:00
辉鸭蛋 c2dbbe85cd Merge pull request #949 from Baisbt/main
战斗脚本:岩水雷火四神
2025-01-05 13:09:35 +08:00
辉鸭蛋 a75cc84773 Merge pull request #954 from masm611/main
修正windows10_1909版本WGC故障
2025-01-05 13:05:02 +08:00
masm611 1ceb991c1b 修正windows10_1909版本WGC故障
windows10_1909版本的WGC不支持IsCursorCaptureEnabled,加了个动态判断防止异常与抓屏失败等。
但是这样就有可能会抓到光标导致图像识别失败,但是个人认为瘦死的骆驼比马大,没有这个api就不调用即可,好歹还能用一下
如果有必要,后面可以考虑加一个弹窗警告一下啥的,但是这样可能会让用户糟心,总不能逼人家换个系统吧?但是不弹窗呢又好像向用户隐藏了某些可能存在的错误,好像又不太对啥的。
只能说云原神的限制还是大了一点,要不要加弹窗我无法决策,还是由大佬来吧
2025-01-05 12:53:03 +08:00
NextKale 1226f85196 Merge branch 'main' of github.com:atiasn/better-genshin-impact 2025-01-05 11:35:09 +08:00
Baisbt e3a5c491be Add files via upload 2025-01-05 02:36:00 +08:00
秋云 7137e52605 确保传送任务开始前一定位于地图界面。 2025-01-05 01:57:16 +08:00
zjl 3174dc75c8 删除了错误的注释 2025-01-03 20:51:25 +08:00
zjl 4c0d9955b3 阵亡后,重试该路线。但重试,准备传回来时,有几率未打开地图界面,导致传送失败,所以加了每次重试都检查是否打开地图界面。 2025-01-03 20:50:50 +08:00
zjl 8345eb4bdc Merge remote-tracking branch 'origin/main' 2025-01-03 20:14:07 +08:00
zjl 57953933d3 由于地图关闭按钮和烹饪关闭按钮一样,无法作为通用判断,所以依旧使用单个界面检查,调整了检查烹饪的图片范围,增加了按ESC出uid的那个界面也会ESC返回,未知界面检查默认开启。 2025-01-03 20:13:51 +08:00
mfkvfhpdx a0af8405b7 Merge branch 'babalae:main' into main 2025-01-03 08:32:50 +08:00
辉鸭蛋 e6e549814d Merge remote-tracking branch 'origin/main' 2025-01-02 22:51:04 +08:00
辉鸭蛋 c80799cbee 0.39.1 & fix some bug 2025-01-02 22:49:38 +08:00
辉鸭蛋 c2fce8618d Merge pull request #916 from haokaiyang/main
auto tcg: update character card config to v5.3
2025-01-02 12:50:07 +08:00
haokaiyang 663277a990 auto tcg: update character card config to v5.3 2025-01-02 11:55:57 +08:00
mfkvfhpdx 3d775241cc Merge branch 'babalae:main' into main 2025-01-02 07:30:31 +08:00
辉鸭蛋 c0fecd079e 0.39.0 2025-01-02 01:16:05 +08:00
辉鸭蛋 97f1000370 fix auto album task end 2025-01-02 01:15:31 +08:00
辉鸭蛋 02f2c1321a auto album 2025-01-02 01:05:03 +08:00
辉鸭蛋 f9d0bd4521 music test 2025-01-01 23:08:01 +08:00
辉鸭蛋 5e929d3d07 fix walk to domain 2025-01-01 23:07:12 +08:00
zjl b52af1e9a7 把检查移入pathing中,对烹饪做了二次判断,第一可能会在战斗时,误判 2025-01-01 22:15:53 +08:00
mfkvfhpdx 942bb3a6dd Merge branch 'babalae:main' into main 2025-01-01 20:56:24 +08:00
zjl 3eecea21aa 路径追踪支持 未知界面检查关闭,主要用来解决狗粮、或锄地捡物品,有小概率误触烹饪界面的问题。 2025-01-01 20:54:19 +08:00
辉鸭蛋 3c393087eb auto music opt 2025-01-01 19:34:39 +08:00
辉鸭蛋 85c7707c7a avatar 5.3 2025-01-01 19:33:14 +08:00
辉鸭蛋 a41a0bdba1 5.3 avatar 2025-01-01 14:10:02 +08:00
辉鸭蛋 5de2067489 auto music opt 2025-01-01 13:59:06 +08:00
辉鸭蛋 c95343e953 #846 daily reward party 2025-01-01 10:48:29 +08:00
mfkvfhpdx f34e6c3530 当最后出招人为万叶,并且剩余cd>3时,跳过此次万叶拾取 (#906) 2025-01-01 09:20:08 +08:00
辉鸭蛋 2d3395b491 typo & ui 2025-01-01 01:52:41 +08:00
zjl ed3cbd47f5 当最后出招人为万叶,并且剩余cd>3时,跳过此次万叶拾取 2024-12-31 22:33:45 +08:00
辉鸭蛋 d86959297c fix skip blessing of the welkin moon 2024-12-31 01:50:38 +08:00
辉鸭蛋 726863462a 0.38.1 2024-12-31 01:00:09 +08:00
辉鸭蛋 9971817e44 fixed #609 2024-12-31 00:59:48 +08:00
辉鸭蛋 bfeaa1b14a fix pathing bug 2024-12-31 00:44:27 +08:00
秋云 71fa4eaf3a Merge pull request #899 from physligl/main
新的传送点数据集 @Limint
2024-12-31 00:28:34 +08:00
辉鸭蛋 9049c85be7 Merge pull request #897 from mfkvfhpdx/main
修正开启万叶拾取后,不生效的问题。修正战斗检查时间的换算问题,以及一个逻辑判断问题。
2024-12-30 22:23:03 +08:00
zjl ac85cda170 修正开启万叶拾取后,不生效的问题。修正战斗检查时间的换算问题,以及一个逻辑判断问题。 2024-12-30 21:42:03 +08:00
辉鸭蛋 178d253c38 Merge pull request #894 from greepar/greepar-patch-3
修复虹灵的净土秘境消失的问题
2024-12-30 14:08:15 +08:00
greepar 8ba5b16710 Update tp.json
修复了自动秘境中纳塔-虹灵的净土秘境消失的问题
2024-12-30 12:26:40 +08:00
辉鸭蛋 25373cac2a 0.38 2024-12-30 00:12:01 +08:00
辉鸭蛋 2411e1dbef Merge remote-tracking branch 'origin/main' 2024-12-29 22:04:09 +08:00
辉鸭蛋 4118e7b6f2 opt 2024-12-29 22:03:26 +08:00
辉鸭蛋 d6c4f5ab57 Merge pull request #892 from mfkvfhpdx/main
战斗未检查成功时,如果按空格会跳跃,导致队伍切换失败。改成x后,应不会影响其他操作
2024-12-29 21:40:26 +08:00
zjl ac2c7e7ac7 战斗未检查成功时,如果按空格会跳跃,导致队伍切换失败。改成x后,应不会影响其他操作 2024-12-29 21:13:22 +08:00
辉鸭蛋 07e5ea643a Merge pull request #891 from mfkvfhpdx/main
增加针对战斗的细化配置
2024-12-29 21:04:24 +08:00
mfkvfhpdx f4f9f22977 Merge branch 'babalae:main' into main 2024-12-29 21:01:27 +08:00
zjl e6c8804b09 1、判断战斗结束、万叶捡材料、自动拾取,三个配置独立执行。
2、增加 更快检查结束战斗配置,可以根据时间或角色,在一轮角本未走完情况下检查,而加快检查战斗速度。
3、增加了万叶拾取的配置
4、增加 检查战斗结束的延时 ,可根据不同人物更精细的制定策略。
2024-12-29 20:59:05 +08:00
辉鸭蛋 d71ff06868 fix domain and map retry 2024-12-29 20:54:31 +08:00
辉鸭蛋 741da4e0c7 #869 2024-12-29 20:22:00 +08:00
辉鸭蛋 a66b802bbd fixed #661 2024-12-29 19:00:26 +08:00
辉鸭蛋 60f1a271c4 Merge remote-tracking branch 'origin/main' 2024-12-29 18:07:32 +08:00
辉鸭蛋 2396daf206 #767 2024-12-29 18:07:00 +08:00
辉鸭蛋 d8f06598aa Merge pull request #890 from physligl/main
更新5.2的传送锚点和神像。
2024-12-29 17:16:13 +08:00
辉鸭蛋 6127fab70b auto domain retry 2024-12-29 17:10:02 +08:00
辉鸭蛋 6432ff1aed fix key mouse 2024-12-29 17:08:08 +08:00
秋云 0670fd9c0d fix typos 2024-12-29 16:37:32 +08:00
秋云 c14025181c 更新5.2的传送锚点和神像。 2024-12-29 16:31:57 +08:00
辉鸭蛋 2b658afad6 fix the character is still fighting after resurrection 2024-12-29 16:27:14 +08:00
辉鸭蛋 54eecbe046 ui & log 2024-12-29 16:20:27 +08:00
辉鸭蛋 9d807e1e42 1. walk to F 2. auto music 2024-12-29 16:02:35 +08:00
辉鸭蛋 c3ef67f57a Merge branch 'pr/884' 2024-12-29 00:52:01 +08:00
辉鸭蛋 13f3272b9c Merge pull request #887 from physligl/main
优化鼠标移动逻辑。
2024-12-29 00:48:50 +08:00
辉鸭蛋 7e04d77f88 kazuha e hold when fight end 2024-12-29 00:28:53 +08:00
秋云 8f1cf62449 优化鼠标移动逻辑。 2024-12-29 00:20:56 +08:00
辉鸭蛋 cad2cf039d more daily path 2024-12-29 00:08:29 +08:00
辉鸭蛋 215f2ce450 Merge pull request #884 from mfkvfhpdx/main
路径追踪支持战斗配置
2024-12-28 23:02:17 +08:00
辉鸭蛋 0a5c78ebbe code format 2024-12-28 23:01:22 +08:00
辉鸭蛋 f9671467fc fix script control low level check 2024-12-28 22:32:44 +08:00
辉鸭蛋 621a91638a support weekly domain config 2024-12-28 22:06:50 +08:00
秋云 34d0917818 合并分支。 2024-12-28 22:05:12 +08:00
秋云 2b371cce33 fix typos. 2024-12-28 22:01:06 +08:00
mfkvfhpdx 510ca82304 Merge branch 'babalae:main' into main 2024-12-28 21:48:21 +08:00
辉鸭蛋 b83017f52e add GetBigMapZoomLevel 2024-12-28 21:29:42 +08:00
秋云 dd6b26ae8d 提高了MouseMoveMap中最小的steps数量以避免除0错误。 2024-12-28 19:22:03 +08:00
mfkvfhpdx cb19255fb4 Merge branch 'babalae:main' into main 2024-12-28 18:23:01 +08:00
辉鸭蛋 71f2c2f52e Merge pull request #885 from physligl/main
fix typos.
2024-12-28 18:21:51 +08:00
秋云 5d780ec4f8 fix typos. 2024-12-28 18:10:48 +08:00
mfkvfhpdx a091bb6734 Merge remote-tracking branch 'origin/main' 2024-12-28 17:21:14 +08:00
mfkvfhpdx 81a7518f72 暂停后按下的键会释放,增加战斗检查偏色配置,由于跟队伍无关,只在独立任务,自动战斗处设置。 2024-12-28 17:12:47 +08:00
mfkvfhpdx 340a3142e5 Merge branch 'babalae:main' into main 2024-12-28 06:16:34 +08:00
辉鸭蛋 dfad3022c2 Merge pull request #882 from physligl/main
修复移动地图时遇到的部分问题
2024-12-28 00:39:55 +08:00
秋云 bb8ccd2297 fix typos. 2024-12-27 23:57:00 +08:00
秋云 17282a3cef 回退修改。 2024-12-27 23:51:40 +08:00
mfkvfhpdx bb7d84ffe3 战斗配置增加超时,调度器增加清空功能 2024-12-27 23:47:58 +08:00
秋云 28ceb3dd85 未知原因导致合并冲突。 2024-12-27 23:24:14 +08:00
秋云 ce75d038b2 修复地图移动前伟打开主界面的问题(上个修改导致)。限制地图最小缩放等级,以节约时间。合并冲突。 2024-12-27 23:21:22 +08:00
秋云 17dd19aa47 合并冲突。 2024-12-27 23:08:59 +08:00
unknown a861a335ac 1. 修复移动到部分传送点时经过开放区域导致移动失败的问题。2. 修复因为初始地图缩放等级过大无法点击传送点的问题。 2024-12-27 22:54:47 +08:00
mfkvfhpdx c439403231 Merge branch 'babalae:main' into main 2024-12-27 21:48:28 +08:00
zjl a63ed2f2d2 路径追踪支持可配置 2024-12-27 21:46:52 +08:00
辉鸭蛋 c9634abebb fix install path get 2024-12-27 02:37:46 +08:00
辉鸭蛋 1214ca2d65 Merge remote-tracking branch 'origin/main' 2024-12-27 00:58:33 +08:00
辉鸭蛋 dc853f2307 new game path loader 2024-12-27 00:57:18 +08:00
辉鸭蛋 875058ae5b Merge pull request #876 from physligl/main
修复地图移动的已知问题。
2024-12-25 00:28:59 +08:00
辉鸭蛋 e9d715876b Merge pull request #874 from mfkvfhpdx/main
降低L识别结束精度,更快的检查战斗结束。
2024-12-25 00:27:49 +08:00
unknown 57bcb3cd6b 修复地图移动的已知问题。 2024-12-25 00:24:08 +08:00
unknown ff993f642f Revert "修复地图移动的已知问题。"
This reverts commit 4aa8c69d0e.
2024-12-25 00:19:42 +08:00
unknown 4aa8c69d0e 修复地图移动的已知问题。 2024-12-25 00:17:39 +08:00
mfkvfhpdx 7511ccc637 Merge branch 'babalae:main' into main 2024-12-24 18:30:23 +08:00
辉鸭蛋 e9d206eca0 0.37.8 2024-12-24 01:33:55 +08:00
辉鸭蛋 88110a21cc ui: more script repo button 2024-12-24 01:33:28 +08:00
辉鸭蛋 84c7fcec21 fix ui bug 2024-12-24 01:26:11 +08:00
zjl b19adcfba4 更快的检查战斗结束,以及降低L识别结束精度。 2024-12-23 23:37:56 +08:00
辉鸭蛋 404457922d 0.37.7 2024-12-23 00:38:02 +08:00
辉鸭蛋 733e5fb98a more settings 2024-12-23 00:37:04 +08:00
辉鸭蛋 a04d2e437a persistent configuration 2024-12-23 00:01:51 +08:00
辉鸭蛋 08b921b982 one dragon configs 2024-12-22 23:24:11 +08:00
辉鸭蛋 e6e78aded0 fix pathing config ineffective 2024-12-22 21:07:06 +08:00
辉鸭蛋 df600c6016 start game when start one dragon 2024-12-22 20:52:39 +08:00
辉鸭蛋 d374a95bb8 new game loading 2024-12-22 14:56:25 +08:00
辉鸭蛋 f5e8edccb8 collapse multiple checkboxes and add filter 2024-12-22 00:17:34 +08:00
辉鸭蛋 f690bc849b Merge pull request #868 from physligl/main
降低鼠标后半部分移动速度,以避免惯性,作为补偿前面一半的速度变快了。
2024-12-21 18:57:16 +08:00
unknown c3c272c241 降低鼠标后半部分移动速度,以避免惯性,作为补偿前面一半的速度变快了。 2024-12-21 16:20:58 +08:00
辉鸭蛋 537f647ba7 fix auto skip plot when pathing 2024-12-21 15:19:01 +08:00
辉鸭蛋 ca353fea70 remove log 2024-12-21 15:06:52 +08:00
辉鸭蛋 9bf82a1bbb Merge pull request #861 from mfkvfhpdx/main
参考失焦,增加了快捷键暂停。调度器任务支持从指定任务开始(右键 下一个任务从此执行,重启软件,或取出待执行任务后,该状态将会清空)。
2024-12-21 14:41:42 +08:00
辉鸭蛋 e497f6ec79 1. 抽离部分内部类,格式化代码
2. ValueTuple 已过时,元组建议使用 ()
3. 暂停变量不建议放在 TaskContext.Instance().Config.Suspend 中,会被持久化到配置内
4. 修改一些方法和变量的存放位置
2024-12-21 14:35:42 +08:00
zjl 36e49bcbc7 1、战斗优化,只保留按L的情况下
2、暂停功能根据点位状态记录,支持暂停后,当判断路径过于远时,会不消耗重试次数重试此任务
3、重试点位时,将只保留跑图的那部分,跳过如打架、挖矿等操作,提升效率
2024-12-21 12:49:39 +08:00
mfkvfhpdx 7c1568a809 Merge branch 'babalae:main' into main 2024-12-20 20:14:43 +08:00
zjl b99144cd3d 调整暂停为sleep方式,能一直维持,除了离开太远,会跳过当前任务,应该没多大问题。低血量尝试队伍回血。调度器右键重命名。 2024-12-20 20:13:51 +08:00
辉鸭蛋 d5d65b7820 use system tick count instead of DateTime 2024-12-20 02:52:00 +08:00
zjl 7d04997300 去掉遗留的注释 2024-12-17 23:16:33 +08:00
zjl 36cbd168ed Merge branch 'main' of https://github.com/mfkvfhpdx/better-genshin-impact 2024-12-17 23:14:55 +08:00
zjl 5162bcc88f 参考失焦,增加了快捷键暂停。调度器任务支持从指定任务开始(右键 下一个任务从此执行,重启软件,或取出待执行任务后,该状态将会清空)。 2024-12-17 23:12:56 +08:00
zjl 1a2cdbbfd7 参考失焦,简易的实现了快捷键暂停。调度器任务配置支持指定下一次从某个任务开始执行。右键下一次从此任务开始执行,同时名称颜色变绿。重启软件,或执行过滤操作后,清空该状态。 2024-12-17 23:06:30 +08:00
辉鸭蛋 ec8fa6e824 KeyDown -> KeyUp 2024-12-14 20:52:19 +08:00
辉鸭蛋 3266b63187 alt use sendInput 2024-12-14 19:56:38 +08:00
辉鸭蛋 294d096229 fixed Alt does not take effect when playing macros 2024-12-14 18:59:16 +08:00
辉鸭蛋 48b5ab8af6 macro: add mouse wheel 2024-12-14 18:40:14 +08:00
辉鸭蛋 e00b38eb66 remove library 2024-12-14 01:23:26 +08:00
辉鸭蛋 0c435a9393 fix #852 2024-12-13 02:23:57 +08:00
辉鸭蛋 3ca7ab6d4c Merge pull request #851 from physligl/main
修复部分已知问题,调快了鼠标移动速度。
2024-12-12 01:09:15 +08:00
unknown c480cf484e 同上 2024-12-11 05:04:32 +08:00
unknown 2ce4e6d665 同上 2024-12-11 04:47:31 +08:00
unknown 7b158c442e 由于修改,默认初始zoomLevel=4,部分传送点识别到之后无法点击传送,原因未知,修改之后识别和点击传送点基本都在zoomLevel=2的时候执行。 2024-12-11 04:20:55 +08:00
unknown 9180b58d94 修复部分已知问题,调快了鼠标移动速度,无需再担忧寻找传送点的苦恼。 2024-12-11 02:43:25 +08:00
辉鸭蛋 5b8caef75a one dragon : 0.37.4 2024-12-11 00:00:49 +08:00
辉鸭蛋 c22edcd39a pathing: dash behind press E, and don't press E when it's too close to the target point
疾跑放在开E后面,离目标点过近的时候不再开E
2024-12-10 23:58:49 +08:00
辉鸭蛋 7e88c9a57d Merge pull request #848 from physligl/main
修改了缩放的逻辑,以及因为缩放导致的bug
2024-12-10 22:05:53 +08:00
unknown 49fc8ed260 清理部分变量 2024-12-10 04:48:02 +08:00
unknown f37d1d34a6 修改了缩放的逻辑,并且缩放后更新鼠标移动的距离,避免因为缩放导致移动距离不够或者过多。 2024-12-10 04:38:02 +08:00
unknown 76dd2f3903 修改了缩放的逻辑,并且缩放后更新鼠标移动的距离,避免因为缩放导致移动距离不够或者过多。 2024-12-10 04:32:58 +08:00
辉鸭蛋 5e94037722 Merge pull request #847 from physligl/main
修改传送过程中移动到目标传送点的逻辑。
2024-12-10 01:20:41 +08:00
unknown 57610a3945 修改传送过程中移动到目标传送点的逻辑。 2024-12-10 01:13:31 +08:00
辉鸭蛋 11dda84592 pick drops 2024-12-09 00:57:17 +08:00
辉鸭蛋 b600d577c4 fix action params not valid 2024-12-08 15:29:06 +08:00
辉鸭蛋 dd19afaca5 update ui 2024-12-08 00:46:48 +08:00
辉鸭蛋 c2cd6dbe9c pathing: pre judgment of recovery
* 强制判断分辨率
* 切换队伍前判断是否需要复苏
2024-12-07 01:47:01 +08:00
辉鸭蛋 c059611edb update ui 2024-12-06 00:32:52 +08:00
辉鸭蛋 7ebbfda15d fix mail reward 2024-12-05 00:11:33 +08:00
辉鸭蛋 54887b90f6 fix daily reward collection judgment 2024-12-04 23:06:17 +08:00
辉鸭蛋 77cfcbe73f fix big map tp shielded area 2024-12-04 01:59:36 +08:00
辉鸭蛋 f3e16fbb77 fixed #837 2024-12-04 01:58:50 +08:00
辉鸭蛋 99c8cd450e add claim mail 2024-12-04 01:33:17 +08:00
辉鸭蛋 dffccd0740 fix auto domain camera bug 2024-12-02 23:40:54 +08:00
辉鸭蛋 6cfa4b27a6 Merge pull request #835 from babalae/feat/new-camera
new camera orientation algorithm
2024-12-02 22:55:21 +08:00
辉鸭蛋 e2a25e4492 new camera orientation algorithm by https://github.com/Limint 2024-12-02 22:53:40 +08:00
辉鸭蛋 b6220db756 update 2024-12-02 22:13:46 +08:00
辉鸭蛋 958703dcd7 V3 test 2024-12-01 23:52:34 +08:00
辉鸭蛋 c182ec13f9 init V3 2024-12-01 23:23:06 +08:00
辉鸭蛋 ff0533288a fix ClaimBattlePass 2024-12-01 22:56:41 +08:00
辉鸭蛋 2383761b5d more js methods to expose 2024-12-01 16:43:42 +08:00
辉鸭蛋 ebc6ed8e07 prevent shortcut key conflicts 2024-12-01 14:37:29 +08:00
辉鸭蛋 9ab518d593 v2 2024-11-30 18:10:26 +08:00
辉鸭蛋 df84cc9ef1 add auto claim Battle Pass rewards 2024-11-29 20:37:27 +08:00
辉鸭蛋 60bd96f1f4 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2024-11-29 01:42:23 +08:00
辉鸭蛋 d9faefd446 fix ArtifactSalvageTask 2024-11-29 01:37:41 +08:00
辉鸭蛋 19530e6c50 Merge pull request #821 from OPPO9008/patch-1
添加纳塔训练大师名字
2024-11-27 17:15:28 +08:00
OPPO9008 842f8506a5 添加纳塔训练大师名字 2024-11-27 11:46:09 +08:00
辉鸭蛋 2083caa9d7 one dragon: params opt 2024-11-26 23:47:40 +08:00
辉鸭蛋 67a418b984 one dragon: task series connection 2024-11-26 00:46:38 +08:00
辉鸭蛋 216c78d4d5 0.37.2 2024-11-25 22:50:45 +08:00
辉鸭蛋 fa1809a1f0 add PickAroundHandler action params 2024-11-25 22:37:19 +08:00
辉鸭蛋 fa9eacf4ac divide the path by tp point 2024-11-25 22:27:04 +08:00
辉鸭蛋 968048baa9 new PickAroundHandler @Limint 2024-11-25 22:04:02 +08:00
辉鸭蛋 436dfef2ee Merge remote-tracking branch 'origin/main' 2024-11-24 19:38:31 +08:00
辉鸭蛋 c2f81877dd Update bug.md 2024-11-24 19:38:12 +08:00
辉鸭蛋 0d6ab88c4a add ClaimEncounterPointsRewardsTask 2024-11-24 19:04:52 +08:00
辉鸭蛋 d7302b65c3 auto domain: tp & switch party & artifact salvage 2024-11-24 17:48:23 +08:00
辉鸭蛋 74acb4eb1c 0.37.1 2024-11-24 11:35:21 +08:00
辉鸭蛋 026dcd4488 auto domain: tp & switch party 2024-11-24 02:45:49 +08:00
辉鸭蛋 1cad8c3a00 pathing: config ui 2024-11-24 01:10:30 +08:00
辉鸭蛋 84629942bc pathing: use gadget #799 2024-11-24 00:49:49 +08:00
辉鸭蛋 a6f6ce55dd pathing: add OnlyInTeleportRecover config #779 2024-11-24 00:32:41 +08:00
辉鸭蛋 62a19c0052 auto pick: add black list #800 2024-11-24 00:01:32 +08:00
辉鸭蛋 3d63f18831 auto skip: background opt 2024-11-23 22:09:43 +08:00
辉鸭蛋 99c593cb7d 0.37.0 2024-11-23 19:44:00 +08:00
辉鸭蛋 93640f0b55 update: UI/UX 2024-11-23 14:03:25 +08:00
辉鸭蛋 2a2acb5b0d auto skip: background skip use key (5.2) 2024-11-23 00:49:11 +08:00
辉鸭蛋 382f31bbe7 auto domain: fix ocr region 2024-11-22 22:52:22 +08:00
辉鸭蛋 e3689cd21a ui opt 2024-11-22 22:36:32 +08:00
辉鸭蛋 258848edba new model 2024-11-22 22:18:02 +08:00
辉鸭蛋 0a5dc888a0 5.2 avatar + Yap model 2024-11-22 00:49:59 +08:00
辉鸭蛋 e27e22acaa 5.2 avatar 2024-11-22 00:29:54 +08:00
辉鸭蛋 a89af32560 pathing: fix bug, init mining 2024-11-22 00:23:21 +08:00
辉鸭蛋 d34d24cd5e fix auto domain skip 2024-11-21 23:41:32 +08:00
辉鸭蛋 175db6a792 Merge pull request #802 from babalae/feat/refine-ui
Refine Script Control Page
2024-11-21 17:25:03 +08:00
DismissedLight a8b105f7ee Refine Script Control Page 2024-11-21 17:11:04 +08:00
辉鸭蛋 142bf0a47f Merge pull request #801 from haokaiyang/main
auto tcg: update character card config to v5.2
2024-11-21 12:09:17 +08:00
haokaiyang 36c0fb0f13 auto tcg: update character card config to v5.2 2024-11-21 11:32:42 +08:00
辉鸭蛋 008f09cbe9 5.2 map 2024-11-20 22:49:35 +08:00
辉鸭蛋 7feb204789 fix stopfly not work 2024-11-18 23:07:25 +08:00
辉鸭蛋 d82859177f extend waiting time 2024-11-17 00:45:37 +08:00
辉鸭蛋 bbe1dc1968 0.36.4 2024-11-16 22:50:31 +08:00
辉鸭蛋 9580dd916a pathing: add action combat_script 2024-11-16 22:48:26 +08:00
辉鸭蛋 bb13aac0a9 fix rider error tips 2024-11-16 13:40:57 +08:00
辉鸭蛋 2c3352f1bc don't switch teams while online 2024-11-15 00:31:41 +08:00
辉鸭蛋 7a5efe208f pathing opt
在 `PathExecutor` 类中添加了 `EndAction` 和 `EndJudgment` 属性,用于判断路径追踪的结束条件,并在路径执行过程中调用 `ResolveAnomalies` 和 `EndJudgment` 方法处理异常和结束条件。处理 `NormalEndException` 异常并记录日志。检查游戏窗口分辨率,低于 1920x1080 记录错误日志。

更新 `冒险家协会_枫丹.json` 文件,将路径点类型从 `path` 修改为 `target`。

在 `GoToAdventurersGuildTask` 和 `GoToCraftingBenchTask` 类中,添加结束日志信息,移除交互代码,并添加 `EndAction` 属性判断任务结束条件。
2024-11-13 23:42:15 +08:00
辉鸭蛋 8941f6ce8c fix elemental collect avatar name
将“心海”更改为“珊瑚宫心海”。
将“万叶”更改为“枫原万叶”。
2024-11-13 23:00:26 +08:00
辉鸭蛋 b2db1e0b84 add GoToCraftingBenchTask
更新了 `BetterGenshinImpact.csproj` 文件中的程序集版本号,从 `0.36.2` 更新到 `0.36.3`。在 `ElementAssets.cs` 文件中,添加了 `CraftCondensedResin` 识别对象,并在 `ElementAssets` 类的构造函数中初始化了该对象。在 `ChooseTalkOptionTask.cs` 文件中,添加了 `BetterGenshinImpact.Core.Config` 的引用,并增加了在选项文本包含指定内容时保存截图的功能。修改了 `SelectLastOptionUntilEnd` 方法,增加了 `endAction` 参数和重试次数 `retry` 参数,并在循环中增加了对 `endAction` 的判断。修改了 `IsOrangeOption` 方法中的颜色阈值参数。在 `GoToAdventurersGuildTask.cs` 文件中,添加了 `Vanara.PInvoke` 的引用,并增加了等待对话界面的延迟时间和领取每日委托奖励后的点击操作。在 `HotKeyPageViewModel.cs` 文件中,修改了 `Test2Hotkey` 的回调函数,改为执行 `GoToCraftingBenchTask` 任务。

添加了多个命名空间引用,包括 `BetterGenshinImpact.Core.Config`、`BetterGenshinImpact.GameTask.AutoPathing`、`BetterGenshinImpact.GameTask.AutoPathing.Model`、`BetterGenshinImpact.GameTask.AutoSkip.Assets`、`BetterGenshinImpact.GameTask.AutoSkip`、`BetterGenshinImpact.GameTask.Common.BgiVision`、`Microsoft.Extensions.Logging`、`System`、`System.Threading`、`System.Threading.Tasks`、`BetterGenshinImpact.Core.Simulator`、`BetterGenshinImpact.GameTask.Common.Element.Assets` 和 `Vanara.PInvoke`。

新增了 `GoToCraftingBenchTask` 类,并定义了其命名空间 `BetterGenshinImpact.GameTask.Common.Job`。在 `GoToCraftingBenchTask` 类中,定义了 `Name` 属性,表示任务名称。定义了 `_retryTimes` 字段,表示重试次数。定义了 `_chooseTalkOptionTask` 字段,用于选择对话选项。新增了 `Start` 方法,接受 `country` 和 `CancellationToken` 参数,表示任务的开始。在 `Start` 方法中,添加了重试机制,调用 `DoOnce` 方法执行任务,并在异常情况下进行重试。新增了 `DoOnce` 方法,接受 `country` 和 `CancellationToken` 参数,表示单次任务的执行。在 `DoOnce` 方法中,定义了前往合成台、交互、等待合成界面、判断浓缩树脂是否存在等步骤。新增了 `GoToCraftingBench` 方法,接受 `country` 和 `CancellationToken` 参数,表示前往合成台的操作。在 `GoToCraftingBench` 方法中,使用 `PathingTask` 和 `PathExecutor` 执行路径任务。
2024-11-12 23:42:56 +08:00
辉鸭蛋 3c2739c5c5 add GoToAdventurersGuildTask
优化项目结构并新增任务和路径文件

主要更改:
- 在 `BetterGenshinImpact.csproj` 文件中,添加了对 `GameTask\Common\Element\Assets\Json\**` 目录的处理,并确保其内容始终复制到输出目录。
- 在 `RecognitionObject.cs` 文件中,新增了多个静态方法 `Ocr` 和一个静态实例 `OcrThis`。
- 在 `PathExecutor.cs` 文件中,优化了路径执行逻辑,新增 `GetPosition` 方法,并调整了超时判断。
- 在 `AutoPickAssets.cs` 文件中,添加了多个 `using` 语句,新增 `_logger` 和 `PickRo` 字段,并在构造函数中添加了自定义拾取按键的处理逻辑。
- 在 `AutoPickTrigger.cs` 文件中,移除了自定义拾取按键的初始化逻辑。
- 在 `OneKeyExpeditionTask.cs` 文件中,注释掉了 `Cv2.ImWrite` 方法的调用。
- 在 `TpTask.cs` 文件中,添加了点位很近时不切换的判断逻辑。
- 在 `BvSimpleOperation.cs` 文件中,新增了多个点击按钮的方法和 `FindF`、`FindFAndPress` 方法。
- 在 `BvStatus.cs` 文件中,新增了多个方法用于判断是否在对话界面并等待对话界面加载完成。
- 在 `GameTaskManager.cs` 文件中,添加了 `MapAssets.DestroyInstance` 方法的调用。
- 在 `HotKeyPageViewModel.cs` 文件中,注释掉了 `ElementalCollectHandler` 的测试代码,并添加了 `GoToAdventurersGuildTask` 的测试代码。
- 在 `TaskSettingsPageViewModel.cs` 文件中,更新了 `OnGoToAutoGeniusInvokationUrlAsync` 方法中的 URL。
- 添加了 `BetterGenshinImpact - Backup.csproj` 文件,配置了项目属性、资源文件和包引用。
- 添加了 `冒险家协会_枫丹.json`、`合成台_枫丹.json` 和 `合成台_璃月.json` 文件,定义了前往相应地点的路径和动作。
- 添加了 `ChooseTalkOptionTask.cs` 文件,实现了选择对话选项的任务。
- 添加了 `GoToAdventurersGuildTask.cs` 文件,实现了前往冒险家协会领取奖励的任务。
2024-11-10 22:49:55 +08:00
辉鸭蛋 648dfd3f41 ensure that the 'settings' object passed into JS is not empty 2024-11-10 13:22:56 +08:00
辉鸭蛋 ef20a5448b fixed the issue where the pathing cannot be used properly when the resolution is below 1920x1080 2024-11-10 13:13:10 +08:00
辉鸭蛋 23973bb679 auto task opt 2024-11-10 12:28:53 +08:00
辉鸭蛋 ebc2b7b42e edit fight end judge 2 2024-11-10 01:24:35 +08:00
辉鸭蛋 8d2ee35b7c edit fight end judge 2024-11-10 01:20:45 +08:00
辉鸭蛋 68d3061523 switch party: shorten the time for Hutao 2024-11-10 01:02:31 +08:00
辉鸭蛋 435d04b52d pathing: add more settings 2024-11-10 00:51:47 +08:00
辉鸭蛋 244ce1c27f pathing: add exception handling for entering conversations 2024-11-10 00:02:18 +08:00
辉鸭蛋 adcd08421a fix: incorrect host judgment methods #777 2024-11-09 17:49:42 +08:00
辉鸭蛋 19c7b10b01 fix repo update 2024-11-09 17:37:46 +08:00
辉鸭蛋 fe1d67bf16 add tool tip for js page 2024-11-09 09:42:50 +08:00
辉鸭蛋 9c7651702a add auto BlessingOfTheWelkinMoonTask 2024-11-09 00:38:57 +08:00
辉鸭蛋 b0b3768ee7 https://github.com/babalae/bettergi-scripts-list/pull/15 2024-11-08 23:17:02 +08:00
辉鸭蛋 462741d3fb 0.36.1 2024-11-05 22:50:58 +08:00
辉鸭蛋 32bec1656b default pathing condition config 2024-11-05 22:50:34 +08:00
辉鸭蛋 003939bb94 js: fix no path pathing task
更新 PathingConditionConfig 和 PathingTask 方法以支持空值

将 PathingConditionConfig 类中的 FilterPartyName 方法的 materialName 参数类型从 string 改为 string?,以允许传入空值。增加了对 materialName 是否为空的检查,只有在 materialName 不为空时才进行条件匹配。将 PathingTask 类中的 GetMaterialName 方法的返回类型从 string 改为 string?,以允许返回空值。增加了对 FullPath 是否为空的检查,如果为空则返回 null。
2024-11-05 22:26:41 +08:00
辉鸭蛋 9c9bd7d138 js: extend click time
修改了 `GlobalMethod` 类中的 `Click` 方法,现在调用 `LeftButtonClick` 方法而不是 `Simulation.SendInput.Mouse.LeftButtonClick`。
修改了 `GlobalMethod` 类中的 `LeftButtonClick` 方法,现在使用 `Simulation.SendInput.Mouse.LeftButtonDown().Sleep(60).LeftButtonUp()` 代替 `Simulation.SendInput.Mouse.LeftButtonClick`。
修改了 `GlobalMethod` 类中的 `RightButtonClick` 方法,现在使用 `Simulation.SendInput.Mouse.RightButtonDown().Sleep(60).RightButtonUp()` 代替 `Simulation.SendInput.Mouse.RightButtonClick`。
2024-11-05 22:00:16 +08:00
辉鸭蛋 5b054bf31b 0.36.0 2024-11-04 21:33:07 +08:00
ema a960f76920 feat: restore from another instance 2024-11-04 03:45:08 +08:00
辉鸭蛋 00447d3e78 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2024-11-03 22:30:24 +08:00
辉鸭蛋 c5de098865 new doc url 2024-11-03 22:26:14 +08:00
辉鸭蛋 4ce7d02e75 Merge pull request #763 from FannieMC/main
增加对多人联机下进入尘歌壶的支持
2024-11-03 21:33:20 +08:00
Fannie MC c7827d0fa3 增加对多人联机下进入尘歌壶的支持 2024-11-03 21:10:08 +08:00
辉鸭蛋 7513e75f74 remove 'textRegion' from the log record The > character of Text `
修改了日志记录的代码,将 `textRegion.Text` 中的 `>` 字符去掉后再记录日志。
2024-11-03 20:54:07 +08:00
辉鸭蛋 0923b0802c auto tp opt 2024-11-03 20:21:25 +08:00
辉鸭蛋 2c9c78f933 edit ui style 2024-11-03 19:01:06 +08:00
辉鸭蛋 c1ef7c141f + drag drop 2024-11-03 00:04:54 +08:00
辉鸭蛋 a98934fc9a fix bug 2024-11-02 22:56:35 +08:00
辉鸭蛋 2b8f38b758 finsh pathing config 2024-11-02 21:03:58 +08:00
辉鸭蛋 2545581807 new pathing config 2024-11-02 19:49:38 +08:00
辉鸭蛋 e595b67d33 msg more info 2024-11-02 13:05:48 +08:00
辉鸭蛋 dcd7831368 auto fix win11 bitblt 2024-11-02 12:57:58 +08:00
辉鸭蛋 4725af5491 impl js run task 2024-11-01 21:37:44 +08:00
辉鸭蛋 a1cdf15c7e fix bug 2024-11-01 19:19:47 +08:00
辉鸭蛋 c461938ddd add elemental collect handler
在 `DefaultAutoFightConfig.cs` 中,将 `JsonSerializer.Deserialize` 替换为 `Newtonsoft.Json.JsonConvert.DeserializeObject` 来反序列化 `combat_avatar.json` 文件。

在 `ActionFactory.cs` 中,添加了 `BetterGenshinImpact.GameTask.AutoGeniusInvokation.Model` 的引用,并在 `ActionFactory` 类中添加了新的元素采集处理器(`hydro_collect`、`electro_collect`、`anemo_collect`)。

在 `HotKeyPageViewModel.cs` 中,添加了 `BetterGenshinImpact.GameTask.AutoGeniusInvokation.Model` 的引用,并修改了 `Test1Hotkey` 的处理逻辑,使用 `ElementalCollectHandler` 进行元素采集。

新增了 `ElementalCollectHandler.cs` 文件,定义了 `ElementalCollectHandler` 类,用于处理元素采集逻辑。该类根据元素类型筛选角色,并执行相应的攻击或技能操作。同时定义了 `ElementalCollectAvatar` 和 `ElementalCollectAvatarConfigs` 类,用于配置和管理不同元素类型的角色。
2024-11-01 01:47:10 +08:00
辉鸭蛋 3d6546b528 time consuming of calculation script 2024-11-01 00:07:11 +08:00
辉鸭蛋 b0d4068eb2 pathing opt 2024-10-31 23:10:11 +08:00
辉鸭蛋 b0d8e1a274 add condition settings 2024-10-31 23:06:40 +08:00
辉鸭蛋 a39aefb44c retry when TpPointNotActivate 2024-10-31 12:36:21 +08:00
辉鸭蛋 adf824519b waiting for map movement to complete 2024-10-31 12:25:55 +08:00
辉鸭蛋 4cb5442161 add switch party task
在 `BetterGenshinImpact.csproj` 文件中,添加了两个新文件夹路径 `GameTask\OneDragon\` 和 `User\AutoPathing\`。

在 `BvStatus.cs` 文件中:
- 将 `WaitForMainUi` 方法的默认重试次数从 25 次减少到 10 次。
- 添加了 `IsInPartyViewUi` 和 `WaitForPartyViewUi` 方法。

在 `ElementAssets.cs` 文件中:
- 添加并初始化了 `PartyBtnChooseView` 和 `PartyBtnDelete` 两个新的识别对象。

在 `NewRetry.cs` 文件中:
- 添加了 `using System.Threading.Tasks;` 引用。
- 添加了 `WaitForAction` 方法。

在 `Region.cs` 文件中,添加了一个新的 `ClickTo` 方法,该方法接受 `double` 类型的参数。

在 `ReturnMainUiTask.cs` 文件中:
- 删除了旧的 `ReturnMainUiTask` 类。
- 添加了新的 `ReturnMainUiTask` 类,内容与旧的类似,但文件路径和命名空间有所变化。

在 `RunnerContext.cs` 文件中,移除了 `using BetterGenshinImpact.GameTask.OneDragon;` 引用,添加了 `using BetterGenshinImpact.GameTask.Common.Job;` 引用。

在 `HotKeyPageViewModel.cs` 文件中:
- 添加了多个 `using` 引用,包括 `using System.Threading.Tasks;` 和 `using BetterGenshinImpact.GameTask.Common.Job;`。
- 修改了多个方法的代码格式,使其更加简洁。
- 添加了多个新的快捷键设置。

添加了两个新的 PNG 图片文件 `party_btn_choose_view.png` 和 `party_btn_delete.png`。

在 `SwitchPartyTask.cs` 文件中,添加了新的 `SwitchPartyTask` 类,用于切换队伍。
2024-10-29 01:41:43 +08:00
辉鸭蛋 b74e09ac8b add continuous execution & add pathing ui right menu & real time updates of script repository
更新了 `BetterGenshinImpact.csproj` 文件中的 `WPF-UI.Violeta` 包版本,从 `3.0.5.21` 升级到 `3.0.5.23`。
在 `RepoWebBridge.cs` 文件中,注释掉了检查本地 `repo.json` 文件是否存在的代码,并直接调用 `ScriptRepoUpdater.Instance.UpdateCenterRepo()` 方法更新仓库。更新后的异常信息也进行了修改。
在 `MapPathingPage.xaml` 文件中,删除了 `ui:TreeListView` 控件的 `behavior:RightClickSelectBehavior.Enabled` 属性。
在 `ScriptControlPage.xaml` 文件中,添加了一个新的 `RowDefinition`,并在 `Grid` 中添加了一个新的 `ui:Button`,用于执行连续脚本组的命令。
在 `ScriptControlViewModel.cs` 文件中,添加了 `System.Windows.Media` 的引用。
在 `ScriptControlViewModel.cs` 文件中,添加了一个新的异步方法 `OnStartMultiScriptGroupAsync`,用于显示一个包含全选按钮和配置组复选框的对话框,并执行选中的脚本组。
2024-10-28 00:25:14 +08:00
辉鸭蛋 dd9433f565 update pathing ui 2024-10-27 23:47:26 +08:00
辉鸭蛋 a802ffa0e5 tp.json supplement 2024-10-27 23:05:15 +08:00
辉鸭蛋 fe12b59b5c Pathing has been stuck 3 times. Try the route again or abandon it!
将 `_retryTimes` 字段改为常量 `RetryTimes`,并将其值设为 2。添加了新的字段 `_inTrap`,用于记录陷入困境的次数。在 `Pathing` 方法中,将 `for` 循环中的 `_retryTimes` 替换为 `RetryTimes`。在路径执行过程中,增加了对陷入困境的检测逻辑。如果在 8 个位置内的移动距离小于 3,则认为可能陷入困境,并增加 `_inTrap` 计数器。如果 `_inTrap` 超过 2 次,则抛出 `RetryException` 异常,提示路线出现 3 次卡死,重试或放弃此路线。检测到疑似卡死时,记录警告日志,并调用 `TrapEscaper` 的方法尝试脱困。
2024-10-27 22:24:14 +08:00
辉鸭蛋 5f40e28332 修复后台自动剧情启用的情况下,自动领取探索奖励失效的问题 2024-10-27 22:18:32 +08:00
辉鸭蛋 44190a522b team identification support online
修复错误信息,改进联机状态处理

更新了 `BetterGenshinImpact.csproj` 文件中的程序集版本号,从 `0.35.2` 更新为 `0.35.4`。

修正了 `ScriptProject.cs` 文件中抛出 `FileNotFoundException` 异常时的错误信息,将 "manifest.json文件存在" 改为 "manifest.json文件不存在"。

在 `AutoFightAssets.cs` 文件中:
- 为 `AvatarSideIconRectList` 和 `AvatarIndexRectList` 添加了注释,解释其在非联机状态下的用途。
- 添加了多个新的属性和注释,用于处理联机状态下的角色头像和对应的白色块位置。
- 初始化了 `OnePRa` 和 `PRa` 两个识别对象,用于识别联机状态下的1P和P图标。

在 `Avatar.cs` 文件中:
- 修改了角色切换逻辑,使用 `CombatScenes.ExpectedTeamAvatarNum` 替代硬编码的数字。
- 在 `TrySwitch` 方法中添加了 `needLog` 参数,并在切换成功时记录日志。
- 移除了部分注释代码,并在日志中保存了角色切换和索引区域的截图。
- 添加了 `System.Diagnostics` 的引用。

在 `CombatScenes.cs` 文件中:
- 将 `Avatars` 初始化为空数组。
- 添加了 `ExpectedTeamAvatarNum` 属性,默认值为4。
- 在 `InitializeTeam` 方法中添加了联机状态的判断和处理逻辑。
- 修改了队伍识别逻辑,使用动态数组替代固定长度的数组。
- 修改了 `CheckTeamInitialized` 方法,使用 `ExpectedTeamAvatarNum` 替代硬编码的数字。
- 修改了 `BuildAvatars` 方法,添加了对联机状态下角色编号位置信息的处理。
- 修改了 `SelectAvatar` 方法,使用 `GetValueOrDefault` 替代 `TryGetValue`。

在 `ScriptControlViewModel.cs` 文件中,设置 `WindowStartupLocation` 为 `WindowStartupLocation.CenterOwner`。

添加了 `1p.png` 和 `p.png` 两个新图像文件,用于识别联机状态下的1P和P图标。
2024-10-27 17:15:55 +08:00
辉鸭蛋 98d2664c28 auto pathing: use group config & fix bug 2024-10-27 00:51:10 +08:00
辉鸭蛋 94418cbe56 auto pathing: add retry 2024-10-26 23:37:55 +08:00
辉鸭蛋 72c2e38f94 add pathing settings for script group 2024-10-26 21:11:59 +08:00
辉鸭蛋 be5c8ad6e3 update logo 2024-10-26 21:08:09 +08:00
辉鸭蛋 255f328b67 update logo 2024-10-26 20:24:17 +08:00
辉鸭蛋 1dbb9e3bf1 auto pathing: optimize avatar switch 2024-10-26 14:46:38 +08:00
辉鸭蛋 df7b55e47c support recognition of semi transparent avatars 2024-10-26 14:45:53 +08:00
辉鸭蛋 ed77d955ef add AvatarClassifyTransparentGen 2024-10-26 01:47:41 +08:00
辉鸭蛋 e4e7b37fd2 the whole team is defeated
在 `PathExecutor.cs` 中,`RecoverWhenLowHp` 方法进行了修改:
- 使用 `using` 语句来捕获区域。
- 如果当前角色血量过低,调用新的 `TpStatueOfTheSeven` 方法进行传送和恢复。
- 增加了一个新的分支,如果检测到复苏提示,点击复苏并等待主界面加载完成,然后再调用 `TpStatueOfTheSeven` 方法。
- 新增了 `TpStatueOfTheSeven` 方法,用于处理传送到七天神像并恢复血量的逻辑。

在 `BvStatus.cs` 中:
- 增加了 `System.Threading.Tasks` 和 `System.Threading` 的引用。
- 在 `Bv` 类中新增了 `WaitForMainUi` 方法,用于等待主界面加载完成。
- 在 `Bv` 类中新增了 `ClickIfInReviveModal` 方法,用于检测并点击复苏提示。
2024-10-26 00:21:51 +08:00
辉鸭蛋 9f728fdf30 new banner 2024-10-26 00:20:50 +08:00
辉鸭蛋 7c96adb591 improve low hp detection and resurrection logic
改进低血量检测和复活逻辑

在 `BetterGenshinImpact.csproj` 文件中,将 `<AssemblyVersion>` 从 `0.35.1` 更新为 `0.35.2`。

在 `AutoDomainTask.cs` 文件中:
- 添加了 `using BetterGenshinImpact.GameTask.Common.BgiVision;` 引用。
- 将 `IsLowHealth` 方法替换为 `Bv.CurrentAvatarIsLowHp(CaptureToRectArea())` 方法。
- 在 `catch` 语句中添加了异常日志记录 `Logger.LogDebug(e, "红血自动吃药检测时发生异常")`。
- 删除了 `IsLowHealth` 方法的实现。

在 `Avatar.cs` 文件中:
- 修改了 `using` 引用,添加了 `BetterGenshinImpact.Core.Recognition`。
- 在 `ThrowWhenDefeated` 方法中,将 `region.Find(AutoFightContext.Instance.FightAssets.ConfirmRa)` 替换为 `Bv.IsInRevivePrompt(region)` 方法,并添加了复活逻辑。

在 `PathExecutor.cs` 文件中:
- 在 `foreach` 循环中添加了 `await RecoverWhenLowHp();` 方法调用。
- 添加了 `RecoverWhenLowHp` 方法,用于检测并处理低血量恢复。

在 `TpTask.cs` 文件中:
- 添加了 `ReviveStatueOfTheSevenPointX` 和 `ReviveStatueOfTheSevenPointY` 静态变量,用于复活点的坐标。

在 `BvStatus.cs` 文件中:
- 添加了多个 `using` 引用。
- 在 `Bv` 类中添加了 `IsInRevivePrompt` 和 `CurrentAvatarIsLowHp` 方法,用于检测复苏提示和当前角色是否低血量。
2024-10-25 23:49:07 +08:00
辉鸭蛋 14a1d3be74 auto pathing: add settings ui 2024-10-25 01:17:00 +08:00
辉鸭蛋 94aae80046 auto pathing: optimize switch avatar
删除 `BetterGenshinImpact.csproj` 中的无用文件夹包含项。
将 `PathingConfig.cs` 中部分属性类型从 `int` 改为 `string`,并调整默认值。
在 `ScriptRepoUpdater.cs` 中用 `MessageBox` 替换 `ContentDialog`。
简化 `ElementalSkillHandler.cs` 和 `NormalAttackHandler.cs` 中的代码。
删除 `NahidaCollectHandler.cs` 中的切换角色代码。
在 `PathingTask.cs` 中添加 `HasAction` 方法。
在 `PathExecutor.cs` 中添加 `_actionAvatarIndexMap` 字典和多个新方法。
新增 `ReturnMainUiTask.cs` 任务类。
2024-10-24 23:05:52 +08:00
辉鸭蛋 404e7215fa add icon for pathing ui 2024-10-24 00:48:58 +08:00
辉鸭蛋 b3f6002846 add pathing config 2024-10-22 01:21:11 +08:00
辉鸭蛋 960cfea102 fix script repo web
重构:移出 localRepoJsonPath 赋值和 null 检查逻辑

将 localRepoJsonPath 的赋值和 null 检查逻辑移出 if (needUpdate) 代码块,以确保无论 needUpdate 的值如何,这段逻辑都会被执行。
2024-10-22 00:36:26 +08:00
辉鸭蛋 7cc4093079 refresh the ui after subscribing to the script
重构了多个类中的方法为异步方法,并增加了消息注册逻辑:
- `ScriptRepoUpdater.cs`:增加了检查并创建 `ReposPath` 目录的逻辑。
- `RepoWebBridge.cs`:引用新命名空间,重构 `GetRepoJson` 和 `ImportUri` 方法为异步方法,增加了检查和更新本地仓库的逻辑。
- `JsListViewModel.cs` 和 `MapPathingViewModel.cs`:引用新命名空间,增加消息注册逻辑,修正方法中的引用。
- `PathingTask.cs`:修正了日志记录中 `FileName` 的引用。
- `TaskSettingsPage.xaml`:更新了文本内容,增加了关于装备「王树瑞佑」的说明。
- 新增 `RefreshDataMessage.cs` 文件,定义了 `RefreshDataMessage` 类。
2024-10-21 01:32:36 +08:00
辉鸭蛋 d23ba65d51 fix #732 2024-10-20 20:38:38 +08:00
辉鸭蛋 6b41b52008 warning when script version number is too high
更新程序集版本号并添加版本号比较逻辑

更新了 `BetterGenshinImpact.csproj` 文件中的程序集版本号,从 `0.35.0` 更新到 `0.35.1`。

在 `Manifest.cs` 文件中,增加了对 `BetterGenshinImpact.GameTask.Common` 和 `Microsoft.Extensions.Logging` 的引用,并在 `Manifest` 类中增加了版本号比较的逻辑,如果脚本要求的版本号大于当前版本号,则记录错误日志。

在 `ScriptProject` 类的构造函数中,增加了对脚本文件夹是否存在的检查,如果不存在则抛出 `DirectoryNotFoundException` 异常。

在 `PathingTask.cs` 文件中,增加了对 `BetterGenshinImpact.Core.Config`、`BetterGenshinImpact.GameTask.Common` 和 `Microsoft.Extensions.Logging` 的引用,并在 `PathingTask` 类中增加了版本号比较的逻辑,如果路径追踪任务要求的版本号大于当前版本号,则记录错误日志。
2024-10-20 15:47:03 +08:00
辉鸭蛋 3cbbbff093 add UpDownGrabLeaf action 2024-10-20 11:20:25 +08:00
辉鸭蛋 81b754125a update ui 2024-10-20 10:51:41 +08:00
辉鸭蛋 29544507eb one dragon: fill
添加 OneDragon 相关 ViewModel 和页面,删除旧配置

在 `App.xaml.cs` 中添加了 `using BetterGenshinImpact.ViewModel.Pages.OneDragon` 语句,并在 `App` 类中添加了一系列 `OneDragon` 相关的 ViewModel 到服务集合中。
在 `OneDragonTaskItem.cs` 中调整了 `using` 语句的顺序,初始化了一些属性的默认值,并添加了两个构造函数。
删除了 `LoginConfigPage.xaml`、`LoginConfigPage.xaml.cs`、`MailConfigPage.xaml`、`MailConfigPage.xaml.cs`、`LoginConfigViewModel.cs` 和 `MailConfigViewModel.cs` 文件的内容。
在 `OneDragonFlowPage.xaml` 中更新了 `oneDragonView` 的命名空间,并添加了多个 `DataTemplate` 以支持新的 ViewModel。
在 `OneDragonFlowViewModel.cs` 中调整了 `using` 语句的顺序,并更新了 `_taskList` 的初始化内容。
添加了多个新的 ViewModel 文件,包括 `CraftViewModel.cs`、`DailyCommissionViewModel.cs`、`DailyRewardViewModel.cs`、`DomainViewModel.cs`、`ForgingViewModel.cs`、`LeyLineBlossomViewModel.cs`、`MailViewModel.cs`、`OneDragonBaseViewModel.cs`、`SereniteaPotViewModel.cs` 和 `TcgViewModel.cs`。
添加了多个新的页面文件,包括 `CraftPage.xaml`、`CraftPage.xaml.cs`、`DailyCommissionPage.xaml`、`DailyCommissionPage.xaml.cs`、`DailyRewardPage.xaml`、`DailyRewardPage.xaml.cs`、`DomainPage.xaml`、`DomainPage.xaml.cs`、`ForgingPage.xaml`、`ForgingPage.xaml.cs`、`LeyLineBlossomPage.xaml`、`LeyLineBlossomPage.xaml.cs`、`MailPage.xaml`、`MailPage.xaml.cs`、`SereniteaPotPage.xaml`、`SereniteaPotPage.xaml.cs` 和 `TcgPage.xaml`、`TcgPage.xaml.cs`。
2024-10-19 19:29:44 +08:00
辉鸭蛋 8471d5ef88 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2024-10-19 17:43:07 +08:00
辉鸭蛋 a4bc632ae7 ui test
新增任务类属性和配置页面,优化日志记录

在 `BetterGenshinImpact.csproj` 文件中,添加了两个新文件夹路径 `GameTask\OneDragon\` 和 `User\AutoPathing\`。

在多个任务类文件中(如 `AutoDomainTask.cs`、`AutoFightTask.cs`、`AutoGeniusInvokationTask.cs`、`AutoMusicGameTask.cs`、`AutoWoodTask.cs`),新增了 `Name` 属性。

在 `PickAroundHandler.cs` 文件中,优化了 `RunAsync` 方法的日志记录,并添加了超时检查。

在 `ISoloTask.cs` 文件中,新增了 `Name` 属性和 `Start` 方法的接口定义。

在 `OneDragonTaskItem.cs` 文件中,新增了 `ViewModel` 属性。

在 `OneDragonFlowPage.xaml` 文件中,右侧配置部分从 `StackPanel` 改为 `ContentControl`,并添加了 `DataTemplate` 以支持不同任务类型的配置页面。

在 `IViewModel.cs` 文件中,将 `IViewModel` 接口的访问修饰符从 `internal` 改为 `public`。

在 `OneDragonFlowViewModel.cs` 文件中,初始化了任务项的 `ViewModel` 属性。

在 `ScriptControlViewModel.cs` 文件中,移除了构造函数的 `HomePageViewModel` 参数。

新增了 `LoginConfigViewModel.cs` 和 `MailConfigViewModel.cs` 文件,定义了相应的 ViewModel 类。

新增了 `LoginConfigPage.xaml` 和 `MailConfigPage.xaml` 文件,定义了相应的 XAML 布局及其交互逻辑。
2024-10-19 17:42:58 +08:00
DismissedLight 1f2d3a40d9 Add HutaoInterop Pipe 2024-10-19 15:20:58 +08:00
辉鸭蛋 3a88da3c6e code cleanup 2024-10-19 14:34:30 +08:00
辉鸭蛋 790d42cee0 Merge pull request #726 from babalae/feat-cts
refactor: CancellationTokenSource -> CancellationToken
2024-10-19 13:10:38 +08:00
辉鸭蛋 c9f541362d Merge branch 'main' into feat-cts 2024-10-19 13:09:44 +08:00
辉鸭蛋 efd2808a2e Merge pull request #721 from jbcaaa/main_testing
添加PickAround实现(浅测试)
2024-10-19 13:08:43 +08:00
辉鸭蛋 11ec9bc45d refactor: CancellationTokenSource -> CancellationToken 2024-10-19 01:50:21 +08:00
jbcaaa 74645e8e93 修正错误 2024-10-18 22:43:20 +08:00
辉鸭蛋 af7209af48 dispather ui : fix the issue of multi-level directories not being displayed
在 `TpTask.cs` 文件中:
- 修改了异常处理的日志记录逻辑。
- 修复了一个多余的 `}`。

在 `ScriptControlViewModel.cs` 文件中:
- 添加了新的 `using` 语句。
- 修改了 `OnAddPathing` 方法,替换了 `LoadAllPathingScripts` 方法。
- 重构了 `CreatePathingScriptSelectionPanel` 方法,修改了参数类型。
- 添加了 `AddNodesToPanel` 方法,用于递归添加节点。
- 修改了 `SetChildCheckBoxesState` 方法,增加了对嵌套 `StackPanel` 的处理。
- 修改了 `AddSelectedPathingScripts` 方法,调整了 `FileInfo` 的创建方式。
- 添加了对 `item.Project` 的空值检查。
- 添加了 `item.Project.LoadSettingUi` 方法的调用。
- 添加了 `oldItem.Projects.CollectionChanged` 事件的取消订阅。
2024-10-18 21:52:11 +08:00
jbcaaa 7df31c66d2 缩小旋转角度转大圈 2024-10-18 21:31:40 +08:00
jbcaaa 0bb45c8390 Merge branch 'babalae:main' into main_testing 2024-10-18 21:24:22 +08:00
辉鸭蛋 07e682d488 auto pathing: code clean & opt 2024-10-18 20:59:58 +08:00
辉鸭蛋 a1508a7b05 Merge pull request #711 from jbcaaa/main
Support using both key-mouse-record and auto-pathing in js scripts
2024-10-18 20:14:12 +08:00
辉鸭蛋 57989fd8b9 update ui 2024-10-18 19:57:39 +08:00
jbcaaa c4031069c6 Merge branch 'babalae:main' into main_testing 2024-10-18 18:46:56 +08:00
jbcaaa ecaab5dc76 添加PickAround实现(未测试) 2024-10-18 17:57:13 +08:00
jbcaaa a220dd2377 修正某些默认方法的使用问题 2024-10-18 15:19:40 +08:00
jbcaaa e1149bc254 分离行走逻辑和避障逻辑 2024-10-18 14:45:23 +08:00
jbcaaa 6a53efce1e 增加注释,辅助理解 2024-10-18 10:51:19 +08:00
jbcaaa a67adc0070 修复许多问题,增加小脱困 2024-10-18 08:24:58 +08:00
jbcaaa 03f6b6331f 设置为非攀爬时进入攀爬,自动脱离 2024-10-18 07:41:43 +08:00
jbcaaa ee720f8dfd try again 2024-10-18 07:06:06 +08:00
jbcaaa b152486327 统一脱困跳跃方法 2024-10-18 06:57:57 +08:00
jbcaaa 70f1f69067 回退一个数值更改 2024-10-18 06:44:27 +08:00
jbcaaa f56465ebf3 fixed the problem causes autopathing cannot run correctly. 2024-10-18 06:41:24 +08:00
jbcaaa 3b8b1ef9db Update PathExecutor.cs 2024-10-18 00:48:57 +08:00
jbcaaa a4bb2eeca2 changed some value 2024-10-18 00:23:26 +08:00
jbcaaa f222431784 [testing] madly modified move actions in autopathing 2024-10-17 21:15:58 +08:00
辉鸭蛋 7c5958f8ad Update README.md 2024-10-17 21:01:05 +08:00
jbcaaa 561f1b8b72 Support using both key-mouse-record and auto-pathing in js scripts 2024-10-17 16:04:27 +08:00
辉鸭蛋 9ad1062020 update one-stop service ui 2024-10-17 03:25:25 +08:00
辉鸭蛋 2ed7a883b3 One-stop service init 2024-10-17 02:48:21 +08:00
辉鸭蛋 4859c4dc4a add log & pathing opt 2024-10-16 01:31:44 +08:00
辉鸭蛋 03f25ebcfb revert #697 2024-10-16 01:06:22 +08:00
辉鸭蛋 0580ec68e9 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2024-10-16 01:03:44 +08:00
辉鸭蛋 b4e6565443 normal attack & elemental_skill 2024-10-16 00:54:56 +08:00
辉鸭蛋 e74d6b6bd4 Merge pull request #697 from ccccccggggg/main
加入四个战斗脚本
2024-10-15 06:11:38 +08:00
鹤望兰 b8c9dc971f Add files via upload 2024-10-15 01:59:36 +08:00
辉鸭蛋 b51200c1f3 fix pick 声望 2024-10-14 23:47:39 +08:00
鹤望兰 943bd4fc4d Add files via upload 2024-10-14 21:58:11 +08:00
辉鸭蛋 3d2b1b376e 0.35.0 2024-10-14 00:24:11 +08:00
辉鸭蛋 73cd48f8b1 fix nahida collect 2024-10-13 23:49:04 +08:00
NextKale d17a29890f Merge branch 'main' of github.com:atiasn/better-genshin-impact 2024-08-16 08:01:16 +08:00
NextKale af86c1147c Merge branch 'main' of github.com:atiasn/better-genshin-impact 2024-07-13 15:37:15 +08:00
NextKale 1c5fe7ec64 wood 2024-06-19 08:57:35 +08:00
1016 changed files with 65776 additions and 46331 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
---
name: Bug report / 错误报告
about: Create a report to help us improve / 创建报告以帮助我们改进
title: "[bug] "
title: "[bug]请补充标题内容"
labels: bug
---
+3 -3
View File
@@ -1,3 +1,3 @@
[submodule "BetterGenshinImpact/Script"]
path = BetterGenshinImpact/Script
url = https://github.com/babalae/bettergi-scripts.git
[submodule "Test/BetterGenshinImpact.UnitTest/Assets"]
path = Test/BetterGenshinImpact.UnitTest/Assets
url = https://github.com/huiyadanli/BetterGI.UnitTest.Assets.git
@@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
</PropertyGroup>
<ItemGroup>
<None Remove="NativeMethods.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
@@ -1,10 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/CsWin32/main/src/Microsoft.Windows.CsWin32/settings.schema.json",
"allowMarshaling": true,
"useSafeHandles": false,
"emitSingleFile": true,
"public": true,
"comInterop": {
"useIntPtrForComOutPointers": true
}
}
@@ -1,38 +0,0 @@
// D3D11
CreateDirect3D11DeviceFromDXGIDevice
CreateDirect3D11SurfaceFromDXGISurface
// GDI32
BitBlt
CreateCompatibleBitmap
CreateCompatibleDC
DeleteDC
GetDeviceCaps
SelectObject
// User32
GetClientRect
GetDC
GetForegroundWindow
GetSystemMetrics
GetWindowDC
GetWindowRect
GetWindowThreadProcessId
mouse_event
PostMessage
ReleaseDC
EnumWindows
GetWindowText
IsWindowVisible
GetWindowTextLength
// COM & WinRT
D3D11CreateDevice
ID3D11Device3
IDirect3DDxgiInterfaceAccess
// Constants
D3D11_SDK_VERSION
DXGI_ERROR_UNSUPPORTED
WM_LBUTTONDOWN
WM_LBUTTONUP
+21 -71
View File
@@ -5,28 +5,18 @@ VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact", "BetterGenshinImpact\BetterGenshinImpact.csproj", "{75EC89E2-413D-4725-BCEA-AFAC57708F07}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture", "Vision.WindowCapture\Vision.WindowCapture.csproj", "{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Win32", "BetterGenshinImpact.Win32\BetterGenshinImpact.Win32.csproj", "{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.GameCapture", "Fischless.GameCapture\Fischless.GameCapture.csproj", "{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture.Test", "Vision.WindowCapture.Test\Vision.WindowCapture.Test.csproj", "{D35CB953-C666-4E57-9A9A-3AAE5BF78402}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.HotkeyCapture", "Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj", "{08152E44-2564-46C5-B5B2-54DD43C01A79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.KeyboardCapture", "Fischless.KeyboardCapture\Fischless.KeyboardCapture.csproj", "{10A48327-7E58-4B51-B1FC-55506C703C8F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deploy", "Deploy", "{458E1106-43A4-47E6-B11B-D243035D4C76}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup", "Build\MicaSetup\MicaSetup.csproj", "{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup.Uninst", "Build\MicaSetup\MicaSetup.Uninst.csproj", "{673344BC-B860-44AE-AD88-D33465BDE25B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "Test\BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.WindowsInput", "Fischless.WindowsInput\Fischless.WindowsInput.csproj", "{9D00BC7A-9280-4AC9-8951-4502EDB71B76}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterGenshinImpact.UnitTest", "Test\BetterGenshinImpact.UnitTest\BetterGenshinImpact.UnitTest.csproj", "{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -43,22 +33,6 @@ Global
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|Any CPU.Build.0 = Release|x64
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.ActiveCfg = Release|x64
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.Build.0 = Release|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.ActiveCfg = Debug|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.Build.0 = Debug|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.ActiveCfg = Debug|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.Build.0 = Debug|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.ActiveCfg = Release|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.Build.0 = Release|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.ActiveCfg = Release|x64
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.Build.0 = Release|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.ActiveCfg = Debug|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.Build.0 = Debug|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.ActiveCfg = Debug|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.Build.0 = Debug|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.ActiveCfg = Release|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.Build.0 = Release|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.ActiveCfg = Release|x64
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.Build.0 = Release|x64
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.ActiveCfg = Debug|x64
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.Build.0 = Debug|x64
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|x64.ActiveCfg = Debug|x64
@@ -67,14 +41,6 @@ Global
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|Any CPU.Build.0 = Release|x64
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.ActiveCfg = Release|x64
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.Build.0 = Release|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.ActiveCfg = Debug|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.Build.0 = Debug|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.ActiveCfg = Debug|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.Build.0 = Debug|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.ActiveCfg = Release|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.Build.0 = Release|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.ActiveCfg = Release|x64
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.Build.0 = Release|x64
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.ActiveCfg = Debug|x64
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.Build.0 = Debug|x64
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|x64.ActiveCfg = Debug|x64
@@ -83,38 +49,14 @@ Global
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|Any CPU.Build.0 = Release|x64
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.ActiveCfg = Release|x64
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.Build.0 = Release|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.ActiveCfg = Debug|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.Build.0 = Debug|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.ActiveCfg = Debug|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.Build.0 = Debug|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.ActiveCfg = Release|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.Build.0 = Release|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.ActiveCfg = Release|x64
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.Build.0 = Release|x64
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.ActiveCfg = Debug|x64
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.Build.0 = Debug|x64
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.Build.0 = Release|Any CPU
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.ActiveCfg = Release|x64
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.Build.0 = Release|x64
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.ActiveCfg = Debug|x64
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.Build.0 = Debug|x64
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.Build.0 = Release|Any CPU
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.ActiveCfg = Release|x64
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.Build.0 = Release|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|Any CPU
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|x64
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|x64
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.ActiveCfg = Debug|x64
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.Build.0 = Debug|x64
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|x64.ActiveCfg = Debug|x64
@@ -123,13 +65,21 @@ Global
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|Any CPU.Build.0 = Release|x64
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.ActiveCfg = Release|x64
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.Build.0 = Release|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.ActiveCfg = Debug|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.Build.0 = Debug|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.ActiveCfg = Release|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.Build.0 = Release|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.ActiveCfg = Release|x64
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15} = {458E1106-43A4-47E6-B11B-D243035D4C76}
{673344BC-B860-44AE-AD88-D33465BDE25B} = {458E1106-43A4-47E6-B11B-D243035D4C76}
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {352D8B78-9DE3-4E58-985F-FADD22594DB4}
+2
View File
@@ -19,6 +19,8 @@
<bgivc:BooleanToEnableTextConverter x:Key="BooleanToEnableTextConverter" />
<bgivc:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<bgivc:NotNullConverter x:Key="NotNullConverter" />
<bgivc:EnumToKVPConverter x:Key="EnumToKVPConverter" />
<bgivc:CultureInfoNameToKVPConverter x:Key="CultureInfoNameToKVPConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>
+48 -18
View File
@@ -1,6 +1,13 @@
using BetterGenshinImpact.GameTask;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Helpers.Extensions;
using BetterGenshinImpact.Hutao;
using BetterGenshinImpact.Service;
using BetterGenshinImpact.Service.Interface;
using BetterGenshinImpact.Service.Notification;
@@ -9,18 +16,15 @@ using BetterGenshinImpact.View;
using BetterGenshinImpact.View.Pages;
using BetterGenshinImpact.ViewModel;
using BetterGenshinImpact.ViewModel.Pages;
using BetterGenshinImpact.ViewModel.Pages.View;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.RichTextBox.Abstraction;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using Wpf.Ui;
using Wpf.Ui.DependencyInjection;
using Wpf.Ui.Violeta.Controls;
namespace BetterGenshinImpact;
@@ -36,6 +40,7 @@ public partial class App : Application
.CheckIntegration()
.UseElevated()
.UseSingleInstance("BetterGI")
.ConfigureLogging(builder => { builder.ClearProviders(); })
.ConfigureServices(
(context, services) =>
{
@@ -52,23 +57,30 @@ public partial class App : Application
services.AddSingleton<IRichTextBox>(richTextBox);
var loggerConfiguration = new LoggerConfiguration()
.WriteTo.File(path: logFile, outputTemplate: "[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}", rollingInterval: RollingInterval.Day)
.WriteTo.File(logFile,
outputTemplate:
"[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}",
rollingInterval: RollingInterval.Day)
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Warning);
if (all.MaskWindowConfig.MaskEnabled)
{
loggerConfiguration.WriteTo.RichTextBox(richTextBox, LogEventLevel.Information, outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
loggerConfiguration.WriteTo.RichTextBox(richTextBox, LogEventLevel.Information,
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
}
Log.Logger = loggerConfiguration.CreateLogger();
services.AddLogging(c => c.AddSerilog());
services.AddLocalization();
services.AddNavigationViewPageProvider();
// App Host
services.AddHostedService<ApplicationHostService>();
// Page resolver service
services.AddSingleton<IPageService, PageService>();
services.AddSingleton<INavigationService, NavigationService>();
services.AddSingleton<IUpdateService, UpdateService>();
// Service containing navigation, same as INavigationWindow... but without window
services.AddSingleton<INavigationService, NavigationService>();
@@ -90,6 +102,21 @@ public partial class App : Application
services.AddView<KeyMouseRecordPage, KeyMouseRecordPageViewModel>();
services.AddView<JsListPage, JsListViewModel>();
services.AddView<MapPathingPage, MapPathingViewModel>();
services.AddView<OneDragonFlowPage, OneDragonFlowViewModel>();
services.AddSingleton<PathingConfigViewModel>();
// services.AddView<PathingConfigView, PathingConfigViewModel>();
services.AddView<KeyBindingsSettingsPage, KeyBindingsSettingsPageViewModel>();
// 一条龙 ViewModels
// services.AddSingleton<CraftViewModel>();
// services.AddSingleton<DailyCommissionViewModel>();
// services.AddSingleton<DailyRewardViewModel>();
// services.AddSingleton<DomainViewModel>();
// services.AddSingleton<ForgingViewModel>();
// services.AddSingleton<LeyLineBlossomViewModel>();
// services.AddSingleton<MailViewModel>();
// services.AddSingleton<SereniteaPotViewModel>();
// services.AddSingleton<TcgViewModel>();
// My Services
services.AddSingleton<TaskTriggerDispatcher>();
@@ -97,6 +124,7 @@ public partial class App : Application
services.AddHostedService(sp => sp.GetRequiredService<NotificationService>());
services.AddSingleton<NotifierManager>();
services.AddSingleton<IScriptService, ScriptService>();
services.AddSingleton<HutaoNamedPipe>();
// Configuration
//services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
@@ -161,6 +189,8 @@ public partial class App : Application
{
base.OnExit(e);
TempManager.CleanUp();
await _host.StopAsync();
_host.Dispose();
}
@@ -217,7 +247,7 @@ public partial class App : Application
}
//UI线程未捕获异常处理事件(UI主线程)
private static void AppDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
private static void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
try
{
@@ -250,16 +280,16 @@ public partial class App : Application
// Fallback.
System.Windows.Forms.MessageBox.Show(
$"""
程序异常:{e.Source}
--
{e.StackTrace}
--
{e.Message}
"""
程序异常:{e.Source}
--
{e.StackTrace}
--
{e.Message}
"""
);
}
// log
GetLogger<App>().LogDebug(e, "UnHandle Exception");
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,185 @@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
]
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
}
¡
£
§
ª
«
­
°
²
³
´
µ
·
º
»
¿
À
Á
Â
Ä
Å
Ç
È
É
Ê
Ë
Ì
Í
Î
Ï
Ò
Ó
Ô
Õ
Ö
Ú
Ü
Ý
ß
à
á
â
ã
ä
å
æ
ç
è
é
ê
ë
ì
í
î
ï
ñ
ò
ó
ô
õ
ö
ø
ù
ú
û
ü
ý
ą
Ć
ć
Č
č
Đ
đ
ę
ı
Ł
ł
ō
Œ
œ
Š
š
Ÿ
Ž
ž
ʒ
β
δ
ε
з
Ṡ
‘
€
™
@@ -1352,7 +1352,7 @@
"秘源机鞘",
"秘源真芯",
"稚嫩的尖齿",
"老练的尖齿",
"老练的坚齿",
"横行霸者的利齿",
"卫从的木哨",
"战士的铁哨",
@@ -4769,6 +4769,696 @@
"「一篇未完成的手稿」",
"杏仁",
"溪泉",
"《提瓦特世界史·第一部分》",
"《枫丹香水广告集》",
"《白猫神探》",
"《薰衣草之花》",
"「伊利萨」",
"「半熟蛋」",
"「合成台」",
"「咕噜噜」",
"「大椰子」",
"「小波」",
"「此地的伟大精神」",
"「毛发如夜的野兽」",
"「灵道刻印门」",
"「炫彩呆子」",
"「狂图捕手」",
"「绿松石」",
"「翡翠」",
"「西弗安雅」",
"「金盏花」",
"「队长」",
"「黑曜石碑的影像」",
"丁戈内克",
"万奎洛",
"万杰鲁",
"不耐烦的贼匪",
"不耐烦的部族成员",
"专注的「花羽会」战士",
"为伙伴们烹饪料理",
"乌丘",
"乌兰塔",
"乌图伦库",
"乌尔",
"乌米",
"乌苏坎",
"乌茨勒",
"互动点",
"亚格贝乌",
"亚瓦尔",
"亚蕾琪",
"代杜古",
"伊克娜",
"伊兹娜",
"伊卡力",
"伊卡尤",
"伊图提娅",
"伊妮",
"伊扎帕",
"伊法",
"伊波莱",
"伊泽",
"伊瓦伊",
"伊约芭",
"伊茨昆",
"伊莫莎",
"伊莱帕",
"伊蒂莉",
"伊蕾尔",
"伊蜜",
"伊西多尔",
"伊西姆",
"伊赫卡",
"众人写成的记录",
"低语",
"佩蕾·努伊",
"依扎娜",
"依稀可以辨认的布告",
"克伊奈",
"克拉莉希娅",
"克瓦斯尼科夫",
"克维库",
"兰卡亚",
"兰维达",
"兰萨提",
"兰齐塔",
"兴奋的「回声之子」战士",
"冰冷的身躯",
"冷静的「回声之子」战士",
"凯塔",
"凯安",
"出魂试炼之所的留言",
"切妮",
"列扎诺夫",
"利别科",
"利洛",
"加勒弗大汪",
"加塔力",
"加杰雷",
"加纳尔",
"努乌",
"努斯妲",
"勇敢的匿叶龙",
"勇猛的嵴锋龙",
"勒拉",
"匿叶龙",
"南娜",
"卡乌帕",
"卡乌胡",
"卡乌鲁",
"卡伦雅",
"卡克斯",
"卡克斯的行装",
"卡兹加",
"卡力弗",
"卡卡妈妈",
"卡嘉",
"卡图马",
"卡安",
"卡帕可",
"卡拉穆鲁",
"卡纳鲁亚",
"卡胡那",
"卡胡鲁",
"卡马克",
"卡马加",
"卡齐娜",
"受困的匿叶龙",
"受困的嵴锋龙",
"古塞尼科夫",
"古寻梦祭司的记录·其之一",
"古寻梦祭司的记录·其之三",
"古寻梦祭司的记录·其之二",
"古寻梦祭司的记录·其之四",
"古瑟雷德",
"古老的布告",
"古老的日记",
"古老的碑刻",
"古雷马",
"叶莱菲",
"吉恩布",
"向下看",
"呆呆的小嵴锋龙",
"呆呆的绵驮兽",
"呼噜克",
"哈卡乌",
"哈蒂丝",
"哈隆加",
"唤灵师的手记·其一",
"唤灵师的手记·其二",
"商队成员",
"嗜岩·兽境幼兽",
"嘉乌兰妮",
"因卡纳克",
"因娜",
"团雀01",
"团雀02",
"团雀03",
"困倦的绒翼龙",
"图尼娜",
"图帕克",
"图蒂坦",
"图蕾娅",
"图达玛",
"圣王的手记·其一",
"圣王的手记·其七",
"圣王的手记·其三",
"圣王的手记·其九",
"圣王的手记·其二",
"圣王的手记·其五",
"圣王的手记·其八",
"圣王的手记·其六",
"圣王的手记·其四",
"坎内克",
"埃文苏",
"基尼奇",
"基斯庇",
"基班古",
"基维拉",
"基耶霍",
"塔力帕",
"塔卢加",
"塔尔科",
"塔恩加",
"塔洛娜",
"塔穆因",
"塔莫蕾",
"塔诺",
"塞奇托",
"塞巴尔",
"夏安卡",
"夏拉帕",
"夏温",
"夏芙米娅",
"夏萝·努伊",
"多巴",
"夜猫子",
"夜神",
"夜魂之灵",
"大家伙?",
"大胆的调查员",
"夸恩因",
"夸恩因的日记",
"夸梅",
"奇卡",
"奇怪的匿叶龙",
"奇普",
"奇梅",
"奇玛",
"奇科娅",
"奇马利",
"奈赫西",
"奎兹",
"奎泰克",
"奎皮亚",
"奥伯龙",
"奥坎比",
"奥奇坎",
"奥奇坎的残躯",
"奥娅",
"奥尔科",
"奥希娜",
"奥杜力",
"奥科兰",
"奥罗卢柯",
"奥西",
"奥贡",
"好奇的调查员",
"妮乌",
"妮佩卡",
"妮赫佳",
"威严的低语",
"娅特兰",
"娜恩希",
"娜玛卡",
"子澄",
"字迹模糊的笔记",
"孟尼力克",
"安切塔",
"安萨鲁",
"安蒂妮",
"家长般的大嵴锋龙",
"容韦勒",
"对话群演",
"小孩的笔记",
"小家伙?",
"小小蜜虫",
"尤季娜",
"尤庇娅",
"尤考姆",
"尼南",
"尼尼",
"尼赞贝",
"山王",
"嵴锋龙",
"嵴锋龙DJ",
"嵴锋龙斗舞女1",
"嵴锋龙斗舞女2",
"嵴锋龙斗舞男1",
"嵴锋龙斗舞男2",
"巡山客的手记",
"工匠的笔记·其一",
"工匠的笔记·其二",
"巴亚吉达",
"巴克",
"巴加约",
"巴哈蒂",
"巴拉诺夫",
"巴茨",
"布基纳",
"布尔莎",
"布纳马",
"布鲁",
"希乌休",
"希亚赫",
"希伊亚",
"希巴拉克",
"希库埃鲁",
"希皮利",
"希诺宁",
"帕兰",
"帕加尔",
"帕卡·努伊",
"帕尼娅",
"帕恰",
"帕朗",
"帕莉西娅",
"帕贾丹",
"年轻的行商",
"年长的行商",
"幻写灵",
"幼光",
"幼小的匿叶龙",
"幼嵴锋龙",
"幼年的暝视龙",
"庇兰",
"库伊米",
"库基亚",
"库娅",
"库希马纳",
"库延",
"库拉霍",
"库斯可",
"库特比",
"库珀·努伊",
"库约尼",
"库纳克",
"库西",
"库阿勒",
"库马约",
"庞塞",
"废弃-奇玛",
"废弃-希乌休",
"废弃-曼扎那",
"废弃-森塔加",
"废弃-阿乌伊娅",
"废弃-马察特利",
"延古",
"延塔莎",
"延索",
"待物3带背包",
"待物3带背包 深肤色",
"德乌特",
"德乌特(灵)",
"忧愁的绒翼龙",
"怪物2带背包",
"怪物2带背包 深肤色",
"怪物带背包",
"怪物带背包 深肤色",
"怯生生的小匿叶龙",
"恩加韦",
"恩古迪",
"恩孔加",
"恩托提亚",
"恩琳",
"恰斯卡",
"悠然的「花羽会」战士",
"愤怒的贩龙者",
"懒懒的鳍游龙",
"戈利科夫",
"战场情报",
"扎安娅",
"托奥",
"托尔特克",
"托托",
"托扬娜",
"托泰克",
"托赞",
"托赫兰妮",
"拉坎阿",
"拉密萨纳",
"拉斯塔恩",
"拉曼",
"拉比娜",
"拉马奈",
"挑战起点",
"振尘",
"提佐科",
"提凯伊",
"提帕诺",
"提莉乌娅",
"搭建帐篷",
"摩亚瓦",
"放置「古名」",
"斯塔杜欣",
"斯普赫",
"无名工匠的笔记",
"无名旅人的笔记·其一",
"无名旅人的笔记·其三",
"无名旅人的笔记·其二",
"无名旅人的笔记·其五",
"无名旅人的笔记·其四",
"无名祭司的笔记",
"昆纳乌",
"晕倒的匿叶龙",
"晕倒的鳍游龙",
"普玛",
"普玛莉",
"暝视龙",
"暴躁的部族战士",
"更换衣服",
"曼尤雅",
"曼扎那",
"曼科",
"曼萨",
"最佳飞行成绩记录",
"朗戈",
"木箱",
"未完成的乐稿",
"朱南",
"机灵的小嵴锋龙",
"来自过去的声音",
"松伽塔",
"某人留下的铭记·其一",
"某人留下的铭记·其三",
"某人留下的铭记·其二",
"某人留下的铭记·其五",
"某人留下的铭记·其四",
"某人遗落的风镜",
"柯奇妲",
"柯娅",
"柯林伍德",
"柯梯米",
"树上的小嵴锋龙",
"栖木普",
"格罗贝尔",
"格茜妮",
"格里斯潘",
"桑哈杰",
"桑科约克",
"梅兹莉",
"梅内娅",
"梅莎",
"梅西娜",
"森塔加",
"森珀娅",
"樋口铁矢",
"欣赏景色",
"欧洛伦",
"欧莎薇",
"残破的石碑",
"比于什",
"比奇津",
"比赛公告板",
"比赛选手",
"毛球",
"水豚",
"汉佩克",
"汉扎",
"沃蕾",
"波卡",
"波吉吉",
"波奇奇",
"波尼尼",
"波蒂莉",
"波蒂薇",
"泽伊拉",
"洛娅",
"活泼的绵驮兽",
"活跃的小嵴锋龙",
"海兹尔",
"海岳",
"涅兰",
"涅提",
"游学者的笔记",
"潘帕",
"灵体真女儿",
"爱可",
"爱梅拉",
"爱维莉",
"爱菲拉",
"爱雅",
"特佐佐",
"特佩潘",
"特帕切",
"特帕尔",
"特拉佐莉",
"特拉佐莉(表演用克隆人)",
"特拉帕尔",
"特拉忒",
"特拉波",
"特拉科",
"特沃德罗斯",
"特波兹",
"特立尼达",
"特纳华",
"特蒂赫莉",
"特诺切",
"特阿墨",
"特阿尤",
"特马乔",
"狄雷",
"献上供物",
"玛亚薇",
"玛伊蕾",
"玛兹嘉",
"玛拉妮",
"玛薇卡",
"玻娜",
"琪丝佩",
"琪希可",
"瓦伊妲",
"瓦伊纳",
"瓦兰卡",
"瓦凯·努伊",
"瓦卡尔",
"瓦图妲",
"瓦尔米",
"瓦托娅",
"瓦斯卡尔",
"瓦曼",
"瓦蕾",
"瓦达娜",
"界碑上的刻文",
"疑惑的调查员",
"疲惫的暝视龙",
"白浜",
"皮尔钦",
"皮希加",
"皮萨克",
"看向仪式台",
"研究中心紧急机械操作手册",
"磨损的记录",
"秋纽奥",
"科优尔",
"科奥劳",
"科奴拉芙",
"科帕",
"科斯特利茨基",
"科潘",
"科科庞",
"科米娜",
"科约帕",
"科莫奎",
"秘源哨机",
"穆伊萨",
"穆基",
"穆尔科",
"穆托塔",
"穆纳伊",
"穆蒲",
"竖立在旁的木牌",
"等待…",
"米卢·努伊",
"米奎克",
"米特尔",
"米齐卡",
"索尔涅夫",
"索莉马娜",
"约洛特莉",
"练习钻地的小嵴锋龙",
"细心的匿叶龙",
"绒翼龙",
"绒翼龙幼龙",
"维兰德",
"维图索夫",
"维护记录·其一",
"维护记录·其三",
"维护记录·其二",
"维查玛",
"维莎",
"羊驼",
"群演1",
"老鼠",
"耶里门",
"胆小的绵驮兽",
"胡妮",
"胡里约",
"自称「山下」之物",
"艾库瓦",
"苏娅",
"苏玛克",
"若娜瓦",
"茜特菈莉",
"荆和",
"莉乌娅",
"莉洛娅",
"莉琉",
"莉瓦",
"莉莉尤",
"莎乌莎",
"莎娜",
"莎维娅",
"莎迪蕾",
"莫乌",
"菲欣妮",
"菲耶蒂娜",
"萨加图拉",
"萨卡乌",
"萨科巴",
"萨约尔",
"萨费伊",
"葵可",
"葵莉娅",
"蒂亚戈",
"蒂图",
"蒂尔妲",
"蒂索克",
"蓬普",
"薇尔恰",
"虚弱的声音",
"虚弱的大灵显化身",
"虚弱的绒翼龙",
"虚弱的膨膨兽",
"被困的匿叶龙",
"被困的嵴锋龙",
"被困的幼暝视龙",
"被救出的匿叶龙",
"被救的鳍游龙",
"装饰花车",
"西坎",
"西布",
"西帕克",
"西蒂娜",
"西薇",
"观察护身符",
"观察武器",
"观察罐子",
"观察腰带",
"观察钓具",
"警示者的记录",
"记录用秘源哨机",
"谁人的手记",
"调查用投喂点",
"谜画涂鸦中的意志",
"谨慎的调查员",
"贝坎",
"贝雷哈努",
"贤龙",
"贪吃的绵驮兽",
"赫伯德",
"赫瓦特莉",
"辛佳",
"辛奇",
"达伊妲",
"达尔戈",
"达布亚",
"达祖玛",
"进行比赛",
"迷惑的调查员",
"迷灰中的石碑·其一",
"迷灰中的石碑·其三",
"迷灰中的石碑·其二",
"通皮斯",
"醒目的标语",
"钦特利",
"闪亮亮的贝壳",
"阿乌伊娅",
"阿乌琪",
"阿乔",
"阿伽娅",
"阿凯蒂",
"阿卡坦加",
"阿卡马",
"阿图科",
"阿坎蒂",
"阿基约",
"阿奇亚库",
"阿妮拉",
"阿姆鲁",
"阿孔",
"阿尔妲",
"阿尔帕",
"阿尤",
"阿布帕隆",
"阿希莉",
"阿斯基娅",
"阿斯麦隆",
"阿格莫",
"阿梅妲",
"阿特琪",
"阿科米蒂",
"阿米娜",
"阿纳",
"阿蕾梅",
"阿达玛",
"阿邦迪",
"阿隆",
"阿霍伊图",
"阿马佐利",
"阿鲁吉",
"陀罗诘利",
"陀达罗",
"难过的嵴锋龙",
"雅库普",
"雅蕾希",
"雅诺斯基",
"雇主",
"雷格巴",
"霍图鲁",
"霍娅",
"霍莱",
"韦尼埃米诺夫",
"顾客",
"马伊塔",
"马兹拉",
"马凯莫",
"马努阿",
"马塔伽",
"马塔伽!记得!!",
"马塔拉",
"马察特利",
"马尼菲科",
"马扎坦",
"马提库伊",
"马洛考",
"马特兰",
"马穆勒",
"马蒂亚斯",
"马西娜·努伊",
"马陶霍",
"驻扎日记",
"验收与维修记录",
"鳍游龙",
"鳍游龙夏威夷吉他",
"鳍游龙尤克里里",
"鳍游龙木吉他",
"鳍游龙箱鼓",
"麦斯欧德",
"黛希特莉",
"龙铭刻",
"(翻找箱子…)",
"亡国的美奈姬·卷五",
"少女薇拉的忧郁·卷一",
"少女薇拉的忧郁·卷二",
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,148 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>12.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
<AssemblyName>BetterGI</AssemblyName>
<AssemblyVersion>0.36.2</AssemblyVersion>
<Platforms>x64</Platforms>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Images\*.jpg" />
<None Remove="Assets\Images\*" />
<None Remove="Assets\Images\*.png" />
<None Remove="Assets\Images\*.ico" />
<None Remove="Assets\Fonts\*.ttf" />
<None Remove="Assets\Highlighting\*.xshd" />
<None Remove="Assets\Strings\*.html" />
<None Remove="Assets\Strings\*.md" />
<None Remove="Assets\Audios\*.mp3" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\*.jpg" />
<Resource Include="Assets\Images\Anniversary\*" />
<Resource Include="Assets\Images\*.png" />
<Resource Include="Assets\Images\*.ico" />
<Resource Include="Assets\Fonts\*.ttf" />
<Resource Include="Assets\Highlighting\*.xshd" />
<Resource Include="Assets\Strings\*.html" />
<Resource Include="Assets\Strings\*.md" />
<Resource Include="Assets\Audios\*.mp3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.18.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.18.1" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
<PackageReference Include="OpenCvSharp4.Windows" Version="4.8.0.20230708" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.5" />
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="PresentMonFps" Version="2.0.5" />
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.0.2" />
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.0.2" />
<PackageReference Include="Vanara.PInvoke.User32" Version="4.0.2" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.23" />
<PackageReference Include="YoloV8" Version="4.1.7" />
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fischless.GameCapture\Fischless.GameCapture.csproj" />
<ProjectReference Include="..\Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj" />
<ProjectReference Include="..\Fischless.WindowsInput\Fischless.WindowsInput.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Assets\Map\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\combat_avatar.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\hangout.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="GameTask\Common\Element\Assets\新文件夹\" />
<Folder Include="GameTask\OneDragon\" />
<Folder Include="User\AutoPathing\" />
</ItemGroup>
</Project>
+39 -8
View File
@@ -8,9 +8,9 @@
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>12.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\Images\Anniversary\logo_1st.ico</ApplicationIcon>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
<AssemblyName>BetterGI</AssemblyName>
<AssemblyVersion>0.34.6</AssemblyVersion>
<AssemblyVersion>0.44.0</AssemblyVersion>
<Platforms>x64</Platforms>
<DebugType>embedded</DebugType>
</PropertyGroup>
@@ -41,12 +41,19 @@
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
<PackageReference Include="BehaviourTree" Version="1.0.73" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="DeviceId" Version="6.8.0" />
<PackageReference Include="DeviceId.Windows" Version="6.8.0" />
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.8.0" />
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.18.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.18.1" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.8.0.20230708" />
@@ -57,19 +64,20 @@
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="PresentMonFps" Version="2.0.5" />
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.0.2" />
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.0.2" />
<PackageReference Include="Vanara.PInvoke.User32" Version="4.0.2" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.18" />
<PackageReference Include="WPF-UI" Version="4.0.0" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.0" />
<PackageReference Include="WPF-UI.Tray" Version="4.0.0" />
<PackageReference Include="WPF-UI.Violeta" Version="4.0.0" />
<PackageReference Include="YoloV8" Version="4.1.7" />
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
</ItemGroup>
@@ -120,9 +128,15 @@
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\Json\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoMusicGame\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -138,7 +152,24 @@
</ItemGroup>
<ItemGroup>
<Folder Include="GameTask\OneDragon\" />
<Folder Include="Service\Notification\Builder\" />
<Folder Include="User\AutoPathing\" />
</ItemGroup>
</Project>
<ItemGroup>
<Page Update="View\Windows\WelcomeDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Update="View\Windows\WelcomeDialog.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>WelcomeDialog.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
+50 -7
View File
@@ -7,13 +7,17 @@ using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
using BetterGenshinImpact.GameTask.AutoPick;
using BetterGenshinImpact.GameTask.AutoSkip;
using BetterGenshinImpact.GameTask.AutoWood;
using BetterGenshinImpact.GameTask.AutoMusicGame;
using BetterGenshinImpact.GameTask.QuickTeleport;
using BetterGenshinImpact.Service.Notification;
using CommunityToolkit.Mvvm.ComponentModel;
using Fischless.GameCapture;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.AutoTrackPath;
namespace BetterGenshinImpact.Core.Config;
@@ -47,13 +51,19 @@ public partial class AllConfig : ObservableObject
[ObservableProperty]
private int _triggerInterval = 50;
// /// <summary>
// /// WGC使用位图缓存
// /// 高帧率情况下,可能会导致卡顿
// /// 云原神可能会出现黑屏
// /// </summary>
// [ObservableProperty]
// private bool _wgcUseBitmapCache = true;
/// <summary>
/// WGC使用位图缓存
/// 高帧率情况下,可能会导致卡顿
/// 云原神可能会出现黑屏
/// 自动修复Win11下BitBlt截图方式不可用的问题
/// </summary>
[ObservableProperty]
private bool _wgcUseBitmapCache = true;
private bool _autoFixWin11BitBlt = true;
/// <summary>
/// 推理使用的设备
@@ -61,6 +71,15 @@ public partial class AllConfig : ObservableObject
[ObservableProperty]
private string _inferenceDevice = "CPU";
[ObservableProperty]
private List<ValueTuple<string, int, string, string>> _nextScheduledTask = [];
/// <summary>
/// 一条龙选中使用的配置
/// </summary>
[ObservableProperty]
private string _selectedOneDragonFlowConfigName = string.Empty;
/// <summary>
/// 遮罩窗口配置
/// </summary>
@@ -115,6 +134,11 @@ public partial class AllConfig : ObservableObject
/// 自动战斗配置
/// </summary>
public AutoFightConfig AutoFightConfig { get; set; } = new();
/// <summary>
/// 自动乐曲配置 - 千音雅集
/// </summary>
public AutoMusicGameConfig AutoMusicGameConfig { get; set; } = new();
/// <summary>
/// 自动秘境配置
@@ -133,6 +157,11 @@ public partial class AllConfig : ObservableObject
/// </summary>
public ScriptConfig ScriptConfig { get; set; } = new();
/// <summary>
/// 地图追踪配置
/// </summary>
public PathingConditionConfig PathingConditionConfig { get; set; } = PathingConditionConfig.Default;
/// <summary>
/// 快捷键配置
/// </summary>
@@ -143,6 +172,18 @@ public partial class AllConfig : ObservableObject
/// </summary>
public NotificationConfig NotificationConfig { get; set; } = new();
/// <summary>
/// 原神按键绑定配置
/// </summary>
public KeyBindingsConfig KeyBindingsConfig { get; set; } = new();
/// <summary>
/// 其他配置
/// </summary>
public OtherConfig OtherConfig { get; set; } = new();
/// <summary>
/// 传送相关配置
/// </summary>
public TpConfig TpConfig { get; set; } = new();
[JsonIgnore]
public Action? OnAnyChangedAction { get; set; }
@@ -154,7 +195,7 @@ public partial class AllConfig : ObservableObject
GenshinStartConfig.PropertyChanged += OnAnyPropertyChanged;
NotificationConfig.PropertyChanged += OnAnyPropertyChanged;
NotificationConfig.PropertyChanged += OnNotificationPropertyChanged;
KeyBindingsConfig.PropertyChanged += OnAnyPropertyChanged;
AutoPickConfig.PropertyChanged += OnAnyPropertyChanged;
AutoSkipConfig.PropertyChanged += OnAnyPropertyChanged;
AutoFishingConfig.PropertyChanged += OnAnyPropertyChanged;
@@ -165,8 +206,10 @@ public partial class AllConfig : ObservableObject
AutoWoodConfig.PropertyChanged += OnAnyPropertyChanged;
AutoFightConfig.PropertyChanged += OnAnyPropertyChanged;
AutoDomainConfig.PropertyChanged += OnAnyPropertyChanged;
AutoMusicGameConfig.PropertyChanged += OnAnyPropertyChanged;
TpConfig.PropertyChanged += OnAnyPropertyChanged;
ScriptConfig.PropertyChanged += OnAnyPropertyChanged;
PathingConditionConfig.PropertyChanged += OnAnyPropertyChanged;
}
public void OnAnyPropertyChanged(object? sender, EventArgs args)
@@ -179,4 +222,4 @@ public partial class AllConfig : ObservableObject
{
NotificationService.Instance().RefreshNotifiers();
}
}
}
@@ -1,5 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using Wpf.Ui.Controls;
namespace BetterGenshinImpact.Core.Config;
@@ -26,4 +28,28 @@ public partial class CommonConfig : ObservableObject
/// </summary>
[ObservableProperty]
private bool _exitToTray;
/// <summary>
/// 主题
/// </summary>
[ObservableProperty]
private WindowBackdropType _currentBackdropType = WindowBackdropType.Mica;
/// <summary>
/// 是否是第一次运行
/// </summary>
[ObservableProperty]
private bool _isFirstRun = true;
/// <summary>
/// 这个版本是否运行过
/// </summary>
[ObservableProperty]
private string _runForVersion = string.Empty;
/// <summary>
/// 一个设备只运行一次的已运行设备ID列表
/// </summary>
[ObservableProperty]
private List<string> _onceHadRunDeviceIdList = new();
}
@@ -9,11 +9,11 @@ namespace BetterGenshinImpact.Core.Config;
[Serializable]
public partial class GenshinStartConfig : ObservableObject
{
/// <summary>
/// 自动点击月卡
/// </summary>
[ObservableProperty]
private bool _autoClickBlessingOfTheWelkinMoonEnabled;
// /// <summary>
// /// 自动点击月卡
// /// </summary>
// [ObservableProperty]
// private bool _autoClickBlessingOfTheWelkinMoonEnabled;
/// <summary>
/// 自动进入游戏(开门)
@@ -38,4 +38,10 @@ public partial class GenshinStartConfig : ObservableObject
/// </summary>
[ObservableProperty]
private bool _linkedStartEnabled = true;
/// <summary>
/// 使用Starward同步记录时间
/// </summary>
[ObservableProperty]
private bool _recordGameTimeEnabled = false;
}
@@ -148,6 +148,13 @@ public partial class HotKeyConfig : ObservableObject
[ObservableProperty]
private string _autoMusicGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 活动音游开始/停止
[ObservableProperty]
private string _autoFishingGameHotkey = "";
[ObservableProperty]
private string _autoFishingGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 自动寻路
[ObservableProperty]
@@ -211,7 +218,12 @@ public partial class HotKeyConfig : ObservableObject
[ObservableProperty]
private string _keyMouseMacroRecordHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 暂停
[ObservableProperty]
private string _suspendHotkey = "";
[ObservableProperty]
private string _suspendHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 停止任意独立任务
[ObservableProperty]
private string _cancelTaskHotkey = "";
@@ -0,0 +1,970 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Windows.Forms;
using System.Windows.Input;
using Windows.Networking.PushNotifications;
using static Vanara.PInvoke.User32;
namespace BetterGenshinImpact.Core.Config;
/// <summary>
/// 原神按键绑定配置
/// </summary>
[Serializable]
public partial class KeyBindingsConfig:ObservableObject
{
/// <summary>
/// 是否启用全局按键映射
/// </summary>
[ObservableProperty]
private bool _globalKeyMappingEnabled = false;
#region Actions(操作)
/// <summary>
/// 向前移动
/// </summary>
[ObservableProperty]
private KeyId _moveForward = KeyId.W;
/// <summary>
/// 向后移动
/// </summary>
[ObservableProperty]
private KeyId _moveBackward = KeyId.S;
/// <summary>
/// 向左移动
/// </summary>
[ObservableProperty]
private KeyId _moveLeft = KeyId.A;
/// <summary>
/// 向右移动
/// </summary>
[ObservableProperty]
private KeyId _moveRight = KeyId.D;
/// <summary>
/// 切换走/跑;特定操作模式下向下移动
/// </summary>
[ObservableProperty]
private KeyId _switchToWalkOrRun = KeyId.LeftCtrl;
/// <summary>
/// 普通攻击
/// </summary>
[ObservableProperty]
private KeyId _normalAttack = KeyId.MouseLeftButton;
/// <summary>
/// 元素战技
/// </summary>
[ObservableProperty]
private KeyId _elementalSkill = KeyId.E;
/// <summary>
/// 元素爆发
/// </summary>
[ObservableProperty]
private KeyId _elementalBurst = KeyId.Q;
/// <summary>
/// 冲刺(键盘)
/// </summary>
[ObservableProperty]
private KeyId _sprintKeyboard = KeyId.LeftShift;
/// <summary>
/// 冲刺(鼠标)
/// </summary>
[ObservableProperty]
private KeyId _sprintMouse = KeyId.MouseRightButton;
/// <summary>
/// 切换瞄准模式
/// </summary>
[ObservableProperty]
private KeyId _switchAimingMode = KeyId.R;
/// <summary>
/// 跳跃;特定操作模式下向上移动
/// </summary>
[ObservableProperty]
private KeyId _jump = KeyId.Space;
/// <summary>
/// 落下
/// </summary>
[ObservableProperty]
private KeyId _drop = KeyId.X;
/// <summary>
/// 拾取/交互(自动拾取由AutoPick模块管理)
/// </summary>
[ObservableProperty]
private KeyId _pickUpOrInteract = KeyId.F;
/// <summary>
/// 快捷使用小道具
/// </summary>
[ObservableProperty]
private KeyId _quickUseGadget = KeyId.Z;
/// <summary>
/// 特定玩法内交互操作
/// </summary>
[ObservableProperty]
private KeyId _interactionInSomeMode = KeyId.T;
/// <summary>
/// 开启任务追踪
/// </summary>
[ObservableProperty]
private KeyId _questNavigation = KeyId.V;
/// <summary>
/// 中断挑战
/// </summary>
[ObservableProperty]
private KeyId _abandonChallenge = KeyId.P;
/// <summary>
/// 切换小队角色1
/// </summary>
[ObservableProperty]
private KeyId _switchMember1 = KeyId.D1;
/// <summary>
/// 切换小队角色2
/// </summary>
[ObservableProperty]
private KeyId _switchMember2 = KeyId.D2;
/// <summary>
/// 切换小队角色3
/// </summary>
[ObservableProperty]
private KeyId _switchMember3 = KeyId.D3;
/// <summary>
/// 切换小队角色4
/// </summary>
[ObservableProperty]
private KeyId _switchMember4 = KeyId.D4;
/// <summary>
/// 切换小队角色5
/// </summary>
[ObservableProperty]
private KeyId _switchMember5 = KeyId.D5;
/// <summary>
/// 呼出快捷轮盘
/// </summary>
[ObservableProperty]
private KeyId _shortcutWheel = KeyId.Tab;
#endregion
#region Menus(菜单)
/// <summary>
/// 打开背包
/// </summary>
[ObservableProperty]
private KeyId _openInventory = KeyId.B;
/// <summary>
/// 打开角色界面
/// </summary>
[ObservableProperty]
private KeyId _openCharacterScreen = KeyId.C;
/// <summary>
/// 打开地图
/// </summary>
[ObservableProperty]
private KeyId _openMap = KeyId.M;
/// <summary>
/// 打开派蒙界面
/// </summary>
[ObservableProperty]
private KeyId _openPaimonMenu = KeyId.Escape;
/// <summary>
/// 打开冒险之证界面
/// </summary>
[ObservableProperty]
private KeyId _openAdventurerHandbook = KeyId.F1;
/// <summary>
/// 打开多人游戏界面
/// </summary>
[ObservableProperty]
private KeyId _openCoOpScreen = KeyId.F2;
/// <summary>
/// 打开祈愿界面
/// </summary>
[ObservableProperty]
private KeyId _openWishScreen = KeyId.F3;
/// <summary>
/// 打开纪行界面
/// </summary>
[ObservableProperty]
private KeyId _openBattlePassScreen = KeyId.F4;
/// <summary>
/// 打开活动面板
/// </summary>
[ObservableProperty]
private KeyId _openTheEventsMenu = KeyId.F5;
/// <summary>
/// 打开玩法系统界面(尘歌壶内猫尾酒馆内)
/// </summary>
[ObservableProperty]
private KeyId _openTheSettingsMenu = KeyId.F6;
/// <summary>
/// 打开摆设界面(尘歌壶内)
/// </summary>
[ObservableProperty]
private KeyId _openTheFurnishingScreen = KeyId.F7;
/// <summary>
/// 打开星之归还(条件符合期间生效)
/// </summary>
[ObservableProperty]
private KeyId _openStellarReunion = KeyId.F8;
/// <summary>
/// 开关任务菜单
/// </summary>
[ObservableProperty]
private KeyId _openQuestMenu = KeyId.J;
/// <summary>
/// 打开通知详情
/// </summary>
[ObservableProperty]
private KeyId _openNotificationDetails = KeyId.Y;
/// <summary>
/// 打开聊天界面
/// </summary>
[ObservableProperty]
private KeyId _openChatScreen = KeyId.Enter;
/// <summary>
/// 打开特殊环境说明
/// </summary>
[ObservableProperty]
private KeyId _openSpecialEnvironmentInformation = KeyId.U;
/// <summary>
/// 查看教程详情
/// </summary>
[ObservableProperty]
private KeyId _checkTutorialDetails = KeyId.G;
/// <summary>
/// 长按打开元素视野
/// </summary>
[ObservableProperty]
private KeyId _elementalSight = KeyId.MouseMiddleButton;
/// <summary>
/// 呼出鼠标
/// </summary>
[ObservableProperty]
private KeyId _showCursor = KeyId.LeftAlt;
/// <summary>
/// 打开队伍配置界面
/// </summary>
[ObservableProperty]
private KeyId _openPartySetupScreen = KeyId.L;
/// <summary>
/// 打开好友界面
/// </summary>
[ObservableProperty]
private KeyId _openFriendsScreen = KeyId.O;
/// <summary>
/// 隐藏主界面
/// </summary>
[ObservableProperty]
private KeyId _hideUI = KeyId.Slash;
#endregion
}
public static class KeyIdConverter
{
/// <summary>
/// 将KeyId转换为字符串(可在后续支持多语言),按键名称的显示尽量与原神UI一致
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string ToName(this KeyId value)
{
return ToChineseName(value);
}
private static string ToChineseName(KeyId value)
{
return value switch
{
// 需要单独翻译的按键
KeyId.None => "<未指定>",
KeyId.Unknown => "<未知>",
KeyId.MouseLeftButton => "鼠标左键",
KeyId.MouseRightButton => "鼠标右键",
KeyId.MouseMiddleButton => "鼠标中键",
KeyId.MouseSideButton1 => "鼠标侧键1",
KeyId.MouseSideButton2 => "鼠标侧键2",
KeyId.Apps => "菜单键",
// 无需单独翻译的部分
_ => EnglishKeyNameToChinese(value),
};
}
private static string EnglishKeyNameToChinese(KeyId value)
{
var engName = ToEnglishName(value);
if (engName.StartsWith("Left ") || engName.StartsWith("Right "))
{
return engName.Replace("Left ", "左").Replace("Right ", "右");
}
return engName;
}
private static string ToEnglishName(KeyId value)
{
return value switch
{
// 需要转换的部分
KeyId.None => "<None>",
KeyId.Unknown => "<Unknown>",
KeyId.MouseLeftButton => "Mouse LButton",
KeyId.MouseRightButton => "Mouse RButton",
KeyId.MouseMiddleButton => "Mouse MButton",
KeyId.MouseSideButton1 => "Mouse XButton1",
KeyId.MouseSideButton2 => "Mouse XButton2",
KeyId.Escape => "Esc",
KeyId.PageUp => "Page Up",
KeyId.PageDown => "Page Down",
KeyId.CapsLock => "Caps Lock",
KeyId.ScrollLock => "Scroll Lock",
KeyId.LeftShift => "Left Shift",
KeyId.RightShift => "Right Shift",
KeyId.LeftCtrl => "Left Crtl",
KeyId.RightCtrl => "Right Ctrl",
KeyId.LeftAlt => "Left Alt",
KeyId.RightAlt => "Right Alt",
KeyId.LeftWin => "Left Win",
KeyId.RightWin => "Right Win",
KeyId.Apps => "Menu",
KeyId.Left => "←",
KeyId.Up => "↑",
KeyId.Right => "→",
KeyId.Down => "↓",
KeyId.D0 => "0",
KeyId.D1 => "1",
KeyId.D2 => "2",
KeyId.D3 => "3",
KeyId.D4 => "4",
KeyId.D5 => "5",
KeyId.D6 => "6",
KeyId.D7 => "7",
KeyId.D8 => "8",
KeyId.D9 => "9",
KeyId.Apostrophe => "'",
KeyId.Comma => ",",
KeyId.Minus => "-",
KeyId.Equal => "=",
KeyId.Period => ".",
KeyId.Slash => "/",
KeyId.Backslash => @"\",
KeyId.Semicolon => ";",
KeyId.LeftSquareBracket => "[",
KeyId.RightSquareBracket => "]",
KeyId.Tilde => "`",
KeyId.NumLock => "Num Lock",
KeyId.NumPad0 => "Num 0",
KeyId.NumPad1 => "Num 1",
KeyId.NumPad2 => "Num 2",
KeyId.NumPad3 => "Num 3",
KeyId.NumPad4 => "Num 4",
KeyId.NumPad5 => "Num 5",
KeyId.NumPad6 => "Num 6",
KeyId.NumPad7 => "Num 7",
KeyId.NumPad8 => "Num 8",
KeyId.NumPad9 => "Num 9",
KeyId.Decimal => "Num .",
KeyId.Divide => "Num /",
KeyId.Multiply => "Num *",
KeyId.Subtract => "Num -",
KeyId.Add => "Num +",
KeyId.NumEnter => "Num Enter",
// 默认使用枚举名
_ => value.ToString(),
};
}
/// <summary>
/// 将KeyId转换为VK
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static VK ToVK(this KeyId value)
{
return value switch
{
// 这两个值在VK中没有,抛异常
KeyId.None => throw new ArgumentOutOfRangeException(nameof(value), "未指定按键,无法转换为VK。"),
KeyId.Unknown => throw new ArgumentOutOfRangeException(nameof(value), "未知按键,无法转换为VK。"),
// 剩下的值相同,直接转
_ => (VK)value,
};
}
/// <summary>
/// 将KeyId转换为System.Windows.Input.Key
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static Key ToInputKey(this KeyId value)
{
// 部分按键名称相同,使用名称转换
try
{
return Enum.Parse<Key>(value.ToString());
}
catch
{
// 其他键使用查表法转换
return value switch
{
KeyId.LeftWin => Key.LWin,
KeyId.RightWin => Key.RWin,
KeyId.Apostrophe => Key.Oem7,
KeyId.Comma => Key.OemComma,
KeyId.Minus => Key.OemMinus,
KeyId.Equal => Key.OemPlus,
KeyId.Period => Key.OemPeriod,
KeyId.Slash => Key.Oem2,
KeyId.Semicolon => Key.Oem1,
KeyId.LeftSquareBracket => Key.Oem4,
KeyId.Backslash => Key.Oem5,
KeyId.RightSquareBracket => Key.Oem6,
KeyId.Tilde => Key.Oem3,
KeyId.Enter => Key.Enter,
KeyId.ScrollLock => Key.Scroll,
KeyId.PageUp => Key.Prior,
KeyId.PageDown => Key.Next,
KeyId.Backspace => Key.Back,
KeyId.CapsLock => Key.Capital,
// None、Unknown和鼠标按键抛异常
_ => throw new ArgumentOutOfRangeException(nameof(value)),
};
}
}
/// <summary>
/// 将KeyId转换为MouseButton
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static MouseButton ToMouseButton(this KeyId value)
{
return value switch
{
KeyId.MouseLeftButton => MouseButton.Left,
KeyId.MouseRightButton => MouseButton.Right,
KeyId.MouseMiddleButton => MouseButton.Middle,
KeyId.MouseSideButton1 => MouseButton.XButton1,
KeyId.MouseSideButton2 => MouseButton.XButton2,
_ => throw new ArgumentOutOfRangeException(nameof(value), "键盘按键请使用ToInputKey方法"),
};
}
/// <summary>
/// [实验] 将KeyId转换为WinForm中的Keys(用于兼容按键连发功能)
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static Keys ToWinFormKeys(this KeyId value)
{
try
{
return Enum.Parse<Keys>(value.ToInputKey().ToString());
}
catch
{
return default;
}
}
/// <summary>
/// 将VK转换为KeyId
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static KeyId FromVK(VK value)
{
// 尝试通过VK的值获取KeyId的枚举名。若成功,表示对应的VK在KeyId支持的范围内,直接转换;否则返回Unknown
return string.IsNullOrEmpty(Enum.GetName(typeof(KeyId), value)) ? KeyId.Unknown : (KeyId)value;
}
/// <summary>
/// 将System.Windows.Input.Key转换为KeyId
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static KeyId FromInputKey(Key value)
{
// 部分按键名称相同,使用名称转换
try
{
return Enum.Parse<KeyId>(value.ToString());
}
catch
{
// 其他键使用查表法转换
return value switch
{
Key.LWin => KeyId.LeftWin,
Key.RWin => KeyId.RightWin,
Key.Oem7 => KeyId.Apostrophe,
Key.OemComma => KeyId.Comma,
Key.OemMinus => KeyId.Minus,
Key.OemPlus => KeyId.Equal,
Key.OemPeriod => KeyId.Period,
Key.Oem2 => KeyId.Slash,
Key.Oem1 => KeyId.Semicolon,
Key.Oem4 => KeyId.LeftSquareBracket,
Key.Oem5 => KeyId.Backslash,
Key.Oem6 => KeyId.RightSquareBracket,
Key.Oem3 => KeyId.Tilde,
Key.Enter => KeyId.Enter,
Key.Scroll => KeyId.ScrollLock,
Key.Prior => KeyId.PageUp,
Key.Next => KeyId.PageDown,
Key.Back => KeyId.Backspace,
Key.Capital => KeyId.CapsLock,
// 支持列表外的值返回Unknown
_ => KeyId.Unknown,
};
}
}
/// <summary>
/// 将MouseButton转换为KeyId
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static KeyId FromMouseButton(MouseButton value)
{
return value switch
{
MouseButton.Left => KeyId.MouseLeftButton,
MouseButton.Right => KeyId.MouseRightButton,
MouseButton.Middle => KeyId.MouseMiddleButton,
MouseButton.XButton1 => KeyId.MouseSideButton1,
MouseButton.XButton2 => KeyId.MouseSideButton2,
_ => KeyId.Unknown,
};
}
}
/// <summary>
/// 用于与VK/Windows.Input.Key解耦,值与VK对应,但是仅包含美式键盘(104键,不包括媒体控制等)和鼠标中的按键
/// </summary>
public enum KeyId
{
/// <summary>无</summary>
None = 0x00,
/// <summary>未知按键</summary>
Unknown = 0xFF,
#region 鼠标按键
/// <summary>鼠标左键</summary>
MouseLeftButton = 0x01,
/// <summary>鼠标右键</summary>
MouseRightButton = 0x02,
/// <summary>鼠标中键(滚轮)</summary>
MouseMiddleButton = 0x04,
/// <summary>鼠标侧键1(后退)</summary>
MouseSideButton1 = 0x05,
/// <summary>鼠标侧键2(前进)</summary>
MouseSideButton2 = 0x06,
#endregion
#region F键区
/// <summary>F1</summary>
F1 = 0x70,
/// <summary>F2</summary>
F2 = 0x71,
/// <summary>F3</summary>
F3 = 0x72,
/// <summary>F4</summary>
F4 = 0x73,
/// <summary>F5</summary>
F5 = 0x74,
/// <summary>F6</summary>
F6 = 0x75,
/// <summary>F7</summary>
F7 = 0x76,
/// <summary>F8</summary>
F8 = 0x77,
/// <summary>F9</summary>
F9 = 0x78,
/// <summary>F10</summary>
F10 = 0x79,
/// <summary>F11</summary>
F11 = 0x7A,
/// <summary>F12</summary>
F12 = 0x7B,
#endregion
#region 控制&功能键
/// <summary>Esc</summary>
Escape = 0x1B,
/// <summary>PrintScreen</summary>
PrintScreen = 0x2C,
/// <summary>ScrollLock</summary>
ScrollLock = 0x91,
/// <summary>Pause</summary>
Pause = 0x13,
/// <summary>Insert</summary>
Insert = 0x2D,
/// <summary>Delete</summary>
Delete = 0x2E,
/// <summary>Home</summary>
Home = 0x24,
/// <summary>End</summary>
End = 0x23,
/// <summary>Page Up</summary>
PageUp = 0x21,
/// <summary>Page Down</summary>
PageDown = 0x22,
/// <summary>Backspace退格</summary>
Backspace = 0x08,
/// <summary>Tab</summary>
Tab = 0x09,
/// <summary>Caps Lock大写锁定</summary>
CapsLock = 0x14,
/// <summary>Enter回车</summary>
Enter = 0x0D,
///// <summary>Shift</summary>
//Shift = 0x10,
/// <summary>左Shift</summary>
LeftShift = 0xA0,
/// <summary>右Shift</summary>
RightShift = 0xA1,
///// <summary>Ctrl</summary>
//Ctrl = 0x11,
/// <summary>左Ctrl</summary>
LeftCtrl = 0xA2,
/// <summary>右Ctrl</summary>
RightCtrl = 0xA3,
///// <summary>Alt</summary>
//Alt = 0x12,
/// <summary>左Alt</summary>
LeftAlt = 0xA4,
/// <summary>右Alt</summary>
RightAlt = 0xA5,
/// <summary>左Win键 (Microsoft Natural Keyboard)</summary>
LeftWin = 0x5B,
/// <summary>右Win键 (Microsoft Natural Keyboard)</summary>
RightWin = 0x5C,
/// <summary>菜单键 (Microsoft Natural Keyboard)</summary>
Apps = 0x5D,
/// <summary>Space空格键</summary>
Space = 0x20,
#endregion
#region 方向键
/// <summary>方向键 ←</summary>
Left = 0x25,
/// <summary>方向键 ↑</summary>
Up = 0x26,
/// <summary>方向键 →</summary>
Right = 0x27,
/// <summary>方向键 ↓</summary>
Down = 0x28,
#endregion
#region 字母区 - 字母
/// <summary>A</summary>
A = 0x41,
/// <summary>B</summary>
B = 0x42,
/// <summary>C</summary>
C = 0x43,
/// <summary>D</summary>
D = 0x44,
/// <summary>E</summary>
E = 0x45,
/// <summary>F</summary>
F = 0x46,
/// <summary>G</summary>
G = 0x47,
/// <summary>H</summary>
H = 0x48,
/// <summary>I</summary>
I = 0x49,
/// <summary>J</summary>
J = 0x4A,
/// <summary>K</summary>
K = 0x4B,
/// <summary>L</summary>
L = 0x4C,
/// <summary>M</summary>
M = 0x4D,
/// <summary>N</summary>
N = 0x4E,
/// <summary>O</summary>
O = 0x4F,
/// <summary>P</summary>
P = 0x50,
/// <summary>Q</summary>
Q = 0x51,
/// <summary>R</summary>
R = 0x52,
/// <summary>S</summary>
S = 0x53,
/// <summary>T</summary>
T = 0x54,
/// <summary>U</summary>
U = 0x55,
/// <summary>V</summary>
V = 0x56,
/// <summary>W</summary>
W = 0x57,
/// <summary>X</summary>
X = 0x58,
/// <summary>Y</summary>
Y = 0x59,
/// <summary>Z</summary>
Z = 0x5A,
#endregion
#region 字母区 - 数字
/// <summary>0</summary>
D0 = 0x30,
/// <summary>1</summary>
D1 = 0x31,
/// <summary>2</summary>
D2 = 0x32,
/// <summary>3</summary>
D3 = 0x33,
/// <summary>4</summary>
D4 = 0x34,
/// <summary>5</summary>
D5 = 0x35,
/// <summary>6</summary>
D6 = 0x36,
/// <summary>7</summary>
D7 = 0x37,
/// <summary>8</summary>
D8 = 0x38,
/// <summary>9</summary>
D9 = 0x39,
#endregion
#region 字母区 - 符号
/// <summary>引号 '</summary>
Apostrophe = 0xDE,
/// <summary>逗号 ,</summary>
Comma = 0xBC,
/// <summary>连接符 -</summary>
Minus = 0xBD,
/// <summary>等于号 =</summary>
Equal = 0xBB,
/// <summary>句号 .</summary>
Period = 0xBE,
/// <summary>斜杠 /</summary>
Slash = 0xBF,
/// <summary>反斜杠 \</summary>
Backslash = 0xE2,
/// <summary>分号 ;</summary>
Semicolon = 0xBA,
/// <summary>左方括号 [</summary>
LeftSquareBracket = 0xDB,
/// <summary>右方括号 ]</summary>
RightSquareBracket = 0xDD,
/// <summary>波浪号 `</summary>
Tilde = 0xC0,
#endregion
#region 小键盘区
/// <summary>Num Lock</summary>
NumLock = 0x90,
/// <summary>Num 0</summary>
NumPad0 = 0x60,
/// <summary>Num 1</summary>
NumPad1 = 0x61,
/// <summary>Num 2</summary>
NumPad2 = 0x62,
/// <summary>Num 3</summary>
NumPad3 = 0x63,
/// <summary>Num 4</summary>
NumPad4 = 0x64,
/// <summary>Num 5</summary>
NumPad5 = 0x65,
/// <summary>Num 6</summary>
NumPad6 = 0x66,
/// <summary>Num 7</summary>
NumPad7 = 0x67,
/// <summary>Num 8</summary>
NumPad8 = 0x68,
/// <summary>Num 9</summary>
NumPad9 = 0x69,
/// <summary>Num .</summary>
Decimal = 0x6E,
/// <summary>Num /</summary>
Divide = 0x6F,
/// <summary>Num *</summary>
Multiply = 0x6A,
/// <summary>Num -</summary>
Subtract = 0x6D,
/// <summary>Num +</summary>
Add = 0x6B,
/// <summary>Num Enter</summary>
NumEnter = 0x0E,
#endregion
}
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
namespace BetterGenshinImpact.Core.Config;
[Serializable]
public partial class OneDragonFlowConfig : ObservableObject
{
// 配置名
[ObservableProperty]
private string _name = string.Empty;
/// <summary>
/// 所有任务的开关状态
/// </summary>
public Dictionary<string, bool> TaskEnabledList { get; set; } = new();
// 合成树脂的国家
[ObservableProperty]
private string _craftingBenchCountry = "枫丹";
// 冒险者协会的国家
[ObservableProperty]
private string _adventurersGuildCountry = "枫丹";
// 自动战斗配置的队伍名称
[ObservableProperty]
private string _partyName = string.Empty;
// 自动战斗配置的策略名称
[ObservableProperty]
private string _domainName = string.Empty;
[ObservableProperty]
private bool _weeklyDomainEnabled = false;
// 领取每日奖励的好感队伍名称
[ObservableProperty]
private string _dailyRewardPartyName = string.Empty;
#region 每周秘境配置
[ObservableProperty]
private string _mondayThursdayPartyName = string.Empty;
[ObservableProperty]
private string _mondayThursdayDomainName = string.Empty;
[ObservableProperty]
private string _tuesdayFridayPartyName = string.Empty;
[ObservableProperty]
private string _tuesdayFridayDomainName = string.Empty;
[ObservableProperty]
private string _wednesdaySaturdayPartyName = string.Empty;
[ObservableProperty]
private string _wednesdaySaturdayDomainName = string.Empty;
[ObservableProperty]
private string _sundayPartyName = string.Empty;
[ObservableProperty]
private string _sundayDomainName = string.Empty;
// 完成后操作
[ObservableProperty]
private string _completionAction = string.Empty;
// 通过当天是哪一天来返回配置
public (string partyName, string domainName) GetDomainConfig()
{
if (WeeklyDomainEnabled)
{
var dayOfWeek = DateTime.Now.DayOfWeek;
return dayOfWeek switch
{
DayOfWeek.Monday => (MondayThursdayPartyName, MondayThursdayDomainName),
DayOfWeek.Tuesday => (TuesdayFridayPartyName, TuesdayFridayDomainName),
DayOfWeek.Wednesday => (WednesdaySaturdayPartyName, WednesdaySaturdayDomainName),
DayOfWeek.Thursday => (MondayThursdayPartyName, MondayThursdayDomainName),
DayOfWeek.Friday => (TuesdayFridayPartyName, TuesdayFridayDomainName),
DayOfWeek.Saturday => (WednesdaySaturdayPartyName, WednesdaySaturdayDomainName),
DayOfWeek.Sunday => (SundayPartyName, SundayDomainName),
_ => (PartyName, DomainName)
};
}
else
{
return (PartyName, DomainName);
}
}
#endregion
}
@@ -0,0 +1,25 @@
using System;
using CommunityToolkit.Mvvm.ComponentModel;
namespace BetterGenshinImpact.Core.Config;
[Serializable]
public partial class OtherConfig : ObservableObject
{
//调度器任务和部分独立任务,失去焦点,自动激活游戏窗口
[ObservableProperty]
private bool _restoreFocusOnLostEnabled = false;
/// <summary>
/// 游戏语言名称
/// </summary>
[ObservableProperty]
private string _gameCultureInfoName = "zh-Hans";
/// <summary>
/// BGI界面语言名称
/// </summary>
[ObservableProperty]
private string _uiCultureInfoName = "zh-Hans";
}
@@ -0,0 +1,192 @@
using BetterGenshinImpact.GameTask.AutoFight.Model;
using BetterGenshinImpact.Model;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
namespace BetterGenshinImpact.Core.Config;
[Serializable]
public partial class PathingConditionConfig : ObservableObject
{
// 地图追踪条件配置
[ObservableProperty]
private ObservableCollection<Condition> _partyConditions = [];
[ObservableProperty]
private ObservableCollection<Condition> _avatarConditions = [];
// 只在传送传送点时复活
[ObservableProperty]
private bool _onlyInTeleportRecover = false;
// 使用小道具的间隔时间(ms)
[ObservableProperty]
private int _useGadgetIntervalMs = 0;
public static PathingConditionConfig Default => new()
{
AvatarConditions =
[
new Condition
{
Subject = "队伍中角色",
Object = ["绮良良", "莱依拉", "茜特菈莉", "芭芭拉", "七七"],
Result = "循环短E"
},
new Condition
{
Subject = "队伍中角色",
Object = ["钟离"],
Result = "循环长E"
},
new Condition
{
Subject = "队伍中角色",
Object = ["迪希雅"],
Result = "作为主要行走角色"
}
]
};
/// <summary>
/// 找出当前应该切换的队伍名称
/// </summary>
/// <param name="materialName">采集物名称</param>
/// <param name="specialActions">特殊动作</param>
/// <returns></returns>
public string? FilterPartyName(string? materialName, List<string?> specialActions)
{
if (specialActions is { Count: > 0 })
{
// 特殊动作匹配队伍名
foreach (var action in specialActions)
{
if (string.IsNullOrEmpty(action))
{
continue;
}
if (!ConditionDefinitions.ActionCnDic.TryGetValue(action, out var actionCn))
{
continue; // 不校验
}
var condition = PartyConditions.FirstOrDefault(c => c.Subject == "动作" && c.Object.Contains(actionCn));
if (condition is { Result: not null })
{
return condition.Result;
}
}
}
// 采集物匹配队伍名
Condition? materialCondition = null;
if (!string.IsNullOrEmpty(materialName))
{
materialCondition = PartyConditions.FirstOrDefault(c => c.Subject == "采集物" && c.Object.Contains(materialName));
}
if (materialCondition is { Result: not null })
{
return materialCondition.Result;
}
else
{
materialCondition = PartyConditions.FirstOrDefault(c => c.Subject == "采集物" && c.Object.Contains("全部"));
if (materialCondition is { Result: not null })
{
return materialCondition.Result;
}
}
return null;
}
/// <summary>
/// 通过条件配置生成队伍配置
/// </summary>
/// <returns></returns>
public PathingPartyConfig BuildPartyConfigByCondition(CombatScenes combatScenes)
{
PathingPartyConfig partyConfig = PathingPartyConfig.BuildDefault();
// 使用最优先匹配上的条件
foreach (var avatarCondition in AvatarConditions)
{
if (avatarCondition.Result == "循环短E" || avatarCondition.Result == "循环长E")
{
foreach (var avatar in combatScenes.Avatars)
{
if (avatarCondition is { Object: not null } && avatarCondition.Object.Contains(avatar.Name))
{
partyConfig.GuardianAvatarIndex = avatar.Index.ToString();
if (avatarCondition.Result == "循环长E")
{
partyConfig.GuardianElementalSkillLongPress = true;
partyConfig.GuardianElementalSkillSecondInterval = avatar.SkillHoldCd.ToString(CultureInfo.CurrentCulture);
}
else
{
partyConfig.GuardianElementalSkillLongPress = false;
partyConfig.GuardianElementalSkillSecondInterval = avatar.SkillCd.ToString(CultureInfo.CurrentCulture);
}
break;
}
}
if (!string.IsNullOrEmpty(partyConfig.GuardianAvatarIndex))
{
break;
}
}
}
foreach (var avatarCondition in AvatarConditions)
{
if (avatarCondition.Result == "作为主要行走角色")
{
foreach (var avatar in combatScenes.Avatars)
{
if (avatarCondition is { Object: not null } && avatarCondition.Object.Contains(avatar.Name))
{
partyConfig.MainAvatarIndex = avatar.Index.ToString();
break;
}
}
if (!string.IsNullOrEmpty(partyConfig.MainAvatarIndex))
{
break;
}
}
}
// 默认元素力采集角色
// var elementalCollectAvatars = ElementalCollectAvatarConfigs.Lists;
// foreach (var avatar in combatScenes.Avatars)
// {
// var elementalCollectAvatar = elementalCollectAvatars.FirstOrDefault(x => x.Name == avatar.Name);
// if (elementalCollectAvatar != null)
// {
// if (elementalCollectAvatar.ElementalType == ElementalType.Hydro)
// {
// partyConfig.HydroCollectAvatarIndex = avatar.Index.ToString();
// }
// else if (elementalCollectAvatar.ElementalType == ElementalType.Electro)
// {
// partyConfig.ElectroCollectAvatarIndex = avatar.Index.ToString();
// }
// else if (elementalCollectAvatar.ElementalType == ElementalType.Anemo)
// {
// partyConfig.AnemoCollectAvatarIndex = avatar.Index.ToString();
// }
// }
// }
return partyConfig;
}
}
@@ -0,0 +1,111 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.GameTask.AutoFight;
namespace BetterGenshinImpact.Core.Config;
[Serializable]
public partial class PathingPartyConfig : ObservableObject
{
// 配置是否启用,不启用会使用地图追踪内的条件配置
[ObservableProperty]
private bool _enabled = false;
// 是否启用自动拾取
[ObservableProperty]
private bool _autoPickEnabled = true;
// 切换到队伍的名称
[ObservableProperty]
private string _partyName = string.Empty;
// 切换队伍前是否前往须弥七天神像
[ObservableProperty]
private bool _isVisitStatueBeforeSwitchParty = false;
// 主要行走追踪的角色编号
[ObservableProperty]
private string _mainAvatarIndex = string.Empty;
// [盾角]使用元素战技的角色编号
[ObservableProperty]
private string _guardianAvatarIndex = string.Empty;
// [盾角]使用元素战技的时间间隔(s)
[ObservableProperty]
private string _guardianElementalSkillSecondInterval = string.Empty;
// [盾角]使用元素战技的方式 长按/短按
[ObservableProperty]
private bool _guardianElementalSkillLongPress = false;
// // normal_attack 配置几号位
// [ObservableProperty]
// private string _normalAttackAvatarIndex = string.Empty;
//
// // elemental_skill 配置几号位
// [ObservableProperty]
// private string _elementalSkillAvatarIndex = string.Empty;
// // hydro_collect 配置几号位
// [ObservableProperty]
// private string _hydroCollectAvatarIndex = string.Empty;
//
// // electro_collect 配置几号位
// [ObservableProperty]
// private string _electroCollectAvatarIndex = string.Empty;
//
// // anemo_collect 配置几号位
// [ObservableProperty]
// private string _anemoCollectAvatarIndex = string.Empty;
[JsonIgnore]
public List<string> AvatarIndexList { get; } = ["", "1", "2", "3", "4"];
// 只在传送传送点时复活
[ObservableProperty]
private bool _onlyInTeleportRecover = false;
//允许在jsScript脚本中使用此地图追踪配置
[ObservableProperty]
private bool _jsScriptUseEnabled = false;
//允许在此调度器中(一般在JS脚本中)调用自动战斗任务时,采用此追踪配置里的战斗策略
[ObservableProperty]
private bool _soloTaskUseFightEnabled = false;
//不在某时执行
[ObservableProperty]
private string _skipDuring = "";
// 使用小道具的间隔时间
[ObservableProperty]
private int _useGadgetIntervalMs = 0;
// 启用进入剧情自动脱离
[ObservableProperty]
private bool _autoSkipEnabled = true;
// 自动冲刺启用
[ObservableProperty]
private bool _autoRunEnabled = true;
//启用自动战斗配置
[ObservableProperty]
private bool _autoFightEnabled = false;
[ObservableProperty]
private AutoFightConfig _autoFightConfig = new();
public static PathingPartyConfig BuildDefault()
{
// 即便是不启用的情况下也设置默认值,减少后续使用的判断
var pathingConditionConfig = TaskContext.Instance().Config.PathingConditionConfig;
return new PathingPartyConfig
{
OnlyInTeleportRecover = pathingConditionConfig.OnlyInTeleportRecover,
UseGadgetIntervalMs = pathingConditionConfig.UseGadgetIntervalMs
};
}
}
@@ -3,6 +3,7 @@ using SharpDX.DirectInput;
using System;
using System.Threading;
using System.Threading.Tasks;
using Vanara.PInvoke;
namespace BetterGenshinImpact.Core.Monitor;
@@ -11,6 +12,8 @@ public class DirectInputMonitor : IDisposable
private bool _isRunning = true;
private readonly Mouse _mouse;
public static int Interval = 5;
public DirectInputMonitor()
{
@@ -34,8 +37,8 @@ public class DirectInputMonitor : IDisposable
_mouse.Acquire();
MouseState state = _mouse.GetCurrentState();
// Debug.WriteLine($"{state.X} {state.Y} {state.Buttons[0]} {state.Buttons[1]}");
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveBy(state);
Thread.Sleep(5); // 10ms, equivalent to CLOCKS_PER_SEC/100
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveBy(state, Kernel32.GetTickCount());
Thread.Sleep(Interval); // 10ms, equivalent to CLOCKS_PER_SEC/100
}
});
}
@@ -1,4 +1,5 @@
using BetterGenshinImpact.Core.Recorder;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recorder;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Model;
@@ -18,6 +19,10 @@ public class MouseKeyMonitor
/// </summary>
private readonly Timer _fTimer = new();
private Keys _pickUpKey = Keys.F;
private User32.VK _pickUpKeyCode = User32.VK.VK_F;
//private readonly Random _random = new();
/// <summary>
@@ -25,6 +30,10 @@ public class MouseKeyMonitor
/// </summary>
private readonly Timer _spaceTimer = new();
private Keys _releaseControlKey = Keys.Space;
private User32.VK _releaseControlKeyCode = User32.VK.VK_SPACE;
private DateTime _firstFKeyDownTime = DateTime.MaxValue;
/// <summary>
@@ -46,27 +55,33 @@ public class MouseKeyMonitor
_globalHook.MouseDownExt += GlobalHookMouseDownExt;
_globalHook.MouseUpExt += GlobalHookMouseUpExt;
_globalHook.MouseMoveExt += GlobalHookMouseMoveExt;
_globalHook.MouseWheelExt += GlobalHookMouseWheelExt;
//_globalHook.KeyPress += GlobalHookKeyPress;
_pickUpKey = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToWinFormKeys();
_pickUpKeyCode = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToVK();
_releaseControlKey = TaskContext.Instance().Config.KeyBindingsConfig.Jump.ToWinFormKeys();
_releaseControlKeyCode = TaskContext.Instance().Config.KeyBindingsConfig.Jump.ToVK();
_firstSpaceKeyDownTime = DateTime.MaxValue;
var si = TaskContext.Instance().Config.MacroConfig.SpaceFireInterval;
_spaceTimer.Interval = si;
_spaceTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_SPACE); };
_spaceTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(_releaseControlKeyCode); };
var fi = TaskContext.Instance().Config.MacroConfig.FFireInterval;
_fTimer.Interval = fi;
_fTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_F); };
_fTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(_pickUpKeyCode); };
}
private void GlobalHookKeyDown(object? sender, KeyEventArgs e)
{
// Debug.WriteLine("KeyDown: \t{0}", e.KeyCode);
GlobalKeyMouseRecord.Instance.GlobalHookKeyDown(e);
GlobalKeyMouseRecord.Instance.GlobalHookKeyDown(e, Kernel32.GetTickCount());
// 热键按下事件
HotKeyDown(sender, e);
if (e.KeyCode == Keys.Space)
if (e.KeyCode == _releaseControlKey)
{
if (_firstSpaceKeyDownTime == DateTime.MaxValue)
{
@@ -80,7 +95,7 @@ public class MouseKeyMonitor
_spaceTimer.Start();
}
}
else if (e.KeyCode == Keys.F)
else if (e.KeyCode == _pickUpKey)
{
if (_firstFKeyDownTime == DateTime.MaxValue)
{
@@ -99,12 +114,12 @@ public class MouseKeyMonitor
private void GlobalHookKeyUp(object? sender, KeyEventArgs e)
{
// Debug.WriteLine("KeyUp: \t{0}", e.KeyCode);
GlobalKeyMouseRecord.Instance.GlobalHookKeyUp(e);
GlobalKeyMouseRecord.Instance.GlobalHookKeyUp(e, Kernel32.GetTickCount());
// 热键松开事件
HotKeyUp(sender, e);
if (e.KeyCode == Keys.Space)
if (e.KeyCode == _releaseControlKey)
{
if (_firstSpaceKeyDownTime != DateTime.MaxValue)
{
@@ -114,7 +129,7 @@ public class MouseKeyMonitor
_spaceTimer.Stop();
}
}
else if (e.KeyCode == Keys.F)
else if (e.KeyCode == _pickUpKey)
{
if (_firstFKeyDownTime != DateTime.MaxValue)
{
@@ -166,6 +181,12 @@ public class MouseKeyMonitor
// Debug.WriteLine("MouseMove: {0}; \t Location: {1};\t System Timestamp: {2}", e.Button, e.Location, e.Timestamp);
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveTo(e);
}
private void GlobalHookMouseWheelExt(object? sender, MouseEventExtArgs e)
{
// Debug.WriteLine("MouseMove: {0}; \t Location: {1};\t Delta: {2};\t System Timestamp: {3}", e.Button, e.Location, e.Delta, e.Timestamp);
GlobalKeyMouseRecord.Instance.GlobalHookMouseWheel(e);
}
public void Unsubscribe()
{
@@ -176,6 +197,7 @@ public class MouseKeyMonitor
_globalHook.MouseDownExt -= GlobalHookMouseDownExt;
_globalHook.MouseUpExt -= GlobalHookMouseUpExt;
_globalHook.MouseMoveExt -= GlobalHookMouseMoveExt;
_globalHook.MouseWheelExt -= GlobalHookMouseWheelExt;
//_globalHook.KeyPress -= GlobalHookKeyPress;
_globalHook.Dispose();
}
@@ -1,18 +1,33 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace BetterGenshinImpact.Core.Recognition.OCR;
public class OcrFactory
{
// public static IOcrService Media = Create(OcrEngineTypes.Media);
public static IOcrService Paddle { get; } = Create(OcrEngineTypes.Paddle);
public static IOcrService Paddle { get; private set; } = Create(OcrEngineTypes.Paddle);
public static IOcrService Create(OcrEngineTypes type)
public static IOcrService Create(OcrEngineTypes type, string? cultureInfoName = null)
{
return type switch
{
OcrEngineTypes.Paddle => new PaddleOcrService(),
OcrEngineTypes.Paddle => new PaddleOcrService(cultureInfoName),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
};
}
public static async Task ChangeCulture(string cultrueInfoName)
{
await Task.Run(() =>
{
lock (Paddle)
{
Paddle = Create(OcrEngineTypes.Paddle, cultrueInfoName);
GC.Collect();
}
});
}
}
@@ -21,13 +21,30 @@ public class PaddleOcrService : IOcrService
/// </summary>
private readonly PaddleOcrAll _paddleOcrAll;
public PaddleOcrService()
public PaddleOcrService(string? cultureInfoName = null)
{
var path = Global.Absolute(@"Assets\Model\PaddleOcr");
var localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4);
var localClsModel = ClassificationModel.FromDirectory(Path.Combine(path, "ch_ppocr_mobile_v2.0_cls"));
var localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_rec"), Path.Combine(path, "ppocr_keys_v1.txt"), ModelVersion.V4);
var model = new FullOcrModel(localDetModel, localClsModel, localRecModel);
DetectionModel localDetModel;
RecognizationModel localRecModel;
FullOcrModel model;
switch (cultureInfoName)
{
case "zh-Hant":
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4); // 和简中共用一下det
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "chinese_cht_PP-OCRv3_rec_infer"), Path.Combine(path, "chinese_cht_dict.txt"), ModelVersion.V3);
//model = OnlineFullModels.TraditionalChineseV3.DownloadAsync().Result;
break;
case "fr":
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "en_PP-OCRv3_det_infer"), ModelVersion.V3);
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "latin_PP-OCRv3_rec_infer"), Path.Combine(path, "latin_dict.txt"), ModelVersion.V3);
break;
default:
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4);
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_rec"), Path.Combine(path, "ppocr_keys_v1.txt"), ModelVersion.V4);
break;
}
model = new FullOcrModel(localDetModel, localRecModel);
// Action<PaddleConfig> device = TaskContext.Instance().Config.InferenceDevice switch
// {
// "CPU" => PaddleDevice.Onnx(),
@@ -8,6 +8,7 @@ using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Text.Json;
using BetterGenshinImpact.View.Drawable;
namespace BetterGenshinImpact.Core.Recognition.ONNX;
@@ -45,6 +46,16 @@ public class BgiYoloV8Predictor(string modelRelativePath) : IDisposable
}
}
Debug.WriteLine("YOLOv8识别结果:" + JsonSerializer.Serialize(dict));
var list = new List<RectDrawable>();
foreach (var box in result.Boxes)
{
var rect = new Rect(box.Bounds.X, box.Bounds.Y, box.Bounds.Width, box.Bounds.Height);
list.Add(region.ToRectDrawable(rect, modelRelativePath));
}
VisionContext.Instance().DrawContent.PutOrRemoveRectList(modelRelativePath, list);
return dict;
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace BetterGenshinImpact.Core.Recognition.ONNX;
public class BgiYoloV8PredictorFactory
{
static Dictionary<string, BgiYoloV8Predictor> _predictors = new();
public static BgiYoloV8Predictor GetPredictor(string modelRelativePath)
{
if (!_predictors.ContainsKey(modelRelativePath))
{
_predictors[modelRelativePath] = new BgiYoloV8Predictor(modelRelativePath);
}
return _predictors[modelRelativePath];
}
}
@@ -7,7 +7,6 @@ using OpenCvSharp.XFeatures2D;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
@@ -137,10 +136,10 @@ public class FeatureMatcher
/// <summary>
/// 合并邻近的特征点后匹配(临近特征)
/// </summary>
/// <param name="queryMat">查询的图</param>
/// <param name="queryMat">查询图像的 Mat 对象。</param>
/// <param name="prevX">上次匹配到的坐标x</param>
/// <param name="prevY">上次匹配到的坐标y</param>
/// <param name="queryMatMask">查询Mask</param>
/// <param name="queryMatMask">查询图像的 Mask,用于限定检测特征的区域。</param>
/// <returns></returns>
public Point2f Match(Mat queryMat, float prevX, float prevY, Mat? queryMatMask = null)
{
@@ -151,18 +150,17 @@ public class FeatureMatcher
Debug.WriteLine($"---------切换到新的特征块({cellRow},{cellCol}),合并特征点--------");
_lastMergedBlock = KeyPointFeatureBlockHelper.MergeNeighboringFeatures(_blocks, _trainDescriptors, cellRow, cellCol);
}
return Match(_lastMergedBlock.KeyPointArray, _lastMergedBlock.Descriptor!, queryMat, queryMatMask);
}
/// <summary>
/// 普通匹配
/// 用于从训练图像和查询图像中找到匹配的特征点,计算透视变换并确定查询图像的中心点在训练图像中的位置。
/// </summary>
/// <param name="trainKeyPoints"></param>
/// <param name="trainDescriptors"></param>
/// <param name="queryMat"></param>
/// <param name="queryMatMask"></param>
/// <param name="matcherType"></param>
/// <param name="trainKeyPoints">训练图像中的关键点集合。</param>
/// <param name="trainDescriptors">训练图像的特征描述子。</param>
/// <param name="queryMat">查询图像的 Mat 对象。</param>
/// <param name="queryMatMask">查询图像的 Mask,用于限定检测特征的区域。</param>
/// <param name="matcherType">描述符匹配器的类型,默认为 DescriptorMatcherType.FlannBased</param>
/// <returns></returns>
public Point2f Match(KeyPoint[] trainKeyPoints, Mat trainDescriptors, Mat queryMat, Mat? queryMatMask = null,
DescriptorMatcherType matcherType = DescriptorMatcherType.FlannBased)
@@ -5,39 +5,32 @@ using System.IO;
namespace BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
public class FeatureStorage(string name)
public class FeatureStorage
{
private readonly string rootPath = Global.Absolute(@"Assets\Map\");
private readonly string _rootPath;
private readonly string _name;
public void SetType(Feature2DType type)
{
TypeName = type.ToString();
}
public string TypeName { get; set; } = "UNKNOWN";
public FeatureStorage(string name)
{
_name = name;
_rootPath = Global.Absolute(@"Assets\Map\");
}
public FeatureStorage(string name, string rootPath)
{
_name = name;
_rootPath = rootPath;
}
// public KeyPoint[]? LoadKeyPointArray1()
// {
// CreateFolder();
// string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
// if (File.Exists(kpPath))
// {
// return ObjectUtils.Deserialize(File.ReadAllBytes(kpPath)) as KeyPoint[];
// }
// return null;
// }
//
// public void SaveKeyPointArray1(KeyPoint[] kpArray)
// {
// CreateFolder();
// string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
// File.WriteAllBytes(kpPath, ObjectUtils.Serialize(kpArray));
// }
public string TypeName { get; set; } = "UNKNOWN";
public KeyPoint[]? LoadKeyPointArray()
{
CreateFolder();
string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
string kpPath = Path.Combine(_rootPath, $"{_name}_{TypeName}.kp");
if (File.Exists(kpPath))
{
FileStorage fs = new(kpPath, FileStorage.Modes.Read);
@@ -51,7 +44,7 @@ public class FeatureStorage(string name)
public void SaveKeyPointArray(KeyPoint[] kpArray)
{
CreateFolder();
string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
string kpPath = Path.Combine(_rootPath, $"{_name}_{TypeName}.kp");
FileStorage fs = new(kpPath, FileStorage.Modes.Write);
fs.Write("kp", kpArray);
fs.Release();
@@ -59,42 +52,16 @@ public class FeatureStorage(string name)
private void CreateFolder()
{
if (Directory.Exists(rootPath) == false)
if (Directory.Exists(_rootPath) == false)
{
Directory.CreateDirectory(rootPath);
Directory.CreateDirectory(_rootPath);
}
}
// public Mat? LoadDescMat1()
// {
// CreateFolder();
// // 格式: Surf_336767x128.mat
// var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}_*.mat", SearchOption.AllDirectories);
// if (files.Length == 0)
// {
// return null;
// }
// else if (files.Length > 1)
// {
// Debug.WriteLine($"[FeatureSerializer] Found multiple files: {string.Join(", ", files)}");
// }
// var rowColPair = Path.GetFileNameWithoutExtension(files[0])
// .Replace($"{name}_{TypeName}_", "")
// .Split('x');
// if (rowColPair.Length != 2)
// {
// Debug.WriteLine($"[FeatureSerializer] Invalid file name: {files[0]}");
// return null;
// }
// GCHandle pinnedArray = GCHandle.Alloc(ObjectUtils.Deserialize(File.ReadAllBytes(files[0])), GCHandleType.Pinned);
// IntPtr pointer = pinnedArray.AddrOfPinnedObject();
// return new Mat(Convert.ToInt32(rowColPair[0]), Convert.ToInt32(rowColPair[1]), MatType.CV_32FC1, pointer);
// }
public Mat? LoadDescMat()
{
CreateFolder();
var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}.mat", SearchOption.AllDirectories);
var files = Directory.GetFiles(_rootPath, $"{_name}_{TypeName}.mat", SearchOption.AllDirectories);
if (files.Length == 0)
{
return null;
@@ -109,34 +76,17 @@ public class FeatureStorage(string name)
return mat;
}
// public void SaveDescMat1(Mat descMat)
// {
// CreateFolder();
// // 删除旧文件
// var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}_*.mat", SearchOption.AllDirectories);
// foreach (var file in files)
// {
// File.Delete(file);
// }
//
// var descPath = Path.Combine(rootPath, $"{name}_{TypeName}_{descMat.Rows}x{descMat.Cols}.mat");
// var bytes = new byte[descMat.Step(0) * descMat.Rows]; // matSrcRet.Total() * matSrcRet.ElemSize()
// Marshal.Copy(descMat.Data, bytes, 0, bytes.Length);
// File.WriteAllBytes(descPath, ObjectUtils.Serialize(bytes));
// }
public void SaveDescMat(Mat descMat)
{
CreateFolder();
// 删除旧文件
var fileName = $"{name}_{TypeName}.mat";
var files = Directory.GetFiles(rootPath, fileName, SearchOption.AllDirectories);
var fileName = $"{_name}_{TypeName}.mat";
var files = Directory.GetFiles(_rootPath, fileName, SearchOption.AllDirectories);
foreach (var file in files)
{
File.Delete(file);
}
var descPath = Path.Combine(rootPath, fileName);
var descPath = Path.Combine(_rootPath, fileName);
FileStorage fs = new(descPath, FileStorage.Modes.Write);
fs.Write("desc", descMat);
fs.Release();
@@ -20,6 +20,9 @@ public class RecognitionObject
/// </summary>
public Rect RegionOfInterest { get; set; }
/// <summary>
/// 识别对象名称,可以为空
/// </summary>
public string? Name { get; set; }
#region 模板匹配
@@ -91,6 +94,29 @@ public class RecognitionObject
if (UseMask && TemplateImageMat != null && MaskMat == null) MaskMat = OpenCvCommonHelper.CreateMask(TemplateImageMat, MaskColor.ToScalar());
return this;
}
public static RecognitionObject TemplateMatch(Mat mat)
{
var ro = new RecognitionObject
{
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = mat,
};
return ro.InitTemplate();
}
public static RecognitionObject TemplateMatch(Mat mat, double x, double y, double w, double h)
{
var ro = new RecognitionObject
{
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = mat,
RegionOfInterest = new Rect((int)Math.Round(x), (int)Math.Round(y), (int)Math.Round(w), (int)Math.Round(h))
};
return ro.InitTemplate();
}
#endregion 模板匹配
@@ -144,5 +170,28 @@ public class RecognitionObject
/// </summary>
public List<string> RegexMatchText { get; set; } = [];
public static RecognitionObject Ocr(double x, double y, double w, double h)
{
return new RecognitionObject
{
RecognitionType = RecognitionTypes.Ocr,
RegionOfInterest = new Rect((int)Math.Round(x), (int)Math.Round(y), (int)Math.Round(w), (int)Math.Round(h))
};
}
public static RecognitionObject Ocr(Rect rect)
{
return new RecognitionObject
{
RecognitionType = RecognitionTypes.Ocr,
RegionOfInterest = rect
};
}
public static RecognitionObject OcrThis = new()
{
RecognitionType = RecognitionTypes.Ocr
};
#endregion OCR文字识别
}
@@ -8,7 +8,7 @@
// using BetterGenshinImpact.GameTask.Common.Element.Assets;
// using BetterGenshinImpact.GameTask.Common.Map;
// using BetterGenshinImpact.GameTask.Model.Area;
// using BetterGenshinImpact.GameTask.Model.Enum;
//
// using BetterGenshinImpact.View.Drawable;
// using BetterGenshinImpact.ViewModel.Pages;
// using Microsoft.Extensions.Logging;
@@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
using SharpDX.DirectInput;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Forms;
using Wpf.Ui.Violeta.Controls;
@@ -114,7 +115,7 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
ra.Dispose();
}
public void GlobalHookKeyDown(KeyEventArgs e)
public void GlobalHookKeyDown(KeyEventArgs e, uint time)
{
// 排除热键
if (e.KeyCode.ToString() == TaskContext.Instance().Config.HotKeyConfig.KeyMouseMacroRecordHotkey)
@@ -138,10 +139,10 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
_keyDownState.Add(e.KeyCode, true);
}
// Debug.WriteLine($"KeyDown: {e.KeyCode}");
_recorder?.KeyDown(e);
_recorder?.KeyDown(e, time);
}
public void GlobalHookKeyUp(KeyEventArgs e)
public void GlobalHookKeyUp(KeyEventArgs e, uint time)
{
if (e.KeyCode.ToString() == TaskContext.Instance().Config.HotKeyConfig.Test1Hotkey)
{
@@ -152,7 +153,7 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
{
// Debug.WriteLine($"KeyUp: {e.KeyCode}");
_keyDownState[e.KeyCode] = false;
_recorder?.KeyUp(e);
_recorder?.KeyUp(e, time);
}
}
@@ -177,15 +178,21 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
// Debug.WriteLine($"MouseMove: {e.X}, {e.Y}");
_recorder?.MouseMoveTo(e);
}
public void GlobalHookMouseWheel(MouseEventExtArgs e)
{
// Debug.WriteLine($"MouseWheel: {e.Delta}");
_recorder?.MouseWheel(e);
}
public void GlobalHookMouseMoveBy(MouseState state)
public void GlobalHookMouseMoveBy(MouseState state, uint time)
{
if (state is { X: 0, Y: 0 } || !_isInMainUi)
{
return;
}
// Debug.WriteLine($"MouseMoveBy: {state.X}, {state.Y}");
_recorder?.MouseMoveBy(state);
_recorder?.MouseMoveBy(state, time);
}
}
@@ -12,6 +12,7 @@ using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Fischless.WindowsInput;
using Vanara.PInvoke;
using Wpf.Ui.Violeta.Controls;
@@ -48,7 +49,7 @@ public class KeyMouseMacroPlayer
public static async Task PlayMacro(List<MacroEvent> macroEvents, CancellationToken ct)
{
WorkingArea = PrimaryScreen.WorkingArea;
var startTime = DateTime.UtcNow;
var startTime = Kernel32.GetTickCount();
foreach (var e in macroEvents)
{
if (ct.IsCancellationRequested)
@@ -56,23 +57,42 @@ public class KeyMouseMacroPlayer
return;
}
var timeToWait = (int)(e.Time - (DateTime.UtcNow - startTime).TotalMilliseconds);
var timeToWait = e.Time - (Kernel32.GetTickCount() - startTime);
if (timeToWait < 0)
{
TaskControl.Logger.LogWarning("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), -timeToWait);
TaskControl.Logger.LogDebug("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), (-timeToWait).ToString("F0"));
}
else
{
await Task.Delay(timeToWait, ct);
await Task.Delay((int)timeToWait, ct);
}
switch (e.Type)
{
case MacroEventType.KeyDown:
Simulation.SendInput.Keyboard.KeyDown((User32.VK)e.KeyCode!);
break;
var vkDown = (User32.VK)e.KeyCode!;
if (InputBuilder.IsExtendedKey(vkDown))
{
Simulation.SendInput.Keyboard.KeyDown(false, vkDown);
}
else
{
Simulation.SendInput.Keyboard.KeyDown(vkDown);
}
break;
case MacroEventType.KeyUp:
Simulation.SendInput.Keyboard.KeyUp((User32.VK)e.KeyCode!);
var vkUp = (User32.VK)e.KeyCode!;
if (InputBuilder.IsExtendedKey(vkUp))
{
Simulation.SendInput.Keyboard.KeyUp(false, vkUp);
}
else
{
Simulation.SendInput.Keyboard.KeyUp(vkUp);
}
break;
case MacroEventType.MouseDown:
@@ -145,11 +165,21 @@ public class KeyMouseMacroPlayer
Simulation.SendInput.Mouse.MoveMouseTo(ToVirtualDesktopX(e.MouseX), ToVirtualDesktopY(e.MouseY));
break;
case MacroEventType.MouseWheel:
var num = (int)(e.MouseY / 120.0);
if (num != 0)
{
// 不支持多次的场景,但是不会出现这种情况
Simulation.SendInput.Mouse.VerticalScroll(num);
}
break;
case MacroEventType.MouseMoveBy:
if (e.CameraOrientation != null)
{
var cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcGreyMat);
var diff = (cao - (int)e.CameraOrientation + 180) % 360 - 180;
var cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcMat);
var diff = ((int)Math.Round(cao) - (int)e.CameraOrientation + 180) % 360 - 180;
diff += diff < -180 ? 360 : 0;
//过滤一下特别大的角度偏差
if (diff != 0 && diff < 8 && diff > -8)
@@ -158,6 +188,7 @@ public class KeyMouseMacroPlayer
e.MouseX -= diff;
}
}
Simulation.SendInput.Mouse.MoveMouseBy(e.MouseX, e.MouseY);
break;
@@ -178,4 +209,4 @@ public class KeyMouseMacroPlayer
{
return y * 65535 * 1d / WorkingArea.Height;
}
}
}
@@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Windows.Forms;
using Vanara.PInvoke;
namespace BetterGenshinImpact.Core.Recorder;
@@ -16,7 +17,7 @@ public class KeyMouseRecorder
{
public List<MacroEvent> MacroEvents { get; } = [];
public DateTime StartTime { get; set; } = DateTime.UtcNow;
public uint StartTime { get; set; } = Kernel32.GetTickCount();
public DateTime LastOrientationDetection { get; set; } = DateTime.UtcNow;
@@ -34,6 +35,11 @@ public class KeyMouseRecorder
public string ToJsonMacro()
{
// MacroEvents 需要以实际时间进行排序
MacroEvents.Sort((a, b) => a.Time.CompareTo(b.Time));
// 删除为负数的时间
MacroEvents.RemoveAll(m => m.Time < 0);
var rect = TaskContext.Instance().SystemInfo.CaptureAreaRect;
// 合并鼠标移动事件
var mergedMacroEvents = new List<MacroEvent>();
@@ -89,6 +95,10 @@ public class KeyMouseRecorder
break;
}
}
if (currentMerge != null)
{
mergedMacroEvents.Add(currentMerge);
}
KeyMouseScript keyMouseScript = new()
{
MacroEvents = mergedMacroEvents,
@@ -104,23 +114,23 @@ public class KeyMouseRecorder
return JsonSerializer.Serialize(keyMouseScript, JsonOptions);
}
public void KeyDown(KeyEventArgs e)
public void KeyDown(KeyEventArgs e, uint time)
{
MacroEvents.Add(new MacroEvent
{
Type = MacroEventType.KeyDown,
KeyCode = e.KeyValue,
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
Time = time - StartTime
});
}
public void KeyUp(KeyEventArgs e)
public void KeyUp(KeyEventArgs e, uint time)
{
MacroEvents.Add(new MacroEvent
{
Type = MacroEventType.KeyUp,
KeyCode = e.KeyValue,
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
Time = time - StartTime
});
}
@@ -132,7 +142,7 @@ public class KeyMouseRecorder
MouseX = e.X,
MouseY = e.Y,
MouseButton = e.Button.ToString(),
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
Time = e.Timestamp - StartTime
});
}
@@ -144,7 +154,7 @@ public class KeyMouseRecorder
MouseX = e.X,
MouseY = e.Y,
MouseButton = e.Button.ToString(),
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
Time = e.Timestamp - StartTime
});
}
@@ -155,28 +165,40 @@ public class KeyMouseRecorder
Type = MacroEventType.MouseMoveTo,
MouseX = e.X,
MouseY = e.Y,
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
Time = e.Timestamp - StartTime
});
}
public void MouseWheel(MouseEventExtArgs e)
{
MacroEvents.Add(new MacroEvent
{
Type = MacroEventType.MouseWheel,
MouseY = e.Delta, // 120 的倍率
Time = e.Timestamp - StartTime
});
}
public void MouseMoveBy(MouseState state)
public void MouseMoveBy(MouseState state, uint time)
{
var now = DateTime.UtcNow;
int? cao = null;
if (TaskContext.Instance().Config.RecordConfig.IsRecordCameraOrientation)
{
var now = DateTime.UtcNow;
if ((now - LastOrientationDetection).TotalMilliseconds > 100.0)
{
LastOrientationDetection = now;
cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcGreyMat);
cao = (int)Math.Round(CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcMat));
}
}
MacroEvents.Add(new MacroEvent
{
Type = MacroEventType.MouseMoveBy,
MouseX = state.X,
MouseY = state.Y,
Time = (now - StartTime).TotalMilliseconds,
Time = time - 5 - StartTime,
CameraOrientation = cao,
});
}
@@ -22,5 +22,6 @@ public enum MacroEventType
MouseMoveTo,
MouseMoveBy,
MouseDown,
MouseUp
MouseUp,
MouseWheel
}
@@ -1,20 +1,43 @@
using BetterGenshinImpact.GameTask.AutoPathing;
using BetterGenshinImpact.GameTask.AutoPathing.Model;
using System.Threading.Tasks;
using BetterGenshinImpact.Core.Config;
namespace BetterGenshinImpact.Core.Script.Dependence;
public class AutoPathingScript(string rootPath)
public class AutoPathingScript
{
private object? _config = null;
private string _rootPath;
public AutoPathingScript(string rootPath, object? config) {
_config = config;
_rootPath = rootPath;
}
public async Task Run(string json)
{
var task = PathingTask.BuildFromJson(json);
await new PathExecutor(CancellationContext.Instance.Cts).Pathing(task);
var pathExecutor = new PathExecutor(CancellationContext.Instance.Cts.Token);
if (_config != null && _config is PathingPartyConfig patyConfig ) {
pathExecutor.PartyConfig = patyConfig;
}
await pathExecutor.Pathing(task);
}
public async Task RunFile(string path)
{
var json = await new LimitedFile(rootPath).ReadText(path);
var json = await new LimitedFile(_rootPath).ReadText(path);
await Run(json);
}
/// <summary>
/// 从已订阅的内容中获取文件
/// </summary>
/// <param name="path">在 `\User\AutoPathing` 目录下获取文件</param>
public async Task RunFileFromUser(string path)
{
var json = await new LimitedFile(Global.Absolute(@"User\AutoPathing")).ReadText(path);
await Run(json);
}
}
@@ -4,35 +4,81 @@ using BetterGenshinImpact.ViewModel.Pages;
using System;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.AutoDomain;
using BetterGenshinImpact.GameTask.AutoFishing;
using BetterGenshinImpact.GameTask.AutoWood;
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
using BetterGenshinImpact.GameTask.AutoPathing.Handler;
namespace BetterGenshinImpact.Core.Script.Dependence;
public class Dispatcher
{
private object _config = null;
public Dispatcher(object config)
{
_config = config;
}
public void RunTask()
{
}
/// <summary>
/// 添加实时任务
/// 添加实时任务,会清理之前的所有任务
/// </summary>
/// <param name="timer">实时任务触发器</param>
/// <exception cref="ArgumentNullException"></exception>
public void AddTimer(RealtimeTimer timer)
{
ClearAllTriggers();
try
{
AddTrigger(timer);
}
catch (ArgumentException e)
{
if (e is ArgumentNullException)
{
throw;
}
}
}
/// <summary>
/// 清理所有实时任务
/// </summary>
public void ClearAllTriggers()
{
TaskTriggerDispatcher.Instance().ClearTriggers();
}
/// <summary>
/// 添加实时任务,不会清理之前的任务
/// </summary>
/// <param name="timer"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public void AddTrigger(RealtimeTimer timer)
{
var realtimeTimer = timer;
if (realtimeTimer == null)
{
throw new ArgumentNullException(nameof(realtimeTimer), "实时任务对象不能为空");
}
if (string.IsNullOrEmpty(realtimeTimer.Name))
{
throw new ArgumentNullException(nameof(realtimeTimer.Name), "实时任务名称不能为空");
}
TaskTriggerDispatcher.Instance().AddTrigger(realtimeTimer.Name, realtimeTimer.Config);
if (!TaskTriggerDispatcher.Instance().AddTrigger(realtimeTimer.Name, realtimeTimer.Config))
{
throw new ArgumentException($"添加实时任务失败: {realtimeTimer.Name}", nameof(realtimeTimer.Name));
}
}
/// <summary>
/// 运行独立任务
/// </summary>
@@ -51,6 +97,7 @@ public class Dispatcher
{
throw new ArgumentNullException(nameof(soloTask), "独立任务对象不能为空");
}
var taskSettingsPageViewModel = App.GetService<TaskSettingsPageViewModel>();
if (taskSettingsPageViewModel == null)
{
@@ -61,15 +108,30 @@ public class Dispatcher
switch (soloTask.Name)
{
case "AutoGeniusInvokation":
taskSettingsPageViewModel.SwitchAutoGeniusInvokationCommand.Execute(null);
if (taskSettingsPageViewModel.GetTcgStrategy(out var content))
{
return;
}
await new AutoGeniusInvokationTask(new GeniusInvokationTaskParam(content)).Start(CancellationContext
.Instance.Cts.Token);
break;
case "AutoWood":
taskSettingsPageViewModel.SwitchAutoWoodCommand.Execute(null);
await new AutoWoodTask(new WoodTaskParam(taskSettingsPageViewModel.AutoWoodRoundNum,
taskSettingsPageViewModel.AutoWoodDailyMaxCount)).Start(CancellationContext.Instance.Cts.Token);
break;
case "AutoFight":
taskSettingsPageViewModel.SwitchAutoFightCommand.Execute(null);
/*if (taskSettingsPageViewModel.GetFightStrategy(out var path1))
{
return;
}
var autoFightConfig = TaskContext.Instance().Config.AutoFightConfig;
var param = new AutoFightParam(path1, autoFightConfig);
await new AutoFightTask(param).Start(CancellationContext.Instance.Cts.Token);*/
await new AutoFightHandler().RunAsyncByScript(CancellationContext.Instance.Cts.Token, null, _config);
break;
case "AutoDomain":
@@ -77,15 +139,21 @@ public class Dispatcher
{
return;
}
await new AutoDomainTask(new AutoDomainParam(0, path)).Start(CancellationContext.Instance.Cts);
await new AutoDomainTask(new AutoDomainParam(0, path)).Start(CancellationContext.Instance.Cts.Token);
break;
case "AutoMusicGame":
taskSettingsPageViewModel.SwitchAutoMusicGameCommand.Execute(null);
// case "AutoMusicGame":
// taskSettingsPageViewModel.SwitchAutoMusicGameCommand.Execute(null);
// break;
case "AutoFishing":
await new AutoFishingTask(AutoFishingTaskParam.BuildFromSoloTaskConfig(soloTask.Config)).Start(
CancellationContext.Instance.Cts.Token);
break;
default:
throw new ArgumentException($"未知的任务名称: {soloTask.Name}", nameof(soloTask.Name));
}
}
}
}
@@ -1,7 +1,11 @@
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.GameTask.AutoTrackPath;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.Common.Job;
using Vanara.PInvoke;
using BetterGenshinImpact.GameTask.AutoFishing;
using BetterGenshinImpact.ViewModel.Pages;
using System;
namespace BetterGenshinImpact.Core.Script.Dependence;
@@ -37,7 +41,12 @@ public class Genshin
/// <returns></returns>
public async Task Tp(double x, double y)
{
await new TpTask(CancellationContext.Instance.Cts).Tp(x, y);
await new TpTask(CancellationContext.Instance.Cts.Token).Tp(x, y);
}
public async Task Tp(double x, double y, bool force)
{
await new TpTask(CancellationContext.Instance.Cts.Token).Tp(x, y, force);
}
/// <summary>
@@ -52,4 +61,116 @@ public class Genshin
double.TryParse(y, out var dy);
await Tp(dx, dy);
}
}
public async Task Tp(string x, string y, bool force)
{
double.TryParse(x, out var dx);
double.TryParse(y, out var dy);
await Tp(dx, dy, force);
}
/// <summary>
/// 切换队伍
/// </summary>
/// <param name="partyName">队伍界面自定义的队伍名称</param>
/// <returns></returns>
public async Task SwitchParty(string partyName)
{
await new SwitchPartyTask().Start(partyName, CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 自动点击空月祝福
/// </summary>
/// <returns></returns>
public async Task BlessingOfTheWelkinMoon()
{
await new BlessingOfTheWelkinMoonTask().Start(CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 持续对话并选择目标选项
/// </summary>
/// <param name="option">选项文本</param>
/// <param name="skipTimes">跳过次数</param>
/// <param name="isOrange">是否为橙色选项</param>
/// <returns></returns>
public async Task ChooseTalkOption(string option, int skipTimes = 10, bool isOrange = false)
{
await new ChooseTalkOptionTask().SingleSelectText(option, CancellationContext.Instance.Cts.Token, skipTimes, isOrange);
}
/// <summary>
/// 一键领取纪行奖励
/// </summary>
/// <returns></returns>
public async Task ClaimBattlePassRewards()
{
await new ClaimBattlePassRewardsTask().Start(CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 领取长效历练点奖励
/// </summary>
/// <returns></returns>
public async Task ClaimEncounterPointsRewards()
{
await new ClaimEncounterPointsRewardsTask().Start(CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 前往冒险家协会领取奖励
/// </summary>
/// <param name="country">国家名称</param>
/// <returns></returns>
public async Task GoToAdventurersGuild(string country)
{
await new GoToAdventurersGuildTask().Start(country, CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 前往合成台
/// </summary>
/// <param name="country">国家名称</param>
/// <returns></returns>
public async Task GoToCraftingBench(string country)
{
await new GoToCraftingBenchTask().Start(country, CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 返回主界面
/// </summary>
/// <returns></returns>
public async Task ReturnMainUi()
{
await new ReturnMainUiTask().Start(CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 钓鱼
/// </summary>
/// <returns></returns>
public async Task AutoFishing(int fishingTimePolicy = 0)
{
var taskSettingsPageViewModel = App.GetService<TaskSettingsPageViewModel>();
if (taskSettingsPageViewModel == null)
{
throw new ArgumentNullException(nameof(taskSettingsPageViewModel), "内部视图模型对象为空");
}
var param = AutoFishingTaskParam.BuildFromConfig(TaskContext.Instance().Config.AutoFishingConfig, taskSettingsPageViewModel.SaveScreenshotOnKeyTick);
param.FishingTimePolicy = (FishingTimePolicy)fishingTimePolicy;
await new AutoFishingTask(param).Start(CancellationContext.Instance.Cts.Token);
}
/// <summary>
/// 重新登录原神
/// </summary>
/// <returns></returns>
public async Task Relogin()
{
await new ExitAndReloginJob().Start(CancellationContext.Instance.Cts.Token);
}
}
@@ -6,6 +6,10 @@ using System;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.Common;
using Vanara.PInvoke;
using static Vanara.PInvoke.User32;
using BetterGenshinImpact.Core.Simulator.Extensions;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.ViewModel.Pages;
namespace BetterGenshinImpact.Core.Script.Dependence;
@@ -20,17 +24,80 @@ public class GlobalMethod
public static void KeyDown(string key)
{
Simulation.SendInput.Keyboard.KeyDown(ToVk(key));
var vk = KeyBindingsSettingsPageViewModel.MappingKey(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(vk);
break;
}
}
public static void KeyUp(string key)
{
Simulation.SendInput.Keyboard.KeyUp(ToVk(key));
var vk = KeyBindingsSettingsPageViewModel.MappingKey(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(vk);
break;
}
}
public static void KeyPress(string key)
{
Simulation.SendInput.Keyboard.KeyPress(ToVk(key));
var vk = KeyBindingsSettingsPageViewModel.MappingKey(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(vk);
break;
}
}
private static User32.VK ToVk(string key)
@@ -45,6 +112,7 @@ public class GlobalMethod
}
}
#endregion 键盘操作
#region 鼠标操作
@@ -91,12 +159,12 @@ public class GlobalMethod
public static void Click(int x, int y)
{
MoveMouseTo(x, y);
Simulation.SendInput.Mouse.LeftButtonClick();
LeftButtonClick();
}
public static void LeftButtonClick()
{
Simulation.SendInput.Mouse.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonDown().Sleep(60).LeftButtonUp();
}
public static void LeftButtonDown()
@@ -111,7 +179,7 @@ public class GlobalMethod
public static void RightButtonClick()
{
Simulation.SendInput.Mouse.RightButtonClick();
Simulation.SendInput.Mouse.RightButtonDown().Sleep(60).RightButtonUp();
}
public static void RightButtonDown()
@@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
using OpenCvSharp;
namespace BetterGenshinImpact.Core.Script.Dependence;
@@ -59,4 +60,16 @@ public class LimitedFile(string rootPath)
return string.Empty;
}
}
/// <summary>
/// 读取Mat图片
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public Mat ReadImageMatSync(string path)
{
path = NormalizePath(path);
var mat = Mat.FromStream(File.OpenRead(path), ImreadModes.Color);
return mat;
}
}
@@ -1,4 +1,6 @@
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
using Microsoft.ClearScript;
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
/// <summary>
/// 独立任务
@@ -13,19 +15,16 @@ public class SoloTask
/// <summary>
/// 独立任务配置
/// </summary>
public object? Config;
public object? Config { get; set; }
public SoloTask(string name)
{
Name = name;
}
public SoloTask(string name, dynamic config)
public SoloTask(string name, ScriptObject config)
{
Name = name;
// if (Name == "AutoPick")
// {
// Config = ScriptObjectConverter.ConvertTo<AutoPickExternalConfig>(config);
// }
Config = config;
}
}
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using OpenCvSharp;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.Core.Config;
namespace BetterGenshinImpact.Core.Script;
@@ -17,19 +18,19 @@ public class EngineExtend
/// <param name="engine"></param>
/// <param name="workDir"></param>
/// <param name="searchPaths"></param>
public static void InitHost(IScriptEngine engine, string workDir, string[]? searchPaths = null)
public static void InitHost(IScriptEngine engine, string workDir, string[]? searchPaths = null, object? config = null)
{
// engine.AddHostObject("xHost", new ExtendedHostFunctions()); // 有越权的安全风险
// 添加我的自定义实例化对象
engine.AddHostObject("keyMouseScript", new KeyMouseScript(workDir));
engine.AddHostObject("pathingScript", new AutoPathingScript(workDir));
engine.AddHostObject("pathingScript", new AutoPathingScript(workDir, config));
engine.AddHostObject("genshin", new Dependence.Genshin());
engine.AddHostObject("log", new Log());
engine.AddHostObject("file", new LimitedFile(workDir)); // 限制文件访问
// 任务调度器
engine.AddHostObject("dispatcher", new Dispatcher());
engine.AddHostObject("dispatcher", new Dispatcher(config));
engine.AddHostType("RealtimeTimer", typeof(RealtimeTimer));
engine.AddHostType("SoloTask", typeof(SoloTask));
@@ -1,12 +1,16 @@
using BetterGenshinImpact.Service;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Text.Json;
namespace BetterGenshinImpact.Core.Script.Group;
/// <summary>
/// 调度器 配置组
/// </summary>
public partial class ScriptGroup : ObservableObject
{
public int Index { get; set; }
@@ -14,6 +18,9 @@ public partial class ScriptGroup : ObservableObject
[ObservableProperty]
private string _name = string.Empty;
[ObservableProperty]
private ScriptGroupConfig _config = new();
[ObservableProperty]
private ObservableCollection<ScriptGroupProject> _projects = [];
@@ -34,6 +41,22 @@ public partial class ScriptGroup : ObservableObject
public static ScriptGroup FromJson(string json)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<ScriptGroup>(json) ?? throw new Exception("解析配置组JSON配置失败");
var group = Newtonsoft.Json.JsonConvert.DeserializeObject<ScriptGroup>(json) ?? throw new Exception("解析配置组JSON配置失败");
ResetGroupInfo(group);
return group;
}
public static void ResetGroupInfo(ScriptGroup group)
{
foreach (var project in group.Projects)
{
project.GroupInfo = group;
}
}
public void AddProject(ScriptGroupProject project)
{
project.GroupInfo = this;
Projects.Add(project);
}
}
@@ -0,0 +1,24 @@
using BetterGenshinImpact.Core.Config;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
namespace BetterGenshinImpact.Core.Script.Group;
[Serializable]
public partial class ScriptGroupConfig : ObservableObject
{
[ObservableProperty]
private PathingPartyConfig _pathingConfig = new();
/// <summary>
/// Shell 执行配置
/// </summary>
[ObservableProperty]
private ShellConfig _shellConfig = new();
/// <summary>
/// 是否启用 Shell 执行配置
/// </summary>
[ObservableProperty]
private bool _enableShellConfig;
}
@@ -4,6 +4,7 @@ using BetterGenshinImpact.Core.Script.Project;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.GameTask.AutoPathing;
using BetterGenshinImpact.GameTask.AutoPathing.Model;
using BetterGenshinImpact.GameTask.Shell;
using BetterGenshinImpact.ViewModel.Pages;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
@@ -64,6 +65,19 @@ public partial class ScriptGroupProject : ObservableObject
public ExpandoObject? JsScriptSettingsObject { get; set; }
/// <summary>
/// 所属配置组
/// </summary>
[JsonIgnore]
public ScriptGroup? GroupInfo { get; set; }
/// <summary>
/// 下一个从此执行标志
/// </summary>
[JsonIgnore]
[ObservableProperty]
public bool? _nextFlag = false;
public ScriptGroupProject()
{
}
@@ -99,6 +113,11 @@ public partial class ScriptGroupProject : ObservableObject
return new ScriptGroupProject(name, name, "KeyMouse");
}
public static ScriptGroupProject BuildShellProject(string command)
{
return new ScriptGroupProject(command, "", "Shell");
}
public static ScriptGroupProject BuildPathingProject(string name, string folder)
{
return new ScriptGroupProject(name, folder, "Pathing");
@@ -124,24 +143,45 @@ public partial class ScriptGroupProject : ObservableObject
{
throw new Exception("JS脚本未初始化");
}
await Project.ExecuteAsync(JsScriptSettingsObject);
JsScriptSettingsObject ??= new ExpandoObject();
var pathingPartyConfig = GroupInfo?.Config.PathingConfig;
if (!(pathingPartyConfig is { Enabled: true, JsScriptUseEnabled: true }))
{
pathingPartyConfig = null;
}
await Project.ExecuteAsync(JsScriptSettingsObject, pathingPartyConfig);
}
if (Type == "KeyMouse")
else if (Type == "KeyMouse")
{
// 加载并执行
var json = await File.ReadAllTextAsync(Global.Absolute(@$"User\KeyMouseScript\{Name}"));
await KeyMouseMacroPlayer.PlayMacro(json, CancellationContext.Instance.Cts.Token, false);
}
if (Type == "Pathing")
else if (Type == "Pathing")
{
// 加载并执行
var task = PathingTask.BuildFromFilePath(Path.Combine(MapPathingViewModel.PathJsonPath, FolderName, Name));
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
await new PathExecutor(CancellationContext.Instance.Cts).Pathing(task);
var pathingTask = new PathExecutor(CancellationContext.Instance.Cts.Token);
pathingTask.PartyConfig = GroupInfo?.Config.PathingConfig;
if (pathingTask.PartyConfig is null || pathingTask.PartyConfig.AutoPickEnabled)
{
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
}
await pathingTask.Pathing(task);
}
else
else if (Type == "Shell")
{
//throw new Exception("不支持的脚本类型");
ShellConfig? shellConfig = null;
if (GroupInfo?.Config.EnableShellConfig ?? false)
{
shellConfig = GroupInfo?.Config.ShellConfig;
}
var task = new ShellTask(ShellTaskParam.BuildFromConfig(Name, shellConfig ?? new ShellConfig()));
await task.Start(CancellationContext.Instance.Cts.Token);
}
}
@@ -167,7 +207,8 @@ public class ScriptGroupProjectExtensions
{
{ "Javascript", "JS脚本" },
{ "KeyMouse", "键鼠脚本" },
{ "Pathing", "路径追踪" }
{ "Pathing", "地图追踪" },
{ "Shell", "Shell" }
};
public static readonly Dictionary<string, string> StatusDescriptions = new()
@@ -4,7 +4,9 @@ using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.Model;
using Microsoft.Extensions.Logging;
namespace BetterGenshinImpact.Core.Script.Project;
@@ -49,6 +51,12 @@ public class Manifest
{
throw new FileNotFoundException("main js file not found.");
}
// 比较版本号大小 BgiVersion
if (!string.IsNullOrWhiteSpace(BgiVersion) && Global.IsNewVersion(BgiVersion))
{
TaskControl.Logger.LogError("脚本 {Name} 版本号要求 {BgiVersion} 大于当前 BetterGI 版本号 {CurrentVersion} , 脚本可能无法正常工作,请更新 BetterGI 版本!", Name, BgiVersion, Global.Version);
}
}
public List<SettingItem> LoadSettingItems(string path)
@@ -65,6 +73,7 @@ public class Manifest
var json = File.ReadAllText(settingFile);
settingItems = JsonSerializer.Deserialize<List<SettingItem>>(json, ConfigService.JsonOptions) ?? [];
}
return settingItems;
}
}
@@ -5,7 +5,9 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using BetterGenshinImpact.Core.Script.Dependence;
namespace BetterGenshinImpact.Core.Script.Project;
@@ -22,24 +24,31 @@ public class ScriptProject
{
FolderName = folderName;
ProjectPath = Path.Combine(Global.ScriptPath(), folderName);
if (!Directory.Exists(ProjectPath))
{
throw new DirectoryNotFoundException("脚本文件夹不存在:" + ProjectPath);
}
ManifestFile = Path.GetFullPath(Path.Combine(ProjectPath, "manifest.json"));
if (!File.Exists(ManifestFile))
{
throw new FileNotFoundException("manifest.json file not found.");
throw new FileNotFoundException("manifest.json文件不存在,请确认此脚本是JS脚本类型。" + ManifestFile);
}
Manifest = Manifest.FromJson(File.ReadAllText(ManifestFile));
Manifest.Validate(ProjectPath);
}
public StackPanel? LoadSettingUi(dynamic context)
public ScrollViewer? LoadSettingUi(dynamic context)
{
var settingItems = Manifest.LoadSettingItems(ProjectPath);
if (settingItems.Count == 0)
{
return null;
}
var stackPanel = new StackPanel();
var stackPanel = new StackPanel
{
Margin = new Thickness(0, 0, 20, 0) // 给右侧滚动条留出位置
};
foreach (var item in settingItems)
{
var controls = item.ToControl(context);
@@ -49,20 +58,30 @@ public class ScriptProject
}
}
return stackPanel;
var scrollViewer = new ScrollViewer
{
Content = stackPanel,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
MaxHeight = 350 // 设置最大高度
};
return scrollViewer;
}
public IScriptEngine BuildScriptEngine()
public IScriptEngine BuildScriptEngine(PathingPartyConfig? partyConfig = null)
{
IScriptEngine engine = new V8ScriptEngine(V8ScriptEngineFlags.UseCaseInsensitiveMemberBinding | V8ScriptEngineFlags.EnableTaskPromiseConversion);
EngineExtend.InitHost(engine, ProjectPath, Manifest.Library);
EngineExtend.InitHost(engine, ProjectPath, Manifest.Library,partyConfig);
return engine;
}
public async Task ExecuteAsync(dynamic? context = null)
public async Task ExecuteAsync(dynamic? context = null, PathingPartyConfig? partyConfig=null)
{
// 默认值
GlobalMethod.SetGameMetrics(1920, 1080);
// 加载代码
var code = await LoadCode();
var engine = BuildScriptEngine();
var engine = BuildScriptEngine(partyConfig);
if (context != null)
{
// 写入配置的内容
@@ -1,6 +1,7 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Script.WebView;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Helpers.Http;
using BetterGenshinImpact.Model;
using BetterGenshinImpact.View.Controls.Webview;
@@ -16,6 +17,7 @@ using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows;
using Vanara.PInvoke;
using Wpf.Ui.Violeta.Controls;
namespace BetterGenshinImpact.Core.Script;
@@ -33,7 +35,11 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
public static readonly string ReposTempPath = Path.Combine(ReposPath, "Temp");
// 中央仓库信息地址
public static readonly string CenterRepoInfoUrl = "https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/repo.json";
public static readonly List<string> CenterRepoInfoUrls =
[
"https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/repo.json",
"https://r2-script.bettergi.com/github_mirror/repo.json",
];
// 中央仓库解压后文件夹名
public static readonly string CenterRepoUnzipName = "bettergi-scripts-list-main";
@@ -54,6 +60,11 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
var scriptConfig = TaskContext.Instance().Config.ScriptConfig;
if (!Directory.Exists(ReposPath))
{
Directory.CreateDirectory(ReposPath);
}
// 判断更新周期是否到达
if (DateTime.Now - scriptConfig.LastUpdateScriptRepoTime >= TimeSpan.FromDays(scriptConfig.AutoUpdateScriptRepoPeriod))
{
@@ -81,18 +92,34 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
public async Task<(string, bool)> UpdateCenterRepo()
{
// 测速并获取信息
var res = await ProxySpeedTester.GetFastestProxyAsync(CenterRepoInfoUrl);
// 解析信息
var fastProxyUrl = res.Item1;
var jsonString = res.Item2;
var (fastUrl, jsonString) = await ProxySpeedTester.GetFastestUrlAsync(CenterRepoInfoUrls);
if (string.IsNullOrEmpty(jsonString))
{
throw new Exception("从互联网下载最新的仓库信息失败");
}
var (time, url, file) = ParseJson(jsonString);
var updated = false;
// 检查仓库是否存在,不存在则下载
if (!Directory.Exists(CenterRepoPath))
var needDownload = false;
if (Directory.Exists(CenterRepoPath))
{
await DownloadRepoAndUnzip(string.Format(fastProxyUrl, url));
var p = Directory.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
if (p is null)
{
needDownload = true;
}
}
else
{
needDownload = true;
}
if (needDownload)
{
await DownloadRepoAndUnzip(url);
updated = true;
}
@@ -108,7 +135,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
// 检查是否需要更新
if (long.Parse(time) > long.Parse(time2))
{
await DownloadRepoAndUnzip(string.Format(fastProxyUrl, url2));
await DownloadRepoAndUnzip(url2);
updated = true;
}
@@ -130,6 +157,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
throw new Exception("本地仓库缺少 repo.json");
}
// 获取与 localRepoJsonPath 同名(无扩展名)的文件夹路径
var folderName = Path.GetFileNameWithoutExtension(localRepoJsonPath);
var folderPath = Path.Combine(Path.GetDirectoryName(localRepoJsonPath)!, folderName);
@@ -137,6 +165,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
throw new Exception("本地仓库文件夹不存在");
}
return folderPath;
}
@@ -183,7 +212,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
// 删除旧文件夹
if (Directory.Exists(CenterRepoPath))
{
Directory.Delete(CenterRepoPath, true);
DirectoryHelper.DeleteReadOnlyDirectory(CenterRepoPath);
}
// 使用 System.IO.Compression 解压
@@ -193,10 +222,18 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
public async Task ImportScriptFromClipboard()
{
// 获取剪切板内容
if (Clipboard.ContainsText())
try
{
string clipboardText = Clipboard.GetText();
await ImportScriptFromUri(clipboardText, true);
if (Clipboard.ContainsText())
{
string clipboardText = Clipboard.GetText();
await ImportScriptFromUri(clipboardText, true);
}
}
catch (Exception e)
{
// 剪切板内容可能获取会失败
Console.WriteLine(e);
}
}
@@ -216,8 +253,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
Content = $"检测到{(formClipboard ? "剪切板上存在" : "")}脚本订阅链接,解析后需要导入的脚本为:{pathJson}。\n是否导入并覆盖此文件或者文件夹下的脚本?",
CloseButtonText = "关闭",
PrimaryButtonText = "确认导入",
WindowStartupLocation = WindowStartupLocation.CenterOwner,
Owner = Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
};
var result = await uiMessageBox.ShowDialogAsync();
@@ -225,6 +262,20 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
await ImportScriptFromPathJson(pathJson);
}
// ContentDialog dialog = new()
// {
// Title = "脚本订阅",
// Content = $"检测到{(formClipboard ? "剪切板上存在" : "")}脚本订阅链接,解析后需要导入的脚本为:{pathJson}。\n是否导入并覆盖此文件或者文件夹下的脚本?",
// CloseButtonText = "关闭",
// PrimaryButtonText = "确认导入",
// };
//
// var result = await dialog.ShowAsync();
// if (result == ContentDialogResult.Primary)
// {
// await ImportScriptFromPathJson(pathJson);
// }
}
if (formClipboard)
@@ -273,7 +324,31 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
Toast.Information("获取最新仓库信息中...");
// 更新仓库
var (repoPath, _) = await Task.Run(UpdateCenterRepo);
string repoPath;
try
{
(repoPath, _) = await Task.Run(UpdateCenterRepo);
}
catch (Exception e)
{
Toast.Warning("获取最新仓库信息失败,尝试使用本地已有仓库信息");
try
{
repoPath = FindCenterRepoPath();
}
catch
{
await MessageBox.ErrorAsync("本地无仓库信息,请至少成功更新一次脚本仓库信息!");
return;
}
}
if (string.IsNullOrEmpty(repoPath))
{
await MessageBox.ErrorAsync("本地无仓库信息,请至少成功更新一次脚本仓库信息!");
return;
}
// // 收集将被覆盖的文件和文件夹
// var filesToOverwrite = new List<string>();
@@ -338,13 +413,19 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
if (Directory.Exists(destPath))
{
Directory.Delete(destPath, true);
DirectoryHelper.DeleteDirectoryWithReadOnlyCheck(destPath);
}
CopyDirectory(scriptPath, destPath);
// 图标处理
DealWithIconFolder(destPath);
}
else if (File.Exists(scriptPath))
{
// 目标文件所在文件夹不存在时创建它
Directory.CreateDirectory(Path.GetDirectoryName(destPath)!);
if (File.Exists(destPath))
{
File.Delete(destPath);
@@ -379,6 +460,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
var destSubDir = Path.Combine(destDir, Path.GetFileName(dir));
CopyDirectory(dir, destSubDir);
// 图标处理
DealWithIconFolder(destSubDir);
}
}
@@ -403,11 +486,9 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
{
_webWindow = new WebpageWindow
{
Title = "enshin Copilot Scripts | BetterGI 脚本本地中央仓库",
Title = "Genshin Copilot Scripts | BetterGI 脚本本地中央仓库",
Width = 1366,
Height = 768,
// Owner = Application.Current.MainWindow,
WindowState = WindowState.Maximized
};
_webWindow.Closed += (s, e) => _webWindow = null;
_webWindow.Panel!.DownloadFolderPath = MapPathingViewModel.PathJsonPath;
@@ -420,4 +501,25 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
_webWindow.Activate();
}
}
}
/// <summary>
/// 处理带有 icon.ico 和 desktop.ini 的文件夹
/// </summary>
/// <param name="folderPath"></param>
private void DealWithIconFolder(string folderPath)
{
if (Directory.Exists(folderPath)
&& File.Exists(Path.Combine(folderPath, "desktop.ini")))
{
// 使用 Vanara 库中的 SetFileAttributes 函数设置文件夹属性
if (Kernel32.SetFileAttributes(folderPath, FileFlagsAndAttributes.FILE_ATTRIBUTE_READONLY))
{
Debug.WriteLine($"成功将文件夹设置为只读: {folderPath}");
}
else
{
Debug.WriteLine($"无法设置文件夹为只读: {folderPath}");
}
}
}
}
@@ -2,6 +2,11 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Threading.Tasks;
using BetterGenshinImpact.ViewModel.Message;
using CommunityToolkit.Mvvm.Messaging;
using Wpf.Ui.Violeta.Controls;
namespace BetterGenshinImpact.Core.Script.WebView;
@@ -13,40 +18,50 @@ namespace BetterGenshinImpact.Core.Script.WebView;
[ComVisible(true)]
public class RepoWebBridge
{
public string GetRepoJson()
public async Task<string> GetRepoJson()
{
try
{
await ScriptRepoUpdater.Instance.UpdateCenterRepo();
}
catch (Exception e)
{
Toast.Warning($"更新仓库信息失败:{e.Message}");
}
try
{
if (!Directory.Exists(ScriptRepoUpdater.CenterRepoPath))
{
throw new Exception("仓库文件夹不存在,请至少成功更新一次仓库!");
}
var localRepoJsonPath = Directory.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
if (localRepoJsonPath is null)
{
_ = ScriptRepoUpdater.Instance.UpdateCenterRepo().ConfigureAwait(false);
localRepoJsonPath = Directory.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
if (localRepoJsonPath is null)
{
throw new Exception("本地仓库缺少 repo.json");
}
throw new Exception("repo.json 仓库索引文件不存在,请至少成功更新一次仓库!");
}
var json = File.ReadAllText(localRepoJsonPath);
var json = await File.ReadAllTextAsync(localRepoJsonPath);
return json;
}
catch (Exception e)
{
MessageBox.Show(e.Message, "获取仓库信息失败!");
await MessageBox.ShowAsync(e.Message, "获取仓库信息失败");
return "";
}
}
public void ImportUri(string url)
public async void ImportUri(string url)
{
try
{
ScriptRepoUpdater.Instance.ImportScriptFromUri(url, false).ConfigureAwait(false);
await ScriptRepoUpdater.Instance.ImportScriptFromUri(url, false);
WeakReferenceMessenger.Default.Send(new RefreshDataMessage("Refresh"));
}
catch (Exception e)
{
MessageBox.Show(e.Message, "订阅脚本链接失败!");
await MessageBox.ShowAsync(e.Message, "订阅脚本链接失败!");
}
}
}
}
@@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BetterGenshinImpact.Core.Simulator.Extensions;
/// <summary>
/// 模拟按键类型
/// </summary>
public enum KeyType
{
/// <summary>
/// 单击按键(KeyPress)
/// </summary>
KeyPress,
/// <summary>
/// 按住按键(KeyDown)
/// </summary>
KeyDown,
/// <summary>
/// 释放按键(KeyUp)
/// </summary>
KeyUp,
/// <summary>
/// 长按1s
/// </summary>
Hold,
}
/// <summary>
/// 原神按键动作
/// </summary>
public enum GIActions
{
/// <summary>
/// 向前移动
/// </summary>
MoveForward,
/// <summary>
/// 向后移动
/// </summary>
MoveBackward,
/// <summary>
/// 向左移动
/// </summary>
MoveLeft,
/// <summary>
/// 向右移动
/// </summary>
MoveRight,
/// <summary>
/// 切换走/跑;特定操作模式下向下移动
/// </summary>
SwitchToWalkOrRun,
/// <summary>
/// 普通攻击
/// </summary>
NormalAttack,
/// <summary>
/// 元素战技
/// </summary>
ElementalSkill,
/// <summary>
/// 元素爆发
/// </summary>
ElementalBurst,
/// <summary>
/// 冲刺(键盘)
/// </summary>
SprintKeyboard,
/// <summary>
/// 冲刺(鼠标)
/// </summary>
SprintMouse,
/// <summary>
/// 切换瞄准模式
/// </summary>
SwitchAimingMode,
/// <summary>
/// 跳跃;特定操作模式下向上移动
/// </summary>
Jump,
/// <summary>
/// 落下
/// </summary>
Drop,
/// <summary>
/// 拾取/交互(自动拾取由AutoPick模块管理)
/// </summary>
PickUpOrInteract,
/// <summary>
/// 快捷使用小道具
/// </summary>
QuickUseGadget,
/// <summary>
/// 特定玩法内交互操作
/// </summary>
InteractionInSomeMode,
/// <summary>
/// 开启任务追踪
/// </summary>
QuestNavigation,
/// <summary>
/// 中断挑战
/// </summary>
AbandonChallenge,
/// <summary>
/// 切换小队角色1
/// </summary>
SwitchMember1,
/// <summary>
/// 切换小队角色2
/// </summary>
SwitchMember2,
/// <summary>
/// 切换小队角色3
/// </summary>
SwitchMember3,
/// <summary>
/// 切换小队角色4
/// </summary>
SwitchMember4,
/// <summary>
/// 切换小队角色5
/// </summary>
SwitchMember5,
/// <summary>
/// 呼出快捷轮盘
/// </summary>
ShortcutWheel,
/// <summary>
/// 打开背包
/// </summary>
OpenInventory,
/// <summary>
/// 打开角色界面
/// </summary>
OpenCharacterScreen,
/// <summary>
/// 打开地图
/// </summary>
OpenMap,
/// <summary>
/// 打开派蒙界面
/// </summary>
OpenPaimonMenu,
/// <summary>
/// 打开冒险之证界面
/// </summary>
OpenAdventurerHandbook,
/// <summary>
/// 打开多人游戏界面
/// </summary>
OpenCoOpScreen,
/// <summary>
/// 打开祈愿界面
/// </summary>
OpenWishScreen,
/// <summary>
/// 打开纪行界面
/// </summary>
OpenBattlePassScreen,
/// <summary>
/// 打开活动面板
/// </summary>
OpenTheEventsMenu,
/// <summary>
/// 打开玩法系统界面(尘歌壶内猫尾酒馆内)
/// </summary>
OpenTheSettingsMenu,
/// <summary>
/// 打开摆设界面(尘歌壶内)
/// </summary>
OpenTheFurnishingScreen,
/// <summary>
/// 打开星之归还(条件符合期间生效)
/// </summary>
OpenStellarReunion,
/// <summary>
/// 开关任务菜单
/// </summary>
OpenQuestMenu,
/// <summary>
/// 打开通知详情
/// </summary>
OpenNotificationDetails,
/// <summary>
/// 打开聊天界面
/// </summary>
OpenChatScreen,
/// <summary>
/// 打开特殊环境说明
/// </summary>
OpenSpecialEnvironmentInformation,
/// <summary>
/// 查看教程详情
/// </summary>
CheckTutorialDetails,
/// <summary>
/// 长按打开元素视野
/// </summary>
ElementalSight,
/// <summary>
/// 呼出鼠标
/// </summary>
ShowCursor,
/// <summary>
/// 打开队伍配置界面
/// </summary>
OpenPartySetupScreen,
/// <summary>
/// 打开好友界面
/// </summary>
OpenFriendsScreen,
/// <summary>
/// 隐藏主界面
/// </summary>
HideUI,
}
@@ -0,0 +1,162 @@
using BetterGenshinImpact.Core.Config;
using System;
using System.Collections.Generic;
using System.Text;
using BetterGenshinImpact.Core.Simulator;
using System.Threading;
using Fischless.WindowsInput;
namespace BetterGenshinImpact.Core.Simulator.Extensions;
/// <summary>
/// 用于扩展<seealso cref="Fischless.WindowsInput.InputSimulator"/>的功能
/// </summary>
public static class InputSimulatorExtension
{
/// <summary>
/// 模拟玩家操作
/// </summary>
/// <param name="action">动作</param>
/// <param name="type">按键类型</param>
public static void SimulateAction(this InputSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
{
var key = action.ToActionKey();
switch (type)
{
case KeyType.KeyPress:
KeyPress(self, key);
break;
case KeyType.KeyDown:
KeyDown(self, key);
break;
case KeyType.KeyUp:
KeyUp(self, key);
break;
case KeyType.Hold:
HoldKeyPress(self, key);
break;
default:
break;
}
}
private static void HoldKeyPress(InputSimulator self, KeyId key)
{
KeyDown(self, key);
Thread.Sleep(1000);
KeyUp(self, key);
}
private static void KeyPress(InputSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.Mouse.LeftButtonClick();
break;
case KeyId.MouseRightButton:
self.Mouse.RightButtonClick();
break;
case KeyId.MouseMiddleButton:
self.Mouse.MiddleButtonClick();
break;
case KeyId.MouseSideButton1:
self.Mouse.XButtonClick(0x0001);
break;
case KeyId.MouseSideButton2:
self.Mouse.XButtonClick(0x0001);
break;
default:
var k = key.ToVK();
// 解决 shift 之类的键位没法正常使用的问题
if (InputBuilder.IsExtendedKey(k))
{
self.Keyboard.KeyPress(false, k);
}
else
{
self.Keyboard.KeyPress(k);
}
break;
}
}
private static void KeyDown(InputSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.Mouse.LeftButtonDown();
break;
case KeyId.MouseRightButton:
self.Mouse.RightButtonDown();
break;
case KeyId.MouseMiddleButton:
self.Mouse.MiddleButtonDown();
break;
case KeyId.MouseSideButton1:
self.Mouse.XButtonDown(0x0001);
break;
case KeyId.MouseSideButton2:
self.Mouse.XButtonDown(0x0001);
break;
default:
var k = key.ToVK();
// 解决 shift 之类的键位没法正常使用的问题
if (InputBuilder.IsExtendedKey(k))
{
self.Keyboard.KeyDown(false, k);
}
else
{
self.Keyboard.KeyDown(k);
}
break;
}
}
private static void KeyUp(InputSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.Mouse.LeftButtonUp();
break;
case KeyId.MouseRightButton:
self.Mouse.RightButtonUp();
break;
case KeyId.MouseMiddleButton:
self.Mouse.MiddleButtonUp();
break;
case KeyId.MouseSideButton1:
self.Mouse.XButtonUp(0x0001);
break;
case KeyId.MouseSideButton2:
self.Mouse.XButtonUp(0x0001);
break;
default:
var k = key.ToVK();
// 解决 shift 之类的键位没法正常使用的问题
if (InputBuilder.IsExtendedKey(k))
{
self.Keyboard.KeyUp(false, k);
}
else
{
self.Keyboard.KeyUp(k);
}
break;
}
}
}
@@ -0,0 +1,204 @@
using BetterGenshinImpact.Core.Config;
using Fischless.WindowsInput;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace BetterGenshinImpact.Core.Simulator.Extensions;
/// <summary>
/// 为<seealso cref="PostMessageSimulator"/>提供扩展功能
/// </summary>
public static class PostMessageSimulatorExtension
{
/// <summary>
/// 模拟玩家操作
/// </summary>
/// <param name="action">动作</param>
/// <param name="type">按键类型</param>
public static PostMessageSimulator SimulateAction(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
{
var key = action.ToActionKey();
switch (type)
{
case KeyType.KeyPress:
KeyPress(self, key);
break;
case KeyType.KeyDown:
KeyDown(self, key);
break;
case KeyType.KeyUp:
KeyUp(self, key);
break;
case KeyType.Hold:
HoldKeyPress(self, key);
break;
default:
break;
}
return self;
}
private static void HoldKeyPress(PostMessageSimulator self, KeyId key)
{
self.LongKeyPress(key.ToVK());
}
private static void KeyPress(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.LeftButtonClick();
break;
case KeyId.MouseRightButton:
self.RightButtonClick();
break;
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyPress(key.ToVK());
break;
}
}
private static void KeyDown(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.LeftButtonDown();
break;
case KeyId.MouseRightButton:
self.RightButtonDown();
break;
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyDown(key.ToVK());
break;
}
}
private static void KeyUp(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.LeftButtonUp();
break;
case KeyId.MouseRightButton:
self.RightButtonUp();
break;
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyUp(key.ToVK());
break;
}
}
/// <summary>
/// 模拟玩家操作(后台)
/// </summary>
/// <param name="action">动作</param>
/// <param name="type">按键类型</param>
public static PostMessageSimulator SimulateActionBackground(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
{
var key = action.ToActionKey();
switch (type)
{
case KeyType.KeyPress:
KeyPressBackground(self, key);
break;
case KeyType.KeyDown:
KeyDownBackground(self, key);
break;
case KeyType.KeyUp:
KeyUpBackground(self, key);
break;
case KeyType.Hold:
break;
default:
break;
}
return self;
}
private static void KeyPressBackground(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
self.LeftButtonClickBackground();
break;
case KeyId.MouseRightButton:
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyPressBackground(key.ToVK());
break;
}
}
private static void KeyDownBackground(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
case KeyId.MouseRightButton:
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyDownBackground(key.ToVK());
break;
}
}
private static void KeyUpBackground(PostMessageSimulator self, KeyId key)
{
switch (key)
{
case KeyId.None:
case KeyId.Unknown:
break;
case KeyId.MouseLeftButton:
case KeyId.MouseRightButton:
case KeyId.MouseMiddleButton:
case KeyId.MouseSideButton1:
case KeyId.MouseSideButton2:
break;
default:
self.KeyUpBackground(key.ToVK());
break;
}
}
}
@@ -0,0 +1,79 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
namespace BetterGenshinImpact.Core.Simulator.Extensions;
public static class SimulateKeyHelper
{
private static KeyBindingsConfig KeyConfig => TaskContext.Instance().Config.KeyBindingsConfig;
public static KeyId ToActionKey(this GIActions action)
{
return GetActionKey(action);
}
/// <summary>
/// 通过ActionId取得实际的键盘绑定
/// </summary>
/// <param name="action"></param>
/// <returns></returns>
public static KeyId GetActionKey(GIActions action)
{
return action switch
{
GIActions.MoveForward => KeyConfig.MoveForward,
GIActions.MoveBackward => KeyConfig.MoveBackward,
GIActions.MoveLeft => KeyConfig.MoveLeft,
GIActions.MoveRight => KeyConfig.MoveRight,
GIActions.SwitchToWalkOrRun => KeyConfig.SwitchToWalkOrRun,
GIActions.NormalAttack => KeyConfig.NormalAttack,
GIActions.ElementalSkill => KeyConfig.ElementalSkill,
GIActions.ElementalBurst => KeyConfig.ElementalBurst,
GIActions.SprintKeyboard => KeyConfig.SprintKeyboard,
GIActions.SprintMouse => KeyConfig.SprintMouse,
GIActions.SwitchAimingMode => KeyConfig.SwitchAimingMode,
GIActions.Jump => KeyConfig.Jump,
GIActions.Drop => KeyConfig.Drop,
GIActions.PickUpOrInteract => KeyConfig.PickUpOrInteract,
GIActions.QuickUseGadget => KeyConfig.QuickUseGadget,
GIActions.InteractionInSomeMode => KeyConfig.InteractionInSomeMode,
GIActions.QuestNavigation => KeyConfig.QuestNavigation,
GIActions.AbandonChallenge => KeyConfig.AbandonChallenge,
GIActions.SwitchMember1 => KeyConfig.SwitchMember1,
GIActions.SwitchMember2 => KeyConfig.SwitchMember2,
GIActions.SwitchMember3 => KeyConfig.SwitchMember3,
GIActions.SwitchMember4 => KeyConfig.SwitchMember4,
GIActions.SwitchMember5 => KeyConfig.SwitchMember5,
GIActions.ShortcutWheel => KeyConfig.ShortcutWheel,
GIActions.OpenInventory => KeyConfig.OpenInventory,
GIActions.OpenCharacterScreen => KeyConfig.OpenCharacterScreen,
GIActions.OpenMap => KeyConfig.OpenMap,
GIActions.OpenPaimonMenu => KeyConfig.OpenPaimonMenu,
GIActions.OpenAdventurerHandbook => KeyConfig.OpenAdventurerHandbook,
GIActions.OpenCoOpScreen => KeyConfig.OpenCoOpScreen,
GIActions.OpenWishScreen => KeyConfig.OpenWishScreen,
GIActions.OpenBattlePassScreen => KeyConfig.OpenBattlePassScreen,
GIActions.OpenTheEventsMenu => KeyConfig.OpenTheEventsMenu,
GIActions.OpenTheSettingsMenu => KeyConfig.OpenTheSettingsMenu,
GIActions.OpenTheFurnishingScreen => KeyConfig.OpenTheFurnishingScreen,
GIActions.OpenStellarReunion => KeyConfig.OpenStellarReunion,
GIActions.OpenQuestMenu => KeyConfig.OpenQuestMenu,
GIActions.OpenNotificationDetails => KeyConfig.OpenNotificationDetails,
GIActions.OpenChatScreen => KeyConfig.OpenChatScreen,
GIActions.OpenSpecialEnvironmentInformation => KeyConfig.OpenSpecialEnvironmentInformation,
GIActions.CheckTutorialDetails => KeyConfig.CheckTutorialDetails,
GIActions.ElementalSight => KeyConfig.ElementalSight,
GIActions.ShowCursor => KeyConfig.ShowCursor,
GIActions.OpenPartySetupScreen => KeyConfig.OpenPartySetupScreen,
GIActions.OpenFriendsScreen => KeyConfig.OpenFriendsScreen,
GIActions.HideUI => KeyConfig.HideUI,
_ => default,
};
}
}
@@ -1,5 +1,8 @@
using Fischless.WindowsInput;
using System;
using BetterGenshinImpact.GameTask.Common;
using Microsoft.Extensions.Logging;
using Vanara.PInvoke;
namespace BetterGenshinImpact.Core.Simulator;
@@ -13,4 +16,26 @@ public class Simulation
{
return new PostMessageSimulator(hWnd);
}
}
public static void ReleaseAllKey()
{
foreach (User32.VK key in Enum.GetValues(typeof(User32.VK)))
{
// 检查键是否被按下
if (IsKeyDown(key)) // 强制转换 VK 枚举为 int
{
TaskControl.Logger.LogDebug($"解除{key}的按下状态.");
SendInput.Keyboard.KeyUp(key);
}
}
}
public static bool IsKeyDown(User32.VK key)
{
// 获取按键状态
var state = User32.GetAsyncKeyState((int)key);
// 检查高位是否为 1(表示按键被按下)
return (state & 0x8000) != 0;
}
}
@@ -9,26 +9,47 @@ public partial class AutoDomainConfig : ObservableObject
/// <summary>
/// 战斗结束后延迟几秒再开始寻找石化古树,秒
/// </summary>
[ObservableProperty] private double _fightEndDelay = 5;
[ObservableProperty]
private double _fightEndDelay = 5;
/// <summary>
/// 寻找古树时,短距离移动,用于识别速度过慢的计算机使用
/// </summary>
[ObservableProperty] private bool _shortMovement = false;
[ObservableProperty]
private bool _shortMovement = false;
/// <summary>
/// 寻找古树时,短距离移动,用于识别速度过慢的计算机使用
/// </summary>
[ObservableProperty] private bool _walkToF = false;
[ObservableProperty]
private bool _walkToF = true;
/// <summary>
/// 寻找古树时,短距离移动的次数
/// </summary>
[ObservableProperty] private int _leftRightMoveTimes = 3;
[ObservableProperty]
private int _leftRightMoveTimes = 3;
/// <summary>
/// 自动吃药
/// </summary>
[ObservableProperty]
private bool _autoEat = false;
}
// 刷副本使用的队伍名称
[ObservableProperty]
private string _partyName = string.Empty;
// 需要刷取的副本名称
[ObservableProperty]
private string _domainName = string.Empty;
// 结束后是否自动分解圣遗物
[ObservableProperty]
private bool _autoArtifactSalvage = false;
// 分解圣遗物的最大星级
// 1~4
[ObservableProperty]
private string _maxArtifactStar = "4";
}
@@ -9,6 +9,19 @@ public class AutoDomainParam : BaseTaskParam
public string CombatStrategyPath { get; set; }
// 刷副本使用的队伍名称
public string PartyName { get; set; } = string.Empty;
// 需要刷取的副本名称
public string DomainName { get; set; } = string.Empty;
// 结束后是否自动分解圣遗物
public bool AutoArtifactSalvage { get; set; } = false;
// 分解圣遗物的最大星级
// 1~4
public string MaxArtifactStar { get; set; } = "4";
public AutoDomainParam(int domainRoundNum, string path)
{
DomainRoundNum = domainRoundNum;
@@ -16,6 +29,17 @@ public class AutoDomainParam : BaseTaskParam
{
DomainRoundNum = 9999;
}
CombatStrategyPath = path;
SetDefault();
}
}
public void SetDefault()
{
var config = TaskContext.Instance().Config.AutoDomainConfig;
PartyName = config.PartyName;
DomainName = config.DomainName;
AutoArtifactSalvage = config.AutoArtifactSalvage;
MaxArtifactStar = config.MaxArtifactStar;
}
}
@@ -1,8 +1,8 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.Core.Script;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.Core.Simulator.Extensions;
using BetterGenshinImpact.GameTask.AutoFight;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
using BetterGenshinImpact.GameTask.AutoFight.Model;
@@ -22,20 +22,31 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.GameTask.AutoTrackPath;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.GameTask.Common.BgiVision;
using BetterGenshinImpact.GameTask.Common.Element.Assets;
using BetterGenshinImpact.GameTask.Common.Job;
using BetterGenshinImpact.Service.Notification.Model.Enum;
using Vanara.PInvoke;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
using static Vanara.PInvoke.Gdi32;
using static Vanara.PInvoke.Kernel32;
using static Vanara.PInvoke.User32;
using Microsoft.Extensions.Localization;
using System.Globalization;
using System.Text.RegularExpressions;
namespace BetterGenshinImpact.GameTask.AutoDomain;
public class AutoDomainTask : ISoloTask
{
private readonly AutoDomainParam _taskParam;
public string Name => "自动秘境";
private readonly PostMessageSimulator _simulator;
private readonly AutoDomainParam _taskParam;
private readonly YoloV8Predictor _predictor;
@@ -43,13 +54,18 @@ public class AutoDomainTask : ISoloTask
private readonly CombatScriptBag _combatScriptBag;
private CancellationTokenSource? _cts;
private CancellationToken _ct;
private readonly string challengeCompletedLocalizedString;
private readonly string autoLeavingLocalizedString;
private readonly string skipLocalizedString;
private readonly string leyLineDisorderLocalizedString;
private readonly string clickanywheretocloseLocalizedString;
public AutoDomainTask(AutoDomainParam taskParam)
{
AutoFightAssets.DestroyInstance();
_taskParam = taskParam;
_simulator = AutoFightContext.Instance.Simulator;
_predictor = YoloV8Builder.CreateDefaultBuilder()
.UseOnnxModel(Global.Absolute(@"Assets\Model\Domain\bgi_tree.onnx"))
.WithSessionOptions(BgiSessionOption.Instance.Options)
@@ -58,26 +74,79 @@ public class AutoDomainTask : ISoloTask
_config = TaskContext.Instance().Config.AutoDomainConfig;
_combatScriptBag = CombatScriptParser.ReadAndParse(_taskParam.CombatStrategyPath);
IStringLocalizer<AutoDomainTask> stringLocalizer = App.GetService<IStringLocalizer<AutoDomainTask>>() ?? throw new NullReferenceException();
CultureInfo cultureInfo = new CultureInfo(TaskContext.Instance().Config.OtherConfig.GameCultureInfoName);
this.challengeCompletedLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "挑战达成");
this.autoLeavingLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "自动退出");
this.skipLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "跳过");
this.leyLineDisorderLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "地脉异常");
this.clickanywheretocloseLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "点击任意位置关闭");
}
public async Task Start(CancellationTokenSource cts)
public async Task Start(CancellationToken ct)
{
_cts = cts;
_ct = ct;
AutoFightAssets.DestroyInstance();
Init();
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Started().Build()); // TODO: 通知后续需要删除迁移
Notify.Event(NotificationEvent.DomainStart).Success("自动秘境启动");
// 3次复活重试
for (int i = 0; i < 3; i++)
{
try
{
await DoDomain();
// 其他场景不重试
break;
}
catch (RetryException e)
{
// 只有选择了秘境的时候才会重试
if (!string.IsNullOrEmpty(_taskParam.DomainName))
{
var msg = e.Message;
if (msg.Contains("复活"))
{
msg = "存在角色死亡,复活后重试秘境...";
}
Logger.LogWarning("自动秘境:{Text}", msg);
await Delay(2000, ct);
Notify.Event(NotificationEvent.DomainRetry).Error(msg);
continue;
}
throw;
}
}
await Delay(2000, ct);
await Bv.WaitForMainUi(_ct, 30);
await Delay(2000, ct);
await ArtifactSalvage();
Notify.Event(NotificationEvent.DomainEnd).Success("自动秘境结束");
}
private async Task DoDomain()
{
// 传送到秘境
await TpDomain();
// 切换队伍
await SwitchParty(_taskParam.PartyName);
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());
// 前置进入秘境
EnterDomain();
await EnterDomain();
for (var i = 0; i < _taskParam.DomainRoundNum; i++)
{
// 0. 关闭秘境提示
Logger.LogDebug("0. 关闭秘境提示");
CloseDomainTip();
await CloseDomainTip();
// 队伍没初始化成功则重试
RetryTeamInit(combatScenes);
@@ -92,6 +161,7 @@ public class AutoDomainTask : ISoloTask
// 2. 执行战斗(战斗线程、视角线程、检测战斗完成线程)
Logger.LogInformation("自动秘境:{Text}", "2. 执行战斗策略");
await StartFight(combatScenes, combatCommands);
combatScenes.AfterTask();
EndFightWait();
// 3. 寻找石化古树 并左右移动直到石化古树位于屏幕中心
@@ -114,10 +184,11 @@ public class AutoDomainTask : ISoloTask
{
Logger.LogInformation("体力已经耗尽,结束自动秘境");
}
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Success().Build());
break;
}
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Progress().Build());
Notify.Event(NotificationEvent.DomainReward).Success("自动秘境奖励领取");
}
}
@@ -139,8 +210,10 @@ public class AutoDomainTask : ISoloTask
var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
{
Logger.LogWarning("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏可能无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
Logger.LogError("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
throw new Exception("游戏窗口分辨率不是 16:9");
}
if (gameScreenSize.Width < 1920 || gameScreenSize.Height < 1080)
{
Logger.LogWarning("游戏窗口分辨率小于 1920x1080 !当前分辨率为 {Width}x{Height} , 小于 1920x1080 的分辨率的游戏可能无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
@@ -159,57 +232,174 @@ public class AutoDomainTask : ISoloTask
}
}
private void EnterDomain()
private async Task TpDomain()
{
var fightAssets = AutoFightContext.Instance.FightAssets;
using var fRectArea = CaptureToRectArea().Find(AutoPickAssets.Instance.FRo);
if (!fRectArea.IsEmpty())
// 传送到秘境
if (!string.IsNullOrEmpty(_taskParam.DomainName))
{
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
// 秘境开门动画 5s
Sleep(5000, _cts);
if (MapLazyAssets.Instance.DomainPositionMap.TryGetValue(_taskParam.DomainName, out var domainPosition))
{
Logger.LogInformation("自动秘境:传送到秘境{Text}", _taskParam.DomainName);
await new TpTask(_ct).Tp(domainPosition.X, domainPosition.Y);
await Delay(1000, _ct);
await Bv.WaitForMainUi(_ct);
await Delay(1000, _ct);
if ("芬德尼尔之顶".Equals(_taskParam.DomainName))
{
Simulation.SendInput.SimulateAction(GIActions.MoveBackward, KeyType.KeyDown);
Thread.Sleep(3000);
Simulation.SendInput.SimulateAction(GIActions.MoveBackward, KeyType.KeyUp);
}
else if ("无妄引咎密宫".Equals(_taskParam.DomainName))
{
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
Thread.Sleep(500);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
Thread.Sleep(100);
Simulation.SendInput.SimulateAction(GIActions.MoveLeft, KeyType.KeyDown);
Thread.Sleep(1600);
Simulation.SendInput.SimulateAction(GIActions.MoveLeft, KeyType.KeyUp);
}
else if ("苍白的遗荣".Equals(_taskParam.DomainName))
{
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
Thread.Sleep(1000);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
}
else if ("太山府".Equals(_taskParam.DomainName))
{
// 直接F即可
// nothing to do
}
else
{
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
Thread.Sleep(2000);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
}
await Delay(100, _ct);
Simulation.SendInput.SimulateAction(GIActions.Drop); // 可能爬上去了,X键下来
await Delay(3000, _ct); // 站稳
}
else
{
Logger.LogError("自动秘境:未找到对应的秘境{Text}的传送点", _taskParam.DomainName);
throw new Exception($"未找到对应的秘境{_taskParam.DomainName}的传送点");
}
}
}
/// <summary>
/// 切换队伍
/// </summary>
/// <param name="partyName"></param>
/// <returns></returns>
private async Task<bool> SwitchParty(string? partyName)
{
if (!string.IsNullOrEmpty(partyName))
{
var b = await new SwitchPartyTask().Start(partyName, _ct);
await Delay(500, _ct);
return b;
}
int retryTimes = 0, clickCount = 0;
while (retryTimes < 20 && clickCount < 2)
return true;
}
private async Task EnterDomain()
{
var fightAssets = AutoFightAssets.Instance;
// 进入秘境
for (int i = 0; i < 3; i++) // 3次重试 有时候会拾取晶蝶
{
using var fRectArea = CaptureToRectArea().Find(AutoPickAssets.Instance.PickRo);
if (!fRectArea.IsEmpty())
{
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
// 秘境开门动画 5s
await Delay(5000, _ct);
}
else
{
await Delay(800, _ct);
}
}
// 点击单人挑战
int retryTimes = 0;
while (retryTimes < 20)
{
retryTimes++;
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
confirmRectArea.Click();
clickCount++;
break;
}
Sleep(1500, _cts);
await Delay(1500, _ct);
}
await Delay(600, _ct);
using var confirmRectArea2 = CaptureToRectArea().Find(ElementAssets.Instance.BtnBlackConfirm);
if (!confirmRectArea2.IsEmpty())
{
throw new Exception("收取完成秘境的奖励需要20点原粹树脂,当前树脂不足,自动秘境停止运行");
}
// 点击进入
retryTimes = 0;
while (retryTimes < 20)
{
retryTimes++;
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
confirmRectArea.Click();
break;
}
await Delay(1200, _ct);
}
// 载入动画
Sleep(3000, _cts);
await Delay(3000, _ct);
}
private void CloseDomainTip()
private async Task CloseDomainTip()
{
// 2min的载入时间总够了吧
var retryTimes = 0;
while (retryTimes < 120)
{
retryTimes++;
using var cactRectArea = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.ClickAnyCloseTipRa);
if (!cactRectArea.IsEmpty())
using var ra = CaptureToRectArea();
// using var cactRectArea =ra.Find(AutoFightAssets.Instance.ClickAnyCloseTipRa);
// if (!cactRectArea.IsEmpty())
// {
// await Delay(1000, _ct);
// cactRectArea.Click();
// break;
// }
var ocrList = ra.FindMulti(RecognitionObject.Ocr(0, ra.Height * 0.2, ra.Width, ra.Height * 0.6));
var done = ocrList.FirstOrDefault(t => Regex.IsMatch(t.Text, this.leyLineDisorderLocalizedString) || Regex.IsMatch(t.Text, this.clickanywheretocloseLocalizedString));
if (done != null)
{
Sleep(1000, _cts);
cactRectArea.Click();
await Delay(1000, _ct);
done.Click();
break;
}
// todo 添加小地图角标位置检测 防止有人手点了
Sleep(1000, _cts);
await Delay(1000, _ct);
}
Sleep(1500, _cts);
await Delay(2000, _ct);
}
private List<CombatCommand> FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes)
@@ -226,55 +416,63 @@ public class AutoDomainTask : ISoloTask
/// </summary>
private async Task WalkToPressF()
{
if (_cts.Token.IsCancellationRequested)
if (_ct.IsCancellationRequested)
{
return;
}
await Task.Run((Action)(() =>
{
_simulator.KeyDown(VK.VK_W);
Sleep(20);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
Sleep(30, _ct);
// 组合键好像不能直接用 postmessage
if (!_config.WalkToF)
{
Simulation.SendInput.Keyboard.KeyDown(VK.VK_SHIFT);
Simulation.SendInput.SimulateAction(GIActions.SprintKeyboard, KeyType.KeyDown);
}
try
{
while (!_cts.Token.IsCancellationRequested)
var startTime = DateTime.Now;
while (!_ct.IsCancellationRequested)
{
using var fRectArea = Common.TaskControl.CaptureToRectArea().Find(AutoPickAssets.Instance.FRo);
using var fRectArea = Common.TaskControl.CaptureToRectArea().Find(AutoPickAssets.Instance.PickRo);
if (fRectArea.IsEmpty())
{
Sleep(100, _cts);
Sleep(100, _ct);
}
else
{
Logger.LogInformation("检测到交互键");
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
break;
}
// 超时直接放弃整个秘境
if (DateTime.Now - startTime> TimeSpan.FromSeconds(60))
{
Logger.LogWarning("自动秘境:{Text}", "前往目标位置处超时,如果选择了秘境名称,将在传送后重试秘境!");
Avatar.TpForRecover(_ct, new RetryException("前往目标位置处超时,先传送到七天神像,然后重试秘境"));
}
}
}
finally
{
_simulator.KeyUp(VK.VK_W);
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
Sleep(50);
if (!_config.WalkToF)
{
Simulation.SendInput.Keyboard.KeyUp(VK.VK_SHIFT);
Simulation.SendInput.SimulateAction(GIActions.SprintKeyboard, KeyType.KeyUp);
}
}
}));
}), _ct);
}
private Task StartFight(CombatScenes combatScenes, List<CombatCommand> combatCommands)
{
CancellationTokenSource cts = new();
_cts.Token.Register(cts.Cancel);
combatScenes.BeforeTask(cts);
_ct.Register(cts.Cancel);
combatScenes.BeforeTask(cts.Token);
// 战斗操作
var combatTask = new Task(() =>
{
@@ -307,7 +505,7 @@ public class AutoDomainTask : ISoloTask
// 对局结束检测
var domainEndTask = DomainEndDetectionTask(cts);
// 自动吃药
var autoEatRecoveryHpTask = AutoEatRecoveryHpTask(cts);
var autoEatRecoveryHpTask = AutoEatRecoveryHpTask(cts.Token);
combatTask.Start();
domainEndTask.Start();
autoEatRecoveryHpTask.Start();
@@ -316,7 +514,7 @@ public class AutoDomainTask : ISoloTask
private void EndFightWait()
{
if (_cts.Token.IsCancellationRequested)
if (_ct.IsCancellationRequested)
{
return;
}
@@ -325,7 +523,7 @@ public class AutoDomainTask : ISoloTask
if (s > 0)
{
Logger.LogInformation("战斗结束后等待 {Second} 秒", s);
Sleep((int)(s * 1000), _cts);
Sleep((int)(s * 1000), _ct);
}
}
@@ -338,7 +536,7 @@ public class AutoDomainTask : ISoloTask
{
try
{
while (!_cts.Token.IsCancellationRequested)
while (!_ct.IsCancellationRequested)
{
if (IsDomainEnd())
{
@@ -346,7 +544,7 @@ public class AutoDomainTask : ISoloTask
break;
}
await Delay(1000, cts);
await Delay(1000, cts.Token);
}
}
catch
@@ -359,17 +557,17 @@ public class AutoDomainTask : ISoloTask
{
using var ra = CaptureToRectArea();
var endTipsRect = ra.DeriveCrop(AutoFightContext.Instance.FightAssets.EndTipsUpperRect);
var endTipsRect = ra.DeriveCrop(AutoFightAssets.Instance.EndTipsUpperRect);
var text = OcrFactory.Paddle.Ocr(endTipsRect.SrcGreyMat);
if (text.Contains("挑战") || text.Contains("达成"))
if (Regex.IsMatch(text, this.challengeCompletedLocalizedString))
{
Logger.LogInformation("检测到秘境结束提示(挑战达成),结束秘境");
return true;
}
endTipsRect = ra.DeriveCrop(AutoFightContext.Instance.FightAssets.EndTipsRect);
endTipsRect = ra.DeriveCrop(AutoFightAssets.Instance.EndTipsRect);
text = OcrFactory.Paddle.Ocr(endTipsRect.SrcGreyMat);
if (text.Contains("自动") || text.Contains("退出"))
if (Regex.IsMatch(text, this.autoLeavingLocalizedString))
{
Logger.LogInformation("检测到秘境结束提示(xxx秒后自动退出),结束秘境");
return true;
@@ -378,7 +576,7 @@ public class AutoDomainTask : ISoloTask
return false;
}
private Task AutoEatRecoveryHpTask(CancellationTokenSource cts)
private Task AutoEatRecoveryHpTask(CancellationToken ct)
{
return new Task(async () =>
{
@@ -386,6 +584,7 @@ public class AutoDomainTask : ISoloTask
{
return;
}
if (!IsTakeFood())
{
Logger.LogInformation("未装备 “{Tool}”,不启用红血自动吃药功能", "便携营养袋");
@@ -394,35 +593,24 @@ public class AutoDomainTask : ISoloTask
try
{
while (!_cts.Token.IsCancellationRequested)
while (!_ct.IsCancellationRequested)
{
if (IsLowHealth())
if (Bv.CurrentAvatarIsLowHp(CaptureToRectArea()))
{
// 模拟按键 "Z"
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_Z);
Simulation.SendInput.SimulateAction(GIActions.QuickUseGadget);
Logger.LogInformation("检测到红血,按Z吃药");
// TODO 吃饱了会一直吃
}
await Delay(500, cts);
await Delay(500, ct);
}
}
catch
catch (Exception e)
{
Logger.LogDebug(e, "红血自动吃药检测时发生异常");
}
}, cts.Token);
}
private bool IsLowHealth()
{
// 获取图像
using var ra = CaptureToRectArea();
// 获取 (808, 1010) 位置的像素颜色
var pixelColor = ra.SrcMat.At<Vec3b>(1010, 808);
// 判断颜色是否是 (255, 90, 90)
return pixelColor is { Item2: 255, Item1: 90, Item0: 90 };
}, ct);
}
private bool IsTakeFood()
@@ -442,10 +630,10 @@ public class AutoDomainTask : ISoloTask
private Task FindPetrifiedTree()
{
CancellationTokenSource treeCts = new();
_cts.Token.Register(treeCts.Cancel);
_ct.Register(treeCts.Cancel);
// 中键回正视角
Simulation.SendInput.Mouse.MiddleButtonClick();
Sleep(900, _cts);
Sleep(900, _ct);
// 左右移动直到石化古树位于屏幕中心任务
var moveAvatarTask = MoveAvatarHorizontallyTask(treeCts);
@@ -460,14 +648,18 @@ public class AutoDomainTask : ISoloTask
{
return new Task(() =>
{
var keyConfig = TaskContext.Instance().Config.KeyBindingsConfig;
var moveLeftKey = keyConfig.MoveLeft.ToVK();
var moveRightKey = keyConfig.MoveRight.ToVK();
var moveForwardKey = keyConfig.MoveForward.ToVK();
var captureArea = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
var middleX = captureArea.Width / 2;
var leftKeyDown = false;
var rightKeyDown = false;
var noDetectCount = 0;
var prevKey = VK.VK_A;
var prevKey = moveLeftKey;
var backwardsAndForwardsCount = 0;
while (!_cts.Token.IsCancellationRequested)
while (!_ct.IsCancellationRequested)
{
var treeRect = DetectTree(CaptureToRectArea());
if (treeRect != Rect.Empty)
@@ -481,13 +673,13 @@ public class AutoDomainTask : ISoloTask
if (rightKeyDown)
{
// 先松开D键
_simulator.KeyUp(VK.VK_D);
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
rightKeyDown = false;
}
if (!leftKeyDown)
{
_simulator.KeyDown(VK.VK_A);
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
leftKeyDown = true;
}
}
@@ -499,13 +691,13 @@ public class AutoDomainTask : ISoloTask
if (leftKeyDown)
{
// 先松开A键
_simulator.KeyUp(VK.VK_A);
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
leftKeyDown = false;
}
if (!rightKeyDown)
{
_simulator.KeyDown(VK.VK_D);
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
rightKeyDown = true;
}
}
@@ -514,43 +706,49 @@ public class AutoDomainTask : ISoloTask
// 树在中间 松开所有键
if (rightKeyDown)
{
_simulator.KeyUp(VK.VK_D);
prevKey = VK.VK_D;
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
prevKey = moveRightKey;
rightKeyDown = false;
}
if (leftKeyDown)
{
_simulator.KeyUp(VK.VK_A);
prevKey = VK.VK_A;
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
prevKey = moveLeftKey;
leftKeyDown = false;
}
// 松开按键后使用小碎步移动
if (treeMiddleX < middleX)
{
if (prevKey == VK.VK_D)
if (prevKey == moveRightKey)
{
backwardsAndForwardsCount++;
}
_simulator.KeyPress(VK.VK_A, 60);
prevKey = VK.VK_A;
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
Sleep(60);
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
prevKey = moveLeftKey;
}
else if (treeMiddleX > middleX)
{
if (prevKey == VK.VK_A)
if (prevKey == moveLeftKey)
{
backwardsAndForwardsCount++;
}
_simulator.KeyPress(VK.VK_D, 60);
prevKey = VK.VK_D;
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
Sleep(60);
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
prevKey = moveRightKey;
}
else
{
_simulator.KeyPress(VK.VK_W, 60);
Sleep(500, _cts);
Simulation.SendInput.Keyboard.KeyDown(moveForwardKey);
Sleep(60);
Simulation.SendInput.Keyboard.KeyUp(moveForwardKey);
Sleep(500, _ct);
treeCts.Cancel();
break;
}
@@ -565,13 +763,13 @@ public class AutoDomainTask : ISoloTask
{
if (leftKeyDown)
{
_simulator.KeyUp(VK.VK_A);
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
leftKeyDown = false;
}
if (!rightKeyDown)
{
_simulator.KeyDown(VK.VK_D);
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
rightKeyDown = true;
}
}
@@ -579,13 +777,13 @@ public class AutoDomainTask : ISoloTask
{
if (rightKeyDown)
{
_simulator.KeyUp(VK.VK_D);
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
rightKeyDown = false;
}
if (!leftKeyDown)
{
_simulator.KeyDown(VK.VK_A);
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
leftKeyDown = true;
}
}
@@ -594,13 +792,15 @@ public class AutoDomainTask : ISoloTask
if (backwardsAndForwardsCount >= _config.LeftRightMoveTimes)
{
// 左右移动5次说明已经在树中心了
_simulator.KeyPress(VK.VK_W, 60);
Sleep(500, _cts);
Simulation.SendInput.Keyboard.KeyDown(moveForwardKey);
Sleep(60);
Simulation.SendInput.Keyboard.KeyUp(moveForwardKey);
Sleep(500, _ct);
treeCts.Cancel();
break;
}
Sleep(60, _cts);
Sleep(60, _ct);
}
VisionContext.Instance().DrawContent.ClearAll();
@@ -640,40 +840,12 @@ public class AutoDomainTask : ISoloTask
while (!cts.Token.IsCancellationRequested)
{
using var captureRegion = CaptureToRectArea();
var angle = CameraOrientation.Compute(captureRegion.SrcGreyMat);
var angle = CameraOrientation.Compute(captureRegion.SrcMat);
CameraOrientation.DrawDirection(captureRegion, angle);
if (angle is >= 356 or <= 4)
{
// 算作对准了
continuousCount++;
}
if (angle <= 180)
{
// 左移视角
var moveAngle = angle;
if (moveAngle > 2)
{
moveAngle *= 2;
}
Simulation.SendInput.Mouse.MoveMouseBy(-moveAngle, 0);
continuousCount = 0;
}
else if (angle is > 180 and < 360)
{
// 右移视角
var moveAngle = 360 - angle;
if (moveAngle > 2)
{
moveAngle *= 2;
}
Simulation.SendInput.Mouse.MoveMouseBy(moveAngle, 0);
continuousCount = 0;
}
else
{
// 360 度 东方向视角
if (continuousCount > 5)
{
@@ -684,6 +856,33 @@ public class AutoDomainTask : ISoloTask
}
}
}
else
{
continuousCount = 0;
}
if (angle <= 180)
{
// 左移视角
var moveAngle = (int)Math.Round(angle);
if (moveAngle > 2)
{
moveAngle *= 2;
}
Simulation.SendInput.Mouse.MoveMouseBy(-moveAngle, 0);
}
else if (angle is > 180 and < 360)
{
// 右移视角
var moveAngle = 360 - (int)Math.Round(angle);
if (moveAngle > 2)
{
moveAngle *= 2;
}
Simulation.SendInput.Mouse.MoveMouseBy(moveAngle, 0);
}
Sleep(100);
}
@@ -701,7 +900,7 @@ public class AutoDomainTask : ISoloTask
private bool GettingTreasure(bool recognizeResin, bool isLastTurn)
{
// 等待窗口弹出
Sleep(1500, _cts);
Sleep(1500, _ct);
// 优先使用浓缩树脂
var retryTimes = 0;
@@ -714,39 +913,53 @@ public class AutoDomainTask : ISoloTask
break;
}
var useCondensedResinRa = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.UseCondensedResinRa);
var useCondensedResinRa = CaptureToRectArea().Find(AutoFightAssets.Instance.UseCondensedResinRa);
if (!useCondensedResinRa.IsEmpty())
{
useCondensedResinRa.Click();
// 点两下 #224 #218
// 解决水龙王按下左键后没松开,然后后续点击按下就没反应了
Sleep(400, _cts);
Sleep(400, _ct);
useCondensedResinRa.Click();
break;
}
Sleep(800, _cts);
Sleep(800, _ct);
}
Sleep(1000, _cts);
Sleep(1000, _ct);
var captureArea = TaskContext.Instance().SystemInfo.CaptureAreaRect;
var hasSkip = false;
var captureArea = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
for (var i = 0; i < 30; i++)
{
// 跳过领取动画
GameCaptureRegion.GameRegionClick((size, scale) => (size.Width - 140 * scale, 53 * scale));
Sleep(200, _cts);
GameCaptureRegion.GameRegionClick((size, scale) => (size.Width - 140 * scale, 53 * scale));
if (!hasSkip)
{
TaskContext.Instance().PostMessageSimulator.LeftButtonClick(); // 先随便点一个地方使得跳过出现
}
using var ra = CaptureToRectArea();
// OCR识别是否有跳过
var ocrList = ra.FindMulti(RecognitionObject.Ocr(captureArea.Width - 230 * assetScale, 0, 230 * assetScale - 5, 80 * assetScale));
var skipTextRa = ocrList.FirstOrDefault(t => Regex.IsMatch(t.Text, this.skipLocalizedString));
if (skipTextRa != null)
{
hasSkip = true;
skipTextRa.Click(); // 有则点击
}
// 优先点击继续
var ra = CaptureToRectArea();
var confirmRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ConfirmRa);
using var confirmRectArea = ra.Find(AutoFightAssets.Instance.ConfirmRa);
if (!confirmRectArea.IsEmpty())
{
if (isLastTurn)
{
// 最后一回合 退出
var exitRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ExitRa);
var exitRectArea = ra.Find(AutoFightAssets.Instance.ExitRa);
if (!exitRectArea.IsEmpty())
{
exitRectArea.Click();
@@ -764,7 +977,7 @@ public class AutoDomainTask : ISoloTask
if (condensedResinCount == 0 && fragileResinCount < 20)
{
// 没有体力了退出
var exitRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ExitRa);
var exitRectArea = ra.Find(AutoFightAssets.Instance.ExitRa);
if (!exitRectArea.IsEmpty())
{
exitRectArea.Click();
@@ -779,7 +992,7 @@ public class AutoDomainTask : ISoloTask
}
}
Sleep(300, _cts);
Sleep(300, _ct);
}
throw new NormalEndException("未检测到秘境结束,可能是背包物品已满。");
@@ -795,7 +1008,7 @@ public class AutoDomainTask : ISoloTask
var ra = CaptureToRectArea();
// 浓缩树脂
var condensedResinCountRa = ra.Find(AutoFightContext.Instance.FightAssets.CondensedResinCountRa);
var condensedResinCountRa = ra.Find(AutoFightAssets.Instance.CondensedResinCountRa);
if (!condensedResinCountRa.IsEmpty())
{
// 图像右侧就是浓缩树脂数量
@@ -806,7 +1019,7 @@ public class AutoDomainTask : ISoloTask
}
// 脆弱树脂
var fragileResinCountRa = ra.Find(AutoFightContext.Instance.FightAssets.FragileResinCountRa);
var fragileResinCountRa = ra.Find(AutoFightAssets.Instance.FragileResinCountRa);
if (!fragileResinCountRa.IsEmpty())
{
// 图像右侧就是脆弱树脂数量
@@ -818,4 +1031,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(star).Start(_ct);
}
}
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="地脉异常" xml:space="preserve">
<value>Ley.*Line.*Disorder</value>
</data>
<data name="挑战达成" xml:space="preserve">
<value>(Challenge|Completed)</value>
</data>
<data name="点击任意位置关闭" xml:space="preserve">
<value>Click.*any.*where.*to.*close</value>
</data>
<data name="自动退出" xml:space="preserve">
<value>Leaving</value>
</data>
<data name="跳过" xml:space="preserve">
<value>Skip</value>
</data>
</root>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="地脉异常" xml:space="preserve">
<value>Anomalie.*énergétique</value>
</data>
<data name="挑战达成" xml:space="preserve">
<value>(Défi|terminé)</value>
</data>
<data name="点击任意位置关闭" xml:space="preserve">
<value>Cliquez.*pour.*fermer</value>
</data>
<data name="自动退出" xml:space="preserve">
<value>Sortie</value>
</data>
<data name="跳过" xml:space="preserve">
<value>Passer</value>
</data>
</root>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="地脉异常" xml:space="preserve">
<value>地脉异常</value>
</data>
<data name="挑战达成" xml:space="preserve">
<value>(挑战|达成)</value>
</data>
<data name="点击任意位置关闭" xml:space="preserve">
<value>点击任意位置关闭</value>
</data>
<data name="自动退出" xml:space="preserve">
<value>(自动|退出)</value>
</data>
<data name="跳过" xml:space="preserve">
<value>跳过</value>
</data>
</root>
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="地脉异常" xml:space="preserve">
<value>地[脈服][異翼昊]常</value>
</data>
<data name="挑战达成" xml:space="preserve">
<value>(挑戰|達成)</value>
</data>
<data name="点击任意位置关闭" xml:space="preserve">
<value>點擊任意位置關閉</value>
</data>
<data name="自动退出" xml:space="preserve">
<value>(自動|退出)</value>
</data>
<data name="跳过" xml:space="preserve">
<value>跳過</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

@@ -9,9 +9,10 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
{
public Rect TeamRectNoIndex;
public Rect TeamRect;
public List<Rect> AvatarSideIconRectList;
public List<Rect> AvatarIndexRectList;
public List<Rect> AvatarSideIconRectList; // 侧边栏角色头像 非联机状态下
public List<Rect> AvatarIndexRectList; // 侧边栏角色头像对应的白色块 非联机状态下
public Rect ERect;
public Rect ECooldownRect;
public Rect QRect;
public Rect EndTipsUpperRect; // 挑战达成提示
public Rect EndTipsRect;
@@ -29,6 +30,16 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
public Dictionary<string, string> AvatarCostumeMap;
// 联机
public RecognitionObject OnePRa;
public RecognitionObject PRa;
public Dictionary<string, List<Rect>> AvatarSideIconRectListMap; // 侧边栏角色头像 联机状态下
public Dictionary<string, List<Rect>> AvatarIndexRectListMap; // 侧边栏角色头像对应的白色块 联机状态下
// 小道具位置
public Rect GadgetRect;
private AutoFightAssets()
{
TeamRectNoIndex = new Rect(CaptureRect.Width - (int)(355 * AssetScale), (int)(220 * AssetScale),
@@ -37,8 +48,13 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
(int)(355 * AssetScale), (int)(465 * AssetScale));
ERect = new Rect(CaptureRect.Width - (int)(267 * AssetScale), CaptureRect.Height - (int)(132 * AssetScale),
(int)(77 * AssetScale), (int)(77 * AssetScale));
ECooldownRect = new Rect(CaptureRect.Width - (int)(241 * AssetScale), CaptureRect.Height - (int)(97 * AssetScale),
(int)(41 * AssetScale), (int)(18 * AssetScale));
QRect = new Rect(CaptureRect.Width - (int)(157 * AssetScale), CaptureRect.Height - (int)(165 * AssetScale),
(int)(110 * AssetScale), (int)(110 * AssetScale));
// 小道具位置 1920-133,800,60,50
GadgetRect = new Rect(CaptureRect.Width - (int)(133 * AssetScale), (int)(800 * AssetScale),
(int)(60 * AssetScale), (int)(50 * AssetScale));
// 结束提示从中间开始找相对位置
EndTipsUpperRect = new Rect(CaptureRect.Width / 2 - (int)(100 * AssetScale), (int)(243 * AssetScale),
(int)(200 * AssetScale), (int)(50 * AssetScale));
@@ -79,6 +95,78 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
{ "Sea", "海风之梦" },
};
// 联机
// 1p_2 与 p_2 为同一位置
// 1p_4 与 p_4 为同一位置
AvatarSideIconRectListMap = new Dictionary<string, List<Rect>>
{
{
"1p_2", [
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
]
},
{
"1p_3", [
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
]
},
{ "1p_4", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(515 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
{
"p_2", [
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
]
},
{ "p_3", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(475 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
{ "p_4", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(515 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
};
AvatarIndexRectListMap = new Dictionary<string, List<Rect>>
{
{
"1p_2", [
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(508 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
]
},
{
"1p_3", [
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(459 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(555 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
]
},
{ "1p_4", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(552 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
{
"p_2", [
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(508 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
]
},
{ "p_3", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
{ "p_4", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(507 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
};
// 左上角的 1P 图标
OnePRa = new RecognitionObject
{
Name = "1P",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoFight", "1p.png"),
RegionOfInterest = new Rect(0, 0, CaptureRect.Width / 4, CaptureRect.Height / 7),
DrawOnWindow = false
}.InitTemplate();
// 右侧联机的 P 图标
PRa = new RecognitionObject
{
Name = "P",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoFight", "p.png"),
RegionOfInterest = new Rect(CaptureRect.Width - (int)(CaptureRect.Width / 12.5), CaptureRect.Height / 5, (int)(CaptureRect.Width / 12.5), CaptureRect.Height / 2 - CaptureRect.Width / 7),
DrawOnWindow = false
}.InitTemplate();
WandererIconRa = new RecognitionObject
{
Name = "WandererIcon",
File diff suppressed because it is too large. Load diff
@@ -3,6 +3,10 @@ using System;
namespace BetterGenshinImpact.GameTask.AutoFight;
/// <summary>
/// 自动战斗配置
/// </summary>
@@ -21,10 +25,111 @@ public partial class AutoFightConfig : ObservableObject
/// </summary>
[ObservableProperty]
private bool _fightFinishDetectEnabled = true;
/// <summary>
/// 根据技能CD优化出招人员
/// 根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),
/// 多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查,如果是人名和数字,则把数字当做出招cd(秒)。
/// </summary>
[ObservableProperty] private string _actionSchedulerByCd = "";
[Serializable]
public partial class FightFinishDetectConfig : ObservableObject
{
/// <summary>
/// 判断战斗结束读条颜色,不同帧率可能下会有些不同,默认为95,235,255
/// </summary>
[ObservableProperty]
private string _battleEndProgressBarColor = "";
/// <summary>
/// 对于上方颜色地偏差值,即±某个值,例如 6或6,6,6,前者表示所有偏差值都一样,后者则可以分别设置
/// </summary>
[ObservableProperty]
private string _battleEndProgressBarColorTolerance = "";
/// <summary>
/// 快速检查战斗结束,在一轮脚本中,可以每隔一定秒数(默认为5)或指定角色操作后,去检查(在每个角色完成该轮脚本时)。
/// </summary>
[ObservableProperty]
private bool _fastCheckEnabled = false;
/// <summary>
/// 快速检查战斗结束的参数,可填入数字和人名,多种用分号分隔,例如:15,白术;钟离;,如果是数字(小于等于0则不会根据时间去检查),则指定检查间隔,如果是人名,则该角色执行一轮操作后进行检查。同时每轮结束后检查不变。
/// </summary>
[ObservableProperty]
private string _fastCheckParams = "";
/// <summary>
/// 检查战斗结束的延时,即角色,默认为1.5秒。也可以指定特定角色之后延时多少时间检查。格式如:2.5;白术,1.5;钟离,1.0;
/// </summary>
[ObservableProperty]
private string _checkEndDelay = "";
/// <summary>
/// 按下切换队伍后去检查屏幕色块的延迟,默认为0.45秒。若频繁误判可以适当提高这个值。确保这个延迟不会真的把队伍配置界面切出来。
/// </summary>
[ObservableProperty]
private string _beforeDetectDelay = "";
}
/// <summary>
/// 战斗结束相关配置
/// </summary>
[ObservableProperty]
private FightFinishDetectConfig _finishDetectConfig = new();
/// <summary>
/// 检测战斗结束
/// 检测战斗结束,默认为每轮脚本后检查
/// </summary>
[ObservableProperty]
private bool _pickDropsAfterFightEnabled = true;
[Serializable]
public partial class PickDropsAfterFightConfig : ObservableObject
{
/// <summary>
/// 前进次数
/// </summary>
[ObservableProperty]
private int _forwardTimes = 6;
/// <summary>
/// 校准次数
/// </summary>
[ObservableProperty]
private int _calibrationTimes = 15;
/// <summary>
/// 衰减因子
/// </summary>
[ObservableProperty]
private double _decayFactor = 0.7;
/// <summary>
/// 前进量(秒),设置为0时在[1,3]中随机
/// </summary>
[ObservableProperty]
private int _forwardSeconds = 2;
}
/// <summary>
/// 掉落寻物相关配置
/// </summary>
[ObservableProperty]
private PickDropsAfterFightConfig _pickDropsConfig = new();
/// <summary>
/// 战斗结束后,如果存在枫原万叶,则使用该角色捡材料
/// </summary>
[ObservableProperty]
private bool _kazuhaPickupEnabled = true;
/// <summary>
/// 战斗超时,单位秒
/// </summary>
[ObservableProperty]
private int _timeout = 120;
}
@@ -1,27 +1,27 @@
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
using BetterGenshinImpact.Model;
// using BetterGenshinImpact.Core.Simulator;
// using BetterGenshinImpact.GameTask.AutoFight.Assets;
// using BetterGenshinImpact.Model;
//
// namespace BetterGenshinImpact.GameTask.AutoFight;
namespace BetterGenshinImpact.GameTask.AutoFight;
/// <summary>
/// 自动战斗上下文
/// 请在启动BetterGI以后再初始化
/// </summary>
public class AutoFightContext : Singleton<AutoFightContext>
{
private AutoFightContext()
{
Simulator = Simulation.PostMessage(TaskContext.Instance().GameHandle);
}
/// <summary>
/// find资源
/// </summary>
public AutoFightAssets FightAssets => AutoFightAssets.Instance;
/// <summary>
/// 战斗专用的PostMessage模拟键鼠操作
/// </summary>
public readonly PostMessageSimulator Simulator;
}
// /// <summary>
// /// 自动战斗上下文
// /// 请在启动BetterGI以后再初始化
// /// </summary>
// public class AutoFightContext : Singleton<AutoFightContext>
// {
// private AutoFightContext()
// {
// Simulator = TaskContext.Instance().PostMessageSimulator;
// }
//
// /// <summary>
// /// find资源
// /// </summary>
// public AutoFightAssets FightAssets => AutoFightAssets.Instance;
//
// /// <summary>
// /// 战斗专用的PostMessage模拟键鼠操作
// /// </summary>
// public readonly PostMessageSimulator Simulator;
// }
@@ -2,11 +2,55 @@
namespace BetterGenshinImpact.GameTask.AutoFight;
public class AutoFightParam(string path) : BaseTaskParam
public class AutoFightParam : BaseTaskParam
{
public string CombatStrategyPath { get; set; } = path;
public class FightFinishDetectConfig
{
public string BattleEndProgressBarColor { get; set; }= "";
public string BattleEndProgressBarColorTolerance { get; set; }= "";
public bool FastCheckEnabled = false;
public string FastCheckParams = "";
public string CheckEndDelay = "";
public string BeforeDetectDelay = "";
}
public AutoFightParam(string path, AutoFightConfig autoFightConfig)
{
CombatStrategyPath = path;
Timeout = autoFightConfig.Timeout;
FightFinishDetectEnabled = autoFightConfig.FightFinishDetectEnabled;
PickDropsAfterFightEnabled = autoFightConfig.PickDropsAfterFightEnabled;
KazuhaPickupEnabled = autoFightConfig.KazuhaPickupEnabled;
ActionSchedulerByCd = autoFightConfig.ActionSchedulerByCd;
FinishDetectConfig.FastCheckEnabled = autoFightConfig.FinishDetectConfig.FastCheckEnabled;
FinishDetectConfig.FastCheckParams = autoFightConfig.FinishDetectConfig.FastCheckParams;
FinishDetectConfig.CheckEndDelay = autoFightConfig.FinishDetectConfig.CheckEndDelay;
FinishDetectConfig.BeforeDetectDelay = autoFightConfig.FinishDetectConfig.BeforeDetectDelay;
//下面参数固定,只取自动战斗里面的
FinishDetectConfig.BattleEndProgressBarColor = TaskContext.Instance().Config.AutoFightConfig.FinishDetectConfig.BattleEndProgressBarColor;
FinishDetectConfig.BattleEndProgressBarColorTolerance = TaskContext.Instance().Config.AutoFightConfig.FinishDetectConfig.BattleEndProgressBarColorTolerance;
}
public FightFinishDetectConfig FinishDetectConfig { get; set; } = new();
public string CombatStrategyPath { get; set; }
public bool FightFinishDetectEnabled { get; set; } = false;
public bool PickDropsAfterFightEnabled { get; set; } = false;
}
public int Timeout { get; set; } = 120;
public bool KazuhaPickupEnabled = true;
public string ActionSchedulerByCd = "";
}
@@ -1,32 +1,179 @@
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.Core.Simulator.Extensions;
using BetterGenshinImpact.GameTask.AutoFight.Model;
using BetterGenshinImpact.GameTask.AutoFight.Script;
using BetterGenshinImpact.GameTask.AutoPathing;
using BetterGenshinImpact.GameTask.Model.Area;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.GameTask.Common.Job;
using OpenCvSharp;
using Vanara;
using Vanara.PInvoke;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.Common.BgiVision;
using BetterGenshinImpact.Helpers;
namespace BetterGenshinImpact.GameTask.AutoFight;
public class AutoFightTask : ISoloTask
{
public string Name => "自动战斗";
private readonly AutoFightParam _taskParam;
private readonly CombatScriptBag _combatScriptBag;
private CancellationTokenSource? _cts;
private CancellationToken _ct;
private readonly BgiYoloV8Predictor _predictor;
private DateTime _lastFightFlagTime = DateTime.Now; // 战斗标志最近一次出现的时间
private readonly double _dpi = TaskContext.Instance().DpiScale;
private class TaskFightFinishDetectConfig
{
public int DelayTime = 1500;
public int DetectDelayTime = 450;
public Dictionary<string, int> DelayTimes = new();
public double CheckTime = 5;
public List<string> CheckNames = new();
public bool FastCheckEnabled;
public TaskFightFinishDetectConfig(AutoFightParam.FightFinishDetectConfig finishDetectConfig)
{
FastCheckEnabled = finishDetectConfig.FastCheckEnabled;
ParseCheckTimeString(finishDetectConfig.FastCheckParams, out CheckTime, CheckNames);
ParseFastCheckEndDelayString(finishDetectConfig.CheckEndDelay, out DelayTime, DelayTimes);
BattleEndProgressBarColor = ParseStringToTuple(finishDetectConfig.BattleEndProgressBarColor, (95, 235, 255));
BattleEndProgressBarColorTolerance = ParseSingleOrCommaSeparated(finishDetectConfig.BattleEndProgressBarColorTolerance, (6, 6, 6));
DetectDelayTime = (int)((double.TryParse(finishDetectConfig.BeforeDetectDelay, out var result) ? result : 0.45) * 1000);
}
public (int, int, int) BattleEndProgressBarColor { get; }
public (int, int, int) BattleEndProgressBarColorTolerance { get; }
public static void ParseCheckTimeString(
string input,
out double checkTime,
List<string> names)
{
checkTime = 5;
if (string.IsNullOrEmpty(input))
{
return; // 直接返回
}
var uniqueNames = new HashSet<string>(); // 用于临时去重的集合
// 按分号分割字符串
var segments = input.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var segment in segments)
{
var trimmedSegment = segment.Trim();
// 如果是纯数字部分
if (double.TryParse(trimmedSegment, NumberStyles.Float, CultureInfo.InvariantCulture, out double number))
{
checkTime = number; // 更新 CheckTime
}
else if (!uniqueNames.Contains(trimmedSegment)) // 如果是非数字且不重复
{
uniqueNames.Add(trimmedSegment); // 添加到集合
}
}
names.AddRange(uniqueNames); // 将集合转换为列表
}
public static void ParseFastCheckEndDelayString(
string input,
out int delayTime,
Dictionary<string, int> nameDelayMap)
{
delayTime = 1500;
if (string.IsNullOrEmpty(input))
{
return; // 直接返回
}
// 分割字符串,以分号为分隔符
var segments = input.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var segment in segments)
{
var parts = segment.Split(',');
// 如果是纯数字部分
if (parts.Length == 1)
{
if (double.TryParse(parts[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out double number))
{
delayTime = (int)(number * 1000); // 更新 delayTime
}
}
// 如果是名字,数字格式
else if (parts.Length == 2)
{
string name = parts[0].Trim();
if (double.TryParse(parts[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out double value))
{
nameDelayMap[name] = (int)(value * 1000); // 更新字典,取最后一个值
}
}
// 其他格式,跳过不处理
}
}
static bool IsSingleNumber(string input, out int result)
{
return int.TryParse(input, out result);
}
static (int, int, int) ParseSingleOrCommaSeparated(string input, (int, int, int) defaultValue)
{
// 如果是单个数字
if (IsSingleNumber(input, out var singleNumber))
{
return (singleNumber, singleNumber, singleNumber);
}
return ParseStringToTuple(input, defaultValue);
}
static (int, int, int) ParseStringToTuple(string input, (int, int, int) defaultValue)
{
// 尝试按逗号分割字符串
var parts = input.Split(',');
if (parts.Length == 3 &&
int.TryParse(parts[0], out var num1) &&
int.TryParse(parts[1], out var num2) &&
int.TryParse(parts[2], out var num3))
{
return (num1, num2, num3);
}
// 如果解析失败,返回默认值
return defaultValue;
}
}
private TaskFightFinishDetectConfig _finishDetectConfig;
public AutoFightTask(AutoFightParam taskParam)
{
_taskParam = taskParam;
@@ -34,13 +181,21 @@ public class AutoFightTask : ISoloTask
if (_taskParam.FightFinishDetectEnabled)
{
_predictor = new BgiYoloV8Predictor(@"Assets\Model\World\bgi_world.onnx");
_predictor = BgiYoloV8PredictorFactory.GetPredictor(@"Assets\Model\World\bgi_world.onnx");
}
_finishDetectConfig = new TaskFightFinishDetectConfig(_taskParam.FinishDetectConfig);
}
public async Task Start(CancellationTokenSource cts)
// 方法1:判断是否是单个数字
/*public int delayTime=1500;
public Dictionary<string, int> delayTimes = new();
public double checkTime = 5;
public List<string> checkNames = new();*/
public async Task Start(CancellationToken ct)
{
_cts = cts;
_ct = ct;
LogScreenResolution();
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());
@@ -49,121 +204,372 @@ public class AutoFightTask : ISoloTask
throw new Exception("识别队伍角色失败");
}
var actionSchedulerByCd = ParseStringToDictionary(_taskParam.ActionSchedulerByCd);
var combatCommands = _combatScriptBag.FindCombatScript(combatScenes.Avatars);
// 新的取消token
var cts2 = new CancellationTokenSource();
cts.Token.Register(cts2.Cancel);
ct.Register(cts2.Cancel);
combatScenes.BeforeTask(cts2);
combatScenes.BeforeTask(cts2.Token);
TimeSpan fightTimeout = TimeSpan.FromSeconds(_taskParam.Timeout); // 战斗超时时间
Stopwatch timeoutStopwatch = Stopwatch.StartNew();
Stopwatch checkFightFinishStopwatch = Stopwatch.StartNew();
TimeSpan checkFightFinishTime = TimeSpan.FromSeconds(_finishDetectConfig.CheckTime); //检查战斗超时时间的超时时间
//战斗前检查,可做成配置
// if (await CheckFightFinish()) {
// return;
// }
var fightEndFlag = false;
string lastFightName = "";
string skipFightName = "";
//统计切换人打架次数
var countFight = 0;
// 战斗操作
var fightTask = Task.Run(() =>
var fightTask = Task.Run(async () =>
{
try
{
while (!cts2.Token.IsCancellationRequested)
{
// 通用化战斗策略
foreach (var command in combatCommands)
for (var i = 0; i < combatCommands.Count; i++)
{
var command = combatCommands[i];
if (timeoutStopwatch.Elapsed > fightTimeout)
{
Logger.LogInformation("战斗超时结束");
fightEndFlag = true;
break;
}
//根据元素技能冷却事件优化出招流程,只有当人物切换后才会触发检查
double skillCd;
if (lastFightName != command.Name && actionSchedulerByCd.TryGetValue(command.Name, out skillCd))
{
var avatar = combatScenes.SelectAvatar(command.Name);
if (avatar == null)
{
continue;
}
if (skillCd < 0)
{
skillCd = FindMax([avatar.SkillCd, avatar.SkillHoldCd]);
}
var dif = (DateTime.UtcNow - avatar.LastSkillTime);
//当技能未冷却时,跳过此次出招
if ((DateTime.UtcNow - avatar.LastSkillTime).TotalSeconds < skillCd)
{
if (skipFightName != command.Name)
{
Logger.LogInformation($"{command.Name}cd冷却为{skillCd}秒,剩余{skillCd - dif.TotalSeconds}秒,跳过此次行动");
}
skipFightName = command.Name;
continue;
}
}
command.Execute(combatScenes);
//统计战斗人次
if (i == combatCommands.Count - 1 || command.Name != combatCommands[i + 1].Name)
{
countFight++;
}
lastFightName = command.Name;
if (!fightEndFlag && _taskParam is { FightFinishDetectEnabled: true })
{
//处于最后一个位置,或者当前执行人和下一个人名字不一样的情况,满足一定条件(开启快速检查,并且检查时间大于0或人名存在配置)检查战斗
if (i == combatCommands.Count - 1
|| (
_finishDetectConfig.FastCheckEnabled && command.Name != combatCommands[i + 1].Name &&
((_finishDetectConfig.CheckTime > 0 && checkFightFinishStopwatch.Elapsed > checkFightFinishTime)
|| _finishDetectConfig.CheckNames.Contains(command.Name))
))
{
checkFightFinishStopwatch.Restart();
var delayTime = _finishDetectConfig.DelayTime;
var detectDelayTime = _finishDetectConfig.DetectDelayTime;
if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time))
{
delayTime = time;
Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
}
else
{
Logger.LogInformation($"延时检查为{delayTime}毫秒");
}
/*if (i<combatCommands.Count - 1)
{
Logger.LogInformation($"{command.Name}下一个人为{combatCommands[i+1].Name}毫秒");
}*/
fightEndFlag = await CheckFightFinish(delayTime, detectDelayTime);
}
}
if (fightEndFlag)
{
break;
}
}
}
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);
}
}, cts2.Token);
// 战斗结束检测线程
var endTask = Task.Run(async () =>
{
if (!_taskParam.FightFinishDetectEnabled)
{
return;
}
try
{
while (!cts2.IsCancellationRequested)
{
var finish = await CheckFightFinish();
if (finish)
if (fightEndFlag)
{
await cts2.CancelAsync();
break;
}
Sleep(1000, cts2);
}
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);
throw;
}
finally
{
Simulation.ReleaseAllKey();
}
}, cts2.Token);
await Task.WhenAll(fightTask, endTask);
await fightTask;
if (_taskParam is { FightFinishDetectEnabled: true, PickDropsAfterFightEnabled: true })
// 战斗结束检测线程
// var endTask = Task.Run(async () =>
// {
// if (!_taskParam.FightFinishDetectEnabled)
// {
// return;
// }
//
// try
// {
// while (!cts2.IsCancellationRequested)
// {
// var finish = await CheckFightFinish();
// if (finish)
// {
// await cts2.CancelAsync();
// break;
// }
//
// Sleep(1000, cts2.Token);
// }
// }
// catch (Exception e)
// {
// Debug.WriteLine(e.Message);
// Debug.WriteLine(e.StackTrace);
// }
// }, cts2.Token);
//
// await Task.WhenAll(fightTask, endTask);
if (_taskParam.KazuhaPickupEnabled)
{
// 队伍中存在万叶的时候使用一次长E
var kazuha = combatScenes.Avatars.FirstOrDefault(a => a.Name == "枫原万叶");
if (kazuha != null)
{
var time = DateTime.UtcNow - kazuha.LastSkillTime;
//当万叶cd大于3时或战斗人次少于2时(通常无怪物情况下),此时不再触发万叶拾取,
if (!(countFight < 2 || lastFightName == "枫原万叶" && time.TotalSeconds > 3))
{
Logger.LogInformation("使用枫原万叶长E拾取掉落物");
await Delay(300, ct);
if (kazuha.TrySwitch())
{
time = DateTime.UtcNow - kazuha.LastSkillTime;
if (time.TotalMilliseconds > 0 && time.TotalSeconds <= kazuha.SkillHoldCd)
{
Logger.LogInformation("枫原万叶长E技能可能处于冷却中,等待 {Time} s", time.TotalSeconds);
await Delay((int)Math.Ceiling(time.TotalMilliseconds), ct);
}
kazuha.UseSkill(true);
await Task.Delay(100);
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
await Delay(1500, ct);
}
}
else
{
Logger.LogInformation((countFight < 2 ? "首个人出招就结束战斗,应该无怪物" : "距最近一次万叶出招,时间过短") + ",跳过此次万叶拾取!");
}
}
}
if (_taskParam is { PickDropsAfterFightEnabled: true })
{
// 执行自动拾取掉落物的功能
await new ScanPickTask().Start(ct);
}
}
private void LogScreenResolution()
{
var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
{
Logger.LogWarning("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏可能无法正常使用自动战斗功能 !", gameScreenSize.Width, gameScreenSize.Height);
}
AssertUtils.CheckGameResolution("自动战斗");
}
private async Task<bool> CheckFightFinish()
static bool AreDifferencesWithinBounds((int, int, int) a, (int, int, int) b, (int, int, int) c)
{
// 计算每个位置的差值绝对值并进行比较
return Math.Abs(a.Item1 - b.Item1) < c.Item1 &&
Math.Abs(a.Item2 - b.Item2) < c.Item2 &&
Math.Abs(a.Item3 - b.Item3) < c.Item3;
}
private async Task<bool> CheckFightFinish(int delayTime = 1500, int detectDelayTime = 450)
{
// YOLO 判断血条和怪物位置
if (HasFightFlag(CaptureToRectArea()))
{
_lastFightFlagTime = DateTime.Now;
return false;
}
// if (HasFightFlagByYolo(CaptureToRectArea()))
// {
// _lastFightFlagTime = DateTime.Now;
// return false;
// }
//
//Random random = new Random();
//double randomFraction = random.NextDouble(); // 生成 0 到 1 之间的随机小数
//此处随机数,防止固定招式下,使按L正好处于招式下,导致无法准确判断战斗结束
// double randomNumber = 1 + (randomFraction * (3 - 1));
// 几秒内没有检测到血条和怪物位置,则开始旋转视角重新检测
if ((DateTime.Now - _lastFightFlagTime).TotalSeconds > 5)
//if ((DateTime.Now - _lastFightFlagTime).TotalSeconds > randomNumber)
//{
// 旋转完毕后都没有检测到血条和怪物位置,则按L键确认战斗结束
/**
Simulation.SendInput.Mouse.MiddleButtonClick();
await Delay(300, _ct);
for (var i = 0; i < 8; i++)
{
// 旋转完毕后都没有检测到血条和怪物位置,则按L键确认战斗结束
List<int> angles = [0, 90, 180, 270];
var rotateTask = new CameraRotateTask(_cts!);
foreach (var a in angles)
Simulation.SendInput.Mouse.MoveMouseBy((int)(500 * _dpi), 0);
await Delay(800, _ct); // 等待视角稳定
if (HasFightFlagByYolo(CaptureToRectArea()))
{
await rotateTask.WaitUntilRotatedTo(a, 5, 30);
await Delay(1000, _cts!); // 等待视角稳定
if (HasFightFlag(CaptureToRectArea()))
{
return false;
}
_lastFightFlagTime = DateTime.Now;
return false;
}
// 最终方案确认战斗结束
}
**/
//Simulation.SendInput.SimulateAction(GIActions.Drop);//在换队前取消爬墙状态
await Delay(delayTime, _ct);
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
// 最终方案确认战斗结束
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
await Delay(detectDelayTime, _ct);
var ra = CaptureToRectArea();
var b3 = ra.SrcMat.At<Vec3b>(50, 790); //进度条颜色
var whiteTile = ra.SrcMat.At<Vec3b>(50, 768); //白块
Simulation.SendInput.SimulateAction(GIActions.Drop);
if (IsWhite(whiteTile.Item2, whiteTile.Item1, whiteTile.Item0) && IsYellow(b3.Item2, b3.Item1, b3.Item0) /* AreDifferencesWithinBounds(_finishDetectConfig.BattleEndProgressBarColor, (b3.Item0, b3.Item1, b3.Item2), _finishDetectConfig.BattleEndProgressBarColorTolerance)*/)
{
Logger.LogInformation("识别到战斗结束");
return true;
}
Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
/**
if (!Bv.IsInMainUi(ra))
{
// 如果不在主界面,说明异常,直接结束战斗继续下一步(地图追踪下一步会进入异常处理)
Logger.LogInformation("当前不在主界面,直接结束战斗!");
return true;
}**/
_lastFightFlagTime = DateTime.Now;
return false;
}
private bool HasFightFlag(ImageRegion imageRegion)
bool IsYellow(int r, int g, int b)
{
if (RuntimeHelper.IsDebug)
//Logger.LogInformation($"IsYellow({r},{g},{b})");
// 黄色范围:R高,G高,B低
return (r >= 200 && r <= 255) &&
(g >= 200 && g <= 255) &&
(b >= 0 && b <= 100);
}
bool IsWhite(int r, int g, int b)
{
//Logger.LogInformation($"IsWhite({r},{g},{b})");
// 白色范围:R高,G高,B低
return (r >= 240 && r <= 255) &&
(g >= 240 && g <= 255) &&
(b >= 240 && b <= 255);
}
static double FindMax(double[] numbers)
{
if (numbers == null || numbers.Length == 0)
{
imageRegion.SrcMat.SaveImage(Global.Absolute(@"log\fight\" + $"{DateTime.Now:yyyyMMdd_HHmmss_ffff}.png"));
throw new ArgumentException("The array is empty or null.");
}
double max = numbers[0] > 10000 ? 0 : numbers[0];
foreach (var num in numbers)
{
var cpnum = numbers[0] > 10000 ? 0 : num;
max = Math.Max(max, num);
}
return max;
}
private static Dictionary<string, double> ParseStringToDictionary(string input, double defaultValue = -1)
{
var dictionary = new Dictionary<string, double>();
if (string.IsNullOrEmpty(input))
{
return dictionary; // 返回空字典
}
string[] pairs = input.Split(';', StringSplitOptions.RemoveEmptyEntries);
foreach (var pair in pairs)
{
var parts = pair.Split(',', StringSplitOptions.TrimEntries);
if (parts.Length > 0)
{
string name = parts[0];
double value = defaultValue;
if (parts.Length > 1 && double.TryParse(parts[1], out var parsedValue))
{
value = parsedValue;
}
dictionary[name] = value;
}
}
return dictionary;
}
private bool HasFightFlagByYolo(ImageRegion imageRegion)
{
// if (RuntimeHelper.IsDebug)
// {
// imageRegion.SrcMat.SaveImage(Global.Absolute(@"log\fight\" + $"{DateTime.Now:yyyyMMdd_HHmmss_ffff}.png"));
// }
var dict = _predictor.Detect(imageRegion);
return dict.ContainsKey("health_bar") || dict.ContainsKey("enemy_identify");
}
}
// 无用
// [Obsolete]
// private bool HasFightFlagByGadget(ImageRegion imageRegion)
// {
// // 小道具位置 1920-133,800,60,50
// var gadgetMat = imageRegion.DeriveCrop(AutoFightAssets.Instance.GadgetRect).SrcMat;
// var list = ContoursHelper.FindSpecifyColorRects(gadgetMat, new Scalar(225, 220, 225), new Scalar(255, 255, 255));
// // 要大于 gadgetMat 的 1/2
// return list.Any(r => r.Width > gadgetMat.Width / 2 && r.Height > gadgetMat.Height / 2);
// }
}
@@ -1,6 +1,6 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Service;
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -10,24 +10,31 @@ namespace BetterGenshinImpact.GameTask.AutoFight.Config;
public class DefaultAutoFightConfig
{
public static List<CombatAvatar> CombatAvatars { get; set; }
//public static List<CombatAvatar> CombatAvatars { get; set; }
public static List<string> CombatAvatarNames { get; set; }
public static Dictionary<string, CombatAvatar> CombatAvatarMap { get; set; }
public static Dictionary<string, CombatAvatar> CombatAvatarNameEnMap { get; set; }
public static FrozenDictionary<string, string> CombatAvatarAliasToNameMap { get; set; }
static DefaultAutoFightConfig()
{
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoFight\Assets\combat_avatar.json"));
var config = JsonSerializer.Deserialize<List<CombatAvatar>>(json, ConfigService.JsonOptions);
CombatAvatars = config ?? throw new Exception("combat_avatar.json deserialize failed");
var config = Newtonsoft.Json.JsonConvert.DeserializeObject<IEnumerable<CombatAvatar>>(json) ?? throw new Exception("combat_avatar.json deserialize failed");
//CombatAvatars = config;
CombatAvatarNames = config.Select(x => x.Name).ToList();
CombatAvatarMap = config.ToDictionary(x => x.Name);
CombatAvatarNameEnMap = config.ToDictionary(x => x.NameEn);
CombatAvatarAliasToNameMap = config.SelectMany(c => c.Alias.Select(a => new KeyValuePair<string, string>(a, c.Name))).ToFrozenDictionary();
}
public static string AvatarAliasToStandardName(string alias)
{
var avatar = CombatAvatars.Find(x => x.Alias.Contains(alias)) ?? throw new Exception($"角色名称校验失败:{alias}");
return avatar.Name;
if (CombatAvatarAliasToNameMap.TryGetValue(alias, out string? name) && name != null)
{
return name;
}
throw new Exception($"角色名称校验失败:{alias}");
// return CombatAvatars.Find(x => x.Alias.Contains(alias))?.Name ?? throw new Exception($"角色名称校验失败:{alias}");
}
}
@@ -1,16 +1,25 @@
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.Core.Simulator.Extensions;
using BetterGenshinImpact.GameTask.AutoFight.Config;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.Helpers;
using Microsoft.Extensions.Logging;
using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
using BetterGenshinImpact.GameTask.AutoTrackPath;
using BetterGenshinImpact.GameTask.Common.BgiVision;
using Vanara.PInvoke;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
using BetterGenshinImpact.ViewModel.Pages;
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
@@ -49,6 +58,11 @@ public class Avatar
/// </summary>
public double SkillHoldCd { get; set; }
/// <summary>
/// 最近一次使用元素战技的时间
/// </summary>
public DateTime LastSkillTime { get; set; }
/// <summary>
/// 元素爆发CD
/// </summary>
@@ -72,13 +86,14 @@ public class Avatar
/// <summary>
/// 任务取消令牌
/// </summary>
public CancellationTokenSource? Cts { get; set; }
public CancellationToken Ct { get; set; }
/// <summary>
/// 战斗场景
/// </summary>
public CombatScenes CombatScenes { get; set; }
public Avatar(CombatScenes combatScenes, string name, int index, Rect nameRect)
{
CombatScenes = combatScenes;
@@ -99,19 +114,35 @@ public class Avatar
/// 通过判断确认按钮
/// </summary>
/// <param name="region"></param>
/// <param name="ct"></param>
/// <returns></returns>
public void ThrowWhenDefeated(ImageRegion region)
public static void ThrowWhenDefeated(ImageRegion region, CancellationToken ct)
{
using var confirmRectArea = region.Find(AutoFightContext.Instance.FightAssets.ConfirmRa);
if (!confirmRectArea.IsEmpty())
if (Bv.IsInRevivePrompt(region))
{
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
Sleep(600, Cts);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M);
throw new Exception("存在角色被击败,按 M 键打开地图,并停止自动秘境。");
Logger.LogWarning("检测到复苏界面,存在角色被击败,前往七天神像复活");
// 先打开地图
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE); // NOTE: 此处按下Esc是为了关闭复苏界面,无需改键
Sleep(600, ct);
TpForRecover(ct, new RetryException("检测到复苏界面,存在角色被击败,前往七天神像复活"));
}
}
/// <summary>
/// tp 到七天神像恢复
/// </summary>
/// <param name="ct"></param>
/// <exception cref="RetryException"></exception>
public static void TpForRecover(CancellationToken ct, Exception ex)
{
Simulation.SendInput.SimulateAction(GIActions.OpenMap);
// tp 到七天神像复活
var tpTask = new TpTask(ct);
tpTask.TpToStatueOfTheSeven().Wait(ct);
Logger.LogInformation("血量恢复完成。【设置】-【七天神像设置】可以修改回血相关配置。");
throw ex;
}
/// <summary>
/// 切换到本角色
/// 切换cd是1秒,如果切换失败,会尝试再次切换,最多尝试5次
@@ -120,27 +151,105 @@ public class Avatar
{
for (var i = 0; i < 30; i++)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
var region = CaptureToRectArea();
ThrowWhenDefeated(region);
ThrowWhenDefeated(region, Ct);
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
if (IsActive(region) && notActiveCount == 3)
if (IsActive(region) && notActiveCount == CombatScenes.ExpectedTeamAvatarNum - 1)
{
return;
}
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_1 + (byte)Index - 1);
Simulation.SendInput.SimulateAction(GIActions.Drop);
switch (Index)
{
case 1:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
break;
case 2:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
break;
case 3:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
break;
case 4:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
break;
case 5:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
break;
default:
break;
}
// Debug.WriteLine($"切换到{Index}号位");
// Cv2.ImWrite($"log/切换.png", content.CaptureRectArea.SrcMat);
Sleep(250, Cts);
// Cv2.ImWrite($"log/切换.png", region.SrcMat);
Sleep(250, Ct);
}
}
/// <summary>
/// 尝试切换到本角色
/// </summary>
/// <param name="tryTimes"></param>
/// <param name="needLog"></param>
/// <returns></returns>
public bool TrySwitch(int tryTimes = 4, bool needLog = true)
{
for (var i = 0; i < tryTimes; i++)
{
if (Ct is { IsCancellationRequested: true })
{
return false;
}
var region = CaptureToRectArea();
ThrowWhenDefeated(region, Ct);
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
if (IsActive(region) && notActiveCount == CombatScenes.ExpectedTeamAvatarNum - 1)
{
if (needLog && i > 0)
{
Logger.LogInformation("成功切换角色:{Name}", Name);
}
return true;
}
Simulation.SendInput.SimulateAction(GIActions.Drop); //反正会重试就不等落地了
switch (Index)
{
case 1:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
break;
case 2:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
break;
case 3:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
break;
case 4:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
break;
case 5:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
break;
default:
break;
}
Sleep(250, Ct);
}
return false;
}
/// <summary>
/// 切换到本角色
/// 切换cd是1秒,如果切换失败,会尝试再次切换,最多尝试5次
@@ -150,7 +259,7 @@ public class Avatar
for (var i = 0; i < 10; i++)
{
var region = CaptureToRectArea();
ThrowWhenDefeated(region);
ThrowWhenDefeated(region, Ct);
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
if (IsActive(region) && notActiveCount == 3)
@@ -158,7 +267,28 @@ public class Avatar
return;
}
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_1 + (byte)Index - 1);
Simulation.SendInput.SimulateAction(GIActions.Drop);
switch (Index)
{
case 1:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
break;
case 2:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
break;
case 3:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
break;
case 4:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
break;
case 5:
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
break;
default:
break;
}
Sleep(250);
}
}
@@ -202,7 +332,7 @@ public class Avatar
{
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
// 剪裁出队伍区域
var teamRa = region.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRect);
var teamRa = region.DeriveCrop(AutoFightAssets.Instance.TeamRect);
var blockX = NameRect.X + NameRect.Width * 2 - 10;
var block = teamRa.DeriveCrop(new Rect(blockX, NameRect.Y, teamRa.Width - blockX, NameRect.Height * 2));
// Cv2.ImWrite($"block_{Name}.png", block.SrcMat);
@@ -225,7 +355,7 @@ public class Avatar
else
{
// 剪裁出IndexRect区域
var teamRa = region.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRect);
var teamRa = region.DeriveCrop(AutoFightAssets.Instance.TeamRect);
var blockX = NameRect.X + NameRect.Width * 2 - 10;
var indexBlock = teamRa.DeriveCrop(new Rect(blockX + IndexRect.X, NameRect.Y + IndexRect.Y, IndexRect.Width, IndexRect.Height));
// Cv2.ImWrite($"indexBlock_{Name}.png", indexBlock.SrcMat);
@@ -248,14 +378,14 @@ public class Avatar
{
while (ms >= 0)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
AutoFightContext.Instance.Simulator.LeftButtonClick();
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
ms -= 200;
Sleep(200, Cts);
Sleep(200, Ct);
}
}
@@ -266,7 +396,7 @@ public class Avatar
{
for (var i = 0; i < 1; i++)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
@@ -275,8 +405,8 @@ public class Avatar
{
if (Name == "纳西妲")
{
AutoFightContext.Instance.Simulator.KeyDown(User32.VK.VK_E);
Sleep(300, Cts);
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyDown);
Sleep(300, Ct);
for (int j = 0; j < 10; j++)
{
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
@@ -284,27 +414,34 @@ public class Avatar
}
Sleep(300); // 持续操作不应该被cts取消
AutoFightContext.Instance.Simulator.KeyUp(User32.VK.VK_E);
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyUp);
}
else if (Name == "坎蒂丝")
{
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyDown);
Thread.Sleep(3000);
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyUp);
}
else
{
AutoFightContext.Instance.Simulator.LongKeyPress(User32.VK.VK_E);
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.Hold);
}
}
else
{
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_E);
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyPress);
}
Sleep(200, Cts);
Sleep(200, Ct);
var region = CaptureToRectArea();
ThrowWhenDefeated(region);
ThrowWhenDefeated(region, Ct);
var cd = GetSkillCurrentCd(region);
if (cd > 0)
{
Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd}" : "{Name} 点按元素战技,cd:{Cd}", Name, cd);
// todo 把cd加入执行队列
LastSkillTime = DateTime.UtcNow;
return;
}
}
@@ -317,8 +454,9 @@ public class Avatar
/// </summary>
public double GetSkillCurrentCd(ImageRegion imageRegion)
{
var eRa = imageRegion.DeriveCrop(AutoFightContext.Instance.FightAssets.ERect);
var text = OcrFactory.Paddle.Ocr(eRa.SrcGreyMat);
var eRa = imageRegion.DeriveCrop(AutoFightAssets.Instance.ECooldownRect);
var eRaWhite = OpenCvCommonHelper.InRangeHsv(eRa.SrcMat, new Scalar(0, 0, 235), new Scalar(0, 25, 255));
var text = OcrFactory.Paddle.OcrWithoutDetector(eRaWhite);
return StringUtils.TryParseDouble(text);
}
@@ -331,21 +469,21 @@ public class Avatar
// var isBurstReleased = false;
for (var i = 0; i < 10; i++)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_Q);
Sleep(200, Cts);
Simulation.SendInput.SimulateAction(GIActions.ElementalBurst);
Sleep(200, Ct);
var region = CaptureToRectArea();
ThrowWhenDefeated(region);
ThrowWhenDefeated(region, Ct);
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
if (notActiveCount == 0)
{
// isBurstReleased = true;
Sleep(1500, Cts);
Sleep(1500, Ct);
return;
}
// else
@@ -371,7 +509,7 @@ public class Avatar
// /// </summary>
// public double GetBurstCurrentCd(CaptureContent content)
// {
// var qRa = content.CaptureRectArea.Crop(AutoFightContext.Instance.FightAssets.QRect);
// var qRa = content.CaptureRectArea.Crop(AutoFightAssets.Instance.QRect);
// var text = OcrFactory.Paddle.Ocr(qRa.SrcGreyMat);
// return StringUtils.TryParseDouble(text);
// }
@@ -381,7 +519,7 @@ public class Avatar
/// </summary>
public void Dash(int ms = 0)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
@@ -391,14 +529,14 @@ public class Avatar
ms = 200;
}
AutoFightContext.Instance.Simulator.RightButtonDown();
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyDown);
Sleep(ms); // 冲刺不能被cts取消
AutoFightContext.Instance.Simulator.RightButtonUp();
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyUp);
}
public void Walk(string key, int ms)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
@@ -406,19 +544,19 @@ public class Avatar
User32.VK vk = User32.VK.VK_NONAME;
if (key == "w")
{
vk = User32.VK.VK_W;
vk = GIActions.MoveForward.ToActionKey().ToVK();
}
else if (key == "s")
{
vk = User32.VK.VK_S;
vk = GIActions.MoveBackward.ToActionKey().ToVK();
}
else if (key == "a")
{
vk = User32.VK.VK_A;
vk = GIActions.MoveLeft.ToActionKey().ToVK();
}
else if (key == "d")
{
vk = User32.VK.VK_D;
vk = GIActions.MoveRight.ToActionKey().ToVK();
}
if (vk == User32.VK.VK_NONAME)
@@ -426,9 +564,9 @@ public class Avatar
return;
}
AutoFightContext.Instance.Simulator.KeyDown(vk);
Simulation.SendInput.Keyboard.KeyDown(vk);
Sleep(ms); // 行走不能被cts取消
AutoFightContext.Instance.Simulator.KeyUp(vk);
Simulation.SendInput.Keyboard.KeyUp(vk);
}
/// <summary>
@@ -455,7 +593,7 @@ public class Avatar
/// </summary>
public void Jump()
{
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_SPACE);
Simulation.SendInput.SimulateAction(GIActions.Jump);
}
/// <summary>
@@ -470,26 +608,49 @@ public class Avatar
if (Name == "那维莱特")
{
AutoFightContext.Instance.Simulator.LeftButtonDown();
var dpi = TaskContext.Instance().DpiScale;
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
while (ms >= 0)
{
if (Cts is { IsCancellationRequested: true })
if (Ct is { IsCancellationRequested: true })
{
return;
}
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
Simulation.SendInput.Mouse.MoveMouseBy((int)(1000 * dpi), 0);
ms -= 50;
Sleep(50); // 持续操作不应该被cts取消
}
AutoFightContext.Instance.Simulator.LeftButtonUp();
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
}
else if (Name == "恰斯卡")
{
var dpi = TaskContext.Instance().DpiScale;
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
int cnt = 0;
while (ms >= 0)
{
if (Ct is { IsCancellationRequested: true })
{
return;
}
// 恰在蓄力时快速转动会把视角趋向于水平,所以在回正的时候不做额外Y轴移动
double rate = cnt % 10 < 5 ? 0 : 4.5;//每500ms做一轮上下移动。
cnt++;
Simulation.SendInput.Mouse.MoveMouseBy((int)(500 * dpi), (int)(rate * 100 * dpi));
ms -= 50;
Sleep(50);
}
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
}
else
{
AutoFightContext.Instance.Simulator.LeftButtonDown();
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
Sleep(ms); // 持续操作不应该被cts取消
AutoFightContext.Instance.Simulator.LeftButtonUp();
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
}
}
@@ -498,11 +659,11 @@ public class Avatar
key = key.ToLower();
if (key == "left")
{
AutoFightContext.Instance.Simulator.LeftButtonDown();
Simulation.SendInput.Mouse.LeftButtonDown();
}
else if (key == "right")
{
AutoFightContext.Instance.Simulator.RightButtonDown();
Simulation.SendInput.Mouse.RightButtonDown();
}
else if (key == "middle")
{
@@ -515,11 +676,11 @@ public class Avatar
key = key.ToLower();
if (key == "left")
{
AutoFightContext.Instance.Simulator.LeftButtonUp();
Simulation.SendInput.Mouse.LeftButtonUp();
}
else if (key == "right")
{
AutoFightContext.Instance.Simulator.RightButtonUp();
Simulation.SendInput.Mouse.RightButtonUp();
}
else if (key == "middle")
{
@@ -532,11 +693,11 @@ public class Avatar
key = key.ToLower();
if (key == "left")
{
AutoFightContext.Instance.Simulator.LeftButtonClick();
Simulation.SendInput.Mouse.LeftButtonClick();
}
else if (key == "right")
{
AutoFightContext.Instance.Simulator.RightButtonClick();
Simulation.SendInput.Mouse.RightButtonClick();
}
else if (key == "middle")
{
@@ -551,19 +712,79 @@ public class Avatar
public void KeyDown(string key)
{
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyDown(vk);
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.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(vk);
break;
}
}
public void KeyUp(string key)
{
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyUp(vk);
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.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(vk);
break;
}
}
public void KeyPress(string key)
{
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyPress(vk);
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.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(vk);
break;
}
}
}
}
@@ -19,6 +19,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading;
using BetterGenshinImpact.Core.Simulator;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
@@ -31,7 +32,7 @@ public class CombatScenes : IDisposable
/// <summary>
/// 当前配队
/// </summary>
public Avatar[] Avatars { get; set; } = new Avatar[1];
public Avatar[] Avatars { get; set; } = [];
public Dictionary<string, Avatar> AvatarMap { get; set; } = [];
@@ -43,12 +44,15 @@ public class CombatScenes : IDisposable
.WithSessionOptions(BgiSessionOption.Instance.Options)
.Build();
public int ExpectedTeamAvatarNum { get; private set; } = 4;
/// <summary>
/// 通过YOLO分类器识别队伍内角色
/// </summary>
/// <param name="imageRegion">完整游戏画面的捕获截图</param>
public CombatScenes InitializeTeam(ImageRegion imageRegion)
{
AssertUtils.CheckGameResolution();
// 优先取配置
if (!string.IsNullOrEmpty(TaskContext.Instance().Config.AutoFightConfig.TeamNames))
{
@@ -56,14 +60,50 @@ public class CombatScenes : IDisposable
return this;
}
// 判断当前是否处于联机状态
List<Rect> avatarSideIconRectList;
List<Rect> avatarIndexRectList;
var pRaList = imageRegion.FindMulti(AutoFightAssets.Instance.PRa);
if (pRaList.Count > 0)
{
var num = pRaList.Count + 1;
if (num > 4)
{
throw new Exception("当前处于联机状态,但是队伍人数超过4人,无法识别");
}
// 联机状态下判断
var onePRa = imageRegion.Find(AutoFightAssets.Instance.OnePRa);
var p = "p";
if (!onePRa.IsEmpty())
{
Logger.LogInformation("当前处于联机状态,且当前账号是房主,联机人数{Num}人", num);
p = "1p";
}
else
{
Logger.LogInformation("当前处于联机状态,且在别人世界中,联机人数{Num}人", num);
}
avatarSideIconRectList = AutoFightAssets.Instance.AvatarSideIconRectListMap[$"{p}_{num}"];
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectListMap[$"{p}_{num}"];
ExpectedTeamAvatarNum = avatarSideIconRectList.Count;
}
else
{
avatarSideIconRectList = AutoFightAssets.Instance.AvatarSideIconRectList;
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectList;
}
// 识别队伍
var names = new string[4];
var displayNames = new string[4];
var names = new string[avatarSideIconRectList.Count];
var displayNames = new string[avatarSideIconRectList.Count];
try
{
for (var i = 0; i < AutoFightAssets.Instance.AvatarSideIconRectList.Count; i++)
for (var i = 0; i < avatarSideIconRectList.Count; i++)
{
var ra = imageRegion.DeriveCrop(AutoFightAssets.Instance.AvatarSideIconRectList[i]);
var ra = imageRegion.DeriveCrop(avatarSideIconRectList[i]);
var pair = ClassifyAvatarCnName(ra.SrcBitmap, i + 1);
names[i] = pair.Item1;
if (!string.IsNullOrEmpty(pair.Item2))
@@ -81,14 +121,16 @@ public class CombatScenes : IDisposable
displayNames[i] = pair.Item1;
}
}
Logger.LogInformation("识别到的队伍角色:{Text}", string.Join(",", displayNames));
Avatars = BuildAvatars([.. names]);
Avatars = BuildAvatars([.. names], null, avatarIndexRectList);
AvatarMap = Avatars.ToDictionary(x => x.Name);
}
catch (Exception e)
{
Logger.LogWarning(e.Message);
}
return this;
}
@@ -124,18 +166,18 @@ public class CombatScenes : IDisposable
if (result.TopClass.Name.Name.StartsWith("Qin") || result.TopClass.Name.Name.Contains("Costume"))
{
// 降低琴和衣装角色的识别率要求
if (result.TopClass.Confidence < 0.6)
if (result.TopClass.Confidence < 0.51)
{
Cv2.ImWrite(@"log\avatar_side_classify_error.png", src.ToMat());
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence},结果:{result.TopClass.Name.Name}");
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence:F1},结果:{result.TopClass.Name.Name}。请重新阅读 BetterGI 文档中的《快速上手》!");
}
}
else
{
if (result.TopClass.Confidence < 0.8)
if (result.TopClass.Confidence < 0.7)
{
Cv2.ImWrite(@"log\avatar_side_classify_error.png", src.ToMat());
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence},结果:{result.TopClass.Name.Name}");
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence:F1},结果:{result.TopClass.Name.Name}。请重新阅读 BetterGI 文档中的《快速上手》!");
}
}
@@ -164,7 +206,7 @@ public class CombatScenes : IDisposable
public bool CheckTeamInitialized()
{
if (Avatars.Length < 4)
if (Avatars.Length != ExpectedTeamAvatarNum)
{
return false;
}
@@ -172,8 +214,18 @@ public class CombatScenes : IDisposable
return true;
}
private Avatar[] BuildAvatars(List<string> names, List<Rect>? nameRects = null)
private Avatar[] BuildAvatars(List<string> names, List<Rect>? nameRects = null, List<Rect>? avatarIndexRectList = null)
{
if (avatarIndexRectList == null && ExpectedTeamAvatarNum == 4)
{
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectList;
}
if (avatarIndexRectList == null)
{
throw new Exception("联机状态下,此方法必须传入队伍角色编号位置信息");
}
AvatarCount = names.Count;
var avatars = new Avatar[AvatarCount];
for (var i = 0; i < AvatarCount; i++)
@@ -181,24 +233,42 @@ public class CombatScenes : IDisposable
var nameRect = nameRects?[i] ?? Rect.Empty;
avatars[i] = new Avatar(this, names[i], i + 1, nameRect)
{
IndexRect = AutoFightContext.Instance.FightAssets.AvatarIndexRectList[i]
IndexRect = avatarIndexRectList[i]
};
}
return avatars;
}
public void BeforeTask(CancellationTokenSource cts)
public void BeforeTask(CancellationToken ct)
{
for (var i = 0; i < AvatarCount; i++)
{
Avatars[i].Cts = cts;
Avatars[i].Ct = ct;
}
}
public void AfterTask()
{
// 释放所有按键
Simulation.ReleaseAllKey();
var mwk = SelectAvatar("玛薇卡");
if (mwk != null)
{
foreach (var avatar in Avatars)
{
if (avatar.Name != "玛薇卡")
{
avatar.Switch();
}
}
}
}
public Avatar? SelectAvatar(string name)
{
return AvatarMap.TryGetValue(name, out var avatar) ? avatar : null;
return AvatarMap.GetValueOrDefault(name);
}
#region OCR识别队伍(已弃用)
@@ -218,7 +288,7 @@ public class CombatScenes : IDisposable
}
// 剪裁出队伍区域
var teamRa = content.CaptureRectArea.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRectNoIndex);
var teamRa = content.CaptureRectArea.DeriveCrop(AutoFightAssets.Instance.TeamRectNoIndex);
// 过滤出白色
var hsvFilterMat = OpenCvCommonHelper.InRangeHsv(teamRa.SrcMat, new Scalar(0, 0, 210), new Scalar(255, 30, 255));
@@ -253,10 +323,10 @@ public class CombatScenes : IDisposable
{
// 流浪者特殊处理
// 4人以上的队伍,不支持流浪者的识别
var wanderer = rectArea.Find(AutoFightContext.Instance.FightAssets.WandererIconRa);
var wanderer = rectArea.Find(AutoFightAssets.Instance.WandererIconRa);
if (wanderer.IsEmpty())
{
wanderer = rectArea.Find(AutoFightContext.Instance.FightAssets.WandererIconNoActiveRa);
wanderer = rectArea.Find(AutoFightAssets.Instance.WandererIconNoActiveRa);
}
if (wanderer.IsEmpty())
@@ -331,4 +401,4 @@ public class CombatScenes : IDisposable
{
_predictor.Dispose();
}
}
}
@@ -1,7 +1,7 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.AutoFight.Model;
using BetterGenshinImpact.GameTask.AutoFight.Script;
using BetterGenshinImpact.GameTask.Model.Enum;
using BetterGenshinImpact.Model;
using BetterGenshinImpact.Service;
using Microsoft.Extensions.Logging;
@@ -53,7 +53,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
if (_cts == null || _cts.Token.IsCancellationRequested)
{
_cts = new CancellationTokenSource();
_fightTask = FightTask(_cts);
_fightTask = FightTask(_cts.Token);
if (!_fightTask.IsCompleted)
{
_fightTask.Start();
@@ -65,7 +65,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
if (_cts == null || _cts.Token.IsCancellationRequested)
{
_cts = new CancellationTokenSource();
_fightTask = FightTask(_cts);
_fightTask = FightTask(_cts.Token);
if (!_fightTask.IsCompleted)
{
_fightTask.Start();
@@ -126,16 +126,8 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
/// <summary>
/// 循环执行战斗宏
/// </summary>
private Task FightTask(CancellationTokenSource cts)
private Task FightTask(CancellationToken ct)
{
// 切换截图模式
var dispatcherCaptureMode = TaskTriggerDispatcher.Instance().GetCacheCaptureMode();
if (dispatcherCaptureMode != DispatcherCaptureModeEnum.CacheCaptureWithTrigger)
{
TaskTriggerDispatcher.Instance().SetCacheCaptureMode(DispatcherCaptureModeEnum.CacheCaptureWithTrigger);
Sleep(TaskContext.Instance().Config.TriggerInterval * 2, cts); // 等待缓存图像
}
var imageRegion = CaptureToRectArea();
var combatScenes = new CombatScenes().InitializeTeam(imageRegion);
if (!combatScenes.CheckTeamInitialized())
@@ -162,7 +154,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
return new Task(() =>
{
Logger.LogInformation("→ {Name}执行宏", activeAvatar.Name);
while (!cts.Token.IsCancellationRequested && IsEnabled())
while (!ct.IsCancellationRequested && IsEnabled())
{
if (IsHoldOnMode() && !_isKeyDown)
{
@@ -27,62 +27,74 @@ public class CombatCommand
Method = Method.GetEnumByCode(method);
var parameters = command.Substring(startIndex + 1, endIndex - startIndex - 1);
Args = new List<string>(parameters.Split(',', StringSplitOptions.TrimEntries));
// 校验参数
if (Method == Method.Walk)
{
AssertUtils.IsTrue(Args.Count == 2, "walk方法必须有两个入参,第一个参数是方向,第二个参数是行走时间。例:walk(s, 0.2)");
var s = double.Parse(Args[1]);
AssertUtils.IsTrue(s > 0, "行走时间必须大于0");
}
else if (Method == Method.W || Method == Method.A || Method == Method.S || Method == Method.D)
{
AssertUtils.IsTrue(Args.Count == 1, "w/a/s/d方法必须有一个入参,代表行走时间。例:d(0.5)");
}
else if (Method == Method.MoveBy)
{
AssertUtils.IsTrue(Args.Count == 2, "moveby方法必须有两个入参,分别是x和y。例:moveby(100, 100))");
}
else if (Method == Method.KeyDown || Method == Method.KeyUp || Method == Method.KeyPress)
{
AssertUtils.IsTrue(Args.Count == 1, $"{Method.Alias[0]}方法必须有一个入参,代表按键");
try
{
User32Helper.ToVk(Args[0]);
}
catch
{
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
}
}
Args = [..parameters.Split(',', StringSplitOptions.TrimEntries)];
}
else
{
Method = Method.GetEnumByCode(command);
Args = [];
}
// 校验参数
if (Method == Method.Walk)
{
AssertUtils.IsTrue(Args.Count == 2, "walk方法必须有两个入参,第一个参数是方向,第二个参数是行走时间。例:walk(s, 0.2)");
var s = double.Parse(Args[1]);
AssertUtils.IsTrue(s > 0, "行走时间必须大于0");
}
else if (Method == Method.W || Method == Method.A || Method == Method.S || Method == Method.D)
{
AssertUtils.IsTrue(Args.Count == 1, "w/a/s/d方法必须有一个入参,代表行走时间。例:d(0.5)");
}
else if (Method == Method.MoveBy)
{
AssertUtils.IsTrue(Args.Count == 2, "moveby方法必须有两个入参,分别是x和y。例:moveby(100, 100))");
}
else if (Method == Method.KeyDown || Method == Method.KeyUp || Method == Method.KeyPress)
{
AssertUtils.IsTrue(Args.Count == 1, $"{Method.Alias[0]}方法必须有一个入参,代表按键");
try
{
User32Helper.ToVk(Args[0]);
}
catch
{
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
}
}
}
public void Execute(CombatScenes combatScenes)
{
var avatar = combatScenes.SelectAvatar(Name);
if (avatar == null)
Avatar? avatar;
if (Name == CombatScriptParser.CurrentAvatarName)
{
return;
// 如果是当前角色,不进行角色切换
avatar = combatScenes.Avatars[0]; // 随便取一个角色
}
// 非宏类脚本,等待切换角色成功
if (Method != Method.Wait
&& Method != Method.MouseDown
&& Method != Method.MouseUp
&& Method != Method.Click
&& Method != Method.MoveBy
&& Method != Method.KeyDown
&& Method != Method.KeyUp
&& Method != Method.KeyPress)
else
{
avatar.Switch();
// 其余情况要进行角色切换
avatar = combatScenes.SelectAvatar(Name);
if (avatar == null)
{
return;
}
// 非宏类脚本,等待切换角色成功
if (Method != Method.Wait
&& Method != Method.MouseDown
&& Method != Method.MouseUp
&& Method != Method.Click
&& Method != Method.MoveBy
&& Method != Method.KeyDown
&& Method != Method.KeyUp
&& Method != Method.KeyPress)
{
avatar.Switch();
}
}
Execute(avatar);
}
@@ -235,4 +247,4 @@ public class CombatCommand
throw new NotImplementedException();
}
}
}
}
@@ -10,6 +10,8 @@ namespace BetterGenshinImpact.GameTask.AutoFight.Script;
public class CombatScriptParser
{
public static string CurrentAvatarName = "当前角色";
public static CombatScriptBag ReadAndParse(string path)
{
if (File.Exists(path))
@@ -50,7 +52,15 @@ public class CombatScriptParser
public static CombatScript Parse(string path)
{
var script = File.ReadAllText(path);
var lines = script.Split(["\r\n", "\r", "\n", ";"], StringSplitOptions.RemoveEmptyEntries);
var combatScript = ParseContext(script);
combatScript.Path = path;
combatScript.Name = Path.GetFileNameWithoutExtension(path);
return combatScript;
}
public static CombatScript ParseContext(string context, bool validate = true)
{
var lines = context.Split(["\r\n", "\r", "\n", ";"], StringSplitOptions.RemoveEmptyEntries);
var result = new List<string>();
foreach (var line in lines)
{
@@ -66,19 +76,16 @@ public class CombatScriptParser
result.Add(l);
}
var combatScript = Parse(result);
combatScript.Path = path;
combatScript.Name = Path.GetFileNameWithoutExtension(path);
return combatScript;
return ParseLines(result, validate);
}
public static CombatScript Parse(List<string> lines)
private static CombatScript ParseLines(List<string> lines, bool validate = true)
{
List<CombatCommand> combatCommands = [];
HashSet<string> combatAvatarNames = [];
foreach (var line in lines)
{
var oneLineCombatCommands = ParseLine(line, combatAvatarNames);
var oneLineCombatCommands = ParseLine(line, combatAvatarNames, validate);
combatCommands.AddRange(oneLineCombatCommands);
}
@@ -88,20 +95,29 @@ public class CombatScriptParser
return new CombatScript(combatAvatarNames, combatCommands);
}
public static List<CombatCommand> ParseLine(string line, HashSet<string> combatAvatarNames)
private static List<CombatCommand> ParseLine(string line, HashSet<string> combatAvatarNames, bool validate = true)
{
var oneLineCombatCommands = new List<CombatCommand>();
// 以空格分隔角色和指令 截取第一个空格前的内容为角色名称,后面的为指令
// 20241116更新 不输入角色名称时,直接以当前角色为准
var firstSpaceIndex = line.IndexOf(' ');
if (firstSpaceIndex < 0)
var character = CurrentAvatarName;
var commands = line;
if (firstSpaceIndex > 0)
{
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
character = line[..firstSpaceIndex];
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
commands = line[(firstSpaceIndex + 1)..];
}
else
{
if (validate)
{
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
}
}
var character = line[..firstSpaceIndex];
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
var commands = line[(firstSpaceIndex + 1)..];
oneLineCombatCommands.AddRange(ParseLineCommands(commands, character));
combatAvatarNames.Add(character);
return oneLineCombatCommands;
@@ -155,4 +171,4 @@ public class CombatScriptParser
return oneLineCombatCommands;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Loaded 100 of 1016 files, more files were not shown because too many files have changed in this diff. Show more