Compare commits

...
37 Commits
Author SHA1 Message Date
辉鸭蛋 c025d94c69 Update README.md 2024-06-08 10:09:08 +08:00
辉鸭蛋 e5b9639dec 0.31.0 2024-06-08 09:49:17 +08:00
辉鸭蛋 414e4dd026 add build script for appveyor 2024-06-08 02:09:14 +08:00
辉鸭蛋 809f974cbb auto hangout: auto press skip #335 2024-06-08 00:59:28 +08:00
辉鸭蛋 8cb7e2565f simplify .csproj config 2024-06-08 00:34:17 +08:00
辉鸭蛋 8aec2b18d9 auto hangout: add choose option sleep delay #440 2024-06-08 00:20:27 +08:00
辉鸭蛋 ffe5452f91 auto wood: fix repeated add 2024-06-07 23:41:36 +08:00
辉鸭蛋 4eb9a6ae10 update 4.7 avatar model 2024-06-06 01:52:35 +08:00
辉鸭蛋 47e2473041 Merge branch 'main' of https://github.com/babalae/better-genshin-impact 2024-06-06 01:24:06 +08:00
辉鸭蛋 3f5b984b55 update 4.7 avatar json 2024-06-06 00:56:09 +08:00
辉鸭蛋 fc5d37670c auto map test 2024-06-06 00:44:52 +08:00
辉鸭蛋 a9f9e69f77 Merge pull request #436 from haokaiyang/main
auto tcg: update character card config to v4.7
2024-06-05 13:39:06 +08:00
haokaiyang b0f3cb9abb auto tcg: update character card config to v4.7 2024-06-05 13:28:59 +08:00
辉鸭蛋 fe426e4e24 Merge pull request #433 from Vinkle-hzt/main
fix pick bug
2024-06-03 14:02:27 +08:00
Vinkle-hzt 8f3adc62c1 fix pick bug 2024-06-03 13:58:35 +08:00
辉鸭蛋 a141bf459c auto skip: backgroud fix 2024-06-02 17:07:01 +08:00
辉鸭蛋 d016e59eb4 add map country switch 2024-06-02 01:57:38 +08:00
辉鸭蛋 19f2956633 add map tp 2024-06-02 01:09:57 +08:00
辉鸭蛋 6b7e51a78e edit UI title 2024-06-01 18:21:08 +08:00
辉鸭蛋 283cdfbd1d fix merge hangout.json 2024-06-01 18:20:46 +08:00
辉鸭蛋 cfe963dcae auto skip: backgroud click 2024-06-01 18:09:34 +08:00
辉鸭蛋 b75420cd0b Merge pull request #427 from wy3057/main
托马邀约
2024-06-01 18:08:43 +08:00
禹仔二号 d7e3fb01d8 Update hangout.json
托马邀约
2024-06-01 16:23:39 +08:00
辉鸭蛋 5c26287e51 #425 2024-06-01 12:55:41 +08:00
辉鸭蛋 7730b9b1de do not add click delay when claiming rewards #425 2024-06-01 10:07:48 +08:00
辉鸭蛋 36cde37fea switch to combobox config 2024-05-31 22:26:44 +08:00
辉鸭蛋 f6ad165d60 Merge pull request #424 from Vinkle-hzt/main
支持拾取键更改为E键
2024-05-31 21:42:23 +08:00
Vinkle-hzt 563812dfe2 support E to pick 2024-05-30 14:38:21 +08:00
辉鸭蛋 4a30881a4e add hotkey for #366 2024-05-28 23:29:19 +08:00
辉鸭蛋 e470d684ae auto skip: optimize chat option choose #422 2024-05-28 23:01:08 +08:00
辉鸭蛋 f3c17f7443 opt orange option OCR #409 2024-05-28 22:42:05 +08:00
辉鸭蛋 0baf176daa fix AutoGetDailyRewardsEnabled & AutoReExploreEnabled not working #417 2024-05-28 22:31:33 +08:00
辉鸭蛋 ce8b8687f4 keyboard monitor hotkey support space #416 2024-05-28 22:23:04 +08:00
辉鸭蛋 2749af78a5 Merge pull request #421 from babalae/feat-directml
支持使用DirectML进行GPU推理
2024-05-28 19:14:05 +08:00
辉鸭蛋 03a336967e add classify yolov8 2024-05-28 19:11:43 +08:00
辉鸭蛋 94c8c6a842 modify device name 2024-05-28 19:08:28 +08:00
辉鸭蛋 889955389b use DML 2024-05-28 11:42:54 +08:00
58 changed files with 1774 additions and 694 deletions

No files matched your search

@@ -19,7 +19,9 @@ public class AvatarClassifyGen
// 读取基础图像
// List<string> sideImageFiles = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "*.png", SearchOption.TopDirectoryOnly).ToList();
// 只用一个图像
List<string> sideImageFiles = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "UI_AvatarIcon_Side_Arlecchino.png", SearchOption.TopDirectoryOnly).ToList();
List<string> sideImageFiles = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "UI_AvatarIcon_Side_Sethos.png", SearchOption.TopDirectoryOnly).ToList();
// List<string> sideImageFiles2 = Directory.GetFiles(Path.Combine(BaseDir, "side_src"), "UI_AvatarIcon_Side_Clorinde.png", SearchOption.TopDirectoryOnly).ToList();
// sideImageFiles.AddRange(sideImageFiles2);
// 生成训练集
GenTo(sideImageFiles, Path.Combine(BaseDir, @"dateset\train"), 200);
+1 -1
View File
@@ -51,7 +51,7 @@
Click="GenAvatarData"
Content="生成侧面头像数据集" />
<Button Canvas.Left="10"
Canvas.Top="190"
Canvas.Top="220"
Width="100"
Height="23"
Click="AutoCookTestCase"
+16 -464
View File
@@ -35,7 +35,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.17.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.17.1" />
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.17.1" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
@@ -43,7 +43,6 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.cuda118_cudnn86_tr85_sm86_89" Version="2.5.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" />
@@ -55,7 +54,7 @@
<PackageReference Include="Vanara.PInvoke.User32" Version="3.4.17" />
<PackageReference Include="WPF-UI" Version="3.0.0-preview.7" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.0-preview.7" />
<PackageReference Include="YoloV8.Gpu" Version="2.0.1" />
<PackageReference Include="YoloV8" Version="2.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
@@ -91,504 +90,57 @@
</ItemGroup>
<ItemGroup>
<None Update="Assets\Map\cityMap2048Block.png">
<None Update="Assets\Map\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\combined_image_2048_lim[quick].png">
<None Update="Assets\Model\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\combined_image_lim[quick].png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\mainMap100Block.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\mainMap1024Block.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\mainMapZoomOut1024.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Map\map_sd1024.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Common\avatar_side_classify_sim.onnx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Domain\bgi_tree.onnx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Domain\bgi_tree.pt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Fish\bgi_fish.onnx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdiparams">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdiparams.info">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_det\inference.pdmodel">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdiparams">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdiparams.info">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_PP-OCRv4_rec\inference.pdmodel">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\._inference.pdmodel">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdiparams">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdiparams.info">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ch_ppocr_mobile_v2.0_cls\inference.pdmodel">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\ppocr_keys_v1.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\PaddleOCR\test_ocr.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Yap\all_list.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Yap\index_2_word.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Model\Yap\model_training.onnx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\click_any_close_tip.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\condensed_resin_count.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\confirm.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\exit.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\fragile_resin_count.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\use_condensed_resin.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\wanderer_icon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFight\Assets\1920x1080\wanderer_icon_no_active.png">
<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\bait\flashing maintenance mek bait.png">
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\sour bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\sugardew bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\lift_rod.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\switch_bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\fake fly bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\false worm bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\fruit paste bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\bait\redrot bait.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\exit_fishing.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\space.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoFishing\Assets\1920x1080\wait_bite.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_anemo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_cryo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_dendro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_electro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_geo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_hydro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_omni.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\action_pyro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_anemo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_cryo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_dendro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_electro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_geo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_hydro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_omni.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\dice\roll_pyro.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\元素调和.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\元素骰子不足.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\冻结.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\出战角色.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\回合结束.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\回合结算阶段.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\对方行动中.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\满能量.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\确定.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\空能量.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色死亡.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_冻结.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_冻结2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色状态_水泡.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色血量上方.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\角色被打败.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\other\退出挑战.png">
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoPick\Assets\1920x1080\F.png">
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoPick\Assets\1920x1080\icon_settings.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\collect.png">
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\comfirm_btn1.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\comfirm_btn2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\hangout_selected.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\hangout_unselected.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_exclamation.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\primogem.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\re.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_daily_reward.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_explore.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\hangout.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\blue_track_point_28x.png">
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_black_cancel.png">
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_no.png">
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_yes.png">
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\paimon_menu.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\icon_option.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\page_close.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\stop_auto.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\submit_goods.png">
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoSkip\Assets\1920x1080\submit_icon_exclamation.png">
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\character_guide.png">
<None Update="User\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\confirm.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\enter_game.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\exit_welcome.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\menu_bag.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\AutoWood\Assets\1920x1080\TheBoonOfTheElderTree.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_black_confirm.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_white_cancel.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_white_confirm.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\collect.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\comfirm_btn1.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\comfirm_btn2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_daily_reward.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_exclamation.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_explore.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\icon_option.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\paimon_menu.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\page_close.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\primogem.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\re.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\stop_auto.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\submit_icon_exclamation.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\ui_left_top_cook_icon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\ui_lt_cook_icon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\Common\Element\Assets\1920x1080\yellow_track_point_28x.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\GameLoading\Assets\1920x1080\welkin_moon_logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Domain.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Domain2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\GoTeleport.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\Mansion.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapChoose.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapCloseButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapScaleButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\MapUndergroundSwitchButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\PortableWaypoint.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\ScaleWithMask.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\StatueOfTheSeven.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\SubSpaceWaypoint.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickTeleport\Assets\1920x1080\TeleportWaypoint.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\SereniteaPotIcon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoFight\1.四神挂机[推荐].txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoFight\2.宵宫夜兰班行秋.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoFight\2.宵宫队[请看文件内说明].txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoFight\群友分享\*.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\1.莫娜砂糖琴.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\2.刻晴雷神甘雨.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\3.雷神阿贝多丘丘王.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\4.重云雷神申鹤.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\5.迪希雅白术皇女.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\6.皇女科莱莫娜.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\7.莫娜白术皇女.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\8.雷神柯莱刻晴[推荐].txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]东东.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]巴哈拉克.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]马鲁夫.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoGeniusInvokation\a.[惊喜牌组]黄衫.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoSkip\default_pause_options.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoSkip\select_options.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\AutoSkip\pause_options.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\avatar_macro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="User\pick_black_lists.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="User\pick_white_lists.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -5,7 +5,7 @@ namespace BetterGenshinImpact.Core.Config;
public class Global
{
public static string Version { get; } = "0.30.2";
public static string Version { get; } = "0.31.0";
public static string StartUpPath { get; set; } = AppContext.BaseDirectory;
@@ -162,4 +162,11 @@ public partial class HotKeyConfig : ObservableObject
[ObservableProperty]
private string _test1HotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
// 日志与状态窗口展示
[ObservableProperty]
private string _logBoxDisplayHotkey = "";
[ObservableProperty]
private string _logBoxDisplayHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
}
@@ -30,13 +30,13 @@ public class PaddleOcrService : IOcrService
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);
Action<PaddleConfig> device = TaskContext.Instance().Config.InferenceDevice switch
{
"CPU" => PaddleDevice.Onnx(),
"GPU" => PaddleDevice.Gpu(),
_ => throw new InvalidEnumArgumentException("无效的推理设备")
};
_paddleOcrAll = new PaddleOcrAll(model, device)
// Action<PaddleConfig> device = TaskContext.Instance().Config.InferenceDevice switch
// {
// "CPU" => PaddleDevice.Onnx(),
// "GPU_DirectML" => PaddleDevice.Onnx(),
// _ => throw new InvalidEnumArgumentException("无效的推理设备")
// };
_paddleOcrAll = new PaddleOcrAll(model, PaddleDevice.Onnx())
{
AllowRotateDetection = false, /* 允许识别有角度的文字 */
Enable180Classification = false /* 允许识别旋转角度大于90度的文字 */
@@ -7,10 +7,29 @@ namespace BetterGenshinImpact.Core.Recognition.ONNX;
public class BgiSessionOption : Singleton<BgiSessionOption>
{
public static string[] InferenceDeviceTypes { get; } = ["CPU", "GPU_DirectML"];
public SessionOptions Options { get; set; } = TaskContext.Instance().Config.InferenceDevice switch
{
"CPU" => new SessionOptions(),
"GPU" => SessionOptions.MakeSessionOptionWithCudaProvider(),
"GPU_DirectML" => MakeSessionOptionWithDirectMlProvider(),
_ => throw new InvalidEnumArgumentException("无效的推理设备")
};
public static SessionOptions MakeSessionOptionWithDirectMlProvider()
{
var sessionOptions = new SessionOptions();
sessionOptions.AppendExecutionProvider_DML(0);
return sessionOptions;
}
// /// <summary>
// /// 重新加载每个推理器(测试没用,只能重启)
// /// </summary>
// public void RefreshInference()
// {
// // 自动秘境每次都会NEW不用管
// // Yap、自动钓鱼
// GameTaskManager.RefreshTriggerConfigs();
// }
}
@@ -39,9 +39,11 @@ public class FeatureMatcher
if (featureStorage != null)
{
featureStorage.TypeName = type.ToString();
Debug.WriteLine("尝试从磁盘加载特征点");
var kpFromDisk = featureStorage.LoadKeyPointArray();
if (kpFromDisk == null)
{
Debug.WriteLine("特征点不存在");
_feature2D.DetectAndCompute(trainMat, null, out _trainKeyPoints, _trainRet);
featureStorage.SaveKeyPointArray(_trainKeyPoints);
featureStorage.SaveDescMat(_trainRet);
@@ -66,19 +68,20 @@ public class FeatureMatcher
/// </summary>
/// <param name="queryMat"></param>
/// <returns></returns>
public Point2f[]? Match(Mat queryMat)
public Point2f[]? Match(Mat queryMat, Mat? queryMatMask = null)
{
return Match(_trainKeyPoints, _trainRet, queryMat);
return Match(_trainKeyPoints, _trainRet, queryMat, queryMatMask);
}
/// <summary>
/// 合并邻近的特征点后匹配(临近特征)
/// </summary>
/// <param name="queryMat"></param>
/// <param name="queryMat">查询的图</param>
/// <param name="prevX">上次匹配到的坐标x</param>
/// <param name="prevY">上次匹配到的坐标y</param>
/// <param name="queryMatMask">查询Mask</param>
/// <returns></returns>
public Point2f[]? Match(Mat queryMat, int prevX, int prevY)
public Point2f[]? Match(Mat queryMat, int prevX, int prevY, Mat? queryMatMask = null)
{
var (cellRow, cellCol) = KeyPointFeatureBlockHelper.GetCellIndex(_trainMat, _splitRow, _splitCol, prevX, prevY);
Debug.WriteLine($"当前坐标({prevX},{prevY})在特征块({cellRow},{cellCol})中");
@@ -88,7 +91,7 @@ public class FeatureMatcher
_lastMergedBlock = KeyPointFeatureBlockHelper.MergeNeighboringFeatures(_blocks, _trainRet, cellRow, cellCol);
}
return Match(_lastMergedBlock.KeyPointArray, _lastMergedBlock.Descriptor!, queryMat);
return Match(_lastMergedBlock.KeyPointArray, _lastMergedBlock.Descriptor!, queryMat, queryMatMask);
}
/// <summary>
@@ -97,14 +100,15 @@ public class FeatureMatcher
/// <param name="trainKeyPoints"></param>
/// <param name="trainRet"></param>
/// <param name="queryMat"></param>
/// <param name="queryMatMask"></param>
/// <returns></returns>
public Point2f[]? Match(KeyPoint[] trainKeyPoints, Mat trainRet, Mat queryMat)
public Point2f[]? Match(KeyPoint[] trainKeyPoints, Mat trainRet, Mat queryMat, Mat? queryMatMask = null)
{
SpeedTimer speedTimer = new();
using var queryRet = new Mat();
_feature2D.DetectAndCompute(queryMat, null, out var queryKeyPoints, queryRet);
_feature2D.DetectAndCompute(queryMat, queryMatMask, out var queryKeyPoints, queryRet);
speedTimer.Record("模板生成KeyPoint");
using var flnMatcher = new FlannBasedMatcher();
@@ -65,6 +65,16 @@ public class PostMessageSimulator
return this;
}
public PostMessageSimulator LeftButtonClickBackground()
{
User32.PostMessage(_hWnd, User32.WindowMessage.WM_ACTIVATE, 1, 0);
IntPtr p = (16 << 16) | 16;
User32.PostMessage(_hWnd, WM_LBUTTONDOWN, IntPtr.Zero, p);
Thread.Sleep(100);
User32.PostMessage(_hWnd, WM_LBUTTONUP, IntPtr.Zero, p);
return this;
}
/// <summary>
/// 默认位置左键按下
/// </summary>
@@ -9,6 +9,7 @@ using BetterGenshinImpact.GameTask.AutoFight.Script;
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
using BetterGenshinImpact.GameTask.AutoPick.Assets;
using BetterGenshinImpact.GameTask.Common.Map;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.GameTask.Model.Enum;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Service.Notification;
@@ -24,10 +25,8 @@ using System.Drawing.Imaging;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using BetterGenshinImpact.GameTask.Model.Area;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
using static Vanara.PInvoke.User32;
using System.Windows.Media.Media3D;
namespace BetterGenshinImpact.GameTask.AutoDomain;
@@ -48,12 +47,8 @@ public class AutoDomainTask
_taskParam = taskParam;
_simulator = AutoFightContext.Instance.Simulator;
_predictor = new(Global.Absolute("Assets\\Model\\Domain\\bgi_tree.onnx"), BgiSessionOption.Instance.Options);
_predictor = new YoloV8(Global.Absolute("Assets\\Model\\Domain\\bgi_tree.onnx"), BgiSessionOption.Instance.Options);
var captureArea = TaskContext.Instance().SystemInfo.CaptureAreaRect;
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
_clickOffset = new ClickOffset(captureArea.X, captureArea.Y, assetScale);
_combatCommands = CombatScriptParser.Parse(_taskParam.CombatStrategyContent);
_config = TaskContext.Instance().Config.AutoDomainConfig;
_combatScriptBag = CombatScriptParser.ReadAndParse(_taskParam.CombatStrategyPath);
@@ -744,6 +744,15 @@
"skillCD": 16.0,
"weapon": "1"
},
{
"alias": [ "希格雯", "Sigewinne", "希格文", "护士", "护士长" ],
"burstCD": 18.0,
"id": "10000095",
"name": "希格雯",
"nameEn": "Sigewinne",
"skillCD": 18.0,
"weapon": "12"
},
{
"alias": [ "阿蕾奇诺", "Arlecchino", "阿雷奇诺", "仆人", "黑优菈", "黑暗优菈", "父亲", "佩露薇利" ],
"burstCD": 15.0,
@@ -752,5 +761,23 @@
"nameEn": "Arlecchino",
"skillCD": 30.0,
"weapon": "13"
},
{
"alias": [ "赛索斯", "Sethos", "丁真" ],
"burstCD": 15.0,
"id": "10000097",
"name": "赛索斯",
"nameEn": "Sethos",
"skillCD": 8.0,
"weapon": "12"
},
{
"alias": [ "克洛琳德", "Clorinde", "科洛琳德", "克洛林德", "美玉", "美玉学姐", "学姐" ],
"burstCD": 15.0,
"id": "10000098",
"name": "克洛琳德",
"nameEn": "Clorinde",
"skillCD": 16.0,
"weapon": "1"
}
]
@@ -532,30 +532,19 @@ public class Avatar
public void KeyDown(string key)
{
var vk = ToVk(key);
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyDown(vk);
}
public void KeyUp(string key)
{
var vk = ToVk(key);
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyUp(vk);
}
public void KeyPress(string key)
{
var vk = ToVk(key);
var vk = User32Helper.ToVk(key);
AutoFightContext.Instance.Simulator.KeyPress(vk);
}
public static User32.VK ToVk(string key)
{
key = key.ToUpper();
if (!key.StartsWith("VK_"))
{
key = $"VK_{key}";
}
return (User32.VK)Enum.Parse(typeof(User32.VK), key);
}
}
@@ -18,6 +18,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.GameTask.Model.Area;
using static BetterGenshinImpact.GameTask.Common.TaskControl;
@@ -37,7 +38,7 @@ public class CombatScenes : IDisposable
public int AvatarCount { get; set; }
private readonly YoloV8 _predictor = new(Global.Absolute("Assets\\Model\\Common\\avatar_side_classify_sim.onnx"));
private readonly YoloV8 _predictor = new(Global.Absolute("Assets\\Model\\Common\\avatar_side_classify_sim.onnx"), BgiSessionOption.Instance.Options);
/// <summary>
/// 通过YOLO分类器识别队伍内角色
@@ -2,6 +2,7 @@
using BetterGenshinImpact.Helpers;
using System;
using System.Collections.Generic;
using System.Windows.Input;
using TimeSpan = System.TimeSpan;
namespace BetterGenshinImpact.GameTask.AutoFight.Script;
@@ -48,7 +49,7 @@ public class CombatCommand
AssertUtils.IsTrue(Args.Count == 1, $"{Method.Alias[0]}方法必须有一个入参,代表按键");
try
{
Avatar.ToVk(Args[0]);
User32Helper.ToVk(Args[0]);
}
catch
{
@@ -712,6 +712,75 @@
}
]
},
{
"id": 1111,
"nameEn": "wriothesley",
"type": "character",
"name": "莱欧斯利",
"hp": 10,
"energy": 3,
"element": "冰元素",
"weapon": "法器",
"skills": [
{
"nameEn": "forceful_fists_of_frost",
"name": "迅烈倾霜拳",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1101,
"nameEn": "cryo",
"type": "冰元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "icefang_rush",
"name": "冰牙突驰",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1101,
"nameEn": "cryo",
"type": "冰元素",
"count": 3
}
]
},
{
"nameEn": "darkgold_wolfbite",
"name": "黑金狼噬",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1101,
"nameEn": "cryo",
"type": "冰元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 3
}
]
}
]
},
{
"id": 1201,
"nameEn": "barbara",
@@ -1426,6 +1495,83 @@
}
]
},
{
"id": 1211,
"nameEn": "furina",
"type": "character",
"name": "芙宁娜",
"hp": 10,
"energy": 2,
"element": "水元素",
"weapon": "单手剑",
"skills": [
{
"nameEn": "soloists_solicitation",
"name": "独舞之邀",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "salon_solitaire",
"name": "孤心沙龙",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 3
}
]
},
{
"nameEn": "let_the_people_rejoice",
"name": "万众狂欢",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 4
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
},
{
"nameEn": "arkhe_seats_sacred_and_secular",
"name": "始基力:圣俗杂座",
"skillTag": [
"被动技能"
],
"cost": []
}
]
},
{
"id": 1301,
"nameEn": "diluc",
@@ -2200,6 +2346,75 @@
}
]
},
{
"id": 1312,
"nameEn": "xinyan",
"type": "character",
"name": "辛焱",
"hp": 10,
"energy": 2,
"element": "火元素",
"weapon": "双手剑",
"skills": [
{
"nameEn": "dance_on_fire",
"name": "炎舞",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "sweeping_fervor",
"name": "热情拂扫",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 3
}
]
},
{
"nameEn": "riff_revolution",
"name": "叛逆刮弦",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1103,
"nameEn": "pyro",
"type": "火元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
}
]
},
{
"id": 1401,
"nameEn": "fischl",
@@ -4025,6 +4240,75 @@
}
]
},
{
"id": 1607,
"nameEn": "yun_jin",
"type": "character",
"name": "云堇",
"hp": 10,
"energy": 2,
"element": "岩元素",
"weapon": "长柄武器",
"skills": [
{
"nameEn": "cloudgrazing_strike",
"name": "拂云出手",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1106,
"nameEn": "geo",
"type": "岩元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "opening_flourish",
"name": "旋云开相",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1106,
"nameEn": "geo",
"type": "岩元素",
"count": 3
}
]
},
{
"nameEn": "cliffbreakers_banner",
"name": "破嶂见旌仪",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1106,
"nameEn": "geo",
"type": "岩元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
}
]
},
{
"id": 1701,
"nameEn": "collei",
@@ -4523,6 +4807,75 @@
}
]
},
{
"id": 1708,
"nameEn": "kaveh",
"type": "character",
"name": "卡维",
"hp": 10,
"energy": 2,
"element": "草元素",
"weapon": "双手剑",
"skills": [
{
"nameEn": "schematic_setup",
"name": "旋规设矩",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "artistic_ingenuity",
"name": "画则巧施",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
}
]
},
{
"nameEn": "painted_dome",
"name": "繁绘隅穹",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
}
]
},
{
"id": 2101,
"nameEn": "fatui_cryo_cicin_mage",
@@ -4976,6 +5329,83 @@
}
]
},
{
"id": 2204,
"nameEn": "alldevouring_narwhal",
"type": "character",
"name": "吞星之鲸",
"hp": 5,
"energy": 2,
"element": "水元素",
"weapon": "其他武器",
"skills": [
{
"nameEn": "shattering_waves",
"name": "碎涛旋跃",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "starfall_shower",
"name": "迸落星雨",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 3
}
]
},
{
"nameEn": "ravaging_devourer",
"name": "横噬鲸吞",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1102,
"nameEn": "hydro",
"type": "水元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
},
{
"nameEn": "insatiable_appetite",
"name": "无尽食欲",
"skillTag": [
"被动技能"
],
"cost": []
}
]
},
{
"id": 2301,
"nameEn": "fatui_pyro_agent",
@@ -5584,6 +6014,83 @@
}
]
},
{
"id": 2405,
"nameEn": "consecrated_scorpion",
"type": "character",
"name": "圣骸毒蝎",
"hp": 10,
"energy": 2,
"element": "雷元素",
"weapon": "其他武器",
"skills": [
{
"nameEn": "scorpion_strike",
"name": "蝎爪钳击",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1104,
"nameEn": "electro",
"type": "雷元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "stinging_spine",
"name": "蝎尾锥刺",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1104,
"nameEn": "electro",
"type": "雷元素",
"count": 3
}
]
},
{
"nameEn": "thunderbore_blast",
"name": "雷锥散射",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1104,
"nameEn": "electro",
"type": "雷元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
},
{
"nameEn": "immortal_remnants_electro",
"name": "不朽亡骸·雷",
"skillTag": [
"被动技能"
],
"cost": []
}
]
},
{
"id": 2501,
"nameEn": "maguu_kenki",
@@ -5752,6 +6259,83 @@
}
]
},
{
"id": 2503,
"nameEn": "consecrated_flying_serpent",
"type": "character",
"name": "圣骸飞蛇",
"hp": 10,
"energy": 2,
"element": "风元素",
"weapon": "其他武器",
"skills": [
{
"nameEn": "whirling_tail",
"name": "旋尾迅击",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1105,
"nameEn": "anemo",
"type": "风元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "swirling_squall",
"name": "盘绕风引",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1105,
"nameEn": "anemo",
"type": "风元素",
"count": 3
}
]
},
{
"nameEn": "scattershot_vortex",
"name": "错落风涡",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1105,
"nameEn": "anemo",
"type": "风元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
},
{
"nameEn": "immortal_remnants_anemo",
"name": "不朽亡骸·风",
"skillTag": [
"被动技能"
],
"cost": []
}
]
},
{
"id": 2601,
"nameEn": "stonehide_lawachurl",
@@ -5982,5 +6566,82 @@
"cost": []
}
]
},
{
"id": 2702,
"nameEn": "guardian_of_apeps_oasis",
"type": "character",
"name": "阿佩普的绿洲守望者",
"hp": 10,
"energy": 2,
"element": "草元素",
"weapon": "其他武器",
"skills": [
{
"nameEn": "strike_of_the_dispossessed",
"name": "失乡重击",
"skillTag": [
"普通攻击"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 1
},
{
"id": 1109,
"nameEn": "unaligned_element",
"type": "无色元素",
"count": 2
}
]
},
{
"nameEn": "life_stream",
"name": "生命流束",
"skillTag": [
"元素战技"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
}
]
},
{
"nameEn": "the_end_falls",
"name": "终景迸落",
"skillTag": [
"元素爆发"
],
"cost": [
{
"id": 1107,
"nameEn": "dendro",
"type": "草元素",
"count": 3
},
{
"id": 1110,
"nameEn": "energy",
"type": "充能",
"count": 2
}
]
},
{
"nameEn": "invokation_of_propagation",
"name": "增殖感召",
"skillTag": [
"被动技能"
],
"cost": []
}
]
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

@@ -42,4 +42,19 @@ public class AutoPickAssets : BaseAssets<AutoPickAssets>
DrawOnWindowPen = new Pen(Color.Chocolate, 2)
}.InitTemplate();
}
public RecognitionObject LoadCustomPickKey(string key)
{
return new RecognitionObject
{
Name = key,
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoPick", key + ".png"),
RegionOfInterest = new Rect((int)(1090 * AssetScale),
(int)(330 * AssetScale),
(int)(60 * AssetScale),
(int)(420 * AssetScale)),
DrawOnWindow = false
}.InitTemplate();
}
}
@@ -43,5 +43,10 @@ namespace BetterGenshinImpact.GameTask.AutoPick
/// </summary>
[ObservableProperty] private bool _fastModeEnabled = false;
/// <summary>
/// 自定义按键拾取
/// </summary>
[ObservableProperty] private string _pickKey = "F";
}
}
@@ -14,7 +14,9 @@ using System.Diagnostics;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using BetterGenshinImpact.Core.Recognition;
using Vanara.PInvoke;
using System.Windows.Input;
namespace BetterGenshinImpact.GameTask.AutoPick;
@@ -40,6 +42,12 @@ public class AutoPickTrigger : ITaskTrigger
/// </summary>
private List<string> _whiteList = new();
// 自定义拾取按键
private string _pickKeyName = "F";
private User32.VK _pickVk = User32.VK.VK_F;
private RecognitionObject _pickRo;
public AutoPickTrigger()
{
_autoPickAssets = AutoPickAssets.Instance;
@@ -47,6 +55,29 @@ public class AutoPickTrigger : ITaskTrigger
public void Init()
{
_pickRo = _autoPickAssets.FRo;
var keyName = TaskContext.Instance().Config.AutoPickConfig.PickKey;
if (!string.IsNullOrEmpty(keyName))
{
try
{
_pickRo = _autoPickAssets.LoadCustomPickKey(keyName);
_pickVk = User32Helper.ToVk(keyName);
_pickKeyName = keyName;
}
catch (Exception e)
{
_logger.LogDebug(e, "加载自定义拾取按键时发生异常");
_logger.LogError("加载自定义拾取按键失败,继续使用默认的F键");
TaskContext.Instance().Config.AutoPickConfig.PickKey = "F";
return;
}
if (_pickKeyName != "F")
{
_logger.LogInformation("自定义拾取按键:{Key}", _pickKeyName);
}
}
IsEnabled = TaskContext.Instance().Config.AutoPickConfig.Enabled;
try
{
@@ -92,13 +123,14 @@ public class AutoPickTrigger : ITaskTrigger
public void OnCapture(CaptureContent content)
{
var speedTimer = new SpeedTimer();
content.CaptureRectArea.Find(_autoPickAssets.FRo, foundRectArea =>
content.CaptureRectArea.Find(_pickRo, foundRectArea =>
{
speedTimer.Record("识别到 F 拾取键");
speedTimer.Record($"识别到 {_pickKeyName} 拾取键");
var scale = TaskContext.Instance().SystemInfo.AssetScale;
var config = TaskContext.Instance().Config.AutoPickConfig;
// 识别到F键,开始识别物品图标
// 识别到拾取键,开始识别物品图标
var isExcludeIcon = false;
_autoPickAssets.ChatIconRo.RegionOfInterest = new Rect(foundRectArea.X + (int)(config.ItemIconLeftOffset * scale), foundRectArea.Y, (int)((config.ItemTextLeftOffset - config.ItemIconLeftOffset) * scale), foundRectArea.Height);
var chatIconRa = content.CaptureRectArea.Find(_autoPickAssets.ChatIconRo);
@@ -175,7 +207,7 @@ public class AutoPickTrigger : ITaskTrigger
if (_whiteList.Contains(text))
{
LogPick(content, text);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(_pickVk);
return;
}
@@ -195,7 +227,7 @@ public class AutoPickTrigger : ITaskTrigger
speedTimer.Record("黑名单判断");
LogPick(content, text);
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_F);
Simulation.SendInput.Keyboard.KeyPress(_pickVk);
}
});
speedTimer.DebugPrint();
Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

@@ -31,6 +31,7 @@ public class AutoSkipAssets : BaseAssets<AutoSkipAssets>
public RecognitionObject HangoutSelectedRo;
public RecognitionObject HangoutUnselectedRo;
public RecognitionObject HangoutSkipRo;
private AutoSkipAssets()
{
@@ -173,5 +174,12 @@ public class AutoSkipAssets : BaseAssets<AutoSkipAssets>
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "hangout_unselected.png"),
DrawOnWindow = true
}.InitTemplate();
HangoutSkipRo = new RecognitionObject
{
Name = "HangoutSkip",
RecognitionType = RecognitionTypes.TemplateMatch,
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "hangout_skip.png"),
RegionOfInterest = new Rect(0, 0, CaptureRect.Width / 5, CaptureRect.Height / 8)
}.InitTemplate();
}
}
@@ -294,6 +294,36 @@
"自己调查一下吧",
"我不想听"
],
"托马结局1:热闹的课堂": [
"随他们说去吧",
"想在室内",
"肯定要大张旗鼓的宣传"
],
"托马结局2:独处的时光": [
"随他们说去吧",
"想在室内",
"只在社奉行里宣传下吧"
],
"托马结局3:寄托思念的海风": [
"随他们说去吧",
"想出去走走",
"对猫猫狗狗感兴趣",
"不如一起去看看它?"
],
"托马结局4:新衣服": [
"随他们说去吧",
"想出去走走",
"对猫猫狗狗感兴趣",
"让它冷静一段时间比较好"
],
"托马结局5:手有余香": [
"随他们说去吧",
"想出去走走",
"对逛街感兴趣"
],
"托马结局6:家政官的另一面": [
"我不是很认可"
],
"迪奥娜结局1:猫咪派对": [
"我是来看小猫的",
"客人们主要",
@@ -1,78 +1,92 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
namespace BetterGenshinImpact.GameTask.AutoSkip
namespace BetterGenshinImpact.GameTask.AutoSkip;
/// <summary>
/// 自动跳过剧情配置
/// </summary>
[Serializable]
public partial class AutoSkipConfig : ObservableObject
{
/// <summary>
/// 自动跳过剧情配置
/// 触发器是否启用
/// 启用后:
/// 1. 快速跳过对话
/// 2. 自动点击一个识别到的选项
/// 3. 黑屏过长自动点击跳过
/// </summary>
[Serializable]
public partial class AutoSkipConfig : ObservableObject
[ObservableProperty] private bool _enabled = true;
/// <summary>
/// 快速跳过对话
/// </summary>
[ObservableProperty] private bool _quicklySkipConversationsEnabled = true;
public int ChatOptionTextWidth { get; set; } = 280;
public int ExpeditionOptionTextWidth { get; set; } = 130;
/// <summary>
/// 选择选项前的延迟(毫秒)
/// </summary>
[ObservableProperty] private int _afterChooseOptionSleepDelay = 0;
/// <summary>
/// 自动领取每日委托奖励
/// </summary>
[ObservableProperty] private bool _autoGetDailyRewardsEnabled = true;
/// <summary>
/// 自动重新派遣
/// </summary>
[ObservableProperty] private bool _autoReExploreEnabled = true;
/// <summary>
/// 自动重新派遣使用角色配置,逗号分割
/// </summary>
[Obsolete]
[ObservableProperty] private string _autoReExploreCharacter = "";
/// <summary>
/// 优先选择第一个选项
/// 优先选择最后一个选项
/// 不选择选项
/// </summary>
[ObservableProperty] private string _clickChatOption = "优先选择最后一个选项";
/// <summary>
/// 自动邀约启用
/// </summary>
[ObservableProperty] private bool _autoHangoutEventEnabled = false;
/// <summary>
/// 自动邀约分支选择
/// </summary>
[ObservableProperty] private string _autoHangoutEndChoose = string.Empty;
/// <summary>
/// 自动邀约选择选项前的延迟(毫秒)
/// </summary>
[ObservableProperty] private int _autoHangoutChooseOptionSleepDelay = 0;
/// <summary>
/// 自动邀约自动点击跳过按钮
/// </summary>
[ObservableProperty] private bool _autoHangoutPressSkipEnabled = true;
public bool IsClickFirstChatOption()
{
/// <summary>
/// 触发器是否启用
/// 启用后:
/// 1. 快速跳过对话
/// 2. 自动点击一个识别到的选项
/// 3. 黑屏过长自动点击跳过
/// </summary>
[ObservableProperty] private bool _enabled = true;
/// <summary>
/// 快速跳过对话
/// </summary>
[ObservableProperty] private bool _quicklySkipConversationsEnabled = true;
public int ChatOptionTextWidth { get; set; } = 280;
public int ExpeditionOptionTextWidth { get; set; } = 130;
/// <summary>
/// 选择选项前的延迟(毫秒)
/// </summary>
[ObservableProperty] private int _afterChooseOptionSleepDelay = 0;
/// <summary>
/// 自动领取每日委托奖励
/// </summary>
[ObservableProperty] private bool _autoGetDailyRewardsEnabled = true;
/// <summary>
/// 自动重新派遣
/// </summary>
[ObservableProperty] private bool _autoReExploreEnabled = true;
/// <summary>
/// 自动重新派遣使用角色配置,逗号分割
/// </summary>
[Obsolete]
[ObservableProperty] private string _autoReExploreCharacter = "";
/// <summary>
/// 优先选择第一个选项
/// 优先选择最后一个选项
/// 不选择选项
/// </summary>
[ObservableProperty] private string _clickChatOption = "优先选择最后一个选项";
/// <summary>
/// 自动邀约启用
/// </summary>
[ObservableProperty] private bool _autoHangoutEventEnabled = false;
/// <summary>
/// 自动邀约启用
/// </summary>
[ObservableProperty] private string _autoHangoutEndChoose = string.Empty;
public bool IsClickFirstChatOption()
{
return ClickChatOption == "优先选择第一个选项";
}
public bool IsClickNoneChatOption()
{
return ClickChatOption == "不选择选项";
}
return ClickChatOption == "优先选择第一个选项";
}
public bool IsClickNoneChatOption()
{
return ClickChatOption == "不选择选项";
}
/// <summary>
/// 后台运行
/// </summary>
[ObservableProperty] private bool _runBackgroundEnabled = false;
}
@@ -1,4 +1,5 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.Core.Recognition.OCR;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.Core.Simulator;
@@ -6,23 +7,23 @@ using BetterGenshinImpact.GameTask.AutoSkip.Assets;
using BetterGenshinImpact.GameTask.AutoSkip.Model;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.GameTask.Common.Element.Assets;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Service;
using BetterGenshinImpact.View.Drawable;
using Microsoft.Extensions.Logging;
using OpenCvSharp;
using Sdcb.PaddleOCR;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.GameTask.Model.Area;
using Vanara.PInvoke;
using Region = BetterGenshinImpact.GameTask.Model.Area.Region;
namespace BetterGenshinImpact.GameTask.AutoSkip;
@@ -38,6 +39,8 @@ public class AutoSkipTrigger : ITaskTrigger
public int Priority => 20;
public bool IsExclusive => false;
public bool IsBackgroundRunning { get; set; }
private readonly AutoSkipAssets _autoSkipAssets;
private readonly AutoSkipConfig _config;
@@ -57,6 +60,8 @@ public class AutoSkipTrigger : ITaskTrigger
/// </summary>
private List<string> _selectList = new();
private PostMessageSimulator? _postMessageSimulator;
public AutoSkipTrigger()
{
_autoSkipAssets = AutoSkipAssets.Instance;
@@ -65,7 +70,9 @@ public class AutoSkipTrigger : ITaskTrigger
public void Init()
{
IsEnabled = TaskContext.Instance().Config.AutoSkipConfig.Enabled;
IsEnabled = _config.Enabled;
IsBackgroundRunning = _config.RunBackgroundEnabled;
_postMessageSimulator = TaskContext.Instance().PostMessageSimulator;
try
{
@@ -182,7 +189,14 @@ public class AutoSkipTrigger : ITaskTrigger
_prevPlayingTime = DateTime.Now;
if (TaskContext.Instance().Config.AutoSkipConfig.QuicklySkipConversationsEnabled)
{
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
if (IsBackgroundRunning)
{
_postMessageSimulator?.KeyPressBackground(User32.VK.VK_SPACE);
}
else
{
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
}
}
// 对话选项选择
@@ -221,7 +235,14 @@ public class AutoSkipTrigger : ITaskTrigger
var rate = blackCount * 1d / (grayMat.Width * grayMat.Height);
if (rate is >= 0.5 and < 0.98999)
{
Simulation.SendInput.Mouse.LeftButtonClick();
if (IsBackgroundRunning)
{
TaskContext.Instance().PostMessageSimulator?.LeftButtonClickBackground();
}
else
{
Simulation.SendInput.Mouse.LeftButtonClick();
}
_logger.LogInformation("自动剧情:{Text} 比例 {Rate}", "点击黑屏", rate.ToString("F"));
@@ -274,7 +295,7 @@ public class AutoSkipTrigger : ITaskTrigger
{
if (hangoutOption.OptionTextSrc.Contains(str))
{
hangoutOption.Click();
HangoutOptionClick(hangoutOption);
_logger.LogInformation("邀约分支[{Text}]关键词[{Str}]命中", _config.AutoHangoutEndChoose, str);
AutoHangoutSkipLog(hangoutOption.OptionTextSrc);
VisionContext.Instance().DrawContent.RemoveRect("HangoutSelected");
@@ -290,7 +311,7 @@ public class AutoSkipTrigger : ITaskTrigger
{
if (!hangoutOption.IsSelected)
{
hangoutOption.Click();
HangoutOptionClick(hangoutOption);
AutoHangoutSkipLog(hangoutOption.OptionTextSrc);
VisionContext.Instance().DrawContent.RemoveRect("HangoutSelected");
VisionContext.Instance().DrawContent.RemoveRect("HangoutUnselected");
@@ -299,11 +320,31 @@ public class AutoSkipTrigger : ITaskTrigger
}
// 没有未点击的选项 选择第一个已点击选项
hangoutOptionList[0].Click();
HangoutOptionClick(hangoutOptionList[0]);
AutoHangoutSkipLog(hangoutOptionList[0].OptionTextSrc);
VisionContext.Instance().DrawContent.RemoveRect("HangoutSelected");
VisionContext.Instance().DrawContent.RemoveRect("HangoutUnselected");
}
else
{
// 没有邀约选项 寻找跳过按钮
if (_config.AutoHangoutPressSkipEnabled)
{
using var skipRa = captureRegion.Find(_autoSkipAssets.HangoutSkipRo);
if (skipRa.IsExist())
{
if (IsBackgroundRunning && !SystemControl.IsGenshinImpactActive())
{
skipRa.BackgroundClick();
}
else
{
skipRa.Click();
}
AutoHangoutSkipLog("点击跳过按钮");
}
}
}
}
/// <summary>
@@ -373,7 +414,7 @@ public class AutoSkipTrigger : ITaskTrigger
});
}
private readonly Regex _enRegex = new(@"^[a-zA-Z]+$");
private readonly Regex _enOrNumRegex = new(@"^[a-zA-Z0-9]+$");
/// <summary>
/// 新的对话选项选择
@@ -392,7 +433,7 @@ public class AutoSkipTrigger : ITaskTrigger
using var exclamationIconRa = region.Find(_autoSkipAssets.ExclamationIconRo);
if (!exclamationIconRa.IsEmpty())
{
TaskControl.Sleep(_config.AfterChooseOptionSleepDelay);
Thread.Sleep(_config.AfterChooseOptionSleepDelay);
exclamationIconRa.Click();
AutoSkipLog("点击感叹号选项");
return true;
@@ -420,12 +461,23 @@ public class AutoSkipTrigger : ITaskTrigger
// 删除为空的结果 和 纯英文的结果
var rs = new List<Region>();
foreach (var item in ocrResList)
// 按照y坐标排序
ocrResList = ocrResList.OrderBy(r => r.Y).ToList();
for (var i = 0; i < ocrResList.Count; i++)
{
if (string.IsNullOrEmpty(item.Text) || (item.Text.Length < 5 && _enRegex.IsMatch(item.Text)))
var item = ocrResList[i];
if (string.IsNullOrEmpty(item.Text) || (item.Text.Length < 5 && _enOrNumRegex.IsMatch(item.Text)))
{
continue;
}
if (i != ocrResList.Count - 1)
{
if (ocrResList[i + 1].Y - ocrResList[i].Y > 150)
{
Debug.WriteLine($"存在Y轴偏差过大的结果,忽略:{item.Text}");
continue;
}
}
rs.Add(item);
}
@@ -455,14 +507,14 @@ public class AutoSkipTrigger : ITaskTrigger
var textMat = item.ToImageRegion().SrcMat;
if (IsOrangeOption(textMat))
{
if (item.Text.Contains("每日委托"))
if (_config.AutoGetDailyRewardsEnabled && (item.Text.Contains("每日") || item.Text.Contains("委托")))
{
ClickOcrRegion(item);
ClickOcrRegion(item, "每日委托");
_prevGetDailyRewardsTime = DateTime.Now; // 记录领取时间
}
else if (item.Text.Contains("探索派遣"))
else if (_config.AutoReExploreEnabled && (item.Text.Contains("探索") || item.Text.Contains("派遣")))
{
ClickOcrRegion(item);
ClickOcrRegion(item, "探索派遣");
Thread.Sleep(800); // 等待探索派遣界面打开
new OneKeyExpeditionTask().Run(_autoSkipAssets);
}
@@ -504,7 +556,7 @@ public class AutoSkipTrigger : ITaskTrigger
}
// 没OCR到文字,直接选择气泡选项
TaskControl.Sleep(_config.AfterChooseOptionSleepDelay);
Thread.Sleep(_config.AfterChooseOptionSleepDelay);
clickRect.Click();
var msg = _config.IsClickFirstChatOption() ? "第一个" : "最后一个";
AutoSkipLog($"点击{msg}气泡选项");
@@ -516,13 +568,39 @@ public class AutoSkipTrigger : ITaskTrigger
return false;
}
private void ClickOcrRegion(Region region)
private void ClickOcrRegion(Region region, string optionType = "")
{
TaskControl.Sleep(_config.AfterChooseOptionSleepDelay);
region.Click();
if (string.IsNullOrEmpty(optionType))
{
Thread.Sleep(_config.AfterChooseOptionSleepDelay);
}
if (IsBackgroundRunning && !SystemControl.IsGenshinImpactActive())
{
region.BackgroundClick();
}
else
{
region.Click();
}
AutoSkipLog(region.Text);
}
private void HangoutOptionClick(HangoutOption option)
{
if (_config.AutoHangoutChooseOptionSleepDelay > 0)
{
Thread.Sleep(_config.AutoHangoutChooseOptionSleepDelay);
}
if (IsBackgroundRunning && !SystemControl.IsGenshinImpactActive())
{
option.BackgroundClick();
}
else
{
option.Click();
}
}
private void AutoHangoutSkipLog(string text)
{
if ((DateTime.Now - _prevClickTime).TotalMilliseconds > 1000)
@@ -60,11 +60,21 @@ public class HangoutOption : IDisposable
}
}
public void Move()
{
IconRect.Move();
}
public void Click()
{
IconRect.Click();
}
public void BackgroundClick()
{
IconRect.BackgroundClick();
}
public void Dispose()
{
IconRect.Dispose();
@@ -16,6 +16,7 @@ public class OneKeyExpeditionTask
{
try
{
SystemControl.ActivateWindow();
// 1.全部领取
var region = CaptureToRectArea();
region.Find(assets.CollectRo, ra =>
@@ -0,0 +1 @@
[{"description":"3.4沙漠锚点神像\\jiemimijing1.json","position":[-735.8589477539062,-23.710371017456055,4427.57177734375]},{"description":"3.4沙漠锚点神像\\jiemimijing2.json","position":[-383.1236267089844,224.03675842285156,5000.1552734375]},{"description":"3.4沙漠锚点神像\\maodian1.json","position":[-1242.898193359375,52.00784683227539,5485.58349609375]},{"description":"3.4沙漠锚点神像\\maodian10.json","position":[-516.5203857421875,-50.85743713378906,5487.57080078125]},{"description":"3.4沙漠锚点神像\\maodian11.json","position":[-819.7119750976562,-253.5146484375,6034.2255859375]},{"description":"3.4沙漠锚点神像\\maodian12.json","position":[-706.3156127929688,94.00806427001953,5686.16259765625]},{"description":"3.4沙漠锚点神像\\maodian13.json","position":[-409.47808837890625,205.45986938476562,5572.96826171875]},{"description":"3.4沙漠锚点神像\\maodian14.json","position":[-497.8412170410156,268.4176940917969,5175.9033203125]},{"description":"3.4沙漠锚点神像\\maodian15.json","position":[-694.6351318359375,212.838623046875,4955.5009765625]},{"description":"3.4沙漠锚点神像\\maodian16.json","position":[-514.9568481445312,180.06808471679688,4267.39697265625]},{"description":"3.4沙漠锚点神像\\maodian17.json","position":[-258.5065612792969,-22.822500228881836,4692.3310546875]},{"description":"3.4沙漠锚点神像\\maodian2.json","position":[-1303.1329345703125,16.06406593322754,5763.4169921875]},{"description":"3.4沙漠锚点神像\\maodian3.json","position":[-1461.8145751953125,8.637067794799805,5411.82861328125]},{"description":"3.4沙漠锚点神像\\maodian4.json","position":[-1338.157958984375,56.277835845947266,5201.19775390625]},{"description":"3.4沙漠锚点神像\\maodian5.json","position":[-986.2532958984375,111.91490936279297,4767.01025390625]},{"description":"3.4沙漠锚点神像\\maodian6.json","position":[-801.1182250976562,-134.3053436279297,4934.56201171875]},{"description":"3.4沙漠锚点神像\\maodian7.json","position":[-1075.71630859375,76.76039123535156,4581.0]},{"description":"3.4沙漠锚点神像\\maodian8.json","position":[-653.1929931640625,105.96498107910156,4589.46533203125]},{"description":"3.4沙漠锚点神像\\maodian9.json","position":[-204.19378662109375,86.0101547241211,5305.62060546875]},{"description":"3.4沙漠锚点神像\\shengxiang1.json","position":[-1588.2569580078125,98.60969543457031,5068.8935546875]},{"description":"3.6沙漠新锚点神像\\maodian4.json","position":[342.9092712402344,235.72434997558594,6609.58251953125]},{"description":"3.6沙漠新锚点神像\\miaodian1.json","position":[-328.1078186035156,134.8601531982422,5998.26806640625]},{"description":"3.6沙漠新锚点神像\\miaodian10.json","position":[821.7305297851562,203.72425842285156,6323.89794921875]},{"description":"3.6沙漠新锚点神像\\miaodian11.json","position":[855.9757690429688,381.4595947265625,6060.423828125]},{"description":"3.6沙漠新锚点神像\\miaodian12.json","position":[742.5003051757812,213.31492614746094,5994.01318359375]},{"description":"3.6沙漠新锚点神像\\miaodian13.json","position":[798.3803100585938,326.153564453125,5790.19580078125]},{"description":"3.6沙漠新锚点神像\\miaodian14.json","position":[421.57940673828125,314.2716064453125,5889.7587890625]},{"description":"3.6沙漠新锚点神像\\miaodian15.json","position":[441.0927429199219,310.39471435546875,5699.1298828125]},{"description":"3.6沙漠新锚点神像\\miaodian16.json","position":[530.6939697265625,221.99050903320312,5724.64990234375]},{"description":"3.6沙漠新锚点神像\\miaodian2.json","position":[2.498239755630493,228.10166931152344,6161.0146484375]},{"description":"3.6沙漠新锚点神像\\miaodian3.json","position":[477.4720458984375,131.10321044921875,6358.4326171875]},{"description":"3.6沙漠新锚点神像\\miaodian5.json","position":[384.06304931640625,319.8273010253906,6817.4755859375]},{"description":"3.6沙漠新锚点神像\\miaodian6.json","position":[552.3153076171875,144.32643127441406,6679.85595703125]},{"description":"3.6沙漠新锚点神像\\miaodian7.json","position":[677.3568725585938,157.34152221679688,6747.1328125]},{"description":"3.6沙漠新锚点神像\\miaodian8.json","position":[725.5885620117188,336.669677734375,6615.39501953125]},{"description":"3.6沙漠新锚点神像\\miaodian9.json","position":[738.9754028320312,305.17138671875,6339.76171875]},{"description":"3.6沙漠新锚点神像\\shenxiang1.json","position":[480.04736328125,325.9526062011719,6188.03515625]},{"description":"3.6沙漠新锚点神像\\shenxiang2.json","position":[618.3367309570312,324.10931396484375,5942.6845703125]},{"description":"4.0枫丹锚点神像\\合\\yuanqi01.json","position":[1212.908203,446.564636,5990.100586]},{"description":"4.0枫丹锚点神像\\合\\yuanqi02.json","position":[1551.94043,280.305969,5329.244629]},{"description":"4.0枫丹锚点神像\\合\\yuanqi03.json","position":[1665.129395Line truncated
@@ -1,13 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.Json;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.GameTask.AutoFight.Assets;
using BetterGenshinImpact.GameTask.AutoFight.Config;
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
using BetterGenshinImpact.GameTask.AutoTrackPath.Model;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.GameTask.Common.Element.Assets;
using BetterGenshinImpact.GameTask.Common.Map;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.GameTask.Model.Enum;
using BetterGenshinImpact.GameTask.QuickTeleport.Assets;
using BetterGenshinImpact.Service;
using BetterGenshinImpact.View.Drawable;
using BetterGenshinImpact.ViewModel.Pages;
using Microsoft.Extensions.Logging;
@@ -22,9 +33,30 @@ public class AutoTrackPathTask
private readonly AutoTrackPathParam _taskParam;
private readonly Random _rd = new Random();
private readonly List<GiWorldPosition> _tpPositions;
private readonly Dictionary<string, double[]> _countryPositions = new()
{
{ "蒙德", [-876, 2278] },
{ "璃月", [270, -666] },
{ "稻妻", [-4400, -3050] },
{ "须弥", [2877, -374] },
{ "枫丹", [4515, 3631] },
};
private GiPath _way;
// 视角偏移移动单位
private const int CharMovingUnit = 100;
public AutoTrackPathTask(AutoTrackPathParam taskParam)
{
_taskParam = taskParam;
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoTrackPath\Assets\tp.json"));
_tpPositions = JsonSerializer.Deserialize<List<GiWorldPosition>>(json, ConfigService.JsonOptions) ?? throw new Exception("tp.json deserialize failed");
var wayJson = File.ReadAllText(Global.Absolute(@"log\way\way1.json"));
_way = JsonSerializer.Deserialize<GiPath>(wayJson, ConfigService.JsonOptions) ?? throw new Exception("way json deserialize failed");
}
public async void Start()
@@ -41,7 +73,7 @@ public class AutoTrackPathTask
Init();
Tp(4726.575195, 1852.823975);
Tp(_tpPositions[260].X, _tpPositions[260].Y);
}
catch (NormalEndException)
{
@@ -81,39 +113,91 @@ public class AutoTrackPathTask
public void DoTask()
{
// 解析路线,第一个点为起点
// 1. 传送到最近的传送点
var first = _way.WayPointList[0]; // 解析路线,第一个点为起点
Tp(first.Pt.X, first.Pt.Y);
// 找到起点最近的传送点位置
// 2. 等待传送完成
Sleep(1000);
NewRetry.Do(() =>
{
var ra = GetRectAreaFromDispatcher();
var miniMapMat = GetMiniMapMat(ra);
if (miniMapMat == null)
{
throw new RetryException("等待传送完成");
}
}, TimeSpan.FromSeconds(1), 100);
Logger.LogInformation("传送完成");
// 初始化全地图特征
// 3. 横向移动偏移量校准,移动指定偏移、按下W后识别朝向
var angleOffset = GetOffsetAngle();
// --- 地图传送模块 ---
// 4. 针对点位进行直线追踪
// M 打开地图识别当前位置,中心点为当前位置
// 循环每个点位
// 计算传送点位置离哪个地图切换后的中心点最近,切换到该地图
// 识别当前位置、人物朝向任务 偏差太大要修正
// 快速移动到目标传送点所在的区域
// 计算当前位置到目标点的角度
// 计算坐标后点击
// 旋转到目标角度
// 触发一次快速传送功能
// 移动到目标点 不用太精准,只要在一定范围内就行
// --- 地图传送模块 ---
// 横向移动偏移量校准,移动指定偏移、按下W后识别朝向
// 针对点位进行直线追踪
// 移动时循环识别当前位置、人物朝向任务
}
public void Tp(string name)
public void Track(List<GiPathPoint> pList)
{
// 通过大地图传送到指定传送点
}
public void Tp(double x, double y)
public int GetOffsetAngle()
{
// 通过大地图传送到指定坐标最近的传送点,然后移动到指定坐标
var angle1 = GetCharacterOrientationAngle();
Simulation.SendInput.Mouse.MoveMouseBy(CharMovingUnit, 0).Sleep(200)
.Keyboard.KeyPress(User32.VK.VK_W).Sleep(500);
var angle2 = GetCharacterOrientationAngle();
var angleOffset = angle2 - angle1;
Logger.LogInformation("横向移动偏移量校准:鼠标平移100单位,角度转动{AngleOffset}", angleOffset);
return angleOffset;
}
public Mat? GetMiniMapMat(ImageRegion ra)
{
var paimon = ra.Find(ElementAssets.Instance.PaimonMenuRo);
if (paimon.IsExist())
{
return new Mat(ra.SrcMat, new Rect(paimon.X + 24, paimon.Y - 15, 210, 210));
}
return null;
}
public int GetCharacterOrientationAngle()
{
var ra = GetRectAreaFromDispatcher();
var miniMapMat = GetMiniMapMat(ra);
if (miniMapMat == null)
{
throw new InvalidOperationException("当前不在主界面");
}
var angle = CharacterOrientation.Compute(miniMapMat);
Logger.LogInformation("当前角度:{Angle}", angle);
CameraOrientation.DrawDirection(ra, angle);
return angle;
}
/// <summary>
/// 通过大地图传送到指定坐标最近的传送点,然后移动到指定坐标
/// </summary>
/// <param name="tpX"></param>
/// <param name="tpY"></param>
public void Tp(double tpX, double tpY)
{
// 获取最近的传送点位置
var (x, y) = GetRecentlyTpPoint(tpX, tpY);
Logger.LogInformation("({TpX},{TpY}) 最近的传送点位置 ({X},{Y})", tpX, tpY, x, y);
// M 打开地图识别当前位置,中心点为当前位置
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M);
@@ -121,8 +205,45 @@ public class AutoTrackPathTask
Sleep(1000);
// 计算传送点位置离哪个地图切换后的中心点最近,切换到该地图
var bigMapCenterPoint = GetPositionFromBigMap();
SwitchRecentlyCountryMap(x, y);
// 移动地图到指定传送点位置
Debug.WriteLine("移动地图到指定传送点位置");
MoveMapTo(x, y);
// 计算坐标后点击
var bigMapInAllMapRect = GetBigMapRect();
while (!bigMapInAllMapRect.Contains((int)x, (int)y))
{
Debug.WriteLine($"({x},{y}) 不在 {bigMapInAllMapRect} 内,继续移动");
Logger.LogInformation("传送点不在当前大地图范围内,继续移动");
MoveMapTo(x, y);
bigMapInAllMapRect = GetBigMapRect();
}
// Debug.WriteLine($"({x},{y}) 在 {bigMapInAllMapRect} 内,计算它在窗体内的位置");
// 注意这个坐标的原点是中心区域某个点,所以要转换一下点击坐标(点击坐标是左上角为原点的坐标系),不能只是缩放
var (picX, picY) = MapCoordinate.GameToMain2048(x, y);
var picRect = MapCoordinate.GameToMain2048(bigMapInAllMapRect);
Debug.WriteLine($"({picX},{picY}) 在 {picRect} 内,计算它在窗体内的位置");
var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
var clickX = (int)((picX - picRect.X) / picRect.Width * captureRect.Width);
var clickY = (int)((picY - picRect.Y) / picRect.Height * captureRect.Height);
Logger.LogInformation("点击传送点:({X},{Y})", clickX, clickY);
using var ra = GetRectAreaFromDispatcher();
ra.ClickTo(clickX, clickY);
// 触发一次快速传送功能
}
/// <summary>
/// 移动地图到指定传送点位置
/// 可能会移动不对,所以可以重试此方法
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void MoveMapTo(double x, double y)
{
var bigMapCenterPoint = GetPositionFromBigMap();
// 移动部分内容测试移动偏移
var (xOffset, yOffset) = (x - bigMapCenterPoint.X, y - bigMapCenterPoint.Y);
@@ -141,33 +262,28 @@ public class AutoTrackPathTask
MouseMoveMapX(diffMouseX);
MouseMoveMapY(diffMouseY);
var newBigMapCenterPoint = GetPositionFromBigMap();
var diffMapX = newBigMapCenterPoint.X - bigMapCenterPoint.X;
var diffMapY = newBigMapCenterPoint.Y - bigMapCenterPoint.Y;
var diffMapX = Math.Abs(newBigMapCenterPoint.X - bigMapCenterPoint.X);
var diffMapY = Math.Abs(newBigMapCenterPoint.Y - bigMapCenterPoint.Y);
Debug.WriteLine($"每100移动的地图距离:({diffMapX},{diffMapY})");
if (diffMapX > 0 && diffMapY > 0)
// 快速移动到目标传送点所在的区域
if (diffMapX > 10 && diffMapY > 10)
{
// // 计算需要移动的次数
var moveCount = (int)(xOffset / diffMapX); // 向下取整 本来还要加1的,但是已经移动了一次了
var moveCount = (int)Math.Abs(xOffset / diffMapX); // 向下取整 本来还要加1的,但是已经移动了一次了
Debug.WriteLine("X需要移动的次数:" + moveCount);
for (var i = 0; i < moveCount; i++)
{
MouseMoveMapX(diffMouseX);
}
moveCount = (int)(yOffset / diffMapY); // 向下取整 本来还要加1的,但是已经移动了一次了
moveCount = (int)Math.Abs(yOffset / diffMapY); // 向下取整 本来还要加1的,但是已经移动了一次了
Debug.WriteLine("Y需要移动的次数:" + moveCount);
for (var i = 0; i < moveCount; i++)
{
MouseMoveMapY(diffMouseY);
}
}
// 快速移动到目标传送点所在的区域
// 计算坐标后点击
// 触发一次快速传送功能
}
public void MouseMoveMapX(int dx)
@@ -195,25 +311,25 @@ public class AutoTrackPathTask
Simulation.SendInput.Mouse.LeftButtonUp().Sleep(200);
}
public Point GetPositionFromBigMap()
public static Point GetPositionFromBigMap()
{
var bigMapRect = GetBigMapRect();
// 中心点
Debug.WriteLine("地图位置转换到游戏坐标:" + bigMapRect);
var bigMapCenterPoint = bigMapRect.GetCenterPoint();
Debug.WriteLine("识别大地图中心点:" + bigMapCenterPoint);
var gamePoint = MapCoordinate.Main2048ToGame(bigMapCenterPoint);
Debug.WriteLine("转换到游戏坐标:" + gamePoint);
return gamePoint;
Debug.WriteLine("地图中心坐标:" + bigMapCenterPoint);
return bigMapCenterPoint;
}
public Rect GetBigMapRect()
public static Rect GetBigMapRect()
{
// 判断是否在地图界面
using var ra = GetRectAreaFromDispatcher();
using var mapScaleButtonRa = ra.Find(QuickTeleportAssets.Instance.MapScaleButtonRo);
if (mapScaleButtonRa.IsExist())
{
return EntireMap.Instance.GetBigMapPositionByFeatureMatch(ra.SrcGreyMat);
var rect = EntireMap.Instance.GetBigMapPositionByFeatureMatch(ra.SrcGreyMat);
Debug.WriteLine("识别大地图在全地图位置矩形:" + rect);
return MapCoordinate.Main2048ToGame(rect);
}
else
{
@@ -221,6 +337,69 @@ public class AutoTrackPathTask
}
}
/// <summary>
/// 获取最近的传送点位置
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public (int x, int y) GetRecentlyTpPoint(double x, double y)
{
var recentX = 0;
var recentY = 0;
var minDistance = double.MaxValue;
foreach (var tpPosition in _tpPositions)
{
var distance = Math.Sqrt(Math.Pow(tpPosition.X - x, 2) + Math.Pow(tpPosition.Y - y, 2));
if (distance < minDistance)
{
minDistance = distance;
recentX = (int)Math.Round(tpPosition.X);
recentY = (int)Math.Round(tpPosition.Y);
}
}
return (recentX, recentY);
}
public void SwitchRecentlyCountryMap(double x, double y)
{
var bigMapCenterPoint = GetPositionFromBigMap();
Logger.LogInformation("识别当前位置:{Pos}", bigMapCenterPoint);
var minDistance = Math.Sqrt(Math.Pow(bigMapCenterPoint.X - x, 2) + Math.Pow(bigMapCenterPoint.Y - y, 2));
var minCountry = "当前位置";
foreach (var (country, position) in _countryPositions)
{
var distance = Math.Sqrt(Math.Pow(position[0] - x, 2) + Math.Pow(position[1] - y, 2));
if (distance < minDistance)
{
minDistance = distance;
minCountry = country;
}
}
Logger.LogInformation("离目标传送点最近的区域是:{Country}", minCountry);
if (minCountry != "当前位置")
{
GameCaptureRegion.GameRegionClick((rect, scale) => (rect.Width - 160 * scale, rect.Height - 60 * scale));
Sleep(200, _taskParam.Cts);
var ra = GetRectAreaFromDispatcher();
var list = ra.FindMulti(new RecognitionObject
{
RecognitionType = RecognitionTypes.Ocr,
RegionOfInterest = new Rect(ra.Width / 2, 0, ra.Width / 2, ra.Height)
});
list.FirstOrDefault(r => r.Text.Contains(minCountry))?.Click();
Logger.LogInformation("切换到区域:{Country}", minCountry);
Sleep(500, _taskParam.Cts);
}
}
public void Tp(string name)
{
// 通过大地图传送到指定传送点
}
public void TpByF1(string name)
{
// 传送到指定传送点
@@ -22,11 +22,11 @@ public class GiPathPoint
public static GiPathPoint BuildFrom(Rect matchRect, int index)
{
var pt = MapCoordinate.Main1024ToGame(matchRect.GetCenterPoint());
var pt = MapCoordinate.Main2048ToGame(matchRect.GetCenterPoint());
return new GiPathPoint
{
Pt = pt,
MatchRect = new Rect(pt, matchRect.Size),
MatchRect = matchRect,
Index = index,
Time = DateTime.Now
};
@@ -0,0 +1,33 @@
namespace BetterGenshinImpact.GameTask.AutoTrackPath.Model;
/// <summary>
/// 原神世界坐标
/// https://github.com/babalae/better-genshin-impact/issues/318
/// </summary>
public class GiWorldPosition
{
/// <summary>
/// 为这个坐标点命名
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 坐标描述
/// </summary>
public string? Description { get; set; }
/// <summary>
/// 坐标 x,y,z 三个值,分别代表纵向、高度、横向,采用原神实际的坐标系
/// 由于这个坐标系和一般的坐标系不同,所以为了方便理解,设这3个值为a,b,c
/// ▲
/// │a
/// ◄───┼────
/// c │
///
/// 值的缩放等级和1024区块坐标系的缩放一致
/// </summary>
public decimal[] Position { get; set; } = new decimal[3];
public double X => (double)Position[2]; // a
public double Y => (double)Position[0]; // c
}
@@ -0,0 +1,33 @@
using BetterGenshinImpact.Core.Simulator;
using BetterGenshinImpact.Model;
using Vanara.PInvoke;
namespace BetterGenshinImpact.GameTask.AutoTrackPath;
public class MovementControl : Singleton<MovementControl>
{
private bool _wDown = false;
public void WDown()
{
if (!_wDown)
{
_wDown = true;
Simulation.SendInput.Keyboard.KeyDown(User32.VK.VK_W);
}
}
public void WUp()
{
if (_wDown)
{
_wDown = false;
Simulation.SendInput.Keyboard.KeyUp(User32.VK.VK_W);
}
}
public void SpacePress()
{
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
}
}
@@ -307,7 +307,7 @@ public partial class AutoWoodTask
if (_firstWoodOcr)
{
// 记录木材单次获取的值
_woodMetricsDict.Add(materialName, quantity);
_woodMetricsDict.TryAdd(materialName, quantity);
}
}
@@ -1,10 +1,9 @@
using System;
using BetterGenshinImpact.GameTask.Model.Area;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.View.Drawable;
using OpenCvSharp;
using Point = OpenCvSharp.Point;
using Size = OpenCvSharp.Size;
@@ -1,14 +1,12 @@
using BetterGenshinImpact.View.Drawable;
using OpenCvSharp;
using OpenCvSharp;
using System;
namespace BetterGenshinImpact.GameTask.Common.Map;
public class CharacterOrientation
{
public static void Compute(CaptureContent content)
public static int Compute(Mat mat)
{
var mat = new Mat(content.CaptureRectArea.SrcMat, new Rect(62, 19, 212, 212));
var splitMat = mat.Split();
// 1. 红蓝通道按位与
@@ -93,12 +91,20 @@ public class CharacterOrientation
maxBlackCount = blackCount;
correctP1 = midPoint; // 底边中点
correctP2 = targetPoint; // 顶点
// 计算弧度
double radians = Math.Atan2(correctP2.Y - correctP1.Y, correctP2.X - correctP1.X);
// 将弧度转换为度数
double angle = radians * (180.0 / Math.PI);
return (int)angle;
}
}
// VisionContext.Instance().DrawContent.PutLine("co", new LineDrawable(correctP1, correctP2 + (correctP2 - correctP1) * 3));
}
}
return -1;
}
static Point Midpoint(Point p1, Point p2)
@@ -81,19 +81,20 @@ public class EntireMap : Singleton<EntireMap>
/// 移动匹配
/// </summary>
/// <param name="greyMat">灰度图</param>
/// <param name="mask">遮罩</param>
/// <returns></returns>
public Rect GetMiniMapPositionByFeatureMatch(Mat greyMat)
public Rect GetMiniMapPositionByFeatureMatch(Mat greyMat, Mat? mask = null)
{
try
{
Point2f[]? pArray;
if (_prevX != -1 && _prevY != -1)
{
pArray = _featureMatcher.Match(greyMat, _prevX, _prevY);
pArray = _featureMatcher.Match(greyMat, _prevX, _prevY, mask);
}
else
{
pArray = _featureMatcher.Match(greyMat);
pArray = _featureMatcher.Match(greyMat, mask);
}
if (pArray == null || pArray.Length < 4)
@@ -1,5 +1,6 @@
using System;
using BetterGenshinImpact.Core.Recognition.OpenCv;
using OpenCvSharp;
using System;
namespace BetterGenshinImpact.GameTask.Common.Map;
@@ -44,13 +45,12 @@ public class MapCoordinate
}
/// <summary>
/// 原神游戏坐标系 -> 主地图1024区块坐标系
/// 原神游戏坐标系 -> 主地图2048区块坐标系
/// </summary>
/// <param name="position">[a,b,c]</param>
/// <returns></returns>
public static Point GameToMain2048(decimal[] position)
{
// 四舍六入五取偶
var a = position[0]; // 上
var c = position[2]; // 左
@@ -61,7 +61,29 @@ public class MapCoordinate
}
/// <summary>
/// 主地图1024区块坐标系 -> 原神游戏坐标系
/// 原神游戏坐标系 -> 主地图2048区块坐标系
/// </summary>
/// <returns></returns>
public static (double x, double y) GameToMain2048(double c, double a)
{
// 转换1024区块坐标,大地图坐标系正轴是往左上方向的
// 这里写最左上角的区块坐标(GameMapUpRows,GameMapLeftCols)/(上,左),截止4.5版本,最左上角的区块坐标是(5,7)
return new(((GameMapLeftCols + 1) * GameMapBlockWidth - c) * 2, ((GameMapUpRows + 1) * GameMapBlockWidth - a) * 2);
}
public static Rect GameToMain2048(Rect rect)
{
var center = rect.GetCenterPoint();
// 转换中心点坐标
(double newX, double newY) = GameToMain2048(center.X, center.Y);
// 返回转换后的矩形坐标
return new Rect((int)Math.Round(newX) - rect.Width, (int)Math.Round(newY) - rect.Height, rect.Width * 2, rect.Height * 2);
}
/// <summary>
/// 主地图2048区块坐标系 -> 原神游戏坐标系
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
@@ -69,4 +91,16 @@ public class MapCoordinate
{
return new Point((GameMapLeftCols + 1) * GameMapBlockWidth - point.X / 2, (GameMapUpRows + 1) * GameMapBlockWidth - point.Y / 2);
}
/// <summary>
/// 主地图2048区块坐标系 -> 原神游戏坐标系
/// </summary>
/// <param name="rect"></param>
/// <returns></returns>
public static Rect Main2048ToGame(Rect rect)
{
var center = rect.GetCenterPoint();
var point = Main2048ToGame(center);
return new Rect(point.X - rect.Width / 4, point.Y - rect.Height / 4, rect.Width / 2, rect.Height / 2);
}
}
@@ -56,17 +56,10 @@ internal class GameTaskManager
{
if (TriggerDictionary is { Count: > 0 })
{
TriggerDictionary["AutoPick"].IsEnabled = TaskContext.Instance().Config.AutoPickConfig.Enabled;
// 用于刷新AutoPick的黑白名单
TriggerDictionary["AutoPick"].Init();
TriggerDictionary["AutoSkip"].IsEnabled = TaskContext.Instance().Config.AutoSkipConfig.Enabled;
TriggerDictionary["AutoFishing"].IsEnabled = TaskContext.Instance().Config.AutoFishingConfig.Enabled;
// 钓鱼有很多变量要初始化,直接重新newZA
if (TriggerDictionary["AutoFishing"].IsEnabled == false)
{
TriggerDictionary["AutoFishing"].Init();
}
TriggerDictionary["QuickTeleport"].IsEnabled = TaskContext.Instance().Config.QuickTeleportConfig.Enabled;
TriggerDictionary["AutoSkip"].Init();
TriggerDictionary["AutoFishing"].Init();
TriggerDictionary["QuickTeleport"].Init();
TriggerDictionary["GameLoading"].Init();
TriggerDictionary["AutoCook"].Init();
// 清理画布
+8 -2
View File
@@ -6,7 +6,7 @@
/// * 也可以是任务的本身
///
/// 需要短时间内持续循环获取游戏图像的,使用触发器;
/// 需要休眠等待且有一定流程的,应该使用<see cref="BaseTaskThread"/>
/// 需要休眠等待且有一定流程的,应自行实现Task
/// </summary>
public interface ITaskTrigger
{
@@ -14,6 +14,7 @@ public interface ITaskTrigger
/// 触发器名称
/// </summary>
string Name { get; }
/// <summary>
/// 是否处于启用状态
/// </summary>
@@ -29,6 +30,11 @@ public interface ITaskTrigger
/// </summary>
bool IsExclusive { get; }
/// <summary>
/// 处于可以后台运行的状态(原神窗口不处于激活状态)
/// </summary>
bool IsBackgroundRunning => false;
/// <summary>
/// 初始化
/// </summary>
@@ -39,4 +45,4 @@ public interface ITaskTrigger
/// </summary>
/// <param name="content">捕获的图片等内容</param>
void OnCapture(CaptureContent content);
}
}
@@ -18,6 +18,12 @@ public class DesktopRegion() : Region(0, 0, PrimaryScreen.WorkingArea.Width, Pri
(y + (h * 1d / 2)) * 65535 / Height).LeftButtonClick().Sleep(50).LeftButtonUp();
}
public void DesktopRegionMove(int x, int y, int w, int h)
{
Simulation.SendInput.Mouse.MoveMouseTo((x + (w * 1d / 2)) * 65535 / Width,
(y + (h * 1d / 2)) * 65535 / Height);
}
/// <summary>
/// 静态方法,每次都会重新计算屏幕大小
/// </summary>
@@ -5,6 +5,8 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using Vanara.PInvoke;
namespace BetterGenshinImpact.GameTask.Model.Area;
@@ -76,6 +78,18 @@ public class Region : IDisposable
// public List<Region>? NextChildren { get; protected set; }
/// <summary>
/// 后台点击【自己】的中心
/// </summary>
public void BackgroundClick()
{
User32.GetCursorPos(out var p);
this.Move(); // 必须移动实际鼠标
TaskContext.Instance().PostMessageSimulator.LeftButtonClickBackground();
Thread.Sleep(10);
DesktopRegion.DesktopRegionMove(p.X, p.Y); // 鼠标移动回原来位置
}
/// <summary>
/// 点击【自己】的中心
/// region.Derive(x,y).Click() 等效于 region.ClickTo(x,y)
@@ -111,6 +125,41 @@ public class Region : IDisposable
res.TargetRegion.DesktopRegionClick(res.X, res.Y, res.Width, res.Height);
}
/// <summary>
/// 移动到【自己】的中心
/// region.Derive(x,y).Move() 等效于 region.MoveTo(x,y)
/// </summary>
public void Move()
{
// 相对自己是 0, 0 坐标
MoveTo(0, 0, Width, Height);
}
/// <summary>
/// 移动到区域内【指定位置】
/// region.Derive(x,y).Move() 等效于 region.MoveTo(x,y)
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void MoveTo(int x, int y)
{
MoveTo(x, y, 0, 0);
}
/// <summary>
/// 移动到区域内【指定矩形区域】的中心
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="w"></param>
/// <param name="h"></param>
/// <exception cref="Exception"></exception>
public void MoveTo(int x, int y, int w, int h)
{
var res = ConvertRes<DesktopRegion>.ConvertPositionToTargetRegion(x, y, w, h, this);
res.TargetRegion.DesktopRegionMove(res.X, res.Y, res.Width, res.Height);
}
/// <summary>
/// 直接在遮罩窗口绘制【自己】
/// </summary>
@@ -5,6 +5,7 @@ using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Service;
using System;
using System.Threading;
using BetterGenshinImpact.Core.Simulator;
namespace BetterGenshinImpact.GameTask
{
@@ -32,6 +33,7 @@ namespace BetterGenshinImpact.GameTask
public void Init(IntPtr hWnd)
{
GameHandle = hWnd;
PostMessageSimulator = Simulation.PostMessage(GameHandle);
SystemInfo = new SystemInfo(hWnd);
DpiScale = DpiHelper.ScaleY;
//MaskWindowHandle = new WindowInteropHelper(MaskWindow.Instance()).Handle;
@@ -42,6 +44,8 @@ namespace BetterGenshinImpact.GameTask
public IntPtr GameHandle { get; set; }
public PostMessageSimulator PostMessageSimulator { get; private set; }
//public IntPtr MaskWindowHandle { get; set; }
public float DpiScale { get; set; }
@@ -268,6 +268,7 @@ namespace BetterGenshinImpact.GameTask
}
// 检查游戏是否在前台
var hasBackgroundTriggerToRun = false;
var active = SystemControl.IsGenshinImpactActive();
if (!active)
{
@@ -291,7 +292,24 @@ namespace BetterGenshinImpact.GameTask
}
_prevGameActive = active;
return;
if (_triggers != null)
{
var exclusive = _triggers.FirstOrDefault(t => t is { IsEnabled: true, IsExclusive: true });
if (exclusive != null)
{
hasBackgroundTriggerToRun = exclusive.IsBackgroundRunning;
}
else
{
hasBackgroundTriggerToRun = _triggers.Any(t => t is { IsEnabled: true, IsBackgroundRunning: true });
}
}
if (!hasBackgroundTriggerToRun)
{
// 没有后台运行的触发器,这次不再进行截图
return;
}
}
else
{
@@ -342,7 +360,7 @@ namespace BetterGenshinImpact.GameTask
// 循环执行所有触发器 有独占状态的触发器的时候只执行独占触发器
var content = new CaptureContent(bitmap, _frameIndex, _timer.Interval);
var exclusiveTrigger = _triggers.FirstOrDefault(t => t is { IsEnabled: true, IsExclusive: true });
var exclusiveTrigger = _triggers!.FirstOrDefault(t => t is { IsEnabled: true, IsExclusive: true });
if (exclusiveTrigger != null)
{
exclusiveTrigger.OnCapture(content);
@@ -350,7 +368,13 @@ namespace BetterGenshinImpact.GameTask
}
else
{
foreach (var trigger in _triggers.Where(trigger => trigger.IsEnabled))
var runningTriggers = _triggers.Where(t => t.IsEnabled);
if (hasBackgroundTriggerToRun)
{
runningTriggers = runningTriggers.Where(t => t.IsBackgroundRunning);
}
foreach (var trigger in runningTriggers)
{
trigger.OnCapture(content);
speedTimer.Record(trigger.Name);
+29
View File
@@ -0,0 +1,29 @@
using System;
using OpenCvSharp;
namespace BetterGenshinImpact.Helpers;
public class MathHelper
{
/// <summary>
/// 点到直线的最短距离
/// </summary>
/// <param name="point"></param>
/// <param name="point1"></param>
/// <param name="point2"></param>
/// <returns></returns>
public static double CalculateDistance(Point point, Point point1, Point point2)
{
// 直线的方向向量
double a = point2.Y - point1.Y;
double b = point1.X - point2.X;
double c = point2.X * point1.Y - point1.X * point2.Y;
// 使用距离公式计算点到直线的最短距离
double numerator = Math.Abs(a * point.X + b * point.Y + c);
double denominator = Math.Sqrt(a * a + b * b);
double distance = numerator / denominator;
return distance;
}
}
@@ -25,8 +25,6 @@ internal static class RuntimeHelper
false;
#endif
public static bool IsGpuPackage => true;
private static bool GetElevated()
{
using WindowsIdentity identity = WindowsIdentity.GetCurrent();
@@ -0,0 +1,18 @@
using System;
using Vanara.PInvoke;
namespace BetterGenshinImpact.Helpers;
public class User32Helper
{
public static User32.VK ToVk(string key)
{
key = key.ToUpper();
if (!key.StartsWith("VK_"))
{
key = $"VK_{key}";
}
return (User32.VK)Enum.Parse(typeof(User32.VK), key);
}
}
+1 -2
View File
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System;
using System.Threading;
namespace BetterGenshinImpact.Model;
@@ -1129,6 +1129,7 @@
"挑战「手鞠游戏」",
"布置「手鞠」",
"「御神签箱」",
"御神签箱",
"开门",
"图书馆使用规范",
"调小火力",
@@ -136,7 +136,10 @@ public class HotKeyTextBox : TextBox
return;
// If Enter/Space/Tab is pressed without modifiers - return
if (key is Key.Enter or Key.Space or Key.Tab && modifiers == ModifierKeys.None)
if (key is Key.Enter or Key.Tab && modifiers == ModifierKeys.None)
return;
if (HotKeyTypeName == HotKeyTypeEnum.GlobalRegister.ToChineseName() && key is Key.Enter or Key.Space or Key.Tab && modifiers == ModifierKeys.None)
return;
// If key has a character and pressed without modifiers or only with Shift - return
+9 -3
View File
@@ -211,14 +211,20 @@
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="GPU推理需要安装CUDA,切换后需要重启程序"
Text="切换后需要重启程序生效"
TextWrapping="Wrap" />
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Margin="0,0,36,0"
ItemsSource="{Binding InferenceDevices}"
SelectedItem="{Binding Config.InferenceDevice, Mode=TwoWay}" />
ItemsSource="{Binding InferenceDeviceTypes}"
SelectedItem="{Binding Config.InferenceDevice, Mode=TwoWay}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="SelectionChanged">
<b:InvokeCommandAction Command="{Binding InferenceDeviceTypeDropDownChangedCommand}" CommandParameter="{Binding Config.InferenceDevice}" />
</b:EventTrigger>
</b:Interaction.Triggers>
</ComboBox>
</Grid>
<Separator Margin="-18,0" BorderThickness="0,1,0,0" />
<Grid Margin="16">
@@ -102,7 +102,7 @@
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Width="180"
Width="100"
Margin="0,0,36,0"
ItemsSource="{Binding PickOcrEngineNames}"
SelectedItem="{Binding Config.AutoPickConfig.OcrEngine, Mode=TwoWay}" />
@@ -159,6 +159,33 @@
Command="{Binding EditWhitelistCommand}"
Content="前往设置" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="自定义拾取按键"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="默认为 F,自带了 E 按键,需要改成其他键的请阅读文档"
TextWrapping="Wrap" />
<ComboBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Width="80"
Margin="0,0,36,0"
ItemsSource="{Binding DefaultPickButtonNames}"
SelectedItem="{Binding Config.AutoPickConfig.PickKey, Mode=TwoWay}" />
</Grid>
</StackPanel>
</ui:CardExpander>
@@ -195,6 +222,31 @@
</Grid>
</ui:CardExpander.Header>
<StackPanel>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="后台时依旧点击对话选项"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="游戏请不要最小化,不在对话中的时候鼠标会自动吸附回游戏中"
TextWrapping="Wrap" />
<ui:ToggleSwitch Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Margin="0,0,36,0"
IsChecked="{Binding Config.AutoSkipConfig.RunBackgroundEnabled, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -367,6 +419,31 @@
</Grid>
</ui:CardExpander.Header>
<StackPanel>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="存在跳过按钮时自动点击"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="邀约过程中左上角存在跳过按钮时候,自动点击跳过"
TextWrapping="Wrap" />
<ui:ToggleSwitch Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Margin="0,0,36,0"
IsChecked="{Binding Config.AutoSkipConfig.AutoHangoutPressSkipEnabled, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -393,6 +470,32 @@
ItemsSource="{Binding HangoutBranches, Mode=OneWay}"
SelectedItem="{Binding Config.AutoSkipConfig.AutoHangoutEndChoose, Mode=TwoWay}" />
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Row="0"
Grid.Column="0"
FontTypography="Body"
Text="选择邀约选项前的延迟(毫秒)"
TextWrapping="Wrap" />
<ui:TextBlock Grid.Row="1"
Grid.Column="0"
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
Text="方便在自动邀约的情况下,依旧能够看清楚选项"
TextWrapping="Wrap" />
<ui:TextBox Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
MinWidth="90"
Margin="0,0,24,0"
Text="{Binding Config.AutoSkipConfig.AutoHangoutChooseOptionSleepDelay, Mode=TwoWay}" />
</Grid>
</StackPanel>
</ui:CardExpander>
@@ -23,7 +23,7 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel
{
private readonly ILogger<MainWindowViewModel> _logger;
private readonly IConfigService _configService;
public string Title => $"BetterGI · 更好的原神 · {Global.Version}{(RuntimeHelper.IsDebug ? " · Dev" : string.Empty)}{(RuntimeHelper.IsGpuPackage ? " · GPU" : string.Empty)}";
public string Title => $"BetterGI · 更好的原神 · {Global.Version}{(RuntimeHelper.IsDebug ? " · Dev" : string.Empty)}";
[ObservableProperty]
public bool _isVisible = true;
@@ -1,5 +1,6 @@
using BetterGenshinImpact.Core;
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.Core.Recognition.ONNX;
using BetterGenshinImpact.GameTask;
using BetterGenshinImpact.Genshin.Paths;
using BetterGenshinImpact.Helpers;
@@ -45,7 +46,11 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
private readonly TaskTriggerDispatcher _taskDispatcher;
private readonly MouseKeyMonitor _mouseKeyMonitor = new();
[ObservableProperty] private string[] _inferenceDevices = ["CPU", "GPU"];
// 记录上次使用原神的句柄
private IntPtr _hWnd;
[ObservableProperty]
private string[] _inferenceDeviceTypes = BgiSessionOption.InferenceDeviceTypes;
public HomePageViewModel(IConfigService configService, TaskTriggerDispatcher taskTriggerDispatcher)
{
@@ -114,6 +119,11 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
}
}
[RelayCommand]
private void OnInferenceDeviceTypeDropDownChanged(string value)
{
}
[RelayCommand]
private void OnStartCaptureTest()
{
@@ -12,6 +12,7 @@ using BetterGenshinImpact.GameTask.AutoFight;
using BetterGenshinImpact.GameTask.AutoTrackPath;
using BetterGenshinImpact.GameTask.Common;
using BetterGenshinImpact.GameTask.Common.BgiVision;
using BetterGenshinImpact.GameTask.Model.Area;
using BetterGenshinImpact.Helpers.Extensions;
using Microsoft.Extensions.Logging;
using HotKeySettingModel = BetterGenshinImpact.Model.HotKeySettingModel;
@@ -22,6 +23,7 @@ using BetterGenshinImpact.GameTask.QuickSereniteaPot;
using BetterGenshinImpact.Helpers;
using BetterGenshinImpact.Model;
using Vanara.PInvoke;
using BetterGenshinImpact.GameTask.Model.Enum;
namespace BetterGenshinImpact.ViewModel.Pages;
@@ -135,6 +137,19 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
);
HotKeySettingModels.Add(takeScreenshotHotKeySettingModel);
HotKeySettingModels.Add(new HotKeySettingModel(
"日志与状态窗口展示开关",
nameof(Config.HotKeyConfig.LogBoxDisplayHotkey),
Config.HotKeyConfig.LogBoxDisplayHotkey,
Config.HotKeyConfig.LogBoxDisplayHotkeyType,
(_, _) =>
{
TaskContext.Instance().Config.MaskWindowConfig.ShowLogBox = !TaskContext.Instance().Config.MaskWindowConfig.ShowLogBox;
// 与状态窗口同步
TaskContext.Instance().Config.MaskWindowConfig.ShowStatus = TaskContext.Instance().Config.MaskWindowConfig.ShowLogBox;
}
));
var autoPickEnabledHotKeySettingModel = new HotKeySettingModel(
"自动拾取开关",
nameof(Config.HotKeyConfig.AutoPickEnabledHotkey),
@@ -362,18 +377,28 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
PostMessageSimulator? postMessageSimulator = null;
HotKeySettingModels.Add(new HotKeySettingModel(
"(测试)按键模拟测试",
"(测试)测试",
nameof(Config.HotKeyConfig.Test1Hotkey),
Config.HotKeyConfig.Test1Hotkey,
Config.HotKeyConfig.Test1HotkeyType,
(_, _) =>
{
if (postMessageSimulator == null)
{
postMessageSimulator = Simulation.PostMessage(TaskContext.Instance().GameHandle);
}
// postMessageSimulator.KeyPressBackground(User32.VK.VK_W);
postMessageSimulator.LeftButtonClickBackground(1340, 655);
// if (postMessageSimulator == null)
// {
// postMessageSimulator = Simulation.PostMessage(TaskContext.Instance().GameHandle);
// }
// User32.GetCursorPos(out var p);
// Debug.WriteLine($"鼠标位置:{p.X},{p.Y}");
// // postMessageSimulator.KeyPressBackground(User32.VK.VK_W);
// GameCaptureRegion.GameRegion1080PPosMove(1340, 655);
// postMessageSimulator.LeftButtonClickBackground(1340, 655);
// Thread.Sleep(5);
// DesktopRegion.DesktopRegionMove(p.X, p.Y);
// 大地图位置
TaskTriggerDispatcher.Instance().SetCacheCaptureMode(DispatcherCaptureModeEnum.OnlyCacheCapture);
Thread.Sleep(TaskContext.Instance().Config.TriggerInterval * 5); // 等待缓存图像
AutoTrackPathTask.GetPositionFromBigMap();
}
));
}
@@ -23,6 +23,9 @@ public partial class TriggerSettingsPageViewModel : ObservableObject, INavigatio
[ObservableProperty]
private string[] _pickOcrEngineNames = [PickOcrEngineEnum.Paddle.ToString(), PickOcrEngineEnum.Yap.ToString()];
[ObservableProperty]
private string[] _defaultPickButtonNames = ["F", "E"];
public AllConfig Config { get; set; }
private readonly INavigationService _navigationService;
+1 -1
View File
@@ -1,5 +1,5 @@
cd /d %~dp0
rd /s /q dist
if exist dist rd /s /q dist
mkdir dist\BetterGI
@echo [prepare compiler]
+54
View File
@@ -0,0 +1,54 @@
cd /d %~dp0
if exist dist rd /s /q dist
mkdir dist\BetterGI
@echo [prepare compiler]
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set "path=%path%;%%i\MSBuild\Current\Bin;%%i\Common7\IDE"
@echo [prepare version]
cd /d ..\BetterGenshinImpact\Core\Config
set "script=Get-Content 'Global.cs' ^| Select-String -Pattern 'Version.*\"(.*)\"' ^| ForEach-Object { $_.Matches.Groups[1].Value }"
for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command ^"%script%^"`) do set version=%%i
echo currnet version is %version%
if "%b%"=="" (
set "b=%version%"
)
set "tmpfolder=%~dp0dist\BetterGI"
set "archiveFile=BetterGI_v%b%.7z"
set "setupFile=BetterGI_Setup_v%b%.exe"
echo [build app using vs2022]
cd /d %~dp0
rd /s /q ..\BetterGenshinImpact\bin\x64\Release\net7.0-windows10.0.22621.0\publish\win-x64\
cd ..\
dotnet publish -c Release -p:PublishProfile=FolderProfile
echo [pack app using 7z]
cd /d %~dp0
cd /d ..\BetterGenshinImpact\bin\x64\Release\net7.0-windows10.0.22621.0\publish\win-x64\
xcopy * "%tmpfolder%" /E /C /I /Y
cd /d %~dp0
del /f /q %tmpfolder%\*.lib
del /f /q %tmpfolder%\*ffmpeg*.dll
MicaSetup.Tools\7-Zip\7z a publish.7z %tmpfolder%\ -t7z -mx=5 -mf=BCJ2 -r -y
copy /y publish.7z .\MicaSetup\Resources\Setups\publish.7z
if exist "%zipFile%" ( del /f /q "%zipfile%" )
rename publish.7z %archiveFile%
@echo [build uninst using vs2022]
msbuild MicaSetup\MicaSetup.Uninst.csproj /t:Rebuild /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /restore
@echo [build setup using vs2022]
copy /y .\MicaSetup\bin\Release\net472\MicaSetup.exe .\MicaSetup\Resources\Setups\Uninst.exe
msbuild MicaSetup\MicaSetup.csproj /t:Build /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /restore
@echo [finish]
del /f /q MicaSetup.exe
copy /y .\MicaSetup\bin\Release\net472\MicaSetup.exe .\
rename MicaSetup.exe %setupFile%
rd /s /q dist\BetterGI
+4 -2
View File
@@ -50,9 +50,11 @@ BetterGI · 更好的原神, 一个基于计算机视觉技术,意图让原
## 下载
> [!NOTE]
> 下载地址:[⚡Github 下载](https://github.com/babalae/better-genshin-impact/releases) | [☁️蓝奏云下载](https://wwmy.lanzouq.com/b00rs2msd) 密码:coco
> 下载地址:[⚡Github 下载](https://github.com/babalae/better-genshin-impact/releases)
>
> 第一次使用请看:[快速上手](https://bgi.huiyadan.com/quickstart.html) , 遇到问题请先看:[常见问题](https://bgi.huiyadan.com/faq.html)
> 不知道下载哪个?第一次使用?请看:[快速上手](https://bgi.huiyadan.com/quickstart.html) , 遇到问题请先看:[常见问题](https://bgi.huiyadan.com/faq.html)
最新编译版本可以从自动构建中获取: [![Build status](https://ci.appveyor.com/api/projects/status/cklcy1oj9u66ul4j)](https://ci.appveyor.com/project/huiyadanli/better-genshin-impact/build/artifacts)
## 使用方法
由于图像识别比较吃性能,低配置电脑可能无法正常使用部分功能。