Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98b46e8f1b | ||
|
|
8f8aad4130 | ||
|
|
ad73198125 | ||
|
|
f7e7320461 | ||
|
|
470eb364db | ||
|
|
282f664c27 | ||
|
|
bae42f84c6 | ||
|
|
79d379f579 | ||
|
|
2e5a933a61 | ||
|
|
84cea2d2e0 | ||
|
|
535e879446 | ||
|
|
4f0af583c2 | ||
|
|
40cd76fbdc | ||
|
|
8240748c95 | ||
|
|
1538b3f8fb | ||
|
|
11f0a8528d | ||
|
|
2cfaf9335e | ||
|
|
bd67d4df30 | ||
|
|
6d4f8b80e8 | ||
|
|
47ffbe9c89 | ||
|
|
de50acd758 | ||
|
|
b6a54c5272 | ||
|
|
2423e36456 | ||
|
|
325b54ef9c | ||
|
|
055f46f4c0 | ||
|
|
1e288ffda4 | ||
|
|
892f0f0fa6 | ||
|
|
d000981be5 | ||
|
|
55a7dec210 | ||
|
|
d3b2f62083 | ||
|
|
917e412d49 | ||
|
|
5a8f38e121 | ||
|
|
c79e919d17 | ||
|
|
00304d48c4 | ||
|
|
e5629f1bb4 | ||
|
|
e77c143f6b | ||
|
|
0d5d1292c8 | ||
|
|
dfbc05599f | ||
|
|
33e9ebbc91 | ||
|
|
9bfdfd041e | ||
|
|
ad3f4c3915 | ||
|
|
f81f628046 | ||
|
|
cbcd9a114e | ||
|
|
e4163e773c | ||
|
|
57d33c4312 | ||
|
|
f5dbe30e25 | ||
|
|
58aedbf9d6 | ||
|
|
2aefabe09c | ||
|
|
cbe90a7003 | ||
|
|
929f4a30b3 | ||
|
|
2cb2604de0 | ||
|
|
11421cbd63 | ||
|
|
f66c9a2aab | ||
|
|
0bbc851ba0 | ||
|
|
377326f492 | ||
|
|
8d3acfc668 | ||
|
|
a9150054c4 | ||
|
|
de0a77b655 | ||
|
|
315318e2fe | ||
|
|
981068b38c | ||
|
|
6eb1d33965 | ||
|
|
e1bd3393b8 | ||
|
|
12617e18e9 | ||
|
|
807288ab90 | ||
|
|
f7903f8e9b | ||
|
|
45fc9fe7f4 | ||
|
|
a662791b6b | ||
|
|
76445ab19d | ||
|
|
3df45ea6ed | ||
|
|
616293432d | ||
|
|
7250ef111d | ||
|
|
19fb0022c1 | ||
|
|
f284a5331a | ||
|
|
29a2c0069e | ||
|
|
22fe431880 | ||
|
|
a172ba6941 | ||
|
|
80b8c968d4 | ||
|
|
bad6db6e8a | ||
|
|
46ebdfc452 | ||
|
|
6becb9dd5a | ||
|
|
3312837129 | ||
|
|
5272c44a44 | ||
|
|
61d635d2e2 | ||
|
|
8298e5f827 | ||
|
|
51ee8dc54e | ||
|
|
b0c12d567b | ||
|
|
14a55c1204 | ||
|
|
9724b158a7 | ||
|
|
a01cc93ba7 | ||
|
|
40f8f191a0 | ||
|
|
4cf2085e90 | ||
|
|
5bfbe7f8a2 | ||
|
|
99a769f3fc | ||
|
|
7a9f0c68bc | ||
|
|
54e3db9228 | ||
|
|
203ae22e7b | ||
|
|
f3e0c68f3e | ||
|
|
807dd28c04 | ||
|
|
c5dd67e854 | ||
|
|
79257b3d3a | ||
|
|
699ed8fc0b | ||
|
|
34e6f4741a | ||
|
|
ad5aa1b118 | ||
|
|
94ae0e216f | ||
|
|
991da1cb69 | ||
|
|
fe8aeb610d | ||
|
|
60b4d65f21 | ||
|
|
abfddea2e5 | ||
|
|
366e5d140a | ||
|
|
4fc2417f26 | ||
|
|
7d0649b358 | ||
|
|
5bb0144c30 | ||
|
|
df9c4e106e | ||
|
|
4c820d09c5 | ||
|
|
b575474cb1 | ||
|
|
b76974aa73 | ||
|
|
e7ceaa7486 | ||
|
|
f356c61051 | ||
|
|
90590b68b8 | ||
|
|
2a173e734d | ||
|
|
2a548ecb1b | ||
|
|
462e89731d | ||
|
|
4305310d2d | ||
|
|
785f5b7903 | ||
|
|
e602995b07 | ||
|
|
c63439bb29 | ||
|
|
5b5eeee9e0 | ||
|
|
8246d1a2f2 | ||
|
|
fc2c809702 | ||
|
|
939c0a5106 | ||
|
|
f8c05d2c33 | ||
|
|
d3659f3b43 | ||
|
|
612474e367 | ||
|
|
6f6ddf129b | ||
|
|
4e44bb0e78 | ||
|
|
aead279c78 | ||
|
|
e634a54913 | ||
|
|
99df54607d | ||
|
|
052d8f095a | ||
|
|
ec9c17209f | ||
|
|
e96214f5c4 | ||
|
|
1adad8149b | ||
|
|
62c4d3e54e | ||
|
|
9c55a929ef | ||
|
|
31332f76b3 | ||
|
|
f9c4298fac | ||
|
|
62da52d5d8 | ||
|
|
b46836741d | ||
|
|
8e3f26f45c | ||
|
|
f70524b0a2 | ||
|
|
4932c52af9 | ||
|
|
4dceb19bbe | ||
|
|
509ff4dce6 | ||
|
|
5fbd10e1a9 | ||
|
|
91a0e771b9 | ||
|
|
75741cd115 | ||
|
|
7efcf02051 | ||
|
|
2b233b7e8e | ||
|
|
a9896f0ff1 | ||
|
|
e00f0b3fa0 | ||
|
|
55442418aa | ||
|
|
82eaa86121 | ||
|
|
56d0463510 | ||
|
|
b63ceaa88a | ||
|
|
8babe59066 | ||
|
|
7ec2e08d3a | ||
|
|
375d796db4 | ||
|
|
9f6299df88 | ||
|
|
ad2c61590e | ||
|
|
b82395cc3a | ||
|
|
675206e9da | ||
|
|
7abd066b15 | ||
|
|
95e17bdef0 | ||
|
|
1aa23df648 | ||
|
|
2135189bf6 | ||
|
|
1f2ed388d6 | ||
|
|
56853c541b | ||
|
|
af8562327f | ||
|
|
73c73b63dd | ||
|
|
9748ccd9ea | ||
|
|
ccf1c37283 | ||
|
|
aabd1e0c01 | ||
|
|
3fcc11a617 | ||
|
|
717bd931f7 | ||
|
|
cb8a743d34 | ||
|
|
dccc116ea8 | ||
|
|
79493b4407 | ||
|
|
2c554ab2f4 | ||
|
|
51216d6b84 | ||
|
|
040f40d94b | ||
|
|
3053e1aeb3 | ||
|
|
6bf0d886ca | ||
|
|
f1cc1cdb94 | ||
|
|
11ac1f3cfa | ||
|
|
ea8468b999 | ||
|
|
8f5529f79d | ||
|
|
0351cc7410 | ||
|
|
33dc5f7d42 | ||
|
|
bb49feb19e | ||
|
|
749cae4dc2 | ||
|
|
472c169603 | ||
|
|
f76c877882 | ||
|
|
328b5f21cc | ||
|
|
5118308e9d | ||
|
|
d3bd62b2c4 | ||
|
|
9463827582 | ||
|
|
445e9b8030 | ||
|
|
7fb04270b1 | ||
|
|
46d4045fd5 | ||
|
|
2c59fe70ad | ||
|
|
8afcf9ddff | ||
|
|
184d186c9c | ||
|
|
eeecb5b44f | ||
|
|
31fcf9cedf | ||
|
|
75449f8ced | ||
|
|
202ac61242 | ||
|
|
7ec0d649cb | ||
|
|
92516c26d2 | ||
|
|
151b383c40 | ||
|
|
644c3d0193 | ||
|
|
1efd8d9454 | ||
|
|
f8bcbcedf7 | ||
|
|
e44c55eb03 | ||
|
|
7040a441f2 | ||
|
|
297618b95f | ||
|
|
33d742bd4d | ||
|
|
1eee073adb | ||
|
|
0fe4e86bc0 | ||
|
|
c2709544fa | ||
|
|
f109ac5a14 | ||
|
|
e735cacb17 | ||
|
|
06b142b8b2 | ||
|
|
98ef56b233 | ||
|
|
c2e028c529 | ||
|
|
90b8a37389 | ||
|
|
09a520a92f | ||
|
|
a9f9946db6 | ||
|
|
982aa7834b | ||
|
|
dfa0c75a15 | ||
|
|
854baad420 | ||
|
|
547a56b932 | ||
|
|
7d7289ac16 | ||
|
|
70a8d544fd | ||
|
|
137ba4384a | ||
|
|
99932e972d | ||
|
|
b14de9ed20 | ||
|
|
bc286d3b47 | ||
|
|
2536b14af1 | ||
|
|
c3cffff4f3 | ||
|
|
8cffb01f0a | ||
|
|
9694919759 | ||
|
|
67df9f298a | ||
|
|
47d88e67c9 | ||
|
|
b130351d8d | ||
|
|
8b52aea9a3 | ||
|
|
efde38439d | ||
|
|
e42c886bbe | ||
|
|
3e114ad358 | ||
|
|
4196f05f21 | ||
|
|
2cdabcf689 | ||
|
|
f7cbc03f3d | ||
|
|
ce7c88f8e8 | ||
|
|
670bb3adad | ||
|
|
6c16296b1b | ||
|
|
770edfab8a | ||
|
|
6a14a8c342 | ||
|
|
f19ee557b2 | ||
|
|
2d0a7b5da8 | ||
|
|
ff92365bb4 | ||
|
|
81c84b94a5 | ||
|
|
3fea7963ce | ||
|
|
3ce54801c6 | ||
|
|
7b259e0329 | ||
|
|
8fdc664400 | ||
|
|
247580c04f | ||
|
|
9de4fd4dfa | ||
|
|
bdaace9c8b | ||
|
|
e30e919539 | ||
|
|
3019d1aefa | ||
|
|
8d4038d2e8 | ||
|
|
489d13dbcf | ||
|
|
7091da2c9f | ||
|
|
945085c34c | ||
|
|
5513931fb6 | ||
|
|
9a421860d0 | ||
|
|
edaf5ac443 | ||
|
|
8e9776f17c | ||
|
|
54e062d490 | ||
|
|
0468854ac5 | ||
|
|
10cb31af57 | ||
|
|
3cca2f329d | ||
|
|
af0a869c70 | ||
|
|
f0baf74dc8 | ||
|
|
8862f57958 | ||
|
|
bd72e6420d | ||
|
|
8c45a02deb | ||
|
|
0dd1dffccb | ||
|
|
9ba3447ab1 | ||
|
|
218029b2e6 | ||
|
|
718db28e51 | ||
|
|
b639b1902e | ||
|
|
e97e04f9db | ||
|
|
7a07719bf8 | ||
|
|
d0f985408e | ||
|
|
4b65370e9f | ||
|
|
5259b1f351 | ||
|
|
1afeb0818a | ||
|
|
99ab38d950 | ||
|
|
1d5f5c772e | ||
|
|
869050283b | ||
|
|
bb692a476e | ||
|
|
518ed95dbe | ||
|
|
987e723b8c | ||
|
|
3c84f3817d | ||
|
|
319e88bb0c | ||
|
|
6beb9fddba | ||
|
|
020c841bc2 | ||
|
|
b445c71e52 | ||
|
|
56e110d11f | ||
|
|
a5e1478ecf | ||
|
|
72cc9d8d01 | ||
|
|
39b7176b4d | ||
|
|
6fcf213631 | ||
|
|
7c620429c3 | ||
|
|
158688d435 | ||
|
|
8caa52e988 | ||
|
|
82275bd1e5 | ||
|
|
4129510029 | ||
|
|
917ba1460d | ||
|
|
d70ed4314a | ||
|
|
3cc3eb44a4 | ||
|
|
07efcbde4f | ||
|
|
d33e54c50f | ||
|
|
f7779af01b | ||
|
|
29f219aee9 | ||
|
|
cb84ae36d0 | ||
|
|
1af75ecc64 | ||
|
|
2181e74a30 | ||
|
|
ec7ecbf9e0 | ||
|
|
50513613de | ||
|
|
39d7422ab9 | ||
|
|
12cc958705 | ||
|
|
197e991a89 | ||
|
|
6ee4318d24 | ||
|
|
6fcc0685e6 | ||
|
|
7f7d28825e | ||
|
|
ccb8025676 | ||
|
|
2ff5a8930d | ||
|
|
ef92586af6 | ||
|
|
bd1702af23 | ||
|
|
23c922d67a | ||
|
|
89acd1fc65 | ||
|
|
0b17dc30fe | ||
|
|
c61691ec1e | ||
|
|
ca96204e01 | ||
|
|
919818a424 | ||
|
|
28cc3fb3e3 | ||
|
|
fb61b83df5 | ||
|
|
79aa1505d3 | ||
|
|
ae954fceb8 | ||
|
|
dcafd64139 | ||
|
|
5ab63a9e76 | ||
|
|
9ddd3c5564 | ||
|
|
a36f938e8a | ||
|
|
5a7721c534 | ||
|
|
12beabc6a2 | ||
|
|
3da43f3543 | ||
|
|
ba3f97c63f | ||
|
|
f14c61145f | ||
|
|
daf6525172 | ||
|
|
38ea7833c1 | ||
|
|
39da7b489f | ||
|
|
e08b0875ee | ||
|
|
e2d0ca5974 | ||
|
|
89e00207cb | ||
|
|
02f6309a11 | ||
|
|
1a0d61ac94 | ||
|
|
1538445990 | ||
|
|
8a63ac8914 | ||
|
|
c87ba278e9 | ||
|
|
55b2b48e43 | ||
|
|
30a1b4d40f | ||
|
|
4f6724613a | ||
|
|
04399c1780 | ||
|
|
48ddd1751c | ||
|
|
ccc5c68c1c | ||
|
|
340c4caf49 | ||
|
|
9ef5cff886 | ||
|
|
ad4993c3cf | ||
|
|
01fe05e0c8 | ||
|
|
a22002966e | ||
|
|
8666c931d9 | ||
|
|
1b7ea8b16b | ||
|
|
5552813d61 | ||
|
|
5e03a29a8e | ||
|
|
dd9e700485 | ||
|
|
d5838017d7 | ||
|
|
64feced367 | ||
|
|
9d504443f7 | ||
|
|
1f70cfb364 | ||
|
|
5f18901e22 | ||
|
|
c4e2f49f4b | ||
|
|
1fe5281018 | ||
|
|
dfc8c61c8d | ||
|
|
21bef81374 | ||
|
|
a90f22a8d5 | ||
|
|
31994ce2f4 | ||
|
|
b0f0b26092 | ||
|
|
58db3ad04c | ||
|
|
b686d88134 | ||
|
|
017f8ed5b0 | ||
|
|
2c727d5e6d | ||
|
|
ebd8031f2c | ||
|
|
7d872704c2 | ||
|
|
6e7c7fb78e | ||
|
|
1469da4699 | ||
|
|
fcac4aa811 | ||
|
|
072943baf9 | ||
|
|
6591c8a387 | ||
|
|
9f11fc984d | ||
|
|
902b319211 | ||
|
|
2e27154871 | ||
|
|
e2afabc7f6 | ||
|
|
7853901137 | ||
|
|
cd3713175a | ||
|
|
3f2a3b118a | ||
|
|
7edd0c2565 | ||
|
|
66fc5fc080 | ||
|
|
a52dddb70a | ||
|
|
2df7598304 | ||
|
|
a9d8659be7 | ||
|
|
74f0aa71c3 | ||
|
|
3239003b22 | ||
|
|
4415e85856 | ||
|
|
291652d75f | ||
|
|
a6fc3aac76 | ||
|
|
828d673509 | ||
|
|
b92c52cb5c | ||
|
|
e11af29b45 | ||
|
|
b9dd66f87a | ||
|
|
65e2da4123 | ||
|
|
a85129b087 | ||
|
|
be31d0962f | ||
|
|
64efabde8f | ||
|
|
a0993b172b | ||
|
|
2a6f8fcab2 | ||
|
|
887e812b28 | ||
|
|
48b51a60e1 | ||
|
|
3fb35051d1 | ||
|
|
e2530a1001 | ||
|
|
07b8899a51 | ||
|
|
55fb63782e | ||
|
|
1b46502374 | ||
|
|
580c4754a4 | ||
|
|
30827b2ff4 | ||
|
|
9f46fb00be | ||
|
|
b0236a7a04 | ||
|
|
608f135640 | ||
|
|
b776ec73a4 | ||
|
|
2bf74c466b | ||
|
|
76829bd3e1 | ||
|
|
00ece6ce7a | ||
|
|
71876a5e65 | ||
|
|
89109958a2 | ||
|
|
d179eb9949 | ||
|
|
be98f10851 | ||
|
|
6067058530 | ||
|
|
19f1315d0a | ||
|
|
56e4dc2dd6 | ||
|
|
e37be52f0e | ||
|
|
543e36f77e | ||
|
|
3b54844e6b | ||
|
|
8822346f3b | ||
|
|
d54d31454d | ||
|
|
5f525f82d7 | ||
|
|
f78d7bfcec | ||
|
|
2e331dbbc6 | ||
|
|
f77251551e | ||
|
|
68d6cb18ef | ||
|
|
6d430429f7 | ||
|
|
bd811b1bdf | ||
|
|
15f363196c | ||
|
|
c904ae5150 | ||
|
|
c7e2d83fb8 | ||
|
|
a11639f243 | ||
|
|
19558c9c53 | ||
|
|
b183762df7 | ||
|
|
b32b0f8af1 | ||
|
|
daf2b3d1ba | ||
|
|
c4b705c350 | ||
|
|
e7d76cdae1 | ||
|
|
8d577050d1 | ||
|
|
242832edc9 | ||
|
|
e39eb9ef93 | ||
|
|
2db2c1957a | ||
|
|
60ccbfbace | ||
|
|
5786ba7634 | ||
|
|
bc6970b6c5 | ||
|
|
06ee8ab1cc | ||
|
|
ac866f9293 | ||
|
|
ca3b31f84e | ||
|
|
a80f6fc423 | ||
|
|
4cfff57b2c | ||
|
|
114a84a9e8 | ||
|
|
9fa2bcb5a7 | ||
|
|
5d80d6d53b | ||
|
|
5a19b7d2ef | ||
|
|
accd0280bb | ||
|
|
317a526f16 | ||
|
|
8dd6131c94 | ||
|
|
0a04734a40 | ||
|
|
38e5de35a2 | ||
|
|
5353231810 | ||
|
|
476f36a19a | ||
|
|
8a6bb597c4 | ||
|
|
b90a6c4227 | ||
|
|
0650bebefa | ||
|
|
6536cad9fd | ||
|
|
63d7d230dc | ||
|
|
abea63bcda | ||
|
|
653df2f7cc | ||
|
|
ebc8870478 | ||
|
|
958c5ab7cd | ||
|
|
99831beb40 | ||
|
|
a7fae09464 | ||
|
|
57a83cc171 | ||
|
|
f0af8134ce | ||
|
|
463555c054 | ||
|
|
01eaa190d8 | ||
|
|
0c487dafd4 | ||
|
|
1f6e3b78a5 | ||
|
|
a7da741342 | ||
|
|
a57aed9ce7 | ||
|
|
aa164adb52 | ||
|
|
e8b939fbee | ||
|
|
d872b511d0 | ||
|
|
c2dbbe85cd | ||
|
|
a75cc84773 | ||
|
|
1ceb991c1b | ||
|
|
1226f85196 | ||
|
|
e3a5c491be | ||
|
|
7137e52605 | ||
|
|
3174dc75c8 | ||
|
|
4c0d9955b3 | ||
|
|
8345eb4bdc | ||
|
|
57953933d3 | ||
|
|
a0af8405b7 | ||
|
|
e6e549814d | ||
|
|
c80799cbee | ||
|
|
c2fce8618d | ||
|
|
663277a990 | ||
|
|
3d775241cc | ||
|
|
c0fecd079e | ||
|
|
97f1000370 | ||
|
|
02f2c1321a | ||
|
|
f9d0bd4521 | ||
|
|
5e929d3d07 | ||
|
|
b52af1e9a7 | ||
|
|
942bb3a6dd | ||
|
|
3eecea21aa | ||
|
|
3c393087eb | ||
|
|
85c7707c7a | ||
|
|
a41a0bdba1 | ||
|
|
5de2067489 | ||
|
|
c95343e953 | ||
|
|
f34e6c3530 | ||
|
|
2d3395b491 | ||
|
|
ed3cbd47f5 | ||
|
|
d86959297c | ||
|
|
726863462a | ||
|
|
9971817e44 | ||
|
|
bfeaa1b14a | ||
|
|
71fa4eaf3a | ||
|
|
9049c85be7 | ||
|
|
ac85cda170 | ||
|
|
178d253c38 | ||
|
|
8ba5b16710 | ||
|
|
25373cac2a | ||
|
|
2411e1dbef | ||
|
|
4118e7b6f2 | ||
|
|
d6c4f5ab57 | ||
|
|
ac2c7e7ac7 | ||
|
|
07e5ea643a | ||
|
|
f4f9f22977 | ||
|
|
e6c8804b09 | ||
|
|
d71ff06868 | ||
|
|
741da4e0c7 | ||
|
|
a66b802bbd | ||
|
|
60f1a271c4 | ||
|
|
2396daf206 | ||
|
|
d8f06598aa | ||
|
|
6127fab70b | ||
|
|
6432ff1aed | ||
|
|
0670fd9c0d | ||
|
|
c14025181c | ||
|
|
2b658afad6 | ||
|
|
54eecbe046 | ||
|
|
9d807e1e42 | ||
|
|
c3ef67f57a | ||
|
|
13f3272b9c | ||
|
|
7e04d77f88 | ||
|
|
8f1cf62449 | ||
|
|
cad2cf039d | ||
|
|
215f2ce450 | ||
|
|
0a5c78ebbe | ||
|
|
f9671467fc | ||
|
|
621a91638a | ||
|
|
34d0917818 | ||
|
|
2b371cce33 | ||
|
|
510ca82304 | ||
|
|
b83017f52e | ||
|
|
dd6b26ae8d | ||
|
|
cb19255fb4 | ||
|
|
71f2c2f52e | ||
|
|
5d780ec4f8 | ||
|
|
a091bb6734 | ||
|
|
81a7518f72 | ||
|
|
340a3142e5 | ||
|
|
dfad3022c2 | ||
|
|
bb8ccd2297 | ||
|
|
17282a3cef | ||
|
|
bb7d84ffe3 | ||
|
|
28ceb3dd85 | ||
|
|
ce75d038b2 | ||
|
|
17dd19aa47 | ||
|
|
a861a335ac | ||
|
|
c439403231 | ||
|
|
a63ed2f2d2 | ||
|
|
c9634abebb | ||
|
|
1214ca2d65 | ||
|
|
dc853f2307 | ||
|
|
875058ae5b | ||
|
|
e9d715876b | ||
|
|
57bcb3cd6b | ||
|
|
ff993f642f | ||
|
|
4aa8c69d0e | ||
|
|
7511ccc637 | ||
|
|
e9d206eca0 | ||
|
|
88110a21cc | ||
|
|
84c7fcec21 | ||
|
|
b19adcfba4 | ||
|
|
404457922d | ||
|
|
733e5fb98a | ||
|
|
a04d2e437a | ||
|
|
08b921b982 | ||
|
|
e6e78aded0 | ||
|
|
df600c6016 | ||
|
|
d374a95bb8 | ||
|
|
f5e8edccb8 | ||
|
|
f690bc849b | ||
|
|
c3c272c241 | ||
|
|
537f647ba7 | ||
|
|
ca353fea70 | ||
|
|
9bf82a1bbb | ||
|
|
e497f6ec79 | ||
|
|
36e49bcbc7 | ||
|
|
7c1568a809 | ||
|
|
b99144cd3d | ||
|
|
d5d65b7820 | ||
|
|
7d04997300 | ||
|
|
36cbd168ed | ||
|
|
5162bcc88f | ||
|
|
1a2cdbbfd7 | ||
|
|
ec8fa6e824 | ||
|
|
3266b63187 | ||
|
|
294d096229 | ||
|
|
48b5ab8af6 | ||
|
|
e00b38eb66 | ||
|
|
0c435a9393 | ||
|
|
3ca7ab6d4c | ||
|
|
c480cf484e | ||
|
|
2ce4e6d665 | ||
|
|
7b158c442e | ||
|
|
9180b58d94 | ||
|
|
5b8caef75a | ||
|
|
c22edcd39a | ||
|
|
7e88c9a57d | ||
|
|
49fc8ed260 | ||
|
|
f37d1d34a6 | ||
|
|
76dd2f3903 | ||
|
|
5e94037722 | ||
|
|
57610a3945 | ||
|
|
11dda84592 | ||
|
|
b600d577c4 | ||
|
|
dd19afaca5 | ||
|
|
c2cd6dbe9c | ||
|
|
c059611edb | ||
|
|
7ebbfda15d | ||
|
|
54887b90f6 | ||
|
|
77cfcbe73f | ||
|
|
f3e16fbb77 | ||
|
|
99c8cd450e | ||
|
|
dffccd0740 | ||
|
|
6cfa4b27a6 | ||
|
|
e2a25e4492 | ||
|
|
b6220db756 | ||
|
|
958703dcd7 | ||
|
|
c182ec13f9 | ||
|
|
ff0533288a | ||
|
|
2383761b5d | ||
|
|
ebc6ed8e07 | ||
|
|
9ab518d593 | ||
|
|
df84cc9ef1 | ||
|
|
60bd96f1f4 | ||
|
|
d9faefd446 | ||
|
|
19530e6c50 | ||
|
|
842f8506a5 | ||
|
|
2083caa9d7 | ||
|
|
67a418b984 | ||
|
|
216c78d4d5 | ||
|
|
fa1809a1f0 | ||
|
|
fa9eacf4ac | ||
|
|
968048baa9 | ||
|
|
436dfef2ee | ||
|
|
c2f81877dd | ||
|
|
0d6ab88c4a | ||
|
|
d7302b65c3 | ||
|
|
74acb4eb1c | ||
|
|
026dcd4488 | ||
|
|
1cad8c3a00 | ||
|
|
84629942bc | ||
|
|
a6f6ce55dd | ||
|
|
62a19c0052 | ||
|
|
3d63f18831 | ||
|
|
99c593cb7d | ||
|
|
93640f0b55 | ||
|
|
2a2acb5b0d | ||
|
|
382f31bbe7 | ||
|
|
e3689cd21a | ||
|
|
258848edba | ||
|
|
0a5dc888a0 | ||
|
|
e27e22acaa | ||
|
|
a89af32560 | ||
|
|
d34d24cd5e | ||
|
|
175db6a792 | ||
|
|
a8b105f7ee | ||
|
|
142bf0a47f | ||
|
|
36c0fb0f13 | ||
|
|
008f09cbe9 | ||
|
|
7feb204789 | ||
|
|
d82859177f | ||
|
|
bbe1dc1968 | ||
|
|
9580dd916a | ||
|
|
bb13aac0a9 | ||
|
|
2c3352f1bc | ||
|
|
7a5efe208f | ||
|
|
8941f6ce8c | ||
|
|
b2db1e0b84 | ||
|
|
3c2739c5c5 | ||
|
|
648dfd3f41 | ||
|
|
ef20a5448b | ||
|
|
23973bb679 | ||
|
|
ebc2b7b42e | ||
|
|
8d2ee35b7c | ||
|
|
68d3061523 | ||
|
|
435d04b52d | ||
|
|
244ce1c27f | ||
|
|
adcd08421a | ||
|
|
19c7b10b01 | ||
|
|
fe1d67bf16 | ||
|
|
9c7651702a | ||
|
|
b0b3768ee7 | ||
|
|
462741d3fb | ||
|
|
32bec1656b | ||
|
|
003939bb94 | ||
|
|
9c9bd7d138 | ||
|
|
5b054bf31b | ||
|
|
a960f76920 | ||
|
|
00447d3e78 | ||
|
|
c5de098865 | ||
|
|
4ce7d02e75 | ||
|
|
c7827d0fa3 | ||
|
|
7513e75f74 | ||
|
|
0923b0802c | ||
|
|
2c9c78f933 | ||
|
|
c1ef7c141f | ||
|
|
a98934fc9a | ||
|
|
2b8f38b758 | ||
|
|
2545581807 | ||
|
|
e595b67d33 | ||
|
|
dcd7831368 | ||
|
|
4725af5491 | ||
|
|
a1cdf15c7e | ||
|
|
c461938ddd | ||
|
|
3d6546b528 | ||
|
|
b0d4068eb2 | ||
|
|
b0d8e1a274 | ||
|
|
a39aefb44c | ||
|
|
adf824519b | ||
|
|
4cb5442161 | ||
|
|
b74e09ac8b | ||
|
|
dd9433f565 | ||
|
|
a802ffa0e5 | ||
|
|
fe12b59b5c | ||
|
|
5f40e28332 | ||
|
|
44190a522b | ||
|
|
98d2664c28 | ||
|
|
94418cbe56 | ||
|
|
72c2e38f94 | ||
|
|
be5c8ad6e3 | ||
|
|
255f328b67 | ||
|
|
1dbb9e3bf1 | ||
|
|
df7b55e47c | ||
|
|
ed77d955ef | ||
|
|
e4e7b37fd2 | ||
|
|
9f728fdf30 | ||
|
|
7c96adb591 | ||
|
|
14a1d3be74 | ||
|
|
94aae80046 | ||
|
|
404e7215fa | ||
|
|
b3f6002846 | ||
|
|
960cfea102 | ||
|
|
7cc4093079 | ||
|
|
d23ba65d51 | ||
|
|
6b41b52008 | ||
|
|
3cbbbff093 | ||
|
|
81b754125a | ||
|
|
29544507eb | ||
|
|
8471d5ef88 | ||
|
|
a4bc632ae7 | ||
|
|
1f2d3a40d9 | ||
|
|
3a88da3c6e | ||
|
|
790d42cee0 | ||
|
|
c9f541362d | ||
|
|
efd2808a2e | ||
|
|
11ec9bc45d | ||
|
|
74645e8e93 | ||
|
|
af7209af48 | ||
|
|
7df31c66d2 | ||
|
|
0bb45c8390 | ||
|
|
07e682d488 | ||
|
|
a1508a7b05 | ||
|
|
57989fd8b9 | ||
|
|
c4031069c6 | ||
|
|
ecaab5dc76 | ||
|
|
a220dd2377 | ||
|
|
e1149bc254 | ||
|
|
6a53efce1e | ||
|
|
a67adc0070 | ||
|
|
03f6b6331f | ||
|
|
ee720f8dfd | ||
|
|
b152486327 | ||
|
|
70f1f69067 | ||
|
|
f56465ebf3 | ||
|
|
3b8b1ef9db | ||
|
|
a4bb2eeca2 | ||
|
|
f222431784 | ||
|
|
7c5958f8ad | ||
|
|
561f1b8b72 | ||
|
|
9ad1062020 | ||
|
|
2ed7a883b3 | ||
|
|
4859c4dc4a | ||
|
|
03f25ebcfb | ||
|
|
0580ec68e9 | ||
|
|
b4e6565443 | ||
|
|
e74d6b6bd4 | ||
|
|
b8c9dc971f | ||
|
|
b51200c1f3 | ||
|
|
943bd4fc4d | ||
|
|
3d2b1b376e | ||
|
|
73cd48f8b1 | ||
|
|
d17a29890f | ||
|
|
af86c1147c | ||
|
|
1c5fe7ec64 |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Bug report / 错误报告
|
||||
about: Create a report to help us improve / 创建报告以帮助我们改进
|
||||
title: "[bug] "
|
||||
title: "[bug]请补充标题内容"
|
||||
labels: bug
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[submodule "BetterGenshinImpact/Script"]
|
||||
path = BetterGenshinImpact/Script
|
||||
url = https://github.com/babalae/bettergi-scripts.git
|
||||
[submodule "Test/BetterGenshinImpact.UnitTest/Assets"]
|
||||
path = Test/BetterGenshinImpact.UnitTest/Assets
|
||||
url = https://github.com/huiyadanli/BetterGI.UnitTest.Assets.git
|
||||
@@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="NativeMethods.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/CsWin32/main/src/Microsoft.Windows.CsWin32/settings.schema.json",
|
||||
"allowMarshaling": true,
|
||||
"useSafeHandles": false,
|
||||
"emitSingleFile": true,
|
||||
"public": true,
|
||||
"comInterop": {
|
||||
"useIntPtrForComOutPointers": true
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
// D3D11
|
||||
CreateDirect3D11DeviceFromDXGIDevice
|
||||
CreateDirect3D11SurfaceFromDXGISurface
|
||||
|
||||
// GDI32
|
||||
BitBlt
|
||||
CreateCompatibleBitmap
|
||||
CreateCompatibleDC
|
||||
DeleteDC
|
||||
GetDeviceCaps
|
||||
SelectObject
|
||||
|
||||
// User32
|
||||
GetClientRect
|
||||
GetDC
|
||||
GetForegroundWindow
|
||||
GetSystemMetrics
|
||||
GetWindowDC
|
||||
GetWindowRect
|
||||
GetWindowThreadProcessId
|
||||
mouse_event
|
||||
PostMessage
|
||||
ReleaseDC
|
||||
EnumWindows
|
||||
GetWindowText
|
||||
IsWindowVisible
|
||||
GetWindowTextLength
|
||||
|
||||
// COM & WinRT
|
||||
D3D11CreateDevice
|
||||
ID3D11Device3
|
||||
IDirect3DDxgiInterfaceAccess
|
||||
|
||||
// Constants
|
||||
D3D11_SDK_VERSION
|
||||
DXGI_ERROR_UNSUPPORTED
|
||||
WM_LBUTTONDOWN
|
||||
WM_LBUTTONUP
|
||||
@@ -5,28 +5,18 @@ VisualStudioVersion = 17.6.33815.320
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact", "BetterGenshinImpact\BetterGenshinImpact.csproj", "{75EC89E2-413D-4725-BCEA-AFAC57708F07}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture", "Vision.WindowCapture\Vision.WindowCapture.csproj", "{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Win32", "BetterGenshinImpact.Win32\BetterGenshinImpact.Win32.csproj", "{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.GameCapture", "Fischless.GameCapture\Fischless.GameCapture.csproj", "{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vision.WindowCapture.Test", "Vision.WindowCapture.Test\Vision.WindowCapture.Test.csproj", "{D35CB953-C666-4E57-9A9A-3AAE5BF78402}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.HotkeyCapture", "Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj", "{08152E44-2564-46C5-B5B2-54DD43C01A79}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.KeyboardCapture", "Fischless.KeyboardCapture\Fischless.KeyboardCapture.csproj", "{10A48327-7E58-4B51-B1FC-55506C703C8F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deploy", "Deploy", "{458E1106-43A4-47E6-B11B-D243035D4C76}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup", "Build\MicaSetup\MicaSetup.csproj", "{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MicaSetup.Uninst", "Build\MicaSetup\MicaSetup.Uninst.csproj", "{673344BC-B860-44AE-AD88-D33465BDE25B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterGenshinImpact.Test", "Test\BetterGenshinImpact.Test\BetterGenshinImpact.Test.csproj", "{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fischless.WindowsInput", "Fischless.WindowsInput\Fischless.WindowsInput.csproj", "{9D00BC7A-9280-4AC9-8951-4502EDB71B76}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterGenshinImpact.UnitTest", "Test\BetterGenshinImpact.UnitTest\BetterGenshinImpact.UnitTest.csproj", "{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -43,22 +33,6 @@ Global
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|Any CPU.Build.0 = Release|x64
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.ActiveCfg = Release|x64
|
||||
{75EC89E2-413D-4725-BCEA-AFAC57708F07}.Release|x64.Build.0 = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|Any CPU.Build.0 = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9080C1D-1B26-46CB-A494-A5E7FE3FCEBA}.Release|x64.Build.0 = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Debug|x64.Build.0 = Debug|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|Any CPU.Build.0 = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.ActiveCfg = Release|x64
|
||||
{75F4541B-9624-4AFB-BAEA-3EAFD3300EE1}.Release|x64.Build.0 = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -67,14 +41,6 @@ Global
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|Any CPU.Build.0 = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.ActiveCfg = Release|x64
|
||||
{6B0A3D96-D88D-48DD-8112-4CD5BA5D27CE}.Release|x64.Build.0 = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Debug|x64.Build.0 = Debug|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|Any CPU.Build.0 = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.ActiveCfg = Release|x64
|
||||
{D35CB953-C666-4E57-9A9A-3AAE5BF78402}.Release|x64.Build.0 = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -83,38 +49,14 @@ Global
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|Any CPU.Build.0 = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.ActiveCfg = Release|x64
|
||||
{08152E44-2564-46C5-B5B2-54DD43C01A79}.Release|x64.Build.0 = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Debug|x64.Build.0 = Debug|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|Any CPU.Build.0 = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.ActiveCfg = Release|x64
|
||||
{10A48327-7E58-4B51-B1FC-55506C703C8F}.Release|x64.Build.0 = Release|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Debug|x64.Build.0 = Debug|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.ActiveCfg = Release|x64
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15}.Release|x64.Build.0 = Release|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Debug|x64.Build.0 = Debug|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.ActiveCfg = Release|x64
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B}.Release|x64.Build.0 = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Debug|x64.Build.0 = Debug|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|Any CPU.Build.0 = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.ActiveCfg = Release|x64
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE}.Release|x64.Build.0 = Release|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -123,13 +65,21 @@ Global
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|Any CPU.Build.0 = Release|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.ActiveCfg = Release|x64
|
||||
{9D00BC7A-9280-4AC9-8951-4502EDB71B76}.Release|x64.Build.0 = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Debug|x64.Build.0 = Debug|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|Any CPU.Build.0 = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.ActiveCfg = Release|x64
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{AB85DA23-EB8F-4FBF-A7FA-35CE05B23C15} = {458E1106-43A4-47E6-B11B-D243035D4C76}
|
||||
{673344BC-B860-44AE-AD88-D33465BDE25B} = {458E1106-43A4-47E6-B11B-D243035D4C76}
|
||||
{27AF227E-BE44-450F-8E95-C1AD4FDE14BE} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
|
||||
{7DA575C0-8D1E-4BD2-AEDB-5471D8906B98} = {02CEA57F-C24B-40F9-AF31-F1D4F3BDB4BF}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {352D8B78-9DE3-4E58-985F-FADD22594DB4}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
<bgivc:BooleanToEnableTextConverter x:Key="BooleanToEnableTextConverter" />
|
||||
<bgivc:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<bgivc:NotNullConverter x:Key="NotNullConverter" />
|
||||
<bgivc:EnumToKVPConverter x:Key="EnumToKVPConverter" />
|
||||
<bgivc:CultureInfoNameToKVPConverter x:Key="CultureInfoNameToKVPConverter" />
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,6 +1,13 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
using BetterGenshinImpact.Hutao;
|
||||
using BetterGenshinImpact.Service;
|
||||
using BetterGenshinImpact.Service.Interface;
|
||||
using BetterGenshinImpact.Service.Notification;
|
||||
@@ -9,18 +16,15 @@ using BetterGenshinImpact.View;
|
||||
using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.ViewModel;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using BetterGenshinImpact.ViewModel.Pages.View;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Sinks.RichTextBox.Abstraction;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.DependencyInjection;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace BetterGenshinImpact;
|
||||
@@ -36,6 +40,7 @@ public partial class App : Application
|
||||
.CheckIntegration()
|
||||
.UseElevated()
|
||||
.UseSingleInstance("BetterGI")
|
||||
.ConfigureLogging(builder => { builder.ClearProviders(); })
|
||||
.ConfigureServices(
|
||||
(context, services) =>
|
||||
{
|
||||
@@ -52,23 +57,30 @@ public partial class App : Application
|
||||
services.AddSingleton<IRichTextBox>(richTextBox);
|
||||
|
||||
var loggerConfiguration = new LoggerConfiguration()
|
||||
.WriteTo.File(path: logFile, outputTemplate: "[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}", rollingInterval: RollingInterval.Day)
|
||||
.WriteTo.File(logFile,
|
||||
outputTemplate:
|
||||
"[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] {SourceContext}{NewLine}{Message}{NewLine}{Exception}{NewLine}",
|
||||
rollingInterval: RollingInterval.Day)
|
||||
.MinimumLevel.Debug()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Warning);
|
||||
if (all.MaskWindowConfig.MaskEnabled)
|
||||
{
|
||||
loggerConfiguration.WriteTo.RichTextBox(richTextBox, LogEventLevel.Information, outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
|
||||
loggerConfiguration.WriteTo.RichTextBox(richTextBox, LogEventLevel.Information,
|
||||
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}");
|
||||
}
|
||||
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
services.AddLogging(c => c.AddSerilog());
|
||||
|
||||
services.AddLocalization();
|
||||
|
||||
services.AddNavigationViewPageProvider();
|
||||
// App Host
|
||||
services.AddHostedService<ApplicationHostService>();
|
||||
|
||||
// Page resolver service
|
||||
services.AddSingleton<IPageService, PageService>();
|
||||
services.AddSingleton<INavigationService, NavigationService>();
|
||||
services.AddSingleton<IUpdateService, UpdateService>();
|
||||
|
||||
// Service containing navigation, same as INavigationWindow... but without window
|
||||
services.AddSingleton<INavigationService, NavigationService>();
|
||||
@@ -90,6 +102,21 @@ public partial class App : Application
|
||||
services.AddView<KeyMouseRecordPage, KeyMouseRecordPageViewModel>();
|
||||
services.AddView<JsListPage, JsListViewModel>();
|
||||
services.AddView<MapPathingPage, MapPathingViewModel>();
|
||||
services.AddView<OneDragonFlowPage, OneDragonFlowViewModel>();
|
||||
services.AddSingleton<PathingConfigViewModel>();
|
||||
// services.AddView<PathingConfigView, PathingConfigViewModel>();
|
||||
services.AddView<KeyBindingsSettingsPage, KeyBindingsSettingsPageViewModel>();
|
||||
|
||||
// 一条龙 ViewModels
|
||||
// services.AddSingleton<CraftViewModel>();
|
||||
// services.AddSingleton<DailyCommissionViewModel>();
|
||||
// services.AddSingleton<DailyRewardViewModel>();
|
||||
// services.AddSingleton<DomainViewModel>();
|
||||
// services.AddSingleton<ForgingViewModel>();
|
||||
// services.AddSingleton<LeyLineBlossomViewModel>();
|
||||
// services.AddSingleton<MailViewModel>();
|
||||
// services.AddSingleton<SereniteaPotViewModel>();
|
||||
// services.AddSingleton<TcgViewModel>();
|
||||
|
||||
// My Services
|
||||
services.AddSingleton<TaskTriggerDispatcher>();
|
||||
@@ -97,6 +124,7 @@ public partial class App : Application
|
||||
services.AddHostedService(sp => sp.GetRequiredService<NotificationService>());
|
||||
services.AddSingleton<NotifierManager>();
|
||||
services.AddSingleton<IScriptService, ScriptService>();
|
||||
services.AddSingleton<HutaoNamedPipe>();
|
||||
|
||||
// Configuration
|
||||
//services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
|
||||
@@ -161,6 +189,8 @@ public partial class App : Application
|
||||
{
|
||||
base.OnExit(e);
|
||||
|
||||
TempManager.CleanUp();
|
||||
|
||||
await _host.StopAsync();
|
||||
_host.Dispose();
|
||||
}
|
||||
@@ -217,7 +247,7 @@ public partial class App : Application
|
||||
}
|
||||
|
||||
//UI线程未捕获异常处理事件(UI主线程)
|
||||
private static void AppDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
private static void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -250,16 +280,16 @@ public partial class App : Application
|
||||
// Fallback.
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
$"""
|
||||
程序异常:{e.Source}
|
||||
--
|
||||
{e.StackTrace}
|
||||
--
|
||||
{e.Message}
|
||||
"""
|
||||
程序异常:{e.Source}
|
||||
--
|
||||
{e.StackTrace}
|
||||
--
|
||||
{e.Message}
|
||||
"""
|
||||
);
|
||||
}
|
||||
|
||||
// log
|
||||
GetLogger<App>().LogDebug(e, "UnHandle Exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 229 KiB |
|
Before Width: | Height: | Size: 2.7 MiB |
@@ -0,0 +1,185 @@
|
||||
|
||||
!
|
||||
"
|
||||
#
|
||||
$
|
||||
%
|
||||
&
|
||||
'
|
||||
(
|
||||
)
|
||||
*
|
||||
+
|
||||
,
|
||||
-
|
||||
.
|
||||
/
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
:
|
||||
;
|
||||
<
|
||||
=
|
||||
>
|
||||
?
|
||||
@
|
||||
A
|
||||
B
|
||||
C
|
||||
D
|
||||
E
|
||||
F
|
||||
G
|
||||
H
|
||||
I
|
||||
J
|
||||
K
|
||||
L
|
||||
M
|
||||
N
|
||||
O
|
||||
P
|
||||
Q
|
||||
R
|
||||
S
|
||||
T
|
||||
U
|
||||
V
|
||||
W
|
||||
X
|
||||
Y
|
||||
Z
|
||||
[
|
||||
]
|
||||
_
|
||||
`
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
f
|
||||
g
|
||||
h
|
||||
i
|
||||
j
|
||||
k
|
||||
l
|
||||
m
|
||||
n
|
||||
o
|
||||
p
|
||||
q
|
||||
r
|
||||
s
|
||||
t
|
||||
u
|
||||
v
|
||||
w
|
||||
x
|
||||
y
|
||||
z
|
||||
{
|
||||
}
|
||||
¡
|
||||
£
|
||||
§
|
||||
ª
|
||||
«
|
||||
|
||||
°
|
||||
²
|
||||
³
|
||||
´
|
||||
µ
|
||||
·
|
||||
º
|
||||
»
|
||||
¿
|
||||
À
|
||||
Á
|
||||
Â
|
||||
Ä
|
||||
Å
|
||||
Ç
|
||||
È
|
||||
É
|
||||
Ê
|
||||
Ë
|
||||
Ì
|
||||
Í
|
||||
Î
|
||||
Ï
|
||||
Ò
|
||||
Ó
|
||||
Ô
|
||||
Õ
|
||||
Ö
|
||||
Ú
|
||||
Ü
|
||||
Ý
|
||||
ß
|
||||
à
|
||||
á
|
||||
â
|
||||
ã
|
||||
ä
|
||||
å
|
||||
æ
|
||||
ç
|
||||
è
|
||||
é
|
||||
ê
|
||||
ë
|
||||
ì
|
||||
í
|
||||
î
|
||||
ï
|
||||
ñ
|
||||
ò
|
||||
ó
|
||||
ô
|
||||
õ
|
||||
ö
|
||||
ø
|
||||
ù
|
||||
ú
|
||||
û
|
||||
ü
|
||||
ý
|
||||
ą
|
||||
Ć
|
||||
ć
|
||||
Č
|
||||
č
|
||||
Đ
|
||||
đ
|
||||
ę
|
||||
ı
|
||||
Ł
|
||||
ł
|
||||
ō
|
||||
Œ
|
||||
œ
|
||||
Š
|
||||
š
|
||||
Ÿ
|
||||
Ž
|
||||
ž
|
||||
ʒ
|
||||
β
|
||||
δ
|
||||
ε
|
||||
з
|
||||
Ṡ
|
||||
‘
|
||||
€
|
||||
™
|
||||
@@ -1352,7 +1352,7 @@
|
||||
"秘源机鞘",
|
||||
"秘源真芯",
|
||||
"稚嫩的尖齿",
|
||||
"老练的尖齿",
|
||||
"老练的坚齿",
|
||||
"横行霸者的利齿",
|
||||
"卫从的木哨",
|
||||
"战士的铁哨",
|
||||
@@ -4769,6 +4769,696 @@
|
||||
"「一篇未完成的手稿」",
|
||||
"杏仁",
|
||||
"溪泉",
|
||||
"《提瓦特世界史·第一部分》",
|
||||
"《枫丹香水广告集》",
|
||||
"《白猫神探》",
|
||||
"《薰衣草之花》",
|
||||
"「伊利萨」",
|
||||
"「半熟蛋」",
|
||||
"「合成台」",
|
||||
"「咕噜噜」",
|
||||
"「大椰子」",
|
||||
"「小波」",
|
||||
"「此地的伟大精神」",
|
||||
"「毛发如夜的野兽」",
|
||||
"「灵道刻印门」",
|
||||
"「炫彩呆子」",
|
||||
"「狂图捕手」",
|
||||
"「绿松石」",
|
||||
"「翡翠」",
|
||||
"「西弗安雅」",
|
||||
"「金盏花」",
|
||||
"「队长」",
|
||||
"「黑曜石碑的影像」",
|
||||
"丁戈内克",
|
||||
"万奎洛",
|
||||
"万杰鲁",
|
||||
"不耐烦的贼匪",
|
||||
"不耐烦的部族成员",
|
||||
"专注的「花羽会」战士",
|
||||
"为伙伴们烹饪料理",
|
||||
"乌丘",
|
||||
"乌兰塔",
|
||||
"乌图伦库",
|
||||
"乌尔",
|
||||
"乌米",
|
||||
"乌苏坎",
|
||||
"乌茨勒",
|
||||
"互动点",
|
||||
"亚格贝乌",
|
||||
"亚瓦尔",
|
||||
"亚蕾琪",
|
||||
"代杜古",
|
||||
"伊克娜",
|
||||
"伊兹娜",
|
||||
"伊卡力",
|
||||
"伊卡尤",
|
||||
"伊图提娅",
|
||||
"伊妮",
|
||||
"伊扎帕",
|
||||
"伊法",
|
||||
"伊波莱",
|
||||
"伊泽",
|
||||
"伊瓦伊",
|
||||
"伊约芭",
|
||||
"伊茨昆",
|
||||
"伊莫莎",
|
||||
"伊莱帕",
|
||||
"伊蒂莉",
|
||||
"伊蕾尔",
|
||||
"伊蜜",
|
||||
"伊西多尔",
|
||||
"伊西姆",
|
||||
"伊赫卡",
|
||||
"众人写成的记录",
|
||||
"低语",
|
||||
"佩蕾·努伊",
|
||||
"依扎娜",
|
||||
"依稀可以辨认的布告",
|
||||
"克伊奈",
|
||||
"克拉莉希娅",
|
||||
"克瓦斯尼科夫",
|
||||
"克维库",
|
||||
"兰卡亚",
|
||||
"兰维达",
|
||||
"兰萨提",
|
||||
"兰齐塔",
|
||||
"兴奋的「回声之子」战士",
|
||||
"冰冷的身躯",
|
||||
"冷静的「回声之子」战士",
|
||||
"凯塔",
|
||||
"凯安",
|
||||
"出魂试炼之所的留言",
|
||||
"切妮",
|
||||
"列扎诺夫",
|
||||
"利别科",
|
||||
"利洛",
|
||||
"加勒弗大汪",
|
||||
"加塔力",
|
||||
"加杰雷",
|
||||
"加纳尔",
|
||||
"努乌",
|
||||
"努斯妲",
|
||||
"勇敢的匿叶龙",
|
||||
"勇猛的嵴锋龙",
|
||||
"勒拉",
|
||||
"匿叶龙",
|
||||
"南娜",
|
||||
"卡乌帕",
|
||||
"卡乌胡",
|
||||
"卡乌鲁",
|
||||
"卡伦雅",
|
||||
"卡克斯",
|
||||
"卡克斯的行装",
|
||||
"卡兹加",
|
||||
"卡力弗",
|
||||
"卡卡妈妈",
|
||||
"卡嘉",
|
||||
"卡图马",
|
||||
"卡安",
|
||||
"卡帕可",
|
||||
"卡拉穆鲁",
|
||||
"卡纳鲁亚",
|
||||
"卡胡那",
|
||||
"卡胡鲁",
|
||||
"卡马克",
|
||||
"卡马加",
|
||||
"卡齐娜",
|
||||
"受困的匿叶龙",
|
||||
"受困的嵴锋龙",
|
||||
"古塞尼科夫",
|
||||
"古寻梦祭司的记录·其之一",
|
||||
"古寻梦祭司的记录·其之三",
|
||||
"古寻梦祭司的记录·其之二",
|
||||
"古寻梦祭司的记录·其之四",
|
||||
"古瑟雷德",
|
||||
"古老的布告",
|
||||
"古老的日记",
|
||||
"古老的碑刻",
|
||||
"古雷马",
|
||||
"叶莱菲",
|
||||
"吉恩布",
|
||||
"向下看",
|
||||
"呆呆的小嵴锋龙",
|
||||
"呆呆的绵驮兽",
|
||||
"呼噜克",
|
||||
"哈卡乌",
|
||||
"哈蒂丝",
|
||||
"哈隆加",
|
||||
"唤灵师的手记·其一",
|
||||
"唤灵师的手记·其二",
|
||||
"商队成员",
|
||||
"嗜岩·兽境幼兽",
|
||||
"嘉乌兰妮",
|
||||
"因卡纳克",
|
||||
"因娜",
|
||||
"团雀01",
|
||||
"团雀02",
|
||||
"团雀03",
|
||||
"困倦的绒翼龙",
|
||||
"图尼娜",
|
||||
"图帕克",
|
||||
"图蒂坦",
|
||||
"图蕾娅",
|
||||
"图达玛",
|
||||
"圣王的手记·其一",
|
||||
"圣王的手记·其七",
|
||||
"圣王的手记·其三",
|
||||
"圣王的手记·其九",
|
||||
"圣王的手记·其二",
|
||||
"圣王的手记·其五",
|
||||
"圣王的手记·其八",
|
||||
"圣王的手记·其六",
|
||||
"圣王的手记·其四",
|
||||
"坎内克",
|
||||
"埃文苏",
|
||||
"基尼奇",
|
||||
"基斯庇",
|
||||
"基班古",
|
||||
"基维拉",
|
||||
"基耶霍",
|
||||
"塔力帕",
|
||||
"塔卢加",
|
||||
"塔尔科",
|
||||
"塔恩加",
|
||||
"塔洛娜",
|
||||
"塔穆因",
|
||||
"塔莫蕾",
|
||||
"塔诺",
|
||||
"塞奇托",
|
||||
"塞巴尔",
|
||||
"夏安卡",
|
||||
"夏拉帕",
|
||||
"夏温",
|
||||
"夏芙米娅",
|
||||
"夏萝·努伊",
|
||||
"多巴",
|
||||
"夜猫子",
|
||||
"夜神",
|
||||
"夜魂之灵",
|
||||
"大家伙?",
|
||||
"大胆的调查员",
|
||||
"夸恩因",
|
||||
"夸恩因的日记",
|
||||
"夸梅",
|
||||
"奇卡",
|
||||
"奇怪的匿叶龙",
|
||||
"奇普",
|
||||
"奇梅",
|
||||
"奇玛",
|
||||
"奇科娅",
|
||||
"奇马利",
|
||||
"奈赫西",
|
||||
"奎兹",
|
||||
"奎泰克",
|
||||
"奎皮亚",
|
||||
"奥伯龙",
|
||||
"奥坎比",
|
||||
"奥奇坎",
|
||||
"奥奇坎的残躯",
|
||||
"奥娅",
|
||||
"奥尔科",
|
||||
"奥希娜",
|
||||
"奥杜力",
|
||||
"奥科兰",
|
||||
"奥罗卢柯",
|
||||
"奥西",
|
||||
"奥贡",
|
||||
"好奇的调查员",
|
||||
"妮乌",
|
||||
"妮佩卡",
|
||||
"妮赫佳",
|
||||
"威严的低语",
|
||||
"娅特兰",
|
||||
"娜恩希",
|
||||
"娜玛卡",
|
||||
"子澄",
|
||||
"字迹模糊的笔记",
|
||||
"孟尼力克",
|
||||
"安切塔",
|
||||
"安萨鲁",
|
||||
"安蒂妮",
|
||||
"家长般的大嵴锋龙",
|
||||
"容韦勒",
|
||||
"对话群演",
|
||||
"小孩的笔记",
|
||||
"小家伙?",
|
||||
"小小蜜虫",
|
||||
"尤季娜",
|
||||
"尤庇娅",
|
||||
"尤考姆",
|
||||
"尼南",
|
||||
"尼尼",
|
||||
"尼赞贝",
|
||||
"山王",
|
||||
"嵴锋龙",
|
||||
"嵴锋龙DJ",
|
||||
"嵴锋龙斗舞女1",
|
||||
"嵴锋龙斗舞女2",
|
||||
"嵴锋龙斗舞男1",
|
||||
"嵴锋龙斗舞男2",
|
||||
"巡山客的手记",
|
||||
"工匠的笔记·其一",
|
||||
"工匠的笔记·其二",
|
||||
"巴亚吉达",
|
||||
"巴克",
|
||||
"巴加约",
|
||||
"巴哈蒂",
|
||||
"巴拉诺夫",
|
||||
"巴茨",
|
||||
"布基纳",
|
||||
"布尔莎",
|
||||
"布纳马",
|
||||
"布鲁",
|
||||
"希乌休",
|
||||
"希亚赫",
|
||||
"希伊亚",
|
||||
"希巴拉克",
|
||||
"希库埃鲁",
|
||||
"希皮利",
|
||||
"希诺宁",
|
||||
"帕兰",
|
||||
"帕加尔",
|
||||
"帕卡·努伊",
|
||||
"帕尼娅",
|
||||
"帕恰",
|
||||
"帕朗",
|
||||
"帕莉西娅",
|
||||
"帕贾丹",
|
||||
"年轻的行商",
|
||||
"年长的行商",
|
||||
"幻写灵",
|
||||
"幼光",
|
||||
"幼小的匿叶龙",
|
||||
"幼嵴锋龙",
|
||||
"幼年的暝视龙",
|
||||
"庇兰",
|
||||
"库伊米",
|
||||
"库基亚",
|
||||
"库娅",
|
||||
"库希马纳",
|
||||
"库延",
|
||||
"库拉霍",
|
||||
"库斯可",
|
||||
"库特比",
|
||||
"库珀·努伊",
|
||||
"库约尼",
|
||||
"库纳克",
|
||||
"库西",
|
||||
"库阿勒",
|
||||
"库马约",
|
||||
"庞塞",
|
||||
"废弃-奇玛",
|
||||
"废弃-希乌休",
|
||||
"废弃-曼扎那",
|
||||
"废弃-森塔加",
|
||||
"废弃-阿乌伊娅",
|
||||
"废弃-马察特利",
|
||||
"延古",
|
||||
"延塔莎",
|
||||
"延索",
|
||||
"待物3带背包",
|
||||
"待物3带背包 深肤色",
|
||||
"德乌特",
|
||||
"德乌特(灵)",
|
||||
"忧愁的绒翼龙",
|
||||
"怪物2带背包",
|
||||
"怪物2带背包 深肤色",
|
||||
"怪物带背包",
|
||||
"怪物带背包 深肤色",
|
||||
"怯生生的小匿叶龙",
|
||||
"恩加韦",
|
||||
"恩古迪",
|
||||
"恩孔加",
|
||||
"恩托提亚",
|
||||
"恩琳",
|
||||
"恰斯卡",
|
||||
"悠然的「花羽会」战士",
|
||||
"愤怒的贩龙者",
|
||||
"懒懒的鳍游龙",
|
||||
"戈利科夫",
|
||||
"战场情报",
|
||||
"扎安娅",
|
||||
"托奥",
|
||||
"托尔特克",
|
||||
"托托",
|
||||
"托扬娜",
|
||||
"托泰克",
|
||||
"托赞",
|
||||
"托赫兰妮",
|
||||
"拉坎阿",
|
||||
"拉密萨纳",
|
||||
"拉斯塔恩",
|
||||
"拉曼",
|
||||
"拉比娜",
|
||||
"拉马奈",
|
||||
"挑战起点",
|
||||
"振尘",
|
||||
"提佐科",
|
||||
"提凯伊",
|
||||
"提帕诺",
|
||||
"提莉乌娅",
|
||||
"搭建帐篷",
|
||||
"摩亚瓦",
|
||||
"放置「古名」",
|
||||
"斯塔杜欣",
|
||||
"斯普赫",
|
||||
"无名工匠的笔记",
|
||||
"无名旅人的笔记·其一",
|
||||
"无名旅人的笔记·其三",
|
||||
"无名旅人的笔记·其二",
|
||||
"无名旅人的笔记·其五",
|
||||
"无名旅人的笔记·其四",
|
||||
"无名祭司的笔记",
|
||||
"昆纳乌",
|
||||
"晕倒的匿叶龙",
|
||||
"晕倒的鳍游龙",
|
||||
"普玛",
|
||||
"普玛莉",
|
||||
"暝视龙",
|
||||
"暴躁的部族战士",
|
||||
"更换衣服",
|
||||
"曼尤雅",
|
||||
"曼扎那",
|
||||
"曼科",
|
||||
"曼萨",
|
||||
"最佳飞行成绩记录",
|
||||
"朗戈",
|
||||
"木箱",
|
||||
"未完成的乐稿",
|
||||
"朱南",
|
||||
"机灵的小嵴锋龙",
|
||||
"来自过去的声音",
|
||||
"松伽塔",
|
||||
"某人留下的铭记·其一",
|
||||
"某人留下的铭记·其三",
|
||||
"某人留下的铭记·其二",
|
||||
"某人留下的铭记·其五",
|
||||
"某人留下的铭记·其四",
|
||||
"某人遗落的风镜",
|
||||
"柯奇妲",
|
||||
"柯娅",
|
||||
"柯林伍德",
|
||||
"柯梯米",
|
||||
"树上的小嵴锋龙",
|
||||
"栖木普",
|
||||
"格罗贝尔",
|
||||
"格茜妮",
|
||||
"格里斯潘",
|
||||
"桑哈杰",
|
||||
"桑科约克",
|
||||
"梅兹莉",
|
||||
"梅内娅",
|
||||
"梅莎",
|
||||
"梅西娜",
|
||||
"森塔加",
|
||||
"森珀娅",
|
||||
"樋口铁矢",
|
||||
"欣赏景色",
|
||||
"欧洛伦",
|
||||
"欧莎薇",
|
||||
"残破的石碑",
|
||||
"比于什",
|
||||
"比奇津",
|
||||
"比赛公告板",
|
||||
"比赛选手",
|
||||
"毛球",
|
||||
"水豚",
|
||||
"汉佩克",
|
||||
"汉扎",
|
||||
"沃蕾",
|
||||
"波卡",
|
||||
"波吉吉",
|
||||
"波奇奇",
|
||||
"波尼尼",
|
||||
"波蒂莉",
|
||||
"波蒂薇",
|
||||
"泽伊拉",
|
||||
"洛娅",
|
||||
"活泼的绵驮兽",
|
||||
"活跃的小嵴锋龙",
|
||||
"海兹尔",
|
||||
"海岳",
|
||||
"涅兰",
|
||||
"涅提",
|
||||
"游学者的笔记",
|
||||
"潘帕",
|
||||
"灵体真女儿",
|
||||
"爱可",
|
||||
"爱梅拉",
|
||||
"爱维莉",
|
||||
"爱菲拉",
|
||||
"爱雅",
|
||||
"特佐佐",
|
||||
"特佩潘",
|
||||
"特帕切",
|
||||
"特帕尔",
|
||||
"特拉佐莉",
|
||||
"特拉佐莉(表演用克隆人)",
|
||||
"特拉帕尔",
|
||||
"特拉忒",
|
||||
"特拉波",
|
||||
"特拉科",
|
||||
"特沃德罗斯",
|
||||
"特波兹",
|
||||
"特立尼达",
|
||||
"特纳华",
|
||||
"特蒂赫莉",
|
||||
"特诺切",
|
||||
"特阿墨",
|
||||
"特阿尤",
|
||||
"特马乔",
|
||||
"狄雷",
|
||||
"献上供物",
|
||||
"玛亚薇",
|
||||
"玛伊蕾",
|
||||
"玛兹嘉",
|
||||
"玛拉妮",
|
||||
"玛薇卡",
|
||||
"玻娜",
|
||||
"琪丝佩",
|
||||
"琪希可",
|
||||
"瓦伊妲",
|
||||
"瓦伊纳",
|
||||
"瓦兰卡",
|
||||
"瓦凯·努伊",
|
||||
"瓦卡尔",
|
||||
"瓦图妲",
|
||||
"瓦尔米",
|
||||
"瓦托娅",
|
||||
"瓦斯卡尔",
|
||||
"瓦曼",
|
||||
"瓦蕾",
|
||||
"瓦达娜",
|
||||
"界碑上的刻文",
|
||||
"疑惑的调查员",
|
||||
"疲惫的暝视龙",
|
||||
"白浜",
|
||||
"皮尔钦",
|
||||
"皮希加",
|
||||
"皮萨克",
|
||||
"看向仪式台",
|
||||
"研究中心紧急机械操作手册",
|
||||
"磨损的记录",
|
||||
"秋纽奥",
|
||||
"科优尔",
|
||||
"科奥劳",
|
||||
"科奴拉芙",
|
||||
"科帕",
|
||||
"科斯特利茨基",
|
||||
"科潘",
|
||||
"科科庞",
|
||||
"科米娜",
|
||||
"科约帕",
|
||||
"科莫奎",
|
||||
"秘源哨机",
|
||||
"穆伊萨",
|
||||
"穆基",
|
||||
"穆尔科",
|
||||
"穆托塔",
|
||||
"穆纳伊",
|
||||
"穆蒲",
|
||||
"竖立在旁的木牌",
|
||||
"等待…",
|
||||
"米卢·努伊",
|
||||
"米奎克",
|
||||
"米特尔",
|
||||
"米齐卡",
|
||||
"索尔涅夫",
|
||||
"索莉马娜",
|
||||
"约洛特莉",
|
||||
"练习钻地的小嵴锋龙",
|
||||
"细心的匿叶龙",
|
||||
"绒翼龙",
|
||||
"绒翼龙幼龙",
|
||||
"维兰德",
|
||||
"维图索夫",
|
||||
"维护记录·其一",
|
||||
"维护记录·其三",
|
||||
"维护记录·其二",
|
||||
"维查玛",
|
||||
"维莎",
|
||||
"羊驼",
|
||||
"群演1",
|
||||
"老鼠",
|
||||
"耶里门",
|
||||
"胆小的绵驮兽",
|
||||
"胡妮",
|
||||
"胡里约",
|
||||
"自称「山下」之物",
|
||||
"艾库瓦",
|
||||
"苏娅",
|
||||
"苏玛克",
|
||||
"若娜瓦",
|
||||
"茜特菈莉",
|
||||
"荆和",
|
||||
"莉乌娅",
|
||||
"莉洛娅",
|
||||
"莉琉",
|
||||
"莉瓦",
|
||||
"莉莉尤",
|
||||
"莎乌莎",
|
||||
"莎娜",
|
||||
"莎维娅",
|
||||
"莎迪蕾",
|
||||
"莫乌",
|
||||
"菲欣妮",
|
||||
"菲耶蒂娜",
|
||||
"萨加图拉",
|
||||
"萨卡乌",
|
||||
"萨科巴",
|
||||
"萨约尔",
|
||||
"萨费伊",
|
||||
"葵可",
|
||||
"葵莉娅",
|
||||
"蒂亚戈",
|
||||
"蒂图",
|
||||
"蒂尔妲",
|
||||
"蒂索克",
|
||||
"蓬普",
|
||||
"薇尔恰",
|
||||
"虚弱的声音",
|
||||
"虚弱的大灵显化身",
|
||||
"虚弱的绒翼龙",
|
||||
"虚弱的膨膨兽",
|
||||
"被困的匿叶龙",
|
||||
"被困的嵴锋龙",
|
||||
"被困的幼暝视龙",
|
||||
"被救出的匿叶龙",
|
||||
"被救的鳍游龙",
|
||||
"装饰花车",
|
||||
"西坎",
|
||||
"西布",
|
||||
"西帕克",
|
||||
"西蒂娜",
|
||||
"西薇",
|
||||
"观察护身符",
|
||||
"观察武器",
|
||||
"观察罐子",
|
||||
"观察腰带",
|
||||
"观察钓具",
|
||||
"警示者的记录",
|
||||
"记录用秘源哨机",
|
||||
"谁人的手记",
|
||||
"调查用投喂点",
|
||||
"谜画涂鸦中的意志",
|
||||
"谨慎的调查员",
|
||||
"贝坎",
|
||||
"贝雷哈努",
|
||||
"贤龙",
|
||||
"贪吃的绵驮兽",
|
||||
"赫伯德",
|
||||
"赫瓦特莉",
|
||||
"辛佳",
|
||||
"辛奇",
|
||||
"达伊妲",
|
||||
"达尔戈",
|
||||
"达布亚",
|
||||
"达祖玛",
|
||||
"进行比赛",
|
||||
"迷惑的调查员",
|
||||
"迷灰中的石碑·其一",
|
||||
"迷灰中的石碑·其三",
|
||||
"迷灰中的石碑·其二",
|
||||
"通皮斯",
|
||||
"醒目的标语",
|
||||
"钦特利",
|
||||
"闪亮亮的贝壳",
|
||||
"阿乌伊娅",
|
||||
"阿乌琪",
|
||||
"阿乔",
|
||||
"阿伽娅",
|
||||
"阿凯蒂",
|
||||
"阿卡坦加",
|
||||
"阿卡马",
|
||||
"阿图科",
|
||||
"阿坎蒂",
|
||||
"阿基约",
|
||||
"阿奇亚库",
|
||||
"阿妮拉",
|
||||
"阿姆鲁",
|
||||
"阿孔",
|
||||
"阿尔妲",
|
||||
"阿尔帕",
|
||||
"阿尤",
|
||||
"阿布帕隆",
|
||||
"阿希莉",
|
||||
"阿斯基娅",
|
||||
"阿斯麦隆",
|
||||
"阿格莫",
|
||||
"阿梅妲",
|
||||
"阿特琪",
|
||||
"阿科米蒂",
|
||||
"阿米娜",
|
||||
"阿纳",
|
||||
"阿蕾梅",
|
||||
"阿达玛",
|
||||
"阿邦迪",
|
||||
"阿隆",
|
||||
"阿霍伊图",
|
||||
"阿马佐利",
|
||||
"阿鲁吉",
|
||||
"陀罗诘利",
|
||||
"陀达罗",
|
||||
"难过的嵴锋龙",
|
||||
"雅库普",
|
||||
"雅蕾希",
|
||||
"雅诺斯基",
|
||||
"雇主",
|
||||
"雷格巴",
|
||||
"霍图鲁",
|
||||
"霍娅",
|
||||
"霍莱",
|
||||
"韦尼埃米诺夫",
|
||||
"顾客",
|
||||
"马伊塔",
|
||||
"马兹拉",
|
||||
"马凯莫",
|
||||
"马努阿",
|
||||
"马塔伽",
|
||||
"马塔伽!记得!!",
|
||||
"马塔拉",
|
||||
"马察特利",
|
||||
"马尼菲科",
|
||||
"马扎坦",
|
||||
"马提库伊",
|
||||
"马洛考",
|
||||
"马特兰",
|
||||
"马穆勒",
|
||||
"马蒂亚斯",
|
||||
"马西娜·努伊",
|
||||
"马陶霍",
|
||||
"驻扎日记",
|
||||
"验收与维修记录",
|
||||
"鳍游龙",
|
||||
"鳍游龙夏威夷吉他",
|
||||
"鳍游龙尤克里里",
|
||||
"鳍游龙木吉他",
|
||||
"鳍游龙箱鼓",
|
||||
"麦斯欧德",
|
||||
"黛希特莉",
|
||||
"龙铭刻",
|
||||
"(翻找箱子…)",
|
||||
"亡国的美奈姬·卷五",
|
||||
"少女薇拉的忧郁·卷一",
|
||||
"少女薇拉的忧郁·卷二",
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>0.36.2</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\Images\*.jpg" />
|
||||
<None Remove="Assets\Images\*" />
|
||||
<None Remove="Assets\Images\*.png" />
|
||||
<None Remove="Assets\Images\*.ico" />
|
||||
<None Remove="Assets\Fonts\*.ttf" />
|
||||
<None Remove="Assets\Highlighting\*.xshd" />
|
||||
<None Remove="Assets\Strings\*.html" />
|
||||
<None Remove="Assets\Strings\*.md" />
|
||||
<None Remove="Assets\Audios\*.mp3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Images\*.jpg" />
|
||||
<Resource Include="Assets\Images\Anniversary\*" />
|
||||
<Resource Include="Assets\Images\*.png" />
|
||||
<Resource Include="Assets\Images\*.ico" />
|
||||
<Resource Include="Assets\Fonts\*.ttf" />
|
||||
<Resource Include="Assets\Highlighting\*.xshd" />
|
||||
<Resource Include="Assets\Strings\*.html" />
|
||||
<Resource Include="Assets\Strings\*.md" />
|
||||
<Resource Include="Assets\Audios\*.mp3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.18.1" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.18.1" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.8.0.20230708" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.8.0.20230708" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.8.0.20230708" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.5" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
|
||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||
<PackageReference Include="PresentMonFps" Version="2.0.5" />
|
||||
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
|
||||
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
|
||||
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.0.2" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.0.2" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.23" />
|
||||
<PackageReference Include="YoloV8" Version="4.1.7" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fischless.GameCapture\Fischless.GameCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.WindowsInput\Fischless.WindowsInput.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Assets\Map\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\combat_avatar.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\hangout.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="GameTask\Common\Element\Assets\新文件夹\" />
|
||||
<Folder Include="GameTask\OneDragon\" />
|
||||
<Folder Include="User\AutoPathing\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -8,9 +8,9 @@
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\Images\Anniversary\logo_1st.ico</ApplicationIcon>
|
||||
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>0.34.6</AssemblyVersion>
|
||||
<AssemblyVersion>0.44.0</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
@@ -41,12 +41,19 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.0.90" />
|
||||
<PackageReference Include="BehaviourTree" Version="1.0.73" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="DeviceId" Version="6.8.0" />
|
||||
<PackageReference Include="DeviceId.Windows" Version="6.8.0" />
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.8.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.14" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.18.1" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.18.1" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.8.0.20230708" />
|
||||
@@ -57,19 +64,20 @@
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
|
||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||
<PackageReference Include="PresentMonFps" Version="2.0.5" />
|
||||
<PackageReference Include="Sdcb.PaddleInference" Version="2.5.0.1" />
|
||||
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.5.1" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0" />
|
||||
<PackageReference Include="Sdcb.PaddleOCR.Models.Online" Version="2.7.0.1" />
|
||||
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.0.2" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.0.2" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.18" />
|
||||
<PackageReference Include="WPF-UI" Version="4.0.0" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.0" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.0.0" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.0" />
|
||||
<PackageReference Include="YoloV8" Version="4.1.7" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
</ItemGroup>
|
||||
@@ -120,9 +128,15 @@
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\Json\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoMusicGame\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -138,7 +152,24 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="GameTask\OneDragon\" />
|
||||
<Folder Include="Service\Notification\Builder\" />
|
||||
<Folder Include="User\AutoPathing\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Windows\WelcomeDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="View\Windows\WelcomeDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>WelcomeDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -7,13 +7,17 @@ using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoPick;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
using BetterGenshinImpact.GameTask.AutoMusicGame;
|
||||
using BetterGenshinImpact.GameTask.QuickTeleport;
|
||||
using BetterGenshinImpact.Service.Notification;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Fischless.GameCapture;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
@@ -47,13 +51,19 @@ public partial class AllConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private int _triggerInterval = 50;
|
||||
|
||||
// /// <summary>
|
||||
// /// WGC使用位图缓存
|
||||
// /// 高帧率情况下,可能会导致卡顿
|
||||
// /// 云原神可能会出现黑屏
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private bool _wgcUseBitmapCache = true;
|
||||
|
||||
/// <summary>
|
||||
/// WGC使用位图缓存
|
||||
/// 高帧率情况下,可能会导致卡顿
|
||||
/// 云原神可能会出现黑屏
|
||||
/// 自动修复Win11下BitBlt截图方式不可用的问题
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _wgcUseBitmapCache = true;
|
||||
private bool _autoFixWin11BitBlt = true;
|
||||
|
||||
/// <summary>
|
||||
/// 推理使用的设备
|
||||
@@ -61,6 +71,15 @@ public partial class AllConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _inferenceDevice = "CPU";
|
||||
|
||||
[ObservableProperty]
|
||||
private List<ValueTuple<string, int, string, string>> _nextScheduledTask = [];
|
||||
|
||||
/// <summary>
|
||||
/// 一条龙选中使用的配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _selectedOneDragonFlowConfigName = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 遮罩窗口配置
|
||||
/// </summary>
|
||||
@@ -115,6 +134,11 @@ public partial class AllConfig : ObservableObject
|
||||
/// 自动战斗配置
|
||||
/// </summary>
|
||||
public AutoFightConfig AutoFightConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动乐曲配置 - 千音雅集
|
||||
/// </summary>
|
||||
public AutoMusicGameConfig AutoMusicGameConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动秘境配置
|
||||
@@ -133,6 +157,11 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public ScriptConfig ScriptConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 地图追踪配置
|
||||
/// </summary>
|
||||
public PathingConditionConfig PathingConditionConfig { get; set; } = PathingConditionConfig.Default;
|
||||
|
||||
/// <summary>
|
||||
/// 快捷键配置
|
||||
/// </summary>
|
||||
@@ -143,6 +172,18 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public NotificationConfig NotificationConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 原神按键绑定配置
|
||||
/// </summary>
|
||||
public KeyBindingsConfig KeyBindingsConfig { get; set; } = new();
|
||||
/// <summary>
|
||||
/// 其他配置
|
||||
/// </summary>
|
||||
public OtherConfig OtherConfig { get; set; } = new();
|
||||
/// <summary>
|
||||
/// 传送相关配置
|
||||
/// </summary>
|
||||
public TpConfig TpConfig { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public Action? OnAnyChangedAction { get; set; }
|
||||
|
||||
@@ -154,7 +195,7 @@ public partial class AllConfig : ObservableObject
|
||||
GenshinStartConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
NotificationConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
NotificationConfig.PropertyChanged += OnNotificationPropertyChanged;
|
||||
|
||||
KeyBindingsConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoPickConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoSkipConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFishingConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
@@ -165,8 +206,10 @@ public partial class AllConfig : ObservableObject
|
||||
AutoWoodConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFightConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoDomainConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
|
||||
AutoMusicGameConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
TpConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
ScriptConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
PathingConditionConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
}
|
||||
|
||||
public void OnAnyPropertyChanged(object? sender, EventArgs args)
|
||||
@@ -179,4 +222,4 @@ public partial class AllConfig : ObservableObject
|
||||
{
|
||||
NotificationService.Instance().RefreshNotifiers();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
@@ -26,4 +28,28 @@ public partial class CommonConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _exitToTray;
|
||||
|
||||
/// <summary>
|
||||
/// 主题
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private WindowBackdropType _currentBackdropType = WindowBackdropType.Mica;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是第一次运行
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _isFirstRun = true;
|
||||
|
||||
/// <summary>
|
||||
/// 这个版本是否运行过
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _runForVersion = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 一个设备只运行一次的已运行设备ID列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private List<string> _onceHadRunDeviceIdList = new();
|
||||
}
|
||||
@@ -9,11 +9,11 @@ namespace BetterGenshinImpact.Core.Config;
|
||||
[Serializable]
|
||||
public partial class GenshinStartConfig : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 自动点击月卡
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoClickBlessingOfTheWelkinMoonEnabled;
|
||||
// /// <summary>
|
||||
// /// 自动点击月卡
|
||||
// /// </summary>
|
||||
// [ObservableProperty]
|
||||
// private bool _autoClickBlessingOfTheWelkinMoonEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 自动进入游戏(开门)
|
||||
@@ -38,4 +38,10 @@ public partial class GenshinStartConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _linkedStartEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 使用Starward同步记录时间
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _recordGameTimeEnabled = false;
|
||||
}
|
||||
@@ -148,6 +148,13 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoMusicGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 活动音游开始/停止
|
||||
[ObservableProperty]
|
||||
private string _autoFishingGameHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoFishingGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 自动寻路
|
||||
[ObservableProperty]
|
||||
@@ -211,7 +218,12 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _keyMouseMacroRecordHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
// 暂停
|
||||
[ObservableProperty]
|
||||
private string _suspendHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _suspendHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
// 停止任意独立任务
|
||||
[ObservableProperty]
|
||||
private string _cancelTaskHotkey = "";
|
||||
|
||||
@@ -0,0 +1,970 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using Windows.Networking.PushNotifications;
|
||||
using static Vanara.PInvoke.User32;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
/// <summary>
|
||||
/// 原神按键绑定配置
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public partial class KeyBindingsConfig:ObservableObject
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用全局按键映射
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _globalKeyMappingEnabled = false;
|
||||
|
||||
#region Actions(操作)
|
||||
|
||||
/// <summary>
|
||||
/// 向前移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _moveForward = KeyId.W;
|
||||
|
||||
/// <summary>
|
||||
/// 向后移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _moveBackward = KeyId.S;
|
||||
|
||||
/// <summary>
|
||||
/// 向左移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _moveLeft = KeyId.A;
|
||||
|
||||
/// <summary>
|
||||
/// 向右移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _moveRight = KeyId.D;
|
||||
|
||||
/// <summary>
|
||||
/// 切换走/跑;特定操作模式下向下移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchToWalkOrRun = KeyId.LeftCtrl;
|
||||
|
||||
/// <summary>
|
||||
/// 普通攻击
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _normalAttack = KeyId.MouseLeftButton;
|
||||
|
||||
/// <summary>
|
||||
/// 元素战技
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _elementalSkill = KeyId.E;
|
||||
|
||||
/// <summary>
|
||||
/// 元素爆发
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _elementalBurst = KeyId.Q;
|
||||
|
||||
/// <summary>
|
||||
/// 冲刺(键盘)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _sprintKeyboard = KeyId.LeftShift;
|
||||
|
||||
/// <summary>
|
||||
/// 冲刺(鼠标)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _sprintMouse = KeyId.MouseRightButton;
|
||||
|
||||
/// <summary>
|
||||
/// 切换瞄准模式
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchAimingMode = KeyId.R;
|
||||
|
||||
/// <summary>
|
||||
/// 跳跃;特定操作模式下向上移动
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _jump = KeyId.Space;
|
||||
|
||||
/// <summary>
|
||||
/// 落下
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _drop = KeyId.X;
|
||||
|
||||
/// <summary>
|
||||
/// 拾取/交互(自动拾取由AutoPick模块管理)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _pickUpOrInteract = KeyId.F;
|
||||
|
||||
/// <summary>
|
||||
/// 快捷使用小道具
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _quickUseGadget = KeyId.Z;
|
||||
|
||||
/// <summary>
|
||||
/// 特定玩法内交互操作
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _interactionInSomeMode = KeyId.T;
|
||||
|
||||
/// <summary>
|
||||
/// 开启任务追踪
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _questNavigation = KeyId.V;
|
||||
|
||||
/// <summary>
|
||||
/// 中断挑战
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _abandonChallenge = KeyId.P;
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色1
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchMember1 = KeyId.D1;
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色2
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchMember2 = KeyId.D2;
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色3
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchMember3 = KeyId.D3;
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色4
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchMember4 = KeyId.D4;
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色5
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _switchMember5 = KeyId.D5;
|
||||
|
||||
/// <summary>
|
||||
/// 呼出快捷轮盘
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _shortcutWheel = KeyId.Tab;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Menus(菜单)
|
||||
|
||||
/// <summary>
|
||||
/// 打开背包
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openInventory = KeyId.B;
|
||||
|
||||
/// <summary>
|
||||
/// 打开角色界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openCharacterScreen = KeyId.C;
|
||||
|
||||
/// <summary>
|
||||
/// 打开地图
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openMap = KeyId.M;
|
||||
|
||||
/// <summary>
|
||||
/// 打开派蒙界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openPaimonMenu = KeyId.Escape;
|
||||
|
||||
/// <summary>
|
||||
/// 打开冒险之证界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openAdventurerHandbook = KeyId.F1;
|
||||
|
||||
/// <summary>
|
||||
/// 打开多人游戏界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openCoOpScreen = KeyId.F2;
|
||||
|
||||
/// <summary>
|
||||
/// 打开祈愿界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openWishScreen = KeyId.F3;
|
||||
|
||||
/// <summary>
|
||||
/// 打开纪行界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openBattlePassScreen = KeyId.F4;
|
||||
|
||||
/// <summary>
|
||||
/// 打开活动面板
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openTheEventsMenu = KeyId.F5;
|
||||
|
||||
/// <summary>
|
||||
/// 打开玩法系统界面(尘歌壶内猫尾酒馆内)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openTheSettingsMenu = KeyId.F6;
|
||||
|
||||
/// <summary>
|
||||
/// 打开摆设界面(尘歌壶内)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openTheFurnishingScreen = KeyId.F7;
|
||||
|
||||
/// <summary>
|
||||
/// 打开星之归还(条件符合期间生效)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openStellarReunion = KeyId.F8;
|
||||
|
||||
/// <summary>
|
||||
/// 开关任务菜单
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openQuestMenu = KeyId.J;
|
||||
|
||||
/// <summary>
|
||||
/// 打开通知详情
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openNotificationDetails = KeyId.Y;
|
||||
|
||||
/// <summary>
|
||||
/// 打开聊天界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openChatScreen = KeyId.Enter;
|
||||
|
||||
/// <summary>
|
||||
/// 打开特殊环境说明
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openSpecialEnvironmentInformation = KeyId.U;
|
||||
|
||||
/// <summary>
|
||||
/// 查看教程详情
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _checkTutorialDetails = KeyId.G;
|
||||
|
||||
/// <summary>
|
||||
/// 长按打开元素视野
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _elementalSight = KeyId.MouseMiddleButton;
|
||||
|
||||
/// <summary>
|
||||
/// 呼出鼠标
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _showCursor = KeyId.LeftAlt;
|
||||
|
||||
/// <summary>
|
||||
/// 打开队伍配置界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openPartySetupScreen = KeyId.L;
|
||||
|
||||
/// <summary>
|
||||
/// 打开好友界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _openFriendsScreen = KeyId.O;
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏主界面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private KeyId _hideUI = KeyId.Slash;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public static class KeyIdConverter
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 将KeyId转换为字符串(可在后续支持多语言),按键名称的显示尽量与原神UI一致
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToName(this KeyId value)
|
||||
{
|
||||
return ToChineseName(value);
|
||||
}
|
||||
|
||||
private static string ToChineseName(KeyId value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
// 需要单独翻译的按键
|
||||
KeyId.None => "<未指定>",
|
||||
KeyId.Unknown => "<未知>",
|
||||
KeyId.MouseLeftButton => "鼠标左键",
|
||||
KeyId.MouseRightButton => "鼠标右键",
|
||||
KeyId.MouseMiddleButton => "鼠标中键",
|
||||
KeyId.MouseSideButton1 => "鼠标侧键1",
|
||||
KeyId.MouseSideButton2 => "鼠标侧键2",
|
||||
KeyId.Apps => "菜单键",
|
||||
// 无需单独翻译的部分
|
||||
_ => EnglishKeyNameToChinese(value),
|
||||
};
|
||||
}
|
||||
|
||||
private static string EnglishKeyNameToChinese(KeyId value)
|
||||
{
|
||||
var engName = ToEnglishName(value);
|
||||
if (engName.StartsWith("Left ") || engName.StartsWith("Right "))
|
||||
{
|
||||
return engName.Replace("Left ", "左").Replace("Right ", "右");
|
||||
}
|
||||
return engName;
|
||||
}
|
||||
|
||||
private static string ToEnglishName(KeyId value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
// 需要转换的部分
|
||||
KeyId.None => "<None>",
|
||||
KeyId.Unknown => "<Unknown>",
|
||||
KeyId.MouseLeftButton => "Mouse LButton",
|
||||
KeyId.MouseRightButton => "Mouse RButton",
|
||||
KeyId.MouseMiddleButton => "Mouse MButton",
|
||||
KeyId.MouseSideButton1 => "Mouse XButton1",
|
||||
KeyId.MouseSideButton2 => "Mouse XButton2",
|
||||
KeyId.Escape => "Esc",
|
||||
KeyId.PageUp => "Page Up",
|
||||
KeyId.PageDown => "Page Down",
|
||||
KeyId.CapsLock => "Caps Lock",
|
||||
KeyId.ScrollLock => "Scroll Lock",
|
||||
KeyId.LeftShift => "Left Shift",
|
||||
KeyId.RightShift => "Right Shift",
|
||||
KeyId.LeftCtrl => "Left Crtl",
|
||||
KeyId.RightCtrl => "Right Ctrl",
|
||||
KeyId.LeftAlt => "Left Alt",
|
||||
KeyId.RightAlt => "Right Alt",
|
||||
KeyId.LeftWin => "Left Win",
|
||||
KeyId.RightWin => "Right Win",
|
||||
KeyId.Apps => "Menu",
|
||||
KeyId.Left => "←",
|
||||
KeyId.Up => "↑",
|
||||
KeyId.Right => "→",
|
||||
KeyId.Down => "↓",
|
||||
KeyId.D0 => "0",
|
||||
KeyId.D1 => "1",
|
||||
KeyId.D2 => "2",
|
||||
KeyId.D3 => "3",
|
||||
KeyId.D4 => "4",
|
||||
KeyId.D5 => "5",
|
||||
KeyId.D6 => "6",
|
||||
KeyId.D7 => "7",
|
||||
KeyId.D8 => "8",
|
||||
KeyId.D9 => "9",
|
||||
KeyId.Apostrophe => "'",
|
||||
KeyId.Comma => ",",
|
||||
KeyId.Minus => "-",
|
||||
KeyId.Equal => "=",
|
||||
KeyId.Period => ".",
|
||||
KeyId.Slash => "/",
|
||||
KeyId.Backslash => @"\",
|
||||
KeyId.Semicolon => ";",
|
||||
KeyId.LeftSquareBracket => "[",
|
||||
KeyId.RightSquareBracket => "]",
|
||||
KeyId.Tilde => "`",
|
||||
KeyId.NumLock => "Num Lock",
|
||||
KeyId.NumPad0 => "Num 0",
|
||||
KeyId.NumPad1 => "Num 1",
|
||||
KeyId.NumPad2 => "Num 2",
|
||||
KeyId.NumPad3 => "Num 3",
|
||||
KeyId.NumPad4 => "Num 4",
|
||||
KeyId.NumPad5 => "Num 5",
|
||||
KeyId.NumPad6 => "Num 6",
|
||||
KeyId.NumPad7 => "Num 7",
|
||||
KeyId.NumPad8 => "Num 8",
|
||||
KeyId.NumPad9 => "Num 9",
|
||||
KeyId.Decimal => "Num .",
|
||||
KeyId.Divide => "Num /",
|
||||
KeyId.Multiply => "Num *",
|
||||
KeyId.Subtract => "Num -",
|
||||
KeyId.Add => "Num +",
|
||||
KeyId.NumEnter => "Num Enter",
|
||||
// 默认使用枚举名
|
||||
_ => value.ToString(),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将KeyId转换为VK
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static VK ToVK(this KeyId value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
// 这两个值在VK中没有,抛异常
|
||||
KeyId.None => throw new ArgumentOutOfRangeException(nameof(value), "未指定按键,无法转换为VK。"),
|
||||
KeyId.Unknown => throw new ArgumentOutOfRangeException(nameof(value), "未知按键,无法转换为VK。"),
|
||||
// 剩下的值相同,直接转
|
||||
_ => (VK)value,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将KeyId转换为System.Windows.Input.Key
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static Key ToInputKey(this KeyId value)
|
||||
{
|
||||
// 部分按键名称相同,使用名称转换
|
||||
try
|
||||
{
|
||||
return Enum.Parse<Key>(value.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 其他键使用查表法转换
|
||||
return value switch
|
||||
{
|
||||
KeyId.LeftWin => Key.LWin,
|
||||
KeyId.RightWin => Key.RWin,
|
||||
KeyId.Apostrophe => Key.Oem7,
|
||||
KeyId.Comma => Key.OemComma,
|
||||
KeyId.Minus => Key.OemMinus,
|
||||
KeyId.Equal => Key.OemPlus,
|
||||
KeyId.Period => Key.OemPeriod,
|
||||
KeyId.Slash => Key.Oem2,
|
||||
KeyId.Semicolon => Key.Oem1,
|
||||
KeyId.LeftSquareBracket => Key.Oem4,
|
||||
KeyId.Backslash => Key.Oem5,
|
||||
KeyId.RightSquareBracket => Key.Oem6,
|
||||
KeyId.Tilde => Key.Oem3,
|
||||
KeyId.Enter => Key.Enter,
|
||||
KeyId.ScrollLock => Key.Scroll,
|
||||
KeyId.PageUp => Key.Prior,
|
||||
KeyId.PageDown => Key.Next,
|
||||
KeyId.Backspace => Key.Back,
|
||||
KeyId.CapsLock => Key.Capital,
|
||||
// None、Unknown和鼠标按键抛异常
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将KeyId转换为MouseButton
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static MouseButton ToMouseButton(this KeyId value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
KeyId.MouseLeftButton => MouseButton.Left,
|
||||
KeyId.MouseRightButton => MouseButton.Right,
|
||||
KeyId.MouseMiddleButton => MouseButton.Middle,
|
||||
KeyId.MouseSideButton1 => MouseButton.XButton1,
|
||||
KeyId.MouseSideButton2 => MouseButton.XButton2,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value), "键盘按键请使用ToInputKey方法"),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [实验] 将KeyId转换为WinForm中的Keys(用于兼容按键连发功能)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static Keys ToWinFormKeys(this KeyId value)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Enum.Parse<Keys>(value.ToInputKey().ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将VK转换为KeyId
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static KeyId FromVK(VK value)
|
||||
{
|
||||
// 尝试通过VK的值获取KeyId的枚举名。若成功,表示对应的VK在KeyId支持的范围内,直接转换;否则返回Unknown
|
||||
return string.IsNullOrEmpty(Enum.GetName(typeof(KeyId), value)) ? KeyId.Unknown : (KeyId)value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将System.Windows.Input.Key转换为KeyId
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static KeyId FromInputKey(Key value)
|
||||
{
|
||||
// 部分按键名称相同,使用名称转换
|
||||
try
|
||||
{
|
||||
return Enum.Parse<KeyId>(value.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 其他键使用查表法转换
|
||||
return value switch
|
||||
{
|
||||
Key.LWin => KeyId.LeftWin,
|
||||
Key.RWin => KeyId.RightWin,
|
||||
Key.Oem7 => KeyId.Apostrophe,
|
||||
Key.OemComma => KeyId.Comma,
|
||||
Key.OemMinus => KeyId.Minus,
|
||||
Key.OemPlus => KeyId.Equal,
|
||||
Key.OemPeriod => KeyId.Period,
|
||||
Key.Oem2 => KeyId.Slash,
|
||||
Key.Oem1 => KeyId.Semicolon,
|
||||
Key.Oem4 => KeyId.LeftSquareBracket,
|
||||
Key.Oem5 => KeyId.Backslash,
|
||||
Key.Oem6 => KeyId.RightSquareBracket,
|
||||
Key.Oem3 => KeyId.Tilde,
|
||||
Key.Enter => KeyId.Enter,
|
||||
Key.Scroll => KeyId.ScrollLock,
|
||||
Key.Prior => KeyId.PageUp,
|
||||
Key.Next => KeyId.PageDown,
|
||||
Key.Back => KeyId.Backspace,
|
||||
Key.Capital => KeyId.CapsLock,
|
||||
// 支持列表外的值返回Unknown
|
||||
_ => KeyId.Unknown,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将MouseButton转换为KeyId
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static KeyId FromMouseButton(MouseButton value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
MouseButton.Left => KeyId.MouseLeftButton,
|
||||
MouseButton.Right => KeyId.MouseRightButton,
|
||||
MouseButton.Middle => KeyId.MouseMiddleButton,
|
||||
MouseButton.XButton1 => KeyId.MouseSideButton1,
|
||||
MouseButton.XButton2 => KeyId.MouseSideButton2,
|
||||
_ => KeyId.Unknown,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于与VK/Windows.Input.Key解耦,值与VK对应,但是仅包含美式键盘(104键,不包括媒体控制等)和鼠标中的按键
|
||||
/// </summary>
|
||||
public enum KeyId
|
||||
{
|
||||
/// <summary>无</summary>
|
||||
None = 0x00,
|
||||
|
||||
/// <summary>未知按键</summary>
|
||||
Unknown = 0xFF,
|
||||
|
||||
#region 鼠标按键
|
||||
|
||||
/// <summary>鼠标左键</summary>
|
||||
MouseLeftButton = 0x01,
|
||||
|
||||
/// <summary>鼠标右键</summary>
|
||||
MouseRightButton = 0x02,
|
||||
|
||||
/// <summary>鼠标中键(滚轮)</summary>
|
||||
MouseMiddleButton = 0x04,
|
||||
|
||||
/// <summary>鼠标侧键1(后退)</summary>
|
||||
MouseSideButton1 = 0x05,
|
||||
|
||||
/// <summary>鼠标侧键2(前进)</summary>
|
||||
MouseSideButton2 = 0x06,
|
||||
|
||||
#endregion
|
||||
|
||||
#region F键区
|
||||
|
||||
/// <summary>F1</summary>
|
||||
F1 = 0x70,
|
||||
|
||||
/// <summary>F2</summary>
|
||||
F2 = 0x71,
|
||||
|
||||
/// <summary>F3</summary>
|
||||
F3 = 0x72,
|
||||
|
||||
/// <summary>F4</summary>
|
||||
F4 = 0x73,
|
||||
|
||||
/// <summary>F5</summary>
|
||||
F5 = 0x74,
|
||||
|
||||
/// <summary>F6</summary>
|
||||
F6 = 0x75,
|
||||
|
||||
/// <summary>F7</summary>
|
||||
F7 = 0x76,
|
||||
|
||||
/// <summary>F8</summary>
|
||||
F8 = 0x77,
|
||||
|
||||
/// <summary>F9</summary>
|
||||
F9 = 0x78,
|
||||
|
||||
/// <summary>F10</summary>
|
||||
F10 = 0x79,
|
||||
|
||||
/// <summary>F11</summary>
|
||||
F11 = 0x7A,
|
||||
|
||||
/// <summary>F12</summary>
|
||||
F12 = 0x7B,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 控制&功能键
|
||||
|
||||
/// <summary>Esc</summary>
|
||||
Escape = 0x1B,
|
||||
|
||||
/// <summary>PrintScreen</summary>
|
||||
PrintScreen = 0x2C,
|
||||
|
||||
/// <summary>ScrollLock</summary>
|
||||
ScrollLock = 0x91,
|
||||
|
||||
/// <summary>Pause</summary>
|
||||
Pause = 0x13,
|
||||
|
||||
/// <summary>Insert</summary>
|
||||
Insert = 0x2D,
|
||||
|
||||
/// <summary>Delete</summary>
|
||||
Delete = 0x2E,
|
||||
|
||||
/// <summary>Home</summary>
|
||||
Home = 0x24,
|
||||
|
||||
/// <summary>End</summary>
|
||||
End = 0x23,
|
||||
|
||||
/// <summary>Page Up</summary>
|
||||
PageUp = 0x21,
|
||||
|
||||
/// <summary>Page Down</summary>
|
||||
PageDown = 0x22,
|
||||
|
||||
/// <summary>Backspace退格</summary>
|
||||
Backspace = 0x08,
|
||||
|
||||
/// <summary>Tab</summary>
|
||||
Tab = 0x09,
|
||||
|
||||
/// <summary>Caps Lock大写锁定</summary>
|
||||
CapsLock = 0x14,
|
||||
|
||||
/// <summary>Enter回车</summary>
|
||||
Enter = 0x0D,
|
||||
|
||||
///// <summary>Shift</summary>
|
||||
//Shift = 0x10,
|
||||
|
||||
/// <summary>左Shift</summary>
|
||||
LeftShift = 0xA0,
|
||||
|
||||
/// <summary>右Shift</summary>
|
||||
RightShift = 0xA1,
|
||||
|
||||
///// <summary>Ctrl</summary>
|
||||
//Ctrl = 0x11,
|
||||
|
||||
/// <summary>左Ctrl</summary>
|
||||
LeftCtrl = 0xA2,
|
||||
|
||||
/// <summary>右Ctrl</summary>
|
||||
RightCtrl = 0xA3,
|
||||
|
||||
///// <summary>Alt</summary>
|
||||
//Alt = 0x12,
|
||||
|
||||
/// <summary>左Alt</summary>
|
||||
LeftAlt = 0xA4,
|
||||
|
||||
/// <summary>右Alt</summary>
|
||||
RightAlt = 0xA5,
|
||||
|
||||
/// <summary>左Win键 (Microsoft Natural Keyboard)</summary>
|
||||
LeftWin = 0x5B,
|
||||
|
||||
/// <summary>右Win键 (Microsoft Natural Keyboard)</summary>
|
||||
RightWin = 0x5C,
|
||||
|
||||
/// <summary>菜单键 (Microsoft Natural Keyboard)</summary>
|
||||
Apps = 0x5D,
|
||||
|
||||
/// <summary>Space空格键</summary>
|
||||
Space = 0x20,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 方向键
|
||||
|
||||
/// <summary>方向键 ←</summary>
|
||||
Left = 0x25,
|
||||
|
||||
/// <summary>方向键 ↑</summary>
|
||||
Up = 0x26,
|
||||
|
||||
/// <summary>方向键 →</summary>
|
||||
Right = 0x27,
|
||||
|
||||
/// <summary>方向键 ↓</summary>
|
||||
Down = 0x28,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 字母区 - 字母
|
||||
|
||||
/// <summary>A</summary>
|
||||
A = 0x41,
|
||||
|
||||
/// <summary>B</summary>
|
||||
B = 0x42,
|
||||
|
||||
/// <summary>C</summary>
|
||||
C = 0x43,
|
||||
|
||||
/// <summary>D</summary>
|
||||
D = 0x44,
|
||||
|
||||
/// <summary>E</summary>
|
||||
E = 0x45,
|
||||
|
||||
/// <summary>F</summary>
|
||||
F = 0x46,
|
||||
|
||||
/// <summary>G</summary>
|
||||
G = 0x47,
|
||||
|
||||
/// <summary>H</summary>
|
||||
H = 0x48,
|
||||
|
||||
/// <summary>I</summary>
|
||||
I = 0x49,
|
||||
|
||||
/// <summary>J</summary>
|
||||
J = 0x4A,
|
||||
|
||||
/// <summary>K</summary>
|
||||
K = 0x4B,
|
||||
|
||||
/// <summary>L</summary>
|
||||
L = 0x4C,
|
||||
|
||||
/// <summary>M</summary>
|
||||
M = 0x4D,
|
||||
|
||||
/// <summary>N</summary>
|
||||
N = 0x4E,
|
||||
|
||||
/// <summary>O</summary>
|
||||
O = 0x4F,
|
||||
|
||||
/// <summary>P</summary>
|
||||
P = 0x50,
|
||||
|
||||
/// <summary>Q</summary>
|
||||
Q = 0x51,
|
||||
|
||||
/// <summary>R</summary>
|
||||
R = 0x52,
|
||||
|
||||
/// <summary>S</summary>
|
||||
S = 0x53,
|
||||
|
||||
/// <summary>T</summary>
|
||||
T = 0x54,
|
||||
|
||||
/// <summary>U</summary>
|
||||
U = 0x55,
|
||||
|
||||
/// <summary>V</summary>
|
||||
V = 0x56,
|
||||
|
||||
/// <summary>W</summary>
|
||||
W = 0x57,
|
||||
|
||||
/// <summary>X</summary>
|
||||
X = 0x58,
|
||||
|
||||
/// <summary>Y</summary>
|
||||
Y = 0x59,
|
||||
|
||||
/// <summary>Z</summary>
|
||||
Z = 0x5A,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 字母区 - 数字
|
||||
|
||||
/// <summary>0</summary>
|
||||
D0 = 0x30,
|
||||
|
||||
/// <summary>1</summary>
|
||||
D1 = 0x31,
|
||||
|
||||
/// <summary>2</summary>
|
||||
D2 = 0x32,
|
||||
|
||||
/// <summary>3</summary>
|
||||
D3 = 0x33,
|
||||
|
||||
/// <summary>4</summary>
|
||||
D4 = 0x34,
|
||||
|
||||
/// <summary>5</summary>
|
||||
D5 = 0x35,
|
||||
|
||||
/// <summary>6</summary>
|
||||
D6 = 0x36,
|
||||
|
||||
/// <summary>7</summary>
|
||||
D7 = 0x37,
|
||||
|
||||
/// <summary>8</summary>
|
||||
D8 = 0x38,
|
||||
|
||||
/// <summary>9</summary>
|
||||
D9 = 0x39,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 字母区 - 符号
|
||||
|
||||
/// <summary>引号 '</summary>
|
||||
Apostrophe = 0xDE,
|
||||
|
||||
/// <summary>逗号 ,</summary>
|
||||
Comma = 0xBC,
|
||||
|
||||
/// <summary>连接符 -</summary>
|
||||
Minus = 0xBD,
|
||||
|
||||
/// <summary>等于号 =</summary>
|
||||
Equal = 0xBB,
|
||||
|
||||
/// <summary>句号 .</summary>
|
||||
Period = 0xBE,
|
||||
|
||||
/// <summary>斜杠 /</summary>
|
||||
Slash = 0xBF,
|
||||
|
||||
/// <summary>反斜杠 \</summary>
|
||||
Backslash = 0xE2,
|
||||
|
||||
/// <summary>分号 ;</summary>
|
||||
Semicolon = 0xBA,
|
||||
|
||||
/// <summary>左方括号 [</summary>
|
||||
LeftSquareBracket = 0xDB,
|
||||
|
||||
/// <summary>右方括号 ]</summary>
|
||||
RightSquareBracket = 0xDD,
|
||||
|
||||
/// <summary>波浪号 `</summary>
|
||||
Tilde = 0xC0,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 小键盘区
|
||||
|
||||
/// <summary>Num Lock</summary>
|
||||
NumLock = 0x90,
|
||||
|
||||
/// <summary>Num 0</summary>
|
||||
NumPad0 = 0x60,
|
||||
|
||||
/// <summary>Num 1</summary>
|
||||
NumPad1 = 0x61,
|
||||
|
||||
/// <summary>Num 2</summary>
|
||||
NumPad2 = 0x62,
|
||||
|
||||
/// <summary>Num 3</summary>
|
||||
NumPad3 = 0x63,
|
||||
|
||||
/// <summary>Num 4</summary>
|
||||
NumPad4 = 0x64,
|
||||
|
||||
/// <summary>Num 5</summary>
|
||||
NumPad5 = 0x65,
|
||||
|
||||
/// <summary>Num 6</summary>
|
||||
NumPad6 = 0x66,
|
||||
|
||||
/// <summary>Num 7</summary>
|
||||
NumPad7 = 0x67,
|
||||
|
||||
/// <summary>Num 8</summary>
|
||||
NumPad8 = 0x68,
|
||||
|
||||
/// <summary>Num 9</summary>
|
||||
NumPad9 = 0x69,
|
||||
|
||||
/// <summary>Num .</summary>
|
||||
Decimal = 0x6E,
|
||||
|
||||
/// <summary>Num /</summary>
|
||||
Divide = 0x6F,
|
||||
|
||||
/// <summary>Num *</summary>
|
||||
Multiply = 0x6A,
|
||||
|
||||
/// <summary>Num -</summary>
|
||||
Subtract = 0x6D,
|
||||
|
||||
/// <summary>Num +</summary>
|
||||
Add = 0x6B,
|
||||
|
||||
/// <summary>Num Enter</summary>
|
||||
NumEnter = 0x0E,
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
[Serializable]
|
||||
public partial class OneDragonFlowConfig : ObservableObject
|
||||
{
|
||||
// 配置名
|
||||
[ObservableProperty]
|
||||
private string _name = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 所有任务的开关状态
|
||||
/// </summary>
|
||||
public Dictionary<string, bool> TaskEnabledList { get; set; } = new();
|
||||
|
||||
// 合成树脂的国家
|
||||
[ObservableProperty]
|
||||
private string _craftingBenchCountry = "枫丹";
|
||||
|
||||
// 冒险者协会的国家
|
||||
[ObservableProperty]
|
||||
private string _adventurersGuildCountry = "枫丹";
|
||||
|
||||
// 自动战斗配置的队伍名称
|
||||
[ObservableProperty]
|
||||
private string _partyName = string.Empty;
|
||||
|
||||
// 自动战斗配置的策略名称
|
||||
[ObservableProperty]
|
||||
private string _domainName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _weeklyDomainEnabled = false;
|
||||
|
||||
// 领取每日奖励的好感队伍名称
|
||||
[ObservableProperty]
|
||||
private string _dailyRewardPartyName = string.Empty;
|
||||
|
||||
|
||||
#region 每周秘境配置
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mondayThursdayPartyName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mondayThursdayDomainName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _tuesdayFridayPartyName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _tuesdayFridayDomainName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _wednesdaySaturdayPartyName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _wednesdaySaturdayDomainName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _sundayPartyName = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _sundayDomainName = string.Empty;
|
||||
|
||||
// 完成后操作
|
||||
[ObservableProperty]
|
||||
private string _completionAction = string.Empty;
|
||||
|
||||
// 通过当天是哪一天来返回配置
|
||||
public (string partyName, string domainName) GetDomainConfig()
|
||||
{
|
||||
if (WeeklyDomainEnabled)
|
||||
{
|
||||
var dayOfWeek = DateTime.Now.DayOfWeek;
|
||||
return dayOfWeek switch
|
||||
{
|
||||
DayOfWeek.Monday => (MondayThursdayPartyName, MondayThursdayDomainName),
|
||||
DayOfWeek.Tuesday => (TuesdayFridayPartyName, TuesdayFridayDomainName),
|
||||
DayOfWeek.Wednesday => (WednesdaySaturdayPartyName, WednesdaySaturdayDomainName),
|
||||
DayOfWeek.Thursday => (MondayThursdayPartyName, MondayThursdayDomainName),
|
||||
DayOfWeek.Friday => (TuesdayFridayPartyName, TuesdayFridayDomainName),
|
||||
DayOfWeek.Saturday => (WednesdaySaturdayPartyName, WednesdaySaturdayDomainName),
|
||||
DayOfWeek.Sunday => (SundayPartyName, SundayDomainName),
|
||||
_ => (PartyName, DomainName)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return (PartyName, DomainName);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
|
||||
[Serializable]
|
||||
public partial class OtherConfig : ObservableObject
|
||||
{
|
||||
//调度器任务和部分独立任务,失去焦点,自动激活游戏窗口
|
||||
[ObservableProperty]
|
||||
private bool _restoreFocusOnLostEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏语言名称
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _gameCultureInfoName = "zh-Hans";
|
||||
|
||||
/// <summary>
|
||||
/// BGI界面语言名称
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _uiCultureInfoName = "zh-Hans";
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.Model;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
[Serializable]
|
||||
public partial class PathingConditionConfig : ObservableObject
|
||||
{
|
||||
// 地图追踪条件配置
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Condition> _partyConditions = [];
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Condition> _avatarConditions = [];
|
||||
|
||||
// 只在传送传送点时复活
|
||||
[ObservableProperty]
|
||||
private bool _onlyInTeleportRecover = false;
|
||||
|
||||
// 使用小道具的间隔时间(ms)
|
||||
[ObservableProperty]
|
||||
private int _useGadgetIntervalMs = 0;
|
||||
|
||||
public static PathingConditionConfig Default => new()
|
||||
{
|
||||
AvatarConditions =
|
||||
[
|
||||
new Condition
|
||||
{
|
||||
Subject = "队伍中角色",
|
||||
Object = ["绮良良", "莱依拉", "茜特菈莉", "芭芭拉", "七七"],
|
||||
Result = "循环短E"
|
||||
},
|
||||
|
||||
new Condition
|
||||
{
|
||||
Subject = "队伍中角色",
|
||||
Object = ["钟离"],
|
||||
Result = "循环长E"
|
||||
},
|
||||
|
||||
new Condition
|
||||
{
|
||||
Subject = "队伍中角色",
|
||||
Object = ["迪希雅"],
|
||||
Result = "作为主要行走角色"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 找出当前应该切换的队伍名称
|
||||
/// </summary>
|
||||
/// <param name="materialName">采集物名称</param>
|
||||
/// <param name="specialActions">特殊动作</param>
|
||||
/// <returns></returns>
|
||||
public string? FilterPartyName(string? materialName, List<string?> specialActions)
|
||||
{
|
||||
if (specialActions is { Count: > 0 })
|
||||
{
|
||||
// 特殊动作匹配队伍名
|
||||
foreach (var action in specialActions)
|
||||
{
|
||||
if (string.IsNullOrEmpty(action))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ConditionDefinitions.ActionCnDic.TryGetValue(action, out var actionCn))
|
||||
{
|
||||
continue; // 不校验
|
||||
}
|
||||
|
||||
var condition = PartyConditions.FirstOrDefault(c => c.Subject == "动作" && c.Object.Contains(actionCn));
|
||||
if (condition is { Result: not null })
|
||||
{
|
||||
return condition.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 采集物匹配队伍名
|
||||
Condition? materialCondition = null;
|
||||
if (!string.IsNullOrEmpty(materialName))
|
||||
{
|
||||
materialCondition = PartyConditions.FirstOrDefault(c => c.Subject == "采集物" && c.Object.Contains(materialName));
|
||||
}
|
||||
if (materialCondition is { Result: not null })
|
||||
{
|
||||
return materialCondition.Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
materialCondition = PartyConditions.FirstOrDefault(c => c.Subject == "采集物" && c.Object.Contains("全部"));
|
||||
if (materialCondition is { Result: not null })
|
||||
{
|
||||
return materialCondition.Result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过条件配置生成队伍配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PathingPartyConfig BuildPartyConfigByCondition(CombatScenes combatScenes)
|
||||
{
|
||||
PathingPartyConfig partyConfig = PathingPartyConfig.BuildDefault();
|
||||
// 使用最优先匹配上的条件
|
||||
foreach (var avatarCondition in AvatarConditions)
|
||||
{
|
||||
if (avatarCondition.Result == "循环短E" || avatarCondition.Result == "循环长E")
|
||||
{
|
||||
foreach (var avatar in combatScenes.Avatars)
|
||||
{
|
||||
if (avatarCondition is { Object: not null } && avatarCondition.Object.Contains(avatar.Name))
|
||||
{
|
||||
partyConfig.GuardianAvatarIndex = avatar.Index.ToString();
|
||||
if (avatarCondition.Result == "循环长E")
|
||||
{
|
||||
partyConfig.GuardianElementalSkillLongPress = true;
|
||||
partyConfig.GuardianElementalSkillSecondInterval = avatar.SkillHoldCd.ToString(CultureInfo.CurrentCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
partyConfig.GuardianElementalSkillLongPress = false;
|
||||
partyConfig.GuardianElementalSkillSecondInterval = avatar.SkillCd.ToString(CultureInfo.CurrentCulture);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(partyConfig.GuardianAvatarIndex))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var avatarCondition in AvatarConditions)
|
||||
{
|
||||
if (avatarCondition.Result == "作为主要行走角色")
|
||||
{
|
||||
foreach (var avatar in combatScenes.Avatars)
|
||||
{
|
||||
if (avatarCondition is { Object: not null } && avatarCondition.Object.Contains(avatar.Name))
|
||||
{
|
||||
partyConfig.MainAvatarIndex = avatar.Index.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(partyConfig.MainAvatarIndex))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 默认元素力采集角色
|
||||
// var elementalCollectAvatars = ElementalCollectAvatarConfigs.Lists;
|
||||
// foreach (var avatar in combatScenes.Avatars)
|
||||
// {
|
||||
// var elementalCollectAvatar = elementalCollectAvatars.FirstOrDefault(x => x.Name == avatar.Name);
|
||||
// if (elementalCollectAvatar != null)
|
||||
// {
|
||||
// if (elementalCollectAvatar.ElementalType == ElementalType.Hydro)
|
||||
// {
|
||||
// partyConfig.HydroCollectAvatarIndex = avatar.Index.ToString();
|
||||
// }
|
||||
// else if (elementalCollectAvatar.ElementalType == ElementalType.Electro)
|
||||
// {
|
||||
// partyConfig.ElectroCollectAvatarIndex = avatar.Index.ToString();
|
||||
// }
|
||||
// else if (elementalCollectAvatar.ElementalType == ElementalType.Anemo)
|
||||
// {
|
||||
// partyConfig.AnemoCollectAvatarIndex = avatar.Index.ToString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return partyConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
[Serializable]
|
||||
public partial class PathingPartyConfig : ObservableObject
|
||||
{
|
||||
// 配置是否启用,不启用会使用地图追踪内的条件配置
|
||||
[ObservableProperty]
|
||||
private bool _enabled = false;
|
||||
|
||||
// 是否启用自动拾取
|
||||
[ObservableProperty]
|
||||
private bool _autoPickEnabled = true;
|
||||
// 切换到队伍的名称
|
||||
[ObservableProperty]
|
||||
private string _partyName = string.Empty;
|
||||
|
||||
// 切换队伍前是否前往须弥七天神像
|
||||
[ObservableProperty]
|
||||
private bool _isVisitStatueBeforeSwitchParty = false;
|
||||
|
||||
// 主要行走追踪的角色编号
|
||||
[ObservableProperty]
|
||||
private string _mainAvatarIndex = string.Empty;
|
||||
|
||||
// [盾角]使用元素战技的角色编号
|
||||
[ObservableProperty]
|
||||
private string _guardianAvatarIndex = string.Empty;
|
||||
|
||||
// [盾角]使用元素战技的时间间隔(s)
|
||||
[ObservableProperty]
|
||||
private string _guardianElementalSkillSecondInterval = string.Empty;
|
||||
|
||||
// [盾角]使用元素战技的方式 长按/短按
|
||||
[ObservableProperty]
|
||||
private bool _guardianElementalSkillLongPress = false;
|
||||
|
||||
// // normal_attack 配置几号位
|
||||
// [ObservableProperty]
|
||||
// private string _normalAttackAvatarIndex = string.Empty;
|
||||
//
|
||||
// // elemental_skill 配置几号位
|
||||
// [ObservableProperty]
|
||||
// private string _elementalSkillAvatarIndex = string.Empty;
|
||||
|
||||
// // hydro_collect 配置几号位
|
||||
// [ObservableProperty]
|
||||
// private string _hydroCollectAvatarIndex = string.Empty;
|
||||
//
|
||||
// // electro_collect 配置几号位
|
||||
// [ObservableProperty]
|
||||
// private string _electroCollectAvatarIndex = string.Empty;
|
||||
//
|
||||
// // anemo_collect 配置几号位
|
||||
// [ObservableProperty]
|
||||
// private string _anemoCollectAvatarIndex = string.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
public List<string> AvatarIndexList { get; } = ["", "1", "2", "3", "4"];
|
||||
|
||||
// 只在传送传送点时复活
|
||||
[ObservableProperty]
|
||||
private bool _onlyInTeleportRecover = false;
|
||||
|
||||
//允许在jsScript脚本中使用此地图追踪配置
|
||||
[ObservableProperty]
|
||||
private bool _jsScriptUseEnabled = false;
|
||||
|
||||
//允许在此调度器中(一般在JS脚本中)调用自动战斗任务时,采用此追踪配置里的战斗策略
|
||||
[ObservableProperty]
|
||||
private bool _soloTaskUseFightEnabled = false;
|
||||
|
||||
//不在某时执行
|
||||
[ObservableProperty]
|
||||
private string _skipDuring = "";
|
||||
|
||||
// 使用小道具的间隔时间
|
||||
[ObservableProperty]
|
||||
private int _useGadgetIntervalMs = 0;
|
||||
|
||||
// 启用进入剧情自动脱离
|
||||
[ObservableProperty]
|
||||
private bool _autoSkipEnabled = true;
|
||||
|
||||
// 自动冲刺启用
|
||||
[ObservableProperty]
|
||||
private bool _autoRunEnabled = true;
|
||||
|
||||
//启用自动战斗配置
|
||||
[ObservableProperty]
|
||||
private bool _autoFightEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private AutoFightConfig _autoFightConfig = new();
|
||||
public static PathingPartyConfig BuildDefault()
|
||||
{
|
||||
// 即便是不启用的情况下也设置默认值,减少后续使用的判断
|
||||
var pathingConditionConfig = TaskContext.Instance().Config.PathingConditionConfig;
|
||||
return new PathingPartyConfig
|
||||
{
|
||||
OnlyInTeleportRecover = pathingConditionConfig.OnlyInTeleportRecover,
|
||||
UseGadgetIntervalMs = pathingConditionConfig.UseGadgetIntervalMs
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using SharpDX.DirectInput;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Monitor;
|
||||
|
||||
@@ -11,6 +12,8 @@ public class DirectInputMonitor : IDisposable
|
||||
private bool _isRunning = true;
|
||||
|
||||
private readonly Mouse _mouse;
|
||||
|
||||
public static int Interval = 5;
|
||||
|
||||
public DirectInputMonitor()
|
||||
{
|
||||
@@ -34,8 +37,8 @@ public class DirectInputMonitor : IDisposable
|
||||
_mouse.Acquire();
|
||||
MouseState state = _mouse.GetCurrentState();
|
||||
// Debug.WriteLine($"{state.X} {state.Y} {state.Buttons[0]} {state.Buttons[1]}");
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveBy(state);
|
||||
Thread.Sleep(5); // 10ms, equivalent to CLOCKS_PER_SEC/100
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveBy(state, Kernel32.GetTickCount());
|
||||
Thread.Sleep(Interval); // 10ms, equivalent to CLOCKS_PER_SEC/100
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BetterGenshinImpact.Core.Recorder;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recorder;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.Model;
|
||||
@@ -18,6 +19,10 @@ public class MouseKeyMonitor
|
||||
/// </summary>
|
||||
private readonly Timer _fTimer = new();
|
||||
|
||||
private Keys _pickUpKey = Keys.F;
|
||||
|
||||
private User32.VK _pickUpKeyCode = User32.VK.VK_F;
|
||||
|
||||
//private readonly Random _random = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -25,6 +30,10 @@ public class MouseKeyMonitor
|
||||
/// </summary>
|
||||
private readonly Timer _spaceTimer = new();
|
||||
|
||||
private Keys _releaseControlKey = Keys.Space;
|
||||
|
||||
private User32.VK _releaseControlKeyCode = User32.VK.VK_SPACE;
|
||||
|
||||
private DateTime _firstFKeyDownTime = DateTime.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
@@ -46,27 +55,33 @@ public class MouseKeyMonitor
|
||||
_globalHook.MouseDownExt += GlobalHookMouseDownExt;
|
||||
_globalHook.MouseUpExt += GlobalHookMouseUpExt;
|
||||
_globalHook.MouseMoveExt += GlobalHookMouseMoveExt;
|
||||
_globalHook.MouseWheelExt += GlobalHookMouseWheelExt;
|
||||
//_globalHook.KeyPress += GlobalHookKeyPress;
|
||||
|
||||
_pickUpKey = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToWinFormKeys();
|
||||
_pickUpKeyCode = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToVK();
|
||||
_releaseControlKey = TaskContext.Instance().Config.KeyBindingsConfig.Jump.ToWinFormKeys();
|
||||
_releaseControlKeyCode = TaskContext.Instance().Config.KeyBindingsConfig.Jump.ToVK();
|
||||
|
||||
_firstSpaceKeyDownTime = DateTime.MaxValue;
|
||||
var si = TaskContext.Instance().Config.MacroConfig.SpaceFireInterval;
|
||||
_spaceTimer.Interval = si;
|
||||
_spaceTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_SPACE); };
|
||||
_spaceTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(_releaseControlKeyCode); };
|
||||
|
||||
var fi = TaskContext.Instance().Config.MacroConfig.FFireInterval;
|
||||
_fTimer.Interval = fi;
|
||||
_fTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(User32.VK.VK_F); };
|
||||
_fTimer.Elapsed += (sender, args) => { Simulation.PostMessage(_hWnd).KeyPress(_pickUpKeyCode); };
|
||||
}
|
||||
|
||||
private void GlobalHookKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
// Debug.WriteLine("KeyDown: \t{0}", e.KeyCode);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookKeyDown(e);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookKeyDown(e, Kernel32.GetTickCount());
|
||||
|
||||
// 热键按下事件
|
||||
HotKeyDown(sender, e);
|
||||
|
||||
if (e.KeyCode == Keys.Space)
|
||||
if (e.KeyCode == _releaseControlKey)
|
||||
{
|
||||
if (_firstSpaceKeyDownTime == DateTime.MaxValue)
|
||||
{
|
||||
@@ -80,7 +95,7 @@ public class MouseKeyMonitor
|
||||
_spaceTimer.Start();
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.F)
|
||||
else if (e.KeyCode == _pickUpKey)
|
||||
{
|
||||
if (_firstFKeyDownTime == DateTime.MaxValue)
|
||||
{
|
||||
@@ -99,12 +114,12 @@ public class MouseKeyMonitor
|
||||
private void GlobalHookKeyUp(object? sender, KeyEventArgs e)
|
||||
{
|
||||
// Debug.WriteLine("KeyUp: \t{0}", e.KeyCode);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookKeyUp(e);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookKeyUp(e, Kernel32.GetTickCount());
|
||||
|
||||
// 热键松开事件
|
||||
HotKeyUp(sender, e);
|
||||
|
||||
if (e.KeyCode == Keys.Space)
|
||||
if (e.KeyCode == _releaseControlKey)
|
||||
{
|
||||
if (_firstSpaceKeyDownTime != DateTime.MaxValue)
|
||||
{
|
||||
@@ -114,7 +129,7 @@ public class MouseKeyMonitor
|
||||
_spaceTimer.Stop();
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.F)
|
||||
else if (e.KeyCode == _pickUpKey)
|
||||
{
|
||||
if (_firstFKeyDownTime != DateTime.MaxValue)
|
||||
{
|
||||
@@ -166,6 +181,12 @@ public class MouseKeyMonitor
|
||||
// Debug.WriteLine("MouseMove: {0}; \t Location: {1};\t System Timestamp: {2}", e.Button, e.Location, e.Timestamp);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookMouseMoveTo(e);
|
||||
}
|
||||
|
||||
private void GlobalHookMouseWheelExt(object? sender, MouseEventExtArgs e)
|
||||
{
|
||||
// Debug.WriteLine("MouseMove: {0}; \t Location: {1};\t Delta: {2};\t System Timestamp: {3}", e.Button, e.Location, e.Delta, e.Timestamp);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookMouseWheel(e);
|
||||
}
|
||||
|
||||
public void Unsubscribe()
|
||||
{
|
||||
@@ -176,6 +197,7 @@ public class MouseKeyMonitor
|
||||
_globalHook.MouseDownExt -= GlobalHookMouseDownExt;
|
||||
_globalHook.MouseUpExt -= GlobalHookMouseUpExt;
|
||||
_globalHook.MouseMoveExt -= GlobalHookMouseMoveExt;
|
||||
_globalHook.MouseWheelExt -= GlobalHookMouseWheelExt;
|
||||
//_globalHook.KeyPress -= GlobalHookKeyPress;
|
||||
_globalHook.Dispose();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,33 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OCR;
|
||||
|
||||
public class OcrFactory
|
||||
{
|
||||
// public static IOcrService Media = Create(OcrEngineTypes.Media);
|
||||
public static IOcrService Paddle { get; } = Create(OcrEngineTypes.Paddle);
|
||||
public static IOcrService Paddle { get; private set; } = Create(OcrEngineTypes.Paddle);
|
||||
|
||||
public static IOcrService Create(OcrEngineTypes type)
|
||||
public static IOcrService Create(OcrEngineTypes type, string? cultureInfoName = null)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
OcrEngineTypes.Paddle => new PaddleOcrService(),
|
||||
OcrEngineTypes.Paddle => new PaddleOcrService(cultureInfoName),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
}
|
||||
|
||||
public static async Task ChangeCulture(string cultrueInfoName)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
lock (Paddle)
|
||||
{
|
||||
Paddle = Create(OcrEngineTypes.Paddle, cultrueInfoName);
|
||||
GC.Collect();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,30 @@ public class PaddleOcrService : IOcrService
|
||||
/// </summary>
|
||||
private readonly PaddleOcrAll _paddleOcrAll;
|
||||
|
||||
public PaddleOcrService()
|
||||
public PaddleOcrService(string? cultureInfoName = null)
|
||||
{
|
||||
var path = Global.Absolute(@"Assets\Model\PaddleOcr");
|
||||
var localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4);
|
||||
var localClsModel = ClassificationModel.FromDirectory(Path.Combine(path, "ch_ppocr_mobile_v2.0_cls"));
|
||||
var localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_rec"), Path.Combine(path, "ppocr_keys_v1.txt"), ModelVersion.V4);
|
||||
var model = new FullOcrModel(localDetModel, localClsModel, localRecModel);
|
||||
DetectionModel localDetModel;
|
||||
RecognizationModel localRecModel;
|
||||
FullOcrModel model;
|
||||
switch (cultureInfoName)
|
||||
{
|
||||
case "zh-Hant":
|
||||
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4); // 和简中共用一下det
|
||||
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "chinese_cht_PP-OCRv3_rec_infer"), Path.Combine(path, "chinese_cht_dict.txt"), ModelVersion.V3);
|
||||
//model = OnlineFullModels.TraditionalChineseV3.DownloadAsync().Result;
|
||||
break;
|
||||
case "fr":
|
||||
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "en_PP-OCRv3_det_infer"), ModelVersion.V3);
|
||||
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "latin_PP-OCRv3_rec_infer"), Path.Combine(path, "latin_dict.txt"), ModelVersion.V3);
|
||||
break;
|
||||
default:
|
||||
localDetModel = DetectionModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_det"), ModelVersion.V4);
|
||||
localRecModel = RecognizationModel.FromDirectory(Path.Combine(path, "ch_PP-OCRv4_rec"), Path.Combine(path, "ppocr_keys_v1.txt"), ModelVersion.V4);
|
||||
|
||||
break;
|
||||
}
|
||||
model = new FullOcrModel(localDetModel, localRecModel);
|
||||
// Action<PaddleConfig> device = TaskContext.Instance().Config.InferenceDevice switch
|
||||
// {
|
||||
// "CPU" => PaddleDevice.Onnx(),
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
|
||||
@@ -45,6 +46,16 @@ public class BgiYoloV8Predictor(string modelRelativePath) : IDisposable
|
||||
}
|
||||
}
|
||||
Debug.WriteLine("YOLOv8识别结果:" + JsonSerializer.Serialize(dict));
|
||||
|
||||
var list = new List<RectDrawable>();
|
||||
foreach (var box in result.Boxes)
|
||||
{
|
||||
var rect = new Rect(box.Bounds.X, box.Bounds.Y, box.Bounds.Width, box.Bounds.Height);
|
||||
list.Add(region.ToRectDrawable(rect, modelRelativePath));
|
||||
}
|
||||
|
||||
VisionContext.Instance().DrawContent.PutOrRemoveRectList(modelRelativePath, list);
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
|
||||
public class BgiYoloV8PredictorFactory
|
||||
{
|
||||
static Dictionary<string, BgiYoloV8Predictor> _predictors = new();
|
||||
|
||||
public static BgiYoloV8Predictor GetPredictor(string modelRelativePath)
|
||||
{
|
||||
if (!_predictors.ContainsKey(modelRelativePath))
|
||||
{
|
||||
_predictors[modelRelativePath] = new BgiYoloV8Predictor(modelRelativePath);
|
||||
}
|
||||
|
||||
return _predictors[modelRelativePath];
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ using OpenCvSharp.XFeatures2D;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
@@ -137,10 +136,10 @@ public class FeatureMatcher
|
||||
/// <summary>
|
||||
/// 合并邻近的特征点后匹配(临近特征)
|
||||
/// </summary>
|
||||
/// <param name="queryMat">查询的图</param>
|
||||
/// <param name="queryMat">查询图像的 Mat 对象。</param>
|
||||
/// <param name="prevX">上次匹配到的坐标x</param>
|
||||
/// <param name="prevY">上次匹配到的坐标y</param>
|
||||
/// <param name="queryMatMask">查询Mask</param>
|
||||
/// <param name="queryMatMask">查询图像的 Mask,用于限定检测特征的区域。</param>
|
||||
/// <returns></returns>
|
||||
public Point2f Match(Mat queryMat, float prevX, float prevY, Mat? queryMatMask = null)
|
||||
{
|
||||
@@ -151,18 +150,17 @@ public class FeatureMatcher
|
||||
Debug.WriteLine($"---------切换到新的特征块({cellRow},{cellCol}),合并特征点--------");
|
||||
_lastMergedBlock = KeyPointFeatureBlockHelper.MergeNeighboringFeatures(_blocks, _trainDescriptors, cellRow, cellCol);
|
||||
}
|
||||
|
||||
return Match(_lastMergedBlock.KeyPointArray, _lastMergedBlock.Descriptor!, queryMat, queryMatMask);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 普通匹配
|
||||
/// 用于从训练图像和查询图像中找到匹配的特征点,计算透视变换并确定查询图像的中心点在训练图像中的位置。
|
||||
/// </summary>
|
||||
/// <param name="trainKeyPoints"></param>
|
||||
/// <param name="trainDescriptors"></param>
|
||||
/// <param name="queryMat"></param>
|
||||
/// <param name="queryMatMask"></param>
|
||||
/// <param name="matcherType"></param>
|
||||
/// <param name="trainKeyPoints">训练图像中的关键点集合。</param>
|
||||
/// <param name="trainDescriptors">训练图像的特征描述子。</param>
|
||||
/// <param name="queryMat">查询图像的 Mat 对象。</param>
|
||||
/// <param name="queryMatMask">查询图像的 Mask,用于限定检测特征的区域。</param>
|
||||
/// <param name="matcherType">描述符匹配器的类型,默认为 DescriptorMatcherType.FlannBased</param>
|
||||
/// <returns></returns>
|
||||
public Point2f Match(KeyPoint[] trainKeyPoints, Mat trainDescriptors, Mat queryMat, Mat? queryMatMask = null,
|
||||
DescriptorMatcherType matcherType = DescriptorMatcherType.FlannBased)
|
||||
|
||||
@@ -5,39 +5,32 @@ using System.IO;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch;
|
||||
|
||||
public class FeatureStorage(string name)
|
||||
public class FeatureStorage
|
||||
{
|
||||
private readonly string rootPath = Global.Absolute(@"Assets\Map\");
|
||||
|
||||
private readonly string _rootPath;
|
||||
private readonly string _name;
|
||||
public void SetType(Feature2DType type)
|
||||
{
|
||||
TypeName = type.ToString();
|
||||
}
|
||||
|
||||
public string TypeName { get; set; } = "UNKNOWN";
|
||||
public FeatureStorage(string name)
|
||||
{
|
||||
_name = name;
|
||||
_rootPath = Global.Absolute(@"Assets\Map\");
|
||||
}
|
||||
public FeatureStorage(string name, string rootPath)
|
||||
{
|
||||
_name = name;
|
||||
_rootPath = rootPath;
|
||||
}
|
||||
|
||||
// public KeyPoint[]? LoadKeyPointArray1()
|
||||
// {
|
||||
// CreateFolder();
|
||||
// string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
|
||||
// if (File.Exists(kpPath))
|
||||
// {
|
||||
// return ObjectUtils.Deserialize(File.ReadAllBytes(kpPath)) as KeyPoint[];
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void SaveKeyPointArray1(KeyPoint[] kpArray)
|
||||
// {
|
||||
// CreateFolder();
|
||||
// string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
|
||||
// File.WriteAllBytes(kpPath, ObjectUtils.Serialize(kpArray));
|
||||
// }
|
||||
public string TypeName { get; set; } = "UNKNOWN";
|
||||
|
||||
public KeyPoint[]? LoadKeyPointArray()
|
||||
{
|
||||
CreateFolder();
|
||||
string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
|
||||
string kpPath = Path.Combine(_rootPath, $"{_name}_{TypeName}.kp");
|
||||
if (File.Exists(kpPath))
|
||||
{
|
||||
FileStorage fs = new(kpPath, FileStorage.Modes.Read);
|
||||
@@ -51,7 +44,7 @@ public class FeatureStorage(string name)
|
||||
public void SaveKeyPointArray(KeyPoint[] kpArray)
|
||||
{
|
||||
CreateFolder();
|
||||
string kpPath = Path.Combine(rootPath, $"{name}_{TypeName}.kp");
|
||||
string kpPath = Path.Combine(_rootPath, $"{_name}_{TypeName}.kp");
|
||||
FileStorage fs = new(kpPath, FileStorage.Modes.Write);
|
||||
fs.Write("kp", kpArray);
|
||||
fs.Release();
|
||||
@@ -59,42 +52,16 @@ public class FeatureStorage(string name)
|
||||
|
||||
private void CreateFolder()
|
||||
{
|
||||
if (Directory.Exists(rootPath) == false)
|
||||
if (Directory.Exists(_rootPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(rootPath);
|
||||
Directory.CreateDirectory(_rootPath);
|
||||
}
|
||||
}
|
||||
|
||||
// public Mat? LoadDescMat1()
|
||||
// {
|
||||
// CreateFolder();
|
||||
// // 格式: Surf_336767x128.mat
|
||||
// var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}_*.mat", SearchOption.AllDirectories);
|
||||
// if (files.Length == 0)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// else if (files.Length > 1)
|
||||
// {
|
||||
// Debug.WriteLine($"[FeatureSerializer] Found multiple files: {string.Join(", ", files)}");
|
||||
// }
|
||||
// var rowColPair = Path.GetFileNameWithoutExtension(files[0])
|
||||
// .Replace($"{name}_{TypeName}_", "")
|
||||
// .Split('x');
|
||||
// if (rowColPair.Length != 2)
|
||||
// {
|
||||
// Debug.WriteLine($"[FeatureSerializer] Invalid file name: {files[0]}");
|
||||
// return null;
|
||||
// }
|
||||
// GCHandle pinnedArray = GCHandle.Alloc(ObjectUtils.Deserialize(File.ReadAllBytes(files[0])), GCHandleType.Pinned);
|
||||
// IntPtr pointer = pinnedArray.AddrOfPinnedObject();
|
||||
// return new Mat(Convert.ToInt32(rowColPair[0]), Convert.ToInt32(rowColPair[1]), MatType.CV_32FC1, pointer);
|
||||
// }
|
||||
|
||||
public Mat? LoadDescMat()
|
||||
{
|
||||
CreateFolder();
|
||||
var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}.mat", SearchOption.AllDirectories);
|
||||
var files = Directory.GetFiles(_rootPath, $"{_name}_{TypeName}.mat", SearchOption.AllDirectories);
|
||||
if (files.Length == 0)
|
||||
{
|
||||
return null;
|
||||
@@ -109,34 +76,17 @@ public class FeatureStorage(string name)
|
||||
return mat;
|
||||
}
|
||||
|
||||
// public void SaveDescMat1(Mat descMat)
|
||||
// {
|
||||
// CreateFolder();
|
||||
// // 删除旧文件
|
||||
// var files = Directory.GetFiles(rootPath, $"{name}_{TypeName}_*.mat", SearchOption.AllDirectories);
|
||||
// foreach (var file in files)
|
||||
// {
|
||||
// File.Delete(file);
|
||||
// }
|
||||
//
|
||||
// var descPath = Path.Combine(rootPath, $"{name}_{TypeName}_{descMat.Rows}x{descMat.Cols}.mat");
|
||||
// var bytes = new byte[descMat.Step(0) * descMat.Rows]; // matSrcRet.Total() * matSrcRet.ElemSize()
|
||||
// Marshal.Copy(descMat.Data, bytes, 0, bytes.Length);
|
||||
// File.WriteAllBytes(descPath, ObjectUtils.Serialize(bytes));
|
||||
// }
|
||||
|
||||
public void SaveDescMat(Mat descMat)
|
||||
{
|
||||
CreateFolder();
|
||||
// 删除旧文件
|
||||
var fileName = $"{name}_{TypeName}.mat";
|
||||
var files = Directory.GetFiles(rootPath, fileName, SearchOption.AllDirectories);
|
||||
var fileName = $"{_name}_{TypeName}.mat";
|
||||
var files = Directory.GetFiles(_rootPath, fileName, SearchOption.AllDirectories);
|
||||
foreach (var file in files)
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
var descPath = Path.Combine(rootPath, fileName);
|
||||
var descPath = Path.Combine(_rootPath, fileName);
|
||||
FileStorage fs = new(descPath, FileStorage.Modes.Write);
|
||||
fs.Write("desc", descMat);
|
||||
fs.Release();
|
||||
|
||||
@@ -20,6 +20,9 @@ public class RecognitionObject
|
||||
/// </summary>
|
||||
public Rect RegionOfInterest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 识别对象名称,可以为空
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region 模板匹配
|
||||
@@ -91,6 +94,29 @@ public class RecognitionObject
|
||||
if (UseMask && TemplateImageMat != null && MaskMat == null) MaskMat = OpenCvCommonHelper.CreateMask(TemplateImageMat, MaskColor.ToScalar());
|
||||
return this;
|
||||
}
|
||||
|
||||
public static RecognitionObject TemplateMatch(Mat mat)
|
||||
{
|
||||
var ro = new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = mat,
|
||||
};
|
||||
|
||||
return ro.InitTemplate();
|
||||
}
|
||||
|
||||
public static RecognitionObject TemplateMatch(Mat mat, double x, double y, double w, double h)
|
||||
{
|
||||
var ro = new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = mat,
|
||||
RegionOfInterest = new Rect((int)Math.Round(x), (int)Math.Round(y), (int)Math.Round(w), (int)Math.Round(h))
|
||||
};
|
||||
|
||||
return ro.InitTemplate();
|
||||
}
|
||||
|
||||
#endregion 模板匹配
|
||||
|
||||
@@ -144,5 +170,28 @@ public class RecognitionObject
|
||||
/// </summary>
|
||||
public List<string> RegexMatchText { get; set; } = [];
|
||||
|
||||
public static RecognitionObject Ocr(double x, double y, double w, double h)
|
||||
{
|
||||
return new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = new Rect((int)Math.Round(x), (int)Math.Round(y), (int)Math.Round(w), (int)Math.Round(h))
|
||||
};
|
||||
}
|
||||
|
||||
public static RecognitionObject Ocr(Rect rect)
|
||||
{
|
||||
return new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = rect
|
||||
};
|
||||
}
|
||||
|
||||
public static RecognitionObject OcrThis = new()
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr
|
||||
};
|
||||
|
||||
#endregion OCR文字识别
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
// using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
// using BetterGenshinImpact.GameTask.Common.Map;
|
||||
// using BetterGenshinImpact.GameTask.Model.Area;
|
||||
// using BetterGenshinImpact.GameTask.Model.Enum;
|
||||
//
|
||||
// using BetterGenshinImpact.View.Drawable;
|
||||
// using BetterGenshinImpact.ViewModel.Pages;
|
||||
// using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
|
||||
using SharpDX.DirectInput;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
@@ -114,7 +115,7 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
|
||||
ra.Dispose();
|
||||
}
|
||||
|
||||
public void GlobalHookKeyDown(KeyEventArgs e)
|
||||
public void GlobalHookKeyDown(KeyEventArgs e, uint time)
|
||||
{
|
||||
// 排除热键
|
||||
if (e.KeyCode.ToString() == TaskContext.Instance().Config.HotKeyConfig.KeyMouseMacroRecordHotkey)
|
||||
@@ -138,10 +139,10 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
|
||||
_keyDownState.Add(e.KeyCode, true);
|
||||
}
|
||||
// Debug.WriteLine($"KeyDown: {e.KeyCode}");
|
||||
_recorder?.KeyDown(e);
|
||||
_recorder?.KeyDown(e, time);
|
||||
}
|
||||
|
||||
public void GlobalHookKeyUp(KeyEventArgs e)
|
||||
public void GlobalHookKeyUp(KeyEventArgs e, uint time)
|
||||
{
|
||||
if (e.KeyCode.ToString() == TaskContext.Instance().Config.HotKeyConfig.Test1Hotkey)
|
||||
{
|
||||
@@ -152,7 +153,7 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
|
||||
{
|
||||
// Debug.WriteLine($"KeyUp: {e.KeyCode}");
|
||||
_keyDownState[e.KeyCode] = false;
|
||||
_recorder?.KeyUp(e);
|
||||
_recorder?.KeyUp(e, time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,15 +178,21 @@ public class GlobalKeyMouseRecord : Singleton<GlobalKeyMouseRecord>
|
||||
// Debug.WriteLine($"MouseMove: {e.X}, {e.Y}");
|
||||
_recorder?.MouseMoveTo(e);
|
||||
}
|
||||
|
||||
public void GlobalHookMouseWheel(MouseEventExtArgs e)
|
||||
{
|
||||
// Debug.WriteLine($"MouseWheel: {e.Delta}");
|
||||
_recorder?.MouseWheel(e);
|
||||
}
|
||||
|
||||
public void GlobalHookMouseMoveBy(MouseState state)
|
||||
public void GlobalHookMouseMoveBy(MouseState state, uint time)
|
||||
{
|
||||
if (state is { X: 0, Y: 0 } || !_isInMainUi)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Debug.WriteLine($"MouseMoveBy: {state.X}, {state.Y}");
|
||||
_recorder?.MouseMoveBy(state);
|
||||
_recorder?.MouseMoveBy(state, time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Fischless.WindowsInput;
|
||||
using Vanara.PInvoke;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
@@ -48,7 +49,7 @@ public class KeyMouseMacroPlayer
|
||||
public static async Task PlayMacro(List<MacroEvent> macroEvents, CancellationToken ct)
|
||||
{
|
||||
WorkingArea = PrimaryScreen.WorkingArea;
|
||||
var startTime = DateTime.UtcNow;
|
||||
var startTime = Kernel32.GetTickCount();
|
||||
foreach (var e in macroEvents)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
@@ -56,23 +57,42 @@ public class KeyMouseMacroPlayer
|
||||
return;
|
||||
}
|
||||
|
||||
var timeToWait = (int)(e.Time - (DateTime.UtcNow - startTime).TotalMilliseconds);
|
||||
var timeToWait = e.Time - (Kernel32.GetTickCount() - startTime);
|
||||
if (timeToWait < 0)
|
||||
{
|
||||
TaskControl.Logger.LogWarning("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), -timeToWait);
|
||||
TaskControl.Logger.LogDebug("无法原速重放事件{Event},落后{TimeToWait}ms", e.Type.ToString(), (-timeToWait).ToString("F0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(timeToWait, ct);
|
||||
await Task.Delay((int)timeToWait, ct);
|
||||
}
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
case MacroEventType.KeyDown:
|
||||
Simulation.SendInput.Keyboard.KeyDown((User32.VK)e.KeyCode!);
|
||||
break;
|
||||
var vkDown = (User32.VK)e.KeyCode!;
|
||||
if (InputBuilder.IsExtendedKey(vkDown))
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyDown(false, vkDown);
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyDown(vkDown);
|
||||
}
|
||||
|
||||
break;
|
||||
case MacroEventType.KeyUp:
|
||||
Simulation.SendInput.Keyboard.KeyUp((User32.VK)e.KeyCode!);
|
||||
|
||||
var vkUp = (User32.VK)e.KeyCode!;
|
||||
if (InputBuilder.IsExtendedKey(vkUp))
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyUp(false, vkUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyUp(vkUp);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MacroEventType.MouseDown:
|
||||
@@ -145,11 +165,21 @@ public class KeyMouseMacroPlayer
|
||||
Simulation.SendInput.Mouse.MoveMouseTo(ToVirtualDesktopX(e.MouseX), ToVirtualDesktopY(e.MouseY));
|
||||
break;
|
||||
|
||||
case MacroEventType.MouseWheel:
|
||||
var num = (int)(e.MouseY / 120.0);
|
||||
if (num != 0)
|
||||
{
|
||||
// 不支持多次的场景,但是不会出现这种情况
|
||||
Simulation.SendInput.Mouse.VerticalScroll(num);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MacroEventType.MouseMoveBy:
|
||||
if (e.CameraOrientation != null)
|
||||
{
|
||||
var cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcGreyMat);
|
||||
var diff = (cao - (int)e.CameraOrientation + 180) % 360 - 180;
|
||||
var cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcMat);
|
||||
var diff = ((int)Math.Round(cao) - (int)e.CameraOrientation + 180) % 360 - 180;
|
||||
diff += diff < -180 ? 360 : 0;
|
||||
//过滤一下特别大的角度偏差
|
||||
if (diff != 0 && diff < 8 && diff > -8)
|
||||
@@ -158,6 +188,7 @@ public class KeyMouseMacroPlayer
|
||||
e.MouseX -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(e.MouseX, e.MouseY);
|
||||
break;
|
||||
|
||||
@@ -178,4 +209,4 @@ public class KeyMouseMacroPlayer
|
||||
{
|
||||
return y * 65535 * 1d / WorkingArea.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Windows.Forms;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recorder;
|
||||
|
||||
@@ -16,7 +17,7 @@ public class KeyMouseRecorder
|
||||
{
|
||||
public List<MacroEvent> MacroEvents { get; } = [];
|
||||
|
||||
public DateTime StartTime { get; set; } = DateTime.UtcNow;
|
||||
public uint StartTime { get; set; } = Kernel32.GetTickCount();
|
||||
|
||||
public DateTime LastOrientationDetection { get; set; } = DateTime.UtcNow;
|
||||
|
||||
@@ -34,6 +35,11 @@ public class KeyMouseRecorder
|
||||
|
||||
public string ToJsonMacro()
|
||||
{
|
||||
// MacroEvents 需要以实际时间进行排序
|
||||
MacroEvents.Sort((a, b) => a.Time.CompareTo(b.Time));
|
||||
// 删除为负数的时间
|
||||
MacroEvents.RemoveAll(m => m.Time < 0);
|
||||
|
||||
var rect = TaskContext.Instance().SystemInfo.CaptureAreaRect;
|
||||
// 合并鼠标移动事件
|
||||
var mergedMacroEvents = new List<MacroEvent>();
|
||||
@@ -89,6 +95,10 @@ public class KeyMouseRecorder
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentMerge != null)
|
||||
{
|
||||
mergedMacroEvents.Add(currentMerge);
|
||||
}
|
||||
KeyMouseScript keyMouseScript = new()
|
||||
{
|
||||
MacroEvents = mergedMacroEvents,
|
||||
@@ -104,23 +114,23 @@ public class KeyMouseRecorder
|
||||
return JsonSerializer.Serialize(keyMouseScript, JsonOptions);
|
||||
}
|
||||
|
||||
public void KeyDown(KeyEventArgs e)
|
||||
public void KeyDown(KeyEventArgs e, uint time)
|
||||
{
|
||||
MacroEvents.Add(new MacroEvent
|
||||
{
|
||||
Type = MacroEventType.KeyDown,
|
||||
KeyCode = e.KeyValue,
|
||||
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
|
||||
Time = time - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
public void KeyUp(KeyEventArgs e)
|
||||
public void KeyUp(KeyEventArgs e, uint time)
|
||||
{
|
||||
MacroEvents.Add(new MacroEvent
|
||||
{
|
||||
Type = MacroEventType.KeyUp,
|
||||
KeyCode = e.KeyValue,
|
||||
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
|
||||
Time = time - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -132,7 +142,7 @@ public class KeyMouseRecorder
|
||||
MouseX = e.X,
|
||||
MouseY = e.Y,
|
||||
MouseButton = e.Button.ToString(),
|
||||
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
|
||||
Time = e.Timestamp - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,7 +154,7 @@ public class KeyMouseRecorder
|
||||
MouseX = e.X,
|
||||
MouseY = e.Y,
|
||||
MouseButton = e.Button.ToString(),
|
||||
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
|
||||
Time = e.Timestamp - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -155,28 +165,40 @@ public class KeyMouseRecorder
|
||||
Type = MacroEventType.MouseMoveTo,
|
||||
MouseX = e.X,
|
||||
MouseY = e.Y,
|
||||
Time = (DateTime.UtcNow - StartTime).TotalMilliseconds
|
||||
Time = e.Timestamp - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
public void MouseWheel(MouseEventExtArgs e)
|
||||
{
|
||||
MacroEvents.Add(new MacroEvent
|
||||
{
|
||||
Type = MacroEventType.MouseWheel,
|
||||
MouseY = e.Delta, // 120 的倍率
|
||||
Time = e.Timestamp - StartTime
|
||||
});
|
||||
}
|
||||
|
||||
public void MouseMoveBy(MouseState state)
|
||||
public void MouseMoveBy(MouseState state, uint time)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
int? cao = null;
|
||||
if (TaskContext.Instance().Config.RecordConfig.IsRecordCameraOrientation)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
if ((now - LastOrientationDetection).TotalMilliseconds > 100.0)
|
||||
{
|
||||
LastOrientationDetection = now;
|
||||
cao = CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcGreyMat);
|
||||
cao = (int)Math.Round(CameraOrientation.Compute(TaskControl.CaptureToRectArea().SrcMat));
|
||||
}
|
||||
}
|
||||
|
||||
MacroEvents.Add(new MacroEvent
|
||||
{
|
||||
Type = MacroEventType.MouseMoveBy,
|
||||
MouseX = state.X,
|
||||
MouseY = state.Y,
|
||||
Time = (now - StartTime).TotalMilliseconds,
|
||||
Time = time - 5 - StartTime,
|
||||
CameraOrientation = cao,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@ public enum MacroEventType
|
||||
MouseMoveTo,
|
||||
MouseMoveBy,
|
||||
MouseDown,
|
||||
MouseUp
|
||||
MouseUp,
|
||||
MouseWheel
|
||||
}
|
||||
@@ -1,20 +1,43 @@
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
public class AutoPathingScript(string rootPath)
|
||||
public class AutoPathingScript
|
||||
{
|
||||
private object? _config = null;
|
||||
private string _rootPath;
|
||||
public AutoPathingScript(string rootPath, object? config) {
|
||||
|
||||
_config = config;
|
||||
_rootPath = rootPath;
|
||||
}
|
||||
|
||||
public async Task Run(string json)
|
||||
{
|
||||
var task = PathingTask.BuildFromJson(json);
|
||||
await new PathExecutor(CancellationContext.Instance.Cts).Pathing(task);
|
||||
var pathExecutor = new PathExecutor(CancellationContext.Instance.Cts.Token);
|
||||
if (_config != null && _config is PathingPartyConfig patyConfig ) {
|
||||
pathExecutor.PartyConfig = patyConfig;
|
||||
}
|
||||
await pathExecutor.Pathing(task);
|
||||
}
|
||||
|
||||
public async Task RunFile(string path)
|
||||
{
|
||||
var json = await new LimitedFile(rootPath).ReadText(path);
|
||||
var json = await new LimitedFile(_rootPath).ReadText(path);
|
||||
await Run(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从已订阅的内容中获取文件
|
||||
/// </summary>
|
||||
/// <param name="path">在 `\User\AutoPathing` 目录下获取文件</param>
|
||||
public async Task RunFileFromUser(string path)
|
||||
{
|
||||
var json = await new LimitedFile(Global.Absolute(@"User\AutoPathing")).ReadText(path);
|
||||
await Run(json);
|
||||
}
|
||||
}
|
||||
@@ -4,35 +4,81 @@ using BetterGenshinImpact.ViewModel.Pages;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
public class Dispatcher
|
||||
{
|
||||
private object _config = null;
|
||||
|
||||
public Dispatcher(object config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public void RunTask()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加实时任务
|
||||
/// 添加实时任务,会清理之前的所有任务
|
||||
/// </summary>
|
||||
/// <param name="timer">实时任务触发器</param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public void AddTimer(RealtimeTimer timer)
|
||||
{
|
||||
ClearAllTriggers();
|
||||
try
|
||||
{
|
||||
AddTrigger(timer);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
if (e is ArgumentNullException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有实时任务
|
||||
/// </summary>
|
||||
public void ClearAllTriggers()
|
||||
{
|
||||
TaskTriggerDispatcher.Instance().ClearTriggers();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加实时任务,不会清理之前的任务
|
||||
/// </summary>
|
||||
/// <param name="timer"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public void AddTrigger(RealtimeTimer timer)
|
||||
{
|
||||
var realtimeTimer = timer;
|
||||
if (realtimeTimer == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(realtimeTimer), "实时任务对象不能为空");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(realtimeTimer.Name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(realtimeTimer.Name), "实时任务名称不能为空");
|
||||
}
|
||||
|
||||
TaskTriggerDispatcher.Instance().AddTrigger(realtimeTimer.Name, realtimeTimer.Config);
|
||||
if (!TaskTriggerDispatcher.Instance().AddTrigger(realtimeTimer.Name, realtimeTimer.Config))
|
||||
{
|
||||
throw new ArgumentException($"添加实时任务失败: {realtimeTimer.Name}", nameof(realtimeTimer.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运行独立任务
|
||||
/// </summary>
|
||||
@@ -51,6 +97,7 @@ public class Dispatcher
|
||||
{
|
||||
throw new ArgumentNullException(nameof(soloTask), "独立任务对象不能为空");
|
||||
}
|
||||
|
||||
var taskSettingsPageViewModel = App.GetService<TaskSettingsPageViewModel>();
|
||||
if (taskSettingsPageViewModel == null)
|
||||
{
|
||||
@@ -61,15 +108,30 @@ public class Dispatcher
|
||||
switch (soloTask.Name)
|
||||
{
|
||||
case "AutoGeniusInvokation":
|
||||
taskSettingsPageViewModel.SwitchAutoGeniusInvokationCommand.Execute(null);
|
||||
if (taskSettingsPageViewModel.GetTcgStrategy(out var content))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await new AutoGeniusInvokationTask(new GeniusInvokationTaskParam(content)).Start(CancellationContext
|
||||
.Instance.Cts.Token);
|
||||
break;
|
||||
|
||||
case "AutoWood":
|
||||
taskSettingsPageViewModel.SwitchAutoWoodCommand.Execute(null);
|
||||
await new AutoWoodTask(new WoodTaskParam(taskSettingsPageViewModel.AutoWoodRoundNum,
|
||||
taskSettingsPageViewModel.AutoWoodDailyMaxCount)).Start(CancellationContext.Instance.Cts.Token);
|
||||
break;
|
||||
|
||||
case "AutoFight":
|
||||
taskSettingsPageViewModel.SwitchAutoFightCommand.Execute(null);
|
||||
|
||||
/*if (taskSettingsPageViewModel.GetFightStrategy(out var path1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var autoFightConfig = TaskContext.Instance().Config.AutoFightConfig;
|
||||
var param = new AutoFightParam(path1, autoFightConfig);
|
||||
await new AutoFightTask(param).Start(CancellationContext.Instance.Cts.Token);*/
|
||||
await new AutoFightHandler().RunAsyncByScript(CancellationContext.Instance.Cts.Token, null, _config);
|
||||
break;
|
||||
|
||||
case "AutoDomain":
|
||||
@@ -77,15 +139,21 @@ public class Dispatcher
|
||||
{
|
||||
return;
|
||||
}
|
||||
await new AutoDomainTask(new AutoDomainParam(0, path)).Start(CancellationContext.Instance.Cts);
|
||||
|
||||
await new AutoDomainTask(new AutoDomainParam(0, path)).Start(CancellationContext.Instance.Cts.Token);
|
||||
break;
|
||||
|
||||
case "AutoMusicGame":
|
||||
taskSettingsPageViewModel.SwitchAutoMusicGameCommand.Execute(null);
|
||||
// case "AutoMusicGame":
|
||||
// taskSettingsPageViewModel.SwitchAutoMusicGameCommand.Execute(null);
|
||||
// break;
|
||||
|
||||
case "AutoFishing":
|
||||
await new AutoFishingTask(AutoFishingTaskParam.BuildFromSoloTaskConfig(soloTask.Config)).Start(
|
||||
CancellationContext.Instance.Cts.Token);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentException($"未知的任务名称: {soloTask.Name}", nameof(soloTask.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
using Vanara.PInvoke;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
@@ -37,7 +41,12 @@ public class Genshin
|
||||
/// <returns></returns>
|
||||
public async Task Tp(double x, double y)
|
||||
{
|
||||
await new TpTask(CancellationContext.Instance.Cts).Tp(x, y);
|
||||
await new TpTask(CancellationContext.Instance.Cts.Token).Tp(x, y);
|
||||
}
|
||||
|
||||
public async Task Tp(double x, double y, bool force)
|
||||
{
|
||||
await new TpTask(CancellationContext.Instance.Cts.Token).Tp(x, y, force);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,4 +61,116 @@ public class Genshin
|
||||
double.TryParse(y, out var dy);
|
||||
await Tp(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Tp(string x, string y, bool force)
|
||||
{
|
||||
double.TryParse(x, out var dx);
|
||||
double.TryParse(y, out var dy);
|
||||
await Tp(dx, dy, force);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换队伍
|
||||
/// </summary>
|
||||
/// <param name="partyName">队伍界面自定义的队伍名称</param>
|
||||
/// <returns></returns>
|
||||
public async Task SwitchParty(string partyName)
|
||||
{
|
||||
await new SwitchPartyTask().Start(partyName, CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动点击空月祝福
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task BlessingOfTheWelkinMoon()
|
||||
{
|
||||
await new BlessingOfTheWelkinMoonTask().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 持续对话并选择目标选项
|
||||
/// </summary>
|
||||
/// <param name="option">选项文本</param>
|
||||
/// <param name="skipTimes">跳过次数</param>
|
||||
/// <param name="isOrange">是否为橙色选项</param>
|
||||
/// <returns></returns>
|
||||
public async Task ChooseTalkOption(string option, int skipTimes = 10, bool isOrange = false)
|
||||
{
|
||||
await new ChooseTalkOptionTask().SingleSelectText(option, CancellationContext.Instance.Cts.Token, skipTimes, isOrange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 一键领取纪行奖励
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task ClaimBattlePassRewards()
|
||||
{
|
||||
await new ClaimBattlePassRewardsTask().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 领取长效历练点奖励
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task ClaimEncounterPointsRewards()
|
||||
{
|
||||
await new ClaimEncounterPointsRewardsTask().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前往冒险家协会领取奖励
|
||||
/// </summary>
|
||||
/// <param name="country">国家名称</param>
|
||||
/// <returns></returns>
|
||||
public async Task GoToAdventurersGuild(string country)
|
||||
{
|
||||
await new GoToAdventurersGuildTask().Start(country, CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前往合成台
|
||||
/// </summary>
|
||||
/// <param name="country">国家名称</param>
|
||||
/// <returns></returns>
|
||||
public async Task GoToCraftingBench(string country)
|
||||
{
|
||||
await new GoToCraftingBenchTask().Start(country, CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回主界面
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task ReturnMainUi()
|
||||
{
|
||||
await new ReturnMainUiTask().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 钓鱼
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task AutoFishing(int fishingTimePolicy = 0)
|
||||
{
|
||||
var taskSettingsPageViewModel = App.GetService<TaskSettingsPageViewModel>();
|
||||
if (taskSettingsPageViewModel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(taskSettingsPageViewModel), "内部视图模型对象为空");
|
||||
}
|
||||
|
||||
var param = AutoFishingTaskParam.BuildFromConfig(TaskContext.Instance().Config.AutoFishingConfig, taskSettingsPageViewModel.SaveScreenshotOnKeyTick);
|
||||
param.FishingTimePolicy = (FishingTimePolicy)fishingTimePolicy;
|
||||
await new AutoFishingTask(param).Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新登录原神
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task Relogin()
|
||||
{
|
||||
await new ExitAndReloginJob().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,10 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using Vanara.PInvoke;
|
||||
using static Vanara.PInvoke.User32;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
@@ -20,17 +24,80 @@ public class GlobalMethod
|
||||
|
||||
public static void KeyDown(string key)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyDown(ToVk(key));
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonDown();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonDown();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonDown();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyDown(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void KeyUp(string key)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyUp(ToVk(key));
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonUp();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyUp(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void KeyPress(string key)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyPress(ToVk(key));
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonClick();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonClick();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonClick();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyPress(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static User32.VK ToVk(string key)
|
||||
@@ -45,6 +112,7 @@ public class GlobalMethod
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion 键盘操作
|
||||
|
||||
#region 鼠标操作
|
||||
@@ -91,12 +159,12 @@ public class GlobalMethod
|
||||
public static void Click(int x, int y)
|
||||
{
|
||||
MoveMouseTo(x, y);
|
||||
Simulation.SendInput.Mouse.LeftButtonClick();
|
||||
LeftButtonClick();
|
||||
}
|
||||
|
||||
public static void LeftButtonClick()
|
||||
{
|
||||
Simulation.SendInput.Mouse.LeftButtonClick();
|
||||
Simulation.SendInput.Mouse.LeftButtonDown().Sleep(60).LeftButtonUp();
|
||||
}
|
||||
|
||||
public static void LeftButtonDown()
|
||||
@@ -111,7 +179,7 @@ public class GlobalMethod
|
||||
|
||||
public static void RightButtonClick()
|
||||
{
|
||||
Simulation.SendInput.Mouse.RightButtonClick();
|
||||
Simulation.SendInput.Mouse.RightButtonDown().Sleep(60).RightButtonUp();
|
||||
}
|
||||
|
||||
public static void RightButtonDown()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
@@ -59,4 +60,16 @@ public class LimitedFile(string rootPath)
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取Mat图片
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public Mat ReadImageMatSync(string path)
|
||||
{
|
||||
path = NormalizePath(path);
|
||||
var mat = Mat.FromStream(File.OpenRead(path), ImreadModes.Color);
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
using Microsoft.ClearScript;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 独立任务
|
||||
@@ -13,19 +15,16 @@ public class SoloTask
|
||||
/// <summary>
|
||||
/// 独立任务配置
|
||||
/// </summary>
|
||||
public object? Config;
|
||||
public object? Config { get; set; }
|
||||
|
||||
public SoloTask(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public SoloTask(string name, dynamic config)
|
||||
public SoloTask(string name, ScriptObject config)
|
||||
{
|
||||
Name = name;
|
||||
// if (Name == "AutoPick")
|
||||
// {
|
||||
// Config = ScriptObjectConverter.ConvertTo<AutoPickExternalConfig>(config);
|
||||
// }
|
||||
Config = config;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using OpenCvSharp;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script;
|
||||
|
||||
@@ -17,19 +18,19 @@ public class EngineExtend
|
||||
/// <param name="engine"></param>
|
||||
/// <param name="workDir"></param>
|
||||
/// <param name="searchPaths"></param>
|
||||
public static void InitHost(IScriptEngine engine, string workDir, string[]? searchPaths = null)
|
||||
public static void InitHost(IScriptEngine engine, string workDir, string[]? searchPaths = null, object? config = null)
|
||||
{
|
||||
// engine.AddHostObject("xHost", new ExtendedHostFunctions()); // 有越权的安全风险
|
||||
|
||||
// 添加我的自定义实例化对象
|
||||
engine.AddHostObject("keyMouseScript", new KeyMouseScript(workDir));
|
||||
engine.AddHostObject("pathingScript", new AutoPathingScript(workDir));
|
||||
engine.AddHostObject("pathingScript", new AutoPathingScript(workDir, config));
|
||||
engine.AddHostObject("genshin", new Dependence.Genshin());
|
||||
engine.AddHostObject("log", new Log());
|
||||
engine.AddHostObject("file", new LimitedFile(workDir)); // 限制文件访问
|
||||
|
||||
// 任务调度器
|
||||
engine.AddHostObject("dispatcher", new Dispatcher());
|
||||
engine.AddHostObject("dispatcher", new Dispatcher(config));
|
||||
engine.AddHostType("RealtimeTimer", typeof(RealtimeTimer));
|
||||
engine.AddHostType("SoloTask", typeof(SoloTask));
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
using BetterGenshinImpact.Service;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Group;
|
||||
|
||||
/// <summary>
|
||||
/// 调度器 配置组
|
||||
/// </summary>
|
||||
public partial class ScriptGroup : ObservableObject
|
||||
{
|
||||
public int Index { get; set; }
|
||||
@@ -14,6 +18,9 @@ public partial class ScriptGroup : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _name = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private ScriptGroupConfig _config = new();
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<ScriptGroupProject> _projects = [];
|
||||
|
||||
@@ -34,6 +41,22 @@ public partial class ScriptGroup : ObservableObject
|
||||
|
||||
public static ScriptGroup FromJson(string json)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<ScriptGroup>(json) ?? throw new Exception("解析配置组JSON配置失败");
|
||||
var group = Newtonsoft.Json.JsonConvert.DeserializeObject<ScriptGroup>(json) ?? throw new Exception("解析配置组JSON配置失败");
|
||||
ResetGroupInfo(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
public static void ResetGroupInfo(ScriptGroup group)
|
||||
{
|
||||
foreach (var project in group.Projects)
|
||||
{
|
||||
project.GroupInfo = group;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddProject(ScriptGroupProject project)
|
||||
{
|
||||
project.GroupInfo = this;
|
||||
Projects.Add(project);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Group;
|
||||
|
||||
[Serializable]
|
||||
public partial class ScriptGroupConfig : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private PathingPartyConfig _pathingConfig = new();
|
||||
|
||||
/// <summary>
|
||||
/// Shell 执行配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ShellConfig _shellConfig = new();
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用 Shell 执行配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _enableShellConfig;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using BetterGenshinImpact.Core.Script.Project;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.Shell;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
@@ -64,6 +65,19 @@ public partial class ScriptGroupProject : ObservableObject
|
||||
|
||||
public ExpandoObject? JsScriptSettingsObject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属配置组
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public ScriptGroup? GroupInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下一个从此执行标志
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
[ObservableProperty]
|
||||
public bool? _nextFlag = false;
|
||||
|
||||
public ScriptGroupProject()
|
||||
{
|
||||
}
|
||||
@@ -99,6 +113,11 @@ public partial class ScriptGroupProject : ObservableObject
|
||||
return new ScriptGroupProject(name, name, "KeyMouse");
|
||||
}
|
||||
|
||||
public static ScriptGroupProject BuildShellProject(string command)
|
||||
{
|
||||
return new ScriptGroupProject(command, "", "Shell");
|
||||
}
|
||||
|
||||
public static ScriptGroupProject BuildPathingProject(string name, string folder)
|
||||
{
|
||||
return new ScriptGroupProject(name, folder, "Pathing");
|
||||
@@ -124,24 +143,45 @@ public partial class ScriptGroupProject : ObservableObject
|
||||
{
|
||||
throw new Exception("JS脚本未初始化");
|
||||
}
|
||||
await Project.ExecuteAsync(JsScriptSettingsObject);
|
||||
JsScriptSettingsObject ??= new ExpandoObject();
|
||||
|
||||
var pathingPartyConfig = GroupInfo?.Config.PathingConfig;
|
||||
if (!(pathingPartyConfig is { Enabled: true, JsScriptUseEnabled: true }))
|
||||
{
|
||||
pathingPartyConfig = null;
|
||||
}
|
||||
|
||||
await Project.ExecuteAsync(JsScriptSettingsObject, pathingPartyConfig);
|
||||
}
|
||||
if (Type == "KeyMouse")
|
||||
else if (Type == "KeyMouse")
|
||||
{
|
||||
// 加载并执行
|
||||
var json = await File.ReadAllTextAsync(Global.Absolute(@$"User\KeyMouseScript\{Name}"));
|
||||
await KeyMouseMacroPlayer.PlayMacro(json, CancellationContext.Instance.Cts.Token, false);
|
||||
}
|
||||
if (Type == "Pathing")
|
||||
else if (Type == "Pathing")
|
||||
{
|
||||
// 加载并执行
|
||||
var task = PathingTask.BuildFromFilePath(Path.Combine(MapPathingViewModel.PathJsonPath, FolderName, Name));
|
||||
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
|
||||
await new PathExecutor(CancellationContext.Instance.Cts).Pathing(task);
|
||||
var pathingTask = new PathExecutor(CancellationContext.Instance.Cts.Token);
|
||||
pathingTask.PartyConfig = GroupInfo?.Config.PathingConfig;
|
||||
if (pathingTask.PartyConfig is null || pathingTask.PartyConfig.AutoPickEnabled)
|
||||
{
|
||||
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
|
||||
}
|
||||
|
||||
await pathingTask.Pathing(task);
|
||||
}
|
||||
else
|
||||
else if (Type == "Shell")
|
||||
{
|
||||
//throw new Exception("不支持的脚本类型");
|
||||
ShellConfig? shellConfig = null;
|
||||
if (GroupInfo?.Config.EnableShellConfig ?? false)
|
||||
{
|
||||
shellConfig = GroupInfo?.Config.ShellConfig;
|
||||
}
|
||||
|
||||
var task = new ShellTask(ShellTaskParam.BuildFromConfig(Name, shellConfig ?? new ShellConfig()));
|
||||
await task.Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +207,8 @@ public class ScriptGroupProjectExtensions
|
||||
{
|
||||
{ "Javascript", "JS脚本" },
|
||||
{ "KeyMouse", "键鼠脚本" },
|
||||
{ "Pathing", "路径追踪" }
|
||||
{ "Pathing", "地图追踪" },
|
||||
{ "Shell", "Shell" }
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> StatusDescriptions = new()
|
||||
|
||||
@@ -4,7 +4,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.Model;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Project;
|
||||
|
||||
@@ -49,6 +51,12 @@ public class Manifest
|
||||
{
|
||||
throw new FileNotFoundException("main js file not found.");
|
||||
}
|
||||
|
||||
// 比较版本号大小 BgiVersion
|
||||
if (!string.IsNullOrWhiteSpace(BgiVersion) && Global.IsNewVersion(BgiVersion))
|
||||
{
|
||||
TaskControl.Logger.LogError("脚本 {Name} 版本号要求 {BgiVersion} 大于当前 BetterGI 版本号 {CurrentVersion} , 脚本可能无法正常工作,请更新 BetterGI 版本!", Name, BgiVersion, Global.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SettingItem> LoadSettingItems(string path)
|
||||
@@ -65,6 +73,7 @@ public class Manifest
|
||||
var json = File.ReadAllText(settingFile);
|
||||
settingItems = JsonSerializer.Deserialize<List<SettingItem>>(json, ConfigService.JsonOptions) ?? [];
|
||||
}
|
||||
|
||||
return settingItems;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Project;
|
||||
|
||||
@@ -22,24 +24,31 @@ public class ScriptProject
|
||||
{
|
||||
FolderName = folderName;
|
||||
ProjectPath = Path.Combine(Global.ScriptPath(), folderName);
|
||||
if (!Directory.Exists(ProjectPath))
|
||||
{
|
||||
throw new DirectoryNotFoundException("脚本文件夹不存在:" + ProjectPath);
|
||||
}
|
||||
ManifestFile = Path.GetFullPath(Path.Combine(ProjectPath, "manifest.json"));
|
||||
if (!File.Exists(ManifestFile))
|
||||
{
|
||||
throw new FileNotFoundException("manifest.json file not found.");
|
||||
throw new FileNotFoundException("manifest.json文件不存在,请确认此脚本是JS脚本类型。" + ManifestFile);
|
||||
}
|
||||
|
||||
Manifest = Manifest.FromJson(File.ReadAllText(ManifestFile));
|
||||
Manifest.Validate(ProjectPath);
|
||||
}
|
||||
|
||||
public StackPanel? LoadSettingUi(dynamic context)
|
||||
public ScrollViewer? LoadSettingUi(dynamic context)
|
||||
{
|
||||
var settingItems = Manifest.LoadSettingItems(ProjectPath);
|
||||
if (settingItems.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var stackPanel = new StackPanel();
|
||||
var stackPanel = new StackPanel
|
||||
{
|
||||
Margin = new Thickness(0, 0, 20, 0) // 给右侧滚动条留出位置
|
||||
};
|
||||
foreach (var item in settingItems)
|
||||
{
|
||||
var controls = item.ToControl(context);
|
||||
@@ -49,20 +58,30 @@ public class ScriptProject
|
||||
}
|
||||
}
|
||||
|
||||
return stackPanel;
|
||||
var scrollViewer = new ScrollViewer
|
||||
{
|
||||
Content = stackPanel,
|
||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
|
||||
MaxHeight = 350 // 设置最大高度
|
||||
};
|
||||
|
||||
return scrollViewer;
|
||||
}
|
||||
|
||||
public IScriptEngine BuildScriptEngine()
|
||||
public IScriptEngine BuildScriptEngine(PathingPartyConfig? partyConfig = null)
|
||||
{
|
||||
IScriptEngine engine = new V8ScriptEngine(V8ScriptEngineFlags.UseCaseInsensitiveMemberBinding | V8ScriptEngineFlags.EnableTaskPromiseConversion);
|
||||
EngineExtend.InitHost(engine, ProjectPath, Manifest.Library);
|
||||
EngineExtend.InitHost(engine, ProjectPath, Manifest.Library,partyConfig);
|
||||
return engine;
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync(dynamic? context = null)
|
||||
public async Task ExecuteAsync(dynamic? context = null, PathingPartyConfig? partyConfig=null)
|
||||
{
|
||||
// 默认值
|
||||
GlobalMethod.SetGameMetrics(1920, 1080);
|
||||
// 加载代码
|
||||
var code = await LoadCode();
|
||||
var engine = BuildScriptEngine();
|
||||
var engine = BuildScriptEngine(partyConfig);
|
||||
if (context != null)
|
||||
{
|
||||
// 写入配置的内容
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Script.WebView;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.Helpers.Http;
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.View.Controls.Webview;
|
||||
@@ -16,6 +17,7 @@ using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Vanara.PInvoke;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script;
|
||||
@@ -33,7 +35,11 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
public static readonly string ReposTempPath = Path.Combine(ReposPath, "Temp");
|
||||
|
||||
// 中央仓库信息地址
|
||||
public static readonly string CenterRepoInfoUrl = "https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/repo.json";
|
||||
public static readonly List<string> CenterRepoInfoUrls =
|
||||
[
|
||||
"https://raw.githubusercontent.com/babalae/bettergi-scripts-list/refs/heads/main/repo.json",
|
||||
"https://r2-script.bettergi.com/github_mirror/repo.json",
|
||||
];
|
||||
|
||||
// 中央仓库解压后文件夹名
|
||||
public static readonly string CenterRepoUnzipName = "bettergi-scripts-list-main";
|
||||
@@ -54,6 +60,11 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
var scriptConfig = TaskContext.Instance().Config.ScriptConfig;
|
||||
|
||||
if (!Directory.Exists(ReposPath))
|
||||
{
|
||||
Directory.CreateDirectory(ReposPath);
|
||||
}
|
||||
|
||||
// 判断更新周期是否到达
|
||||
if (DateTime.Now - scriptConfig.LastUpdateScriptRepoTime >= TimeSpan.FromDays(scriptConfig.AutoUpdateScriptRepoPeriod))
|
||||
{
|
||||
@@ -81,18 +92,34 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
public async Task<(string, bool)> UpdateCenterRepo()
|
||||
{
|
||||
// 测速并获取信息
|
||||
var res = await ProxySpeedTester.GetFastestProxyAsync(CenterRepoInfoUrl);
|
||||
// 解析信息
|
||||
var fastProxyUrl = res.Item1;
|
||||
var jsonString = res.Item2;
|
||||
var (fastUrl, jsonString) = await ProxySpeedTester.GetFastestUrlAsync(CenterRepoInfoUrls);
|
||||
if (string.IsNullOrEmpty(jsonString))
|
||||
{
|
||||
throw new Exception("从互联网下载最新的仓库信息失败");
|
||||
}
|
||||
|
||||
var (time, url, file) = ParseJson(jsonString);
|
||||
|
||||
var updated = false;
|
||||
|
||||
// 检查仓库是否存在,不存在则下载
|
||||
if (!Directory.Exists(CenterRepoPath))
|
||||
var needDownload = false;
|
||||
if (Directory.Exists(CenterRepoPath))
|
||||
{
|
||||
await DownloadRepoAndUnzip(string.Format(fastProxyUrl, url));
|
||||
var p = Directory.GetFiles(CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (p is null)
|
||||
{
|
||||
needDownload = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
needDownload = true;
|
||||
}
|
||||
|
||||
if (needDownload)
|
||||
{
|
||||
await DownloadRepoAndUnzip(url);
|
||||
updated = true;
|
||||
}
|
||||
|
||||
@@ -108,7 +135,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
// 检查是否需要更新
|
||||
if (long.Parse(time) > long.Parse(time2))
|
||||
{
|
||||
await DownloadRepoAndUnzip(string.Format(fastProxyUrl, url2));
|
||||
await DownloadRepoAndUnzip(url2);
|
||||
updated = true;
|
||||
}
|
||||
|
||||
@@ -130,6 +157,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
throw new Exception("本地仓库缺少 repo.json");
|
||||
}
|
||||
|
||||
// 获取与 localRepoJsonPath 同名(无扩展名)的文件夹路径
|
||||
var folderName = Path.GetFileNameWithoutExtension(localRepoJsonPath);
|
||||
var folderPath = Path.Combine(Path.GetDirectoryName(localRepoJsonPath)!, folderName);
|
||||
@@ -137,6 +165,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
throw new Exception("本地仓库文件夹不存在");
|
||||
}
|
||||
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
@@ -183,7 +212,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
// 删除旧文件夹
|
||||
if (Directory.Exists(CenterRepoPath))
|
||||
{
|
||||
Directory.Delete(CenterRepoPath, true);
|
||||
DirectoryHelper.DeleteReadOnlyDirectory(CenterRepoPath);
|
||||
}
|
||||
|
||||
// 使用 System.IO.Compression 解压
|
||||
@@ -193,10 +222,18 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
public async Task ImportScriptFromClipboard()
|
||||
{
|
||||
// 获取剪切板内容
|
||||
if (Clipboard.ContainsText())
|
||||
try
|
||||
{
|
||||
string clipboardText = Clipboard.GetText();
|
||||
await ImportScriptFromUri(clipboardText, true);
|
||||
if (Clipboard.ContainsText())
|
||||
{
|
||||
string clipboardText = Clipboard.GetText();
|
||||
await ImportScriptFromUri(clipboardText, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// 剪切板内容可能获取会失败
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +253,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
Content = $"检测到{(formClipboard ? "剪切板上存在" : "")}脚本订阅链接,解析后需要导入的脚本为:{pathJson}。\n是否导入并覆盖此文件或者文件夹下的脚本?",
|
||||
CloseButtonText = "关闭",
|
||||
PrimaryButtonText = "确认导入",
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
Owner = Application.Current.MainWindow,
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
};
|
||||
|
||||
var result = await uiMessageBox.ShowDialogAsync();
|
||||
@@ -225,6 +262,20 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
await ImportScriptFromPathJson(pathJson);
|
||||
}
|
||||
|
||||
// ContentDialog dialog = new()
|
||||
// {
|
||||
// Title = "脚本订阅",
|
||||
// Content = $"检测到{(formClipboard ? "剪切板上存在" : "")}脚本订阅链接,解析后需要导入的脚本为:{pathJson}。\n是否导入并覆盖此文件或者文件夹下的脚本?",
|
||||
// CloseButtonText = "关闭",
|
||||
// PrimaryButtonText = "确认导入",
|
||||
// };
|
||||
//
|
||||
// var result = await dialog.ShowAsync();
|
||||
// if (result == ContentDialogResult.Primary)
|
||||
// {
|
||||
// await ImportScriptFromPathJson(pathJson);
|
||||
// }
|
||||
}
|
||||
|
||||
if (formClipboard)
|
||||
@@ -273,7 +324,31 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
Toast.Information("获取最新仓库信息中...");
|
||||
|
||||
// 更新仓库
|
||||
var (repoPath, _) = await Task.Run(UpdateCenterRepo);
|
||||
string repoPath;
|
||||
try
|
||||
{
|
||||
(repoPath, _) = await Task.Run(UpdateCenterRepo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Toast.Warning("获取最新仓库信息失败,尝试使用本地已有仓库信息");
|
||||
try
|
||||
{
|
||||
repoPath = FindCenterRepoPath();
|
||||
}
|
||||
catch
|
||||
{
|
||||
await MessageBox.ErrorAsync("本地无仓库信息,请至少成功更新一次脚本仓库信息!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(repoPath))
|
||||
{
|
||||
await MessageBox.ErrorAsync("本地无仓库信息,请至少成功更新一次脚本仓库信息!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// // 收集将被覆盖的文件和文件夹
|
||||
// var filesToOverwrite = new List<string>();
|
||||
@@ -338,13 +413,19 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
if (Directory.Exists(destPath))
|
||||
{
|
||||
Directory.Delete(destPath, true);
|
||||
DirectoryHelper.DeleteDirectoryWithReadOnlyCheck(destPath);
|
||||
}
|
||||
|
||||
CopyDirectory(scriptPath, destPath);
|
||||
|
||||
// 图标处理
|
||||
DealWithIconFolder(destPath);
|
||||
}
|
||||
else if (File.Exists(scriptPath))
|
||||
{
|
||||
// 目标文件所在文件夹不存在时创建它
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destPath)!);
|
||||
|
||||
if (File.Exists(destPath))
|
||||
{
|
||||
File.Delete(destPath);
|
||||
@@ -379,6 +460,8 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
var destSubDir = Path.Combine(destDir, Path.GetFileName(dir));
|
||||
CopyDirectory(dir, destSubDir);
|
||||
// 图标处理
|
||||
DealWithIconFolder(destSubDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,11 +486,9 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
{
|
||||
_webWindow = new WebpageWindow
|
||||
{
|
||||
Title = "enshin Copilot Scripts | BetterGI 脚本本地中央仓库",
|
||||
Title = "Genshin Copilot Scripts | BetterGI 脚本本地中央仓库",
|
||||
Width = 1366,
|
||||
Height = 768,
|
||||
// Owner = Application.Current.MainWindow,
|
||||
WindowState = WindowState.Maximized
|
||||
};
|
||||
_webWindow.Closed += (s, e) => _webWindow = null;
|
||||
_webWindow.Panel!.DownloadFolderPath = MapPathingViewModel.PathJsonPath;
|
||||
@@ -420,4 +501,25 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
|
||||
_webWindow.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理带有 icon.ico 和 desktop.ini 的文件夹
|
||||
/// </summary>
|
||||
/// <param name="folderPath"></param>
|
||||
private void DealWithIconFolder(string folderPath)
|
||||
{
|
||||
if (Directory.Exists(folderPath)
|
||||
&& File.Exists(Path.Combine(folderPath, "desktop.ini")))
|
||||
{
|
||||
// 使用 Vanara 库中的 SetFileAttributes 函数设置文件夹属性
|
||||
if (Kernel32.SetFileAttributes(folderPath, FileFlagsAndAttributes.FILE_ATTRIBUTE_READONLY))
|
||||
{
|
||||
Debug.WriteLine($"成功将文件夹设置为只读: {folderPath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine($"无法设置文件夹为只读: {folderPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Policy;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.ViewModel.Message;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.WebView;
|
||||
|
||||
@@ -13,40 +18,50 @@ namespace BetterGenshinImpact.Core.Script.WebView;
|
||||
[ComVisible(true)]
|
||||
public class RepoWebBridge
|
||||
{
|
||||
public string GetRepoJson()
|
||||
public async Task<string> GetRepoJson()
|
||||
{
|
||||
try
|
||||
{
|
||||
await ScriptRepoUpdater.Instance.UpdateCenterRepo();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Toast.Warning($"更新仓库信息失败:{e.Message}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(ScriptRepoUpdater.CenterRepoPath))
|
||||
{
|
||||
throw new Exception("仓库文件夹不存在,请至少成功更新一次仓库!");
|
||||
}
|
||||
|
||||
var localRepoJsonPath = Directory.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (localRepoJsonPath is null)
|
||||
{
|
||||
_ = ScriptRepoUpdater.Instance.UpdateCenterRepo().ConfigureAwait(false);
|
||||
localRepoJsonPath = Directory.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories).FirstOrDefault();
|
||||
if (localRepoJsonPath is null)
|
||||
{
|
||||
throw new Exception("本地仓库缺少 repo.json");
|
||||
}
|
||||
throw new Exception("repo.json 仓库索引文件不存在,请至少成功更新一次仓库!");
|
||||
}
|
||||
|
||||
var json = File.ReadAllText(localRepoJsonPath);
|
||||
var json = await File.ReadAllTextAsync(localRepoJsonPath);
|
||||
return json;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "获取仓库信息失败!");
|
||||
await MessageBox.ShowAsync(e.Message, "获取仓库信息失败");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void ImportUri(string url)
|
||||
public async void ImportUri(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
ScriptRepoUpdater.Instance.ImportScriptFromUri(url, false).ConfigureAwait(false);
|
||||
await ScriptRepoUpdater.Instance.ImportScriptFromUri(url, false);
|
||||
WeakReferenceMessenger.Default.Send(new RefreshDataMessage("Refresh"));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "订阅脚本链接失败!");
|
||||
await MessageBox.ShowAsync(e.Message, "订阅脚本链接失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// 模拟按键类型
|
||||
/// </summary>
|
||||
public enum KeyType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 单击按键(KeyPress)
|
||||
/// </summary>
|
||||
KeyPress,
|
||||
|
||||
/// <summary>
|
||||
/// 按住按键(KeyDown)
|
||||
/// </summary>
|
||||
KeyDown,
|
||||
|
||||
/// <summary>
|
||||
/// 释放按键(KeyUp)
|
||||
/// </summary>
|
||||
KeyUp,
|
||||
|
||||
/// <summary>
|
||||
/// 长按1s
|
||||
/// </summary>
|
||||
Hold,
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原神按键动作
|
||||
/// </summary>
|
||||
public enum GIActions
|
||||
{
|
||||
/// <summary>
|
||||
/// 向前移动
|
||||
/// </summary>
|
||||
MoveForward,
|
||||
|
||||
/// <summary>
|
||||
/// 向后移动
|
||||
/// </summary>
|
||||
MoveBackward,
|
||||
|
||||
/// <summary>
|
||||
/// 向左移动
|
||||
/// </summary>
|
||||
MoveLeft,
|
||||
|
||||
/// <summary>
|
||||
/// 向右移动
|
||||
/// </summary>
|
||||
MoveRight,
|
||||
|
||||
/// <summary>
|
||||
/// 切换走/跑;特定操作模式下向下移动
|
||||
/// </summary>
|
||||
SwitchToWalkOrRun,
|
||||
|
||||
/// <summary>
|
||||
/// 普通攻击
|
||||
/// </summary>
|
||||
NormalAttack,
|
||||
|
||||
/// <summary>
|
||||
/// 元素战技
|
||||
/// </summary>
|
||||
ElementalSkill,
|
||||
|
||||
/// <summary>
|
||||
/// 元素爆发
|
||||
/// </summary>
|
||||
ElementalBurst,
|
||||
|
||||
/// <summary>
|
||||
/// 冲刺(键盘)
|
||||
/// </summary>
|
||||
SprintKeyboard,
|
||||
|
||||
/// <summary>
|
||||
/// 冲刺(鼠标)
|
||||
/// </summary>
|
||||
SprintMouse,
|
||||
|
||||
/// <summary>
|
||||
/// 切换瞄准模式
|
||||
/// </summary>
|
||||
SwitchAimingMode,
|
||||
|
||||
/// <summary>
|
||||
/// 跳跃;特定操作模式下向上移动
|
||||
/// </summary>
|
||||
Jump,
|
||||
|
||||
/// <summary>
|
||||
/// 落下
|
||||
/// </summary>
|
||||
Drop,
|
||||
|
||||
/// <summary>
|
||||
/// 拾取/交互(自动拾取由AutoPick模块管理)
|
||||
/// </summary>
|
||||
PickUpOrInteract,
|
||||
|
||||
/// <summary>
|
||||
/// 快捷使用小道具
|
||||
/// </summary>
|
||||
QuickUseGadget,
|
||||
|
||||
/// <summary>
|
||||
/// 特定玩法内交互操作
|
||||
/// </summary>
|
||||
InteractionInSomeMode,
|
||||
|
||||
/// <summary>
|
||||
/// 开启任务追踪
|
||||
/// </summary>
|
||||
QuestNavigation,
|
||||
|
||||
/// <summary>
|
||||
/// 中断挑战
|
||||
/// </summary>
|
||||
AbandonChallenge,
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色1
|
||||
/// </summary>
|
||||
SwitchMember1,
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色2
|
||||
/// </summary>
|
||||
SwitchMember2,
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色3
|
||||
/// </summary>
|
||||
SwitchMember3,
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色4
|
||||
/// </summary>
|
||||
SwitchMember4,
|
||||
|
||||
/// <summary>
|
||||
/// 切换小队角色5
|
||||
/// </summary>
|
||||
SwitchMember5,
|
||||
|
||||
/// <summary>
|
||||
/// 呼出快捷轮盘
|
||||
/// </summary>
|
||||
ShortcutWheel,
|
||||
|
||||
/// <summary>
|
||||
/// 打开背包
|
||||
/// </summary>
|
||||
OpenInventory,
|
||||
|
||||
/// <summary>
|
||||
/// 打开角色界面
|
||||
/// </summary>
|
||||
OpenCharacterScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开地图
|
||||
/// </summary>
|
||||
OpenMap,
|
||||
|
||||
/// <summary>
|
||||
/// 打开派蒙界面
|
||||
/// </summary>
|
||||
OpenPaimonMenu,
|
||||
|
||||
/// <summary>
|
||||
/// 打开冒险之证界面
|
||||
/// </summary>
|
||||
OpenAdventurerHandbook,
|
||||
|
||||
/// <summary>
|
||||
/// 打开多人游戏界面
|
||||
/// </summary>
|
||||
OpenCoOpScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开祈愿界面
|
||||
/// </summary>
|
||||
OpenWishScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开纪行界面
|
||||
/// </summary>
|
||||
OpenBattlePassScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开活动面板
|
||||
/// </summary>
|
||||
OpenTheEventsMenu,
|
||||
|
||||
/// <summary>
|
||||
/// 打开玩法系统界面(尘歌壶内猫尾酒馆内)
|
||||
/// </summary>
|
||||
OpenTheSettingsMenu,
|
||||
|
||||
/// <summary>
|
||||
/// 打开摆设界面(尘歌壶内)
|
||||
/// </summary>
|
||||
OpenTheFurnishingScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开星之归还(条件符合期间生效)
|
||||
/// </summary>
|
||||
OpenStellarReunion,
|
||||
|
||||
/// <summary>
|
||||
/// 开关任务菜单
|
||||
/// </summary>
|
||||
OpenQuestMenu,
|
||||
|
||||
/// <summary>
|
||||
/// 打开通知详情
|
||||
/// </summary>
|
||||
OpenNotificationDetails,
|
||||
|
||||
/// <summary>
|
||||
/// 打开聊天界面
|
||||
/// </summary>
|
||||
OpenChatScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开特殊环境说明
|
||||
/// </summary>
|
||||
OpenSpecialEnvironmentInformation,
|
||||
|
||||
/// <summary>
|
||||
/// 查看教程详情
|
||||
/// </summary>
|
||||
CheckTutorialDetails,
|
||||
|
||||
/// <summary>
|
||||
/// 长按打开元素视野
|
||||
/// </summary>
|
||||
ElementalSight,
|
||||
|
||||
/// <summary>
|
||||
/// 呼出鼠标
|
||||
/// </summary>
|
||||
ShowCursor,
|
||||
|
||||
/// <summary>
|
||||
/// 打开队伍配置界面
|
||||
/// </summary>
|
||||
OpenPartySetupScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 打开好友界面
|
||||
/// </summary>
|
||||
OpenFriendsScreen,
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏主界面
|
||||
/// </summary>
|
||||
HideUI,
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using System.Threading;
|
||||
using Fischless.WindowsInput;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// 用于扩展<seealso cref="Fischless.WindowsInput.InputSimulator"/>的功能
|
||||
/// </summary>
|
||||
public static class InputSimulatorExtension
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 模拟玩家操作
|
||||
/// </summary>
|
||||
/// <param name="action">动作</param>
|
||||
/// <param name="type">按键类型</param>
|
||||
public static void SimulateAction(this InputSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
|
||||
{
|
||||
var key = action.ToActionKey();
|
||||
switch (type)
|
||||
{
|
||||
case KeyType.KeyPress:
|
||||
KeyPress(self, key);
|
||||
break;
|
||||
case KeyType.KeyDown:
|
||||
KeyDown(self, key);
|
||||
break;
|
||||
case KeyType.KeyUp:
|
||||
KeyUp(self, key);
|
||||
break;
|
||||
case KeyType.Hold:
|
||||
HoldKeyPress(self, key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void HoldKeyPress(InputSimulator self, KeyId key)
|
||||
{
|
||||
KeyDown(self, key);
|
||||
Thread.Sleep(1000);
|
||||
KeyUp(self, key);
|
||||
}
|
||||
|
||||
private static void KeyPress(InputSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.Mouse.LeftButtonClick();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.Mouse.RightButtonClick();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
self.Mouse.MiddleButtonClick();
|
||||
break;
|
||||
case KeyId.MouseSideButton1:
|
||||
self.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
case KeyId.MouseSideButton2:
|
||||
self.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
default:
|
||||
var k = key.ToVK();
|
||||
// 解决 shift 之类的键位没法正常使用的问题
|
||||
if (InputBuilder.IsExtendedKey(k))
|
||||
{
|
||||
self.Keyboard.KeyPress(false, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.Keyboard.KeyPress(k);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyDown(InputSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.Mouse.LeftButtonDown();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.Mouse.RightButtonDown();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
self.Mouse.MiddleButtonDown();
|
||||
break;
|
||||
case KeyId.MouseSideButton1:
|
||||
self.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
case KeyId.MouseSideButton2:
|
||||
self.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
default:
|
||||
var k = key.ToVK();
|
||||
// 解决 shift 之类的键位没法正常使用的问题
|
||||
if (InputBuilder.IsExtendedKey(k))
|
||||
{
|
||||
self.Keyboard.KeyDown(false, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.Keyboard.KeyDown(k);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyUp(InputSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.Mouse.LeftButtonUp();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.Mouse.RightButtonUp();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
self.Mouse.MiddleButtonUp();
|
||||
break;
|
||||
case KeyId.MouseSideButton1:
|
||||
self.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
case KeyId.MouseSideButton2:
|
||||
self.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
default:
|
||||
var k = key.ToVK();
|
||||
// 解决 shift 之类的键位没法正常使用的问题
|
||||
if (InputBuilder.IsExtendedKey(k))
|
||||
{
|
||||
self.Keyboard.KeyUp(false, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.Keyboard.KeyUp(k);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using Fischless.WindowsInput;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// 为<seealso cref="PostMessageSimulator"/>提供扩展功能
|
||||
/// </summary>
|
||||
public static class PostMessageSimulatorExtension
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 模拟玩家操作
|
||||
/// </summary>
|
||||
/// <param name="action">动作</param>
|
||||
/// <param name="type">按键类型</param>
|
||||
public static PostMessageSimulator SimulateAction(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
|
||||
{
|
||||
var key = action.ToActionKey();
|
||||
switch (type)
|
||||
{
|
||||
case KeyType.KeyPress:
|
||||
KeyPress(self, key);
|
||||
break;
|
||||
case KeyType.KeyDown:
|
||||
KeyDown(self, key);
|
||||
break;
|
||||
case KeyType.KeyUp:
|
||||
KeyUp(self, key);
|
||||
break;
|
||||
case KeyType.Hold:
|
||||
HoldKeyPress(self, key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
private static void HoldKeyPress(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
self.LongKeyPress(key.ToVK());
|
||||
}
|
||||
|
||||
private static void KeyPress(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.LeftButtonClick();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.RightButtonClick();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyPress(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyDown(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.LeftButtonDown();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.RightButtonDown();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyDown(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyUp(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.LeftButtonUp();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
self.RightButtonUp();
|
||||
break;
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyUp(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模拟玩家操作(后台)
|
||||
/// </summary>
|
||||
/// <param name="action">动作</param>
|
||||
/// <param name="type">按键类型</param>
|
||||
public static PostMessageSimulator SimulateActionBackground(this PostMessageSimulator self, GIActions action, KeyType type = KeyType.KeyPress)
|
||||
{
|
||||
var key = action.ToActionKey();
|
||||
switch (type)
|
||||
{
|
||||
case KeyType.KeyPress:
|
||||
KeyPressBackground(self, key);
|
||||
break;
|
||||
case KeyType.KeyDown:
|
||||
KeyDownBackground(self, key);
|
||||
break;
|
||||
case KeyType.KeyUp:
|
||||
KeyUpBackground(self, key);
|
||||
break;
|
||||
case KeyType.Hold:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
private static void KeyPressBackground(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
self.LeftButtonClickBackground();
|
||||
break;
|
||||
case KeyId.MouseRightButton:
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyPressBackground(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyDownBackground(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
case KeyId.MouseRightButton:
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyDownBackground(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void KeyUpBackground(PostMessageSimulator self, KeyId key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KeyId.None:
|
||||
case KeyId.Unknown:
|
||||
break;
|
||||
case KeyId.MouseLeftButton:
|
||||
case KeyId.MouseRightButton:
|
||||
case KeyId.MouseMiddleButton:
|
||||
case KeyId.MouseSideButton1:
|
||||
case KeyId.MouseSideButton2:
|
||||
break;
|
||||
default:
|
||||
self.KeyUpBackground(key.ToVK());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
|
||||
public static class SimulateKeyHelper
|
||||
{
|
||||
|
||||
private static KeyBindingsConfig KeyConfig => TaskContext.Instance().Config.KeyBindingsConfig;
|
||||
|
||||
public static KeyId ToActionKey(this GIActions action)
|
||||
{
|
||||
return GetActionKey(action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过ActionId取得实际的键盘绑定
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
public static KeyId GetActionKey(GIActions action)
|
||||
{
|
||||
return action switch
|
||||
{
|
||||
GIActions.MoveForward => KeyConfig.MoveForward,
|
||||
GIActions.MoveBackward => KeyConfig.MoveBackward,
|
||||
GIActions.MoveLeft => KeyConfig.MoveLeft,
|
||||
GIActions.MoveRight => KeyConfig.MoveRight,
|
||||
GIActions.SwitchToWalkOrRun => KeyConfig.SwitchToWalkOrRun,
|
||||
GIActions.NormalAttack => KeyConfig.NormalAttack,
|
||||
GIActions.ElementalSkill => KeyConfig.ElementalSkill,
|
||||
GIActions.ElementalBurst => KeyConfig.ElementalBurst,
|
||||
GIActions.SprintKeyboard => KeyConfig.SprintKeyboard,
|
||||
GIActions.SprintMouse => KeyConfig.SprintMouse,
|
||||
GIActions.SwitchAimingMode => KeyConfig.SwitchAimingMode,
|
||||
GIActions.Jump => KeyConfig.Jump,
|
||||
GIActions.Drop => KeyConfig.Drop,
|
||||
GIActions.PickUpOrInteract => KeyConfig.PickUpOrInteract,
|
||||
GIActions.QuickUseGadget => KeyConfig.QuickUseGadget,
|
||||
GIActions.InteractionInSomeMode => KeyConfig.InteractionInSomeMode,
|
||||
GIActions.QuestNavigation => KeyConfig.QuestNavigation,
|
||||
GIActions.AbandonChallenge => KeyConfig.AbandonChallenge,
|
||||
GIActions.SwitchMember1 => KeyConfig.SwitchMember1,
|
||||
GIActions.SwitchMember2 => KeyConfig.SwitchMember2,
|
||||
GIActions.SwitchMember3 => KeyConfig.SwitchMember3,
|
||||
GIActions.SwitchMember4 => KeyConfig.SwitchMember4,
|
||||
GIActions.SwitchMember5 => KeyConfig.SwitchMember5,
|
||||
GIActions.ShortcutWheel => KeyConfig.ShortcutWheel,
|
||||
GIActions.OpenInventory => KeyConfig.OpenInventory,
|
||||
GIActions.OpenCharacterScreen => KeyConfig.OpenCharacterScreen,
|
||||
GIActions.OpenMap => KeyConfig.OpenMap,
|
||||
GIActions.OpenPaimonMenu => KeyConfig.OpenPaimonMenu,
|
||||
GIActions.OpenAdventurerHandbook => KeyConfig.OpenAdventurerHandbook,
|
||||
GIActions.OpenCoOpScreen => KeyConfig.OpenCoOpScreen,
|
||||
GIActions.OpenWishScreen => KeyConfig.OpenWishScreen,
|
||||
GIActions.OpenBattlePassScreen => KeyConfig.OpenBattlePassScreen,
|
||||
GIActions.OpenTheEventsMenu => KeyConfig.OpenTheEventsMenu,
|
||||
GIActions.OpenTheSettingsMenu => KeyConfig.OpenTheSettingsMenu,
|
||||
GIActions.OpenTheFurnishingScreen => KeyConfig.OpenTheFurnishingScreen,
|
||||
GIActions.OpenStellarReunion => KeyConfig.OpenStellarReunion,
|
||||
GIActions.OpenQuestMenu => KeyConfig.OpenQuestMenu,
|
||||
GIActions.OpenNotificationDetails => KeyConfig.OpenNotificationDetails,
|
||||
GIActions.OpenChatScreen => KeyConfig.OpenChatScreen,
|
||||
GIActions.OpenSpecialEnvironmentInformation => KeyConfig.OpenSpecialEnvironmentInformation,
|
||||
GIActions.CheckTutorialDetails => KeyConfig.CheckTutorialDetails,
|
||||
GIActions.ElementalSight => KeyConfig.ElementalSight,
|
||||
GIActions.ShowCursor => KeyConfig.ShowCursor,
|
||||
GIActions.OpenPartySetupScreen => KeyConfig.OpenPartySetupScreen,
|
||||
GIActions.OpenFriendsScreen => KeyConfig.OpenFriendsScreen,
|
||||
GIActions.HideUI => KeyConfig.HideUI,
|
||||
_ => default,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
using Fischless.WindowsInput;
|
||||
using System;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Simulator;
|
||||
|
||||
@@ -13,4 +16,26 @@ public class Simulation
|
||||
{
|
||||
return new PostMessageSimulator(hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReleaseAllKey()
|
||||
{
|
||||
foreach (User32.VK key in Enum.GetValues(typeof(User32.VK)))
|
||||
{
|
||||
// 检查键是否被按下
|
||||
if (IsKeyDown(key)) // 强制转换 VK 枚举为 int
|
||||
{
|
||||
TaskControl.Logger.LogDebug($"解除{key}的按下状态.");
|
||||
SendInput.Keyboard.KeyUp(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsKeyDown(User32.VK key)
|
||||
{
|
||||
// 获取按键状态
|
||||
var state = User32.GetAsyncKeyState((int)key);
|
||||
|
||||
// 检查高位是否为 1(表示按键被按下)
|
||||
return (state & 0x8000) != 0;
|
||||
}
|
||||
}
|
||||
@@ -9,26 +9,47 @@ public partial class AutoDomainConfig : ObservableObject
|
||||
/// <summary>
|
||||
/// 战斗结束后延迟几秒再开始寻找石化古树,秒
|
||||
/// </summary>
|
||||
[ObservableProperty] private double _fightEndDelay = 5;
|
||||
[ObservableProperty]
|
||||
private double _fightEndDelay = 5;
|
||||
|
||||
/// <summary>
|
||||
/// 寻找古树时,短距离移动,用于识别速度过慢的计算机使用
|
||||
/// </summary>
|
||||
[ObservableProperty] private bool _shortMovement = false;
|
||||
[ObservableProperty]
|
||||
private bool _shortMovement = false;
|
||||
|
||||
/// <summary>
|
||||
/// 寻找古树时,短距离移动,用于识别速度过慢的计算机使用
|
||||
/// </summary>
|
||||
[ObservableProperty] private bool _walkToF = false;
|
||||
[ObservableProperty]
|
||||
private bool _walkToF = true;
|
||||
|
||||
/// <summary>
|
||||
/// 寻找古树时,短距离移动的次数
|
||||
/// </summary>
|
||||
[ObservableProperty] private int _leftRightMoveTimes = 3;
|
||||
[ObservableProperty]
|
||||
private int _leftRightMoveTimes = 3;
|
||||
|
||||
/// <summary>
|
||||
/// 自动吃药
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoEat = false;
|
||||
}
|
||||
|
||||
// 刷副本使用的队伍名称
|
||||
[ObservableProperty]
|
||||
private string _partyName = string.Empty;
|
||||
|
||||
// 需要刷取的副本名称
|
||||
[ObservableProperty]
|
||||
private string _domainName = string.Empty;
|
||||
|
||||
// 结束后是否自动分解圣遗物
|
||||
[ObservableProperty]
|
||||
private bool _autoArtifactSalvage = false;
|
||||
|
||||
// 分解圣遗物的最大星级
|
||||
// 1~4
|
||||
[ObservableProperty]
|
||||
private string _maxArtifactStar = "4";
|
||||
}
|
||||
@@ -9,6 +9,19 @@ public class AutoDomainParam : BaseTaskParam
|
||||
|
||||
public string CombatStrategyPath { get; set; }
|
||||
|
||||
// 刷副本使用的队伍名称
|
||||
public string PartyName { get; set; } = string.Empty;
|
||||
|
||||
// 需要刷取的副本名称
|
||||
public string DomainName { get; set; } = string.Empty;
|
||||
|
||||
// 结束后是否自动分解圣遗物
|
||||
public bool AutoArtifactSalvage { get; set; } = false;
|
||||
|
||||
// 分解圣遗物的最大星级
|
||||
// 1~4
|
||||
public string MaxArtifactStar { get; set; } = "4";
|
||||
|
||||
public AutoDomainParam(int domainRoundNum, string path)
|
||||
{
|
||||
DomainRoundNum = domainRoundNum;
|
||||
@@ -16,6 +29,17 @@ public class AutoDomainParam : BaseTaskParam
|
||||
{
|
||||
DomainRoundNum = 9999;
|
||||
}
|
||||
|
||||
CombatStrategyPath = path;
|
||||
SetDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDefault()
|
||||
{
|
||||
var config = TaskContext.Instance().Config.AutoDomainConfig;
|
||||
PartyName = config.PartyName;
|
||||
DomainName = config.DomainName;
|
||||
AutoArtifactSalvage = config.AutoArtifactSalvage;
|
||||
MaxArtifactStar = config.MaxArtifactStar;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using BetterGenshinImpact.Core.Script;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
@@ -22,20 +22,31 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
using BetterGenshinImpact.Service.Notification.Model.Enum;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using static Vanara.PInvoke.Gdi32;
|
||||
using static Vanara.PInvoke.Kernel32;
|
||||
using static Vanara.PInvoke.User32;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoDomain;
|
||||
|
||||
public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
private readonly AutoDomainParam _taskParam;
|
||||
public string Name => "自动秘境";
|
||||
|
||||
private readonly PostMessageSimulator _simulator;
|
||||
private readonly AutoDomainParam _taskParam;
|
||||
|
||||
private readonly YoloV8Predictor _predictor;
|
||||
|
||||
@@ -43,13 +54,18 @@ public class AutoDomainTask : ISoloTask
|
||||
|
||||
private readonly CombatScriptBag _combatScriptBag;
|
||||
|
||||
private CancellationTokenSource? _cts;
|
||||
private CancellationToken _ct;
|
||||
|
||||
private readonly string challengeCompletedLocalizedString;
|
||||
private readonly string autoLeavingLocalizedString;
|
||||
private readonly string skipLocalizedString;
|
||||
private readonly string leyLineDisorderLocalizedString;
|
||||
private readonly string clickanywheretocloseLocalizedString;
|
||||
|
||||
public AutoDomainTask(AutoDomainParam taskParam)
|
||||
{
|
||||
AutoFightAssets.DestroyInstance();
|
||||
_taskParam = taskParam;
|
||||
_simulator = AutoFightContext.Instance.Simulator;
|
||||
|
||||
_predictor = YoloV8Builder.CreateDefaultBuilder()
|
||||
.UseOnnxModel(Global.Absolute(@"Assets\Model\Domain\bgi_tree.onnx"))
|
||||
.WithSessionOptions(BgiSessionOption.Instance.Options)
|
||||
@@ -58,26 +74,79 @@ public class AutoDomainTask : ISoloTask
|
||||
_config = TaskContext.Instance().Config.AutoDomainConfig;
|
||||
|
||||
_combatScriptBag = CombatScriptParser.ReadAndParse(_taskParam.CombatStrategyPath);
|
||||
|
||||
IStringLocalizer<AutoDomainTask> stringLocalizer = App.GetService<IStringLocalizer<AutoDomainTask>>() ?? throw new NullReferenceException();
|
||||
CultureInfo cultureInfo = new CultureInfo(TaskContext.Instance().Config.OtherConfig.GameCultureInfoName);
|
||||
this.challengeCompletedLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "挑战达成");
|
||||
this.autoLeavingLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "自动退出");
|
||||
this.skipLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "跳过");
|
||||
this.leyLineDisorderLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "地脉异常");
|
||||
this.clickanywheretocloseLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "点击任意位置关闭");
|
||||
}
|
||||
|
||||
public async Task Start(CancellationTokenSource cts)
|
||||
public async Task Start(CancellationToken ct)
|
||||
{
|
||||
_cts = cts;
|
||||
_ct = ct;
|
||||
|
||||
AutoFightAssets.DestroyInstance();
|
||||
Init();
|
||||
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Started().Build()); // TODO: 通知后续需要删除迁移
|
||||
Notify.Event(NotificationEvent.DomainStart).Success("自动秘境启动");
|
||||
|
||||
// 3次复活重试
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
await DoDomain();
|
||||
// 其他场景不重试
|
||||
break;
|
||||
}
|
||||
catch (RetryException e)
|
||||
{
|
||||
// 只有选择了秘境的时候才会重试
|
||||
if (!string.IsNullOrEmpty(_taskParam.DomainName))
|
||||
{
|
||||
var msg = e.Message;
|
||||
if (msg.Contains("复活"))
|
||||
{
|
||||
msg = "存在角色死亡,复活后重试秘境...";
|
||||
}
|
||||
|
||||
Logger.LogWarning("自动秘境:{Text}", msg);
|
||||
await Delay(2000, ct);
|
||||
Notify.Event(NotificationEvent.DomainRetry).Error(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await Delay(2000, ct);
|
||||
await Bv.WaitForMainUi(_ct, 30);
|
||||
await Delay(2000, ct);
|
||||
|
||||
await ArtifactSalvage();
|
||||
Notify.Event(NotificationEvent.DomainEnd).Success("自动秘境结束");
|
||||
}
|
||||
|
||||
private async Task DoDomain()
|
||||
{
|
||||
// 传送到秘境
|
||||
await TpDomain();
|
||||
// 切换队伍
|
||||
await SwitchParty(_taskParam.PartyName);
|
||||
|
||||
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());
|
||||
|
||||
// 前置进入秘境
|
||||
EnterDomain();
|
||||
await EnterDomain();
|
||||
|
||||
for (var i = 0; i < _taskParam.DomainRoundNum; i++)
|
||||
{
|
||||
// 0. 关闭秘境提示
|
||||
Logger.LogDebug("0. 关闭秘境提示");
|
||||
CloseDomainTip();
|
||||
await CloseDomainTip();
|
||||
|
||||
// 队伍没初始化成功则重试
|
||||
RetryTeamInit(combatScenes);
|
||||
@@ -92,6 +161,7 @@ public class AutoDomainTask : ISoloTask
|
||||
// 2. 执行战斗(战斗线程、视角线程、检测战斗完成线程)
|
||||
Logger.LogInformation("自动秘境:{Text}", "2. 执行战斗策略");
|
||||
await StartFight(combatScenes, combatCommands);
|
||||
combatScenes.AfterTask();
|
||||
EndFightWait();
|
||||
|
||||
// 3. 寻找石化古树 并左右移动直到石化古树位于屏幕中心
|
||||
@@ -114,10 +184,11 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
Logger.LogInformation("体力已经耗尽,结束自动秘境");
|
||||
}
|
||||
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Success().Build());
|
||||
|
||||
break;
|
||||
}
|
||||
NotificationHelper.SendTaskNotificationWithScreenshotUsing(b => b.Domain().Progress().Build());
|
||||
|
||||
Notify.Event(NotificationEvent.DomainReward).Success("自动秘境奖励领取");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +210,10 @@ public class AutoDomainTask : ISoloTask
|
||||
var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
|
||||
if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
|
||||
{
|
||||
Logger.LogWarning("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏可能无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
|
||||
Logger.LogError("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
|
||||
throw new Exception("游戏窗口分辨率不是 16:9");
|
||||
}
|
||||
|
||||
if (gameScreenSize.Width < 1920 || gameScreenSize.Height < 1080)
|
||||
{
|
||||
Logger.LogWarning("游戏窗口分辨率小于 1920x1080 !当前分辨率为 {Width}x{Height} , 小于 1920x1080 的分辨率的游戏可能无法正常使用自动秘境功能 !", gameScreenSize.Width, gameScreenSize.Height);
|
||||
@@ -159,57 +232,174 @@ public class AutoDomainTask : ISoloTask
|
||||
}
|
||||
}
|
||||
|
||||
private void EnterDomain()
|
||||
private async Task TpDomain()
|
||||
{
|
||||
var fightAssets = AutoFightContext.Instance.FightAssets;
|
||||
|
||||
using var fRectArea = CaptureToRectArea().Find(AutoPickAssets.Instance.FRo);
|
||||
if (!fRectArea.IsEmpty())
|
||||
// 传送到秘境
|
||||
if (!string.IsNullOrEmpty(_taskParam.DomainName))
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
|
||||
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
|
||||
// 秘境开门动画 5s
|
||||
Sleep(5000, _cts);
|
||||
if (MapLazyAssets.Instance.DomainPositionMap.TryGetValue(_taskParam.DomainName, out var domainPosition))
|
||||
{
|
||||
Logger.LogInformation("自动秘境:传送到秘境{Text}", _taskParam.DomainName);
|
||||
await new TpTask(_ct).Tp(domainPosition.X, domainPosition.Y);
|
||||
await Delay(1000, _ct);
|
||||
await Bv.WaitForMainUi(_ct);
|
||||
await Delay(1000, _ct);
|
||||
|
||||
if ("芬德尼尔之顶".Equals(_taskParam.DomainName))
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveBackward, KeyType.KeyDown);
|
||||
Thread.Sleep(3000);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveBackward, KeyType.KeyUp);
|
||||
}
|
||||
else if ("无妄引咎密宫".Equals(_taskParam.DomainName))
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
Thread.Sleep(500);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
|
||||
Thread.Sleep(100);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveLeft, KeyType.KeyDown);
|
||||
Thread.Sleep(1600);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveLeft, KeyType.KeyUp);
|
||||
}
|
||||
else if ("苍白的遗荣".Equals(_taskParam.DomainName))
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
Thread.Sleep(1000);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
|
||||
}
|
||||
else if ("太山府".Equals(_taskParam.DomainName))
|
||||
{
|
||||
// 直接F即可
|
||||
// nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
Thread.Sleep(2000);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
|
||||
}
|
||||
|
||||
await Delay(100, _ct);
|
||||
Simulation.SendInput.SimulateAction(GIActions.Drop); // 可能爬上去了,X键下来
|
||||
await Delay(3000, _ct); // 站稳
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError("自动秘境:未找到对应的秘境{Text}的传送点", _taskParam.DomainName);
|
||||
throw new Exception($"未找到对应的秘境{_taskParam.DomainName}的传送点");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换队伍
|
||||
/// </summary>
|
||||
/// <param name="partyName"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> SwitchParty(string? partyName)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(partyName))
|
||||
{
|
||||
var b = await new SwitchPartyTask().Start(partyName, _ct);
|
||||
await Delay(500, _ct);
|
||||
return b;
|
||||
}
|
||||
|
||||
int retryTimes = 0, clickCount = 0;
|
||||
while (retryTimes < 20 && clickCount < 2)
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task EnterDomain()
|
||||
{
|
||||
var fightAssets = AutoFightAssets.Instance;
|
||||
|
||||
// 进入秘境
|
||||
for (int i = 0; i < 3; i++) // 3次重试 有时候会拾取晶蝶
|
||||
{
|
||||
using var fRectArea = CaptureToRectArea().Find(AutoPickAssets.Instance.PickRo);
|
||||
if (!fRectArea.IsEmpty())
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
|
||||
Logger.LogInformation("自动秘境:{Text}", "进入秘境");
|
||||
// 秘境开门动画 5s
|
||||
await Delay(5000, _ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Delay(800, _ct);
|
||||
}
|
||||
}
|
||||
|
||||
// 点击单人挑战
|
||||
int retryTimes = 0;
|
||||
while (retryTimes < 20)
|
||||
{
|
||||
retryTimes++;
|
||||
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
|
||||
if (!confirmRectArea.IsEmpty())
|
||||
{
|
||||
confirmRectArea.Click();
|
||||
clickCount++;
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(1500, _cts);
|
||||
await Delay(1500, _ct);
|
||||
}
|
||||
|
||||
await Delay(600, _ct);
|
||||
using var confirmRectArea2 = CaptureToRectArea().Find(ElementAssets.Instance.BtnBlackConfirm);
|
||||
if (!confirmRectArea2.IsEmpty())
|
||||
{
|
||||
throw new Exception("收取完成秘境的奖励需要20点原粹树脂,当前树脂不足,自动秘境停止运行");
|
||||
}
|
||||
|
||||
// 点击进入
|
||||
retryTimes = 0;
|
||||
while (retryTimes < 20)
|
||||
{
|
||||
retryTimes++;
|
||||
using var confirmRectArea = CaptureToRectArea().Find(fightAssets.ConfirmRa);
|
||||
if (!confirmRectArea.IsEmpty())
|
||||
{
|
||||
confirmRectArea.Click();
|
||||
break;
|
||||
}
|
||||
await Delay(1200, _ct);
|
||||
}
|
||||
|
||||
|
||||
// 载入动画
|
||||
Sleep(3000, _cts);
|
||||
await Delay(3000, _ct);
|
||||
}
|
||||
|
||||
private void CloseDomainTip()
|
||||
private async Task CloseDomainTip()
|
||||
{
|
||||
// 2min的载入时间总够了吧
|
||||
var retryTimes = 0;
|
||||
while (retryTimes < 120)
|
||||
{
|
||||
retryTimes++;
|
||||
using var cactRectArea = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.ClickAnyCloseTipRa);
|
||||
if (!cactRectArea.IsEmpty())
|
||||
using var ra = CaptureToRectArea();
|
||||
// using var cactRectArea =ra.Find(AutoFightAssets.Instance.ClickAnyCloseTipRa);
|
||||
// if (!cactRectArea.IsEmpty())
|
||||
// {
|
||||
// await Delay(1000, _ct);
|
||||
// cactRectArea.Click();
|
||||
// break;
|
||||
// }
|
||||
|
||||
var ocrList = ra.FindMulti(RecognitionObject.Ocr(0, ra.Height * 0.2, ra.Width, ra.Height * 0.6));
|
||||
var done = ocrList.FirstOrDefault(t => Regex.IsMatch(t.Text, this.leyLineDisorderLocalizedString) || Regex.IsMatch(t.Text, this.clickanywheretocloseLocalizedString));
|
||||
if (done != null)
|
||||
{
|
||||
Sleep(1000, _cts);
|
||||
cactRectArea.Click();
|
||||
await Delay(1000, _ct);
|
||||
done.Click();
|
||||
break;
|
||||
}
|
||||
|
||||
// todo 添加小地图角标位置检测 防止有人手点了
|
||||
Sleep(1000, _cts);
|
||||
await Delay(1000, _ct);
|
||||
}
|
||||
|
||||
Sleep(1500, _cts);
|
||||
await Delay(2000, _ct);
|
||||
}
|
||||
|
||||
private List<CombatCommand> FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes)
|
||||
@@ -226,55 +416,63 @@ public class AutoDomainTask : ISoloTask
|
||||
/// </summary>
|
||||
private async Task WalkToPressF()
|
||||
{
|
||||
if (_cts.Token.IsCancellationRequested)
|
||||
if (_ct.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Run((Action)(() =>
|
||||
{
|
||||
_simulator.KeyDown(VK.VK_W);
|
||||
Sleep(20);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyDown);
|
||||
Sleep(30, _ct);
|
||||
// 组合键好像不能直接用 postmessage
|
||||
if (!_config.WalkToF)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyDown(VK.VK_SHIFT);
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintKeyboard, KeyType.KeyDown);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
var startTime = DateTime.Now;
|
||||
while (!_ct.IsCancellationRequested)
|
||||
{
|
||||
using var fRectArea = Common.TaskControl.CaptureToRectArea().Find(AutoPickAssets.Instance.FRo);
|
||||
using var fRectArea = Common.TaskControl.CaptureToRectArea().Find(AutoPickAssets.Instance.PickRo);
|
||||
if (fRectArea.IsEmpty())
|
||||
{
|
||||
Sleep(100, _cts);
|
||||
Sleep(100, _ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation("检测到交互键");
|
||||
Simulation.SendInput.Keyboard.KeyPress(VK.VK_F);
|
||||
Simulation.SendInput.Keyboard.KeyPress(AutoPickAssets.Instance.PickVk);
|
||||
break;
|
||||
}
|
||||
|
||||
// 超时直接放弃整个秘境
|
||||
if (DateTime.Now - startTime> TimeSpan.FromSeconds(60))
|
||||
{
|
||||
Logger.LogWarning("自动秘境:{Text}", "前往目标位置处超时,如果选择了秘境名称,将在传送后重试秘境!");
|
||||
Avatar.TpForRecover(_ct, new RetryException("前往目标位置处超时,先传送到七天神像,然后重试秘境"));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_simulator.KeyUp(VK.VK_W);
|
||||
Simulation.SendInput.SimulateAction(GIActions.MoveForward, KeyType.KeyUp);
|
||||
Sleep(50);
|
||||
if (!_config.WalkToF)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyUp(VK.VK_SHIFT);
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintKeyboard, KeyType.KeyUp);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}), _ct);
|
||||
}
|
||||
|
||||
private Task StartFight(CombatScenes combatScenes, List<CombatCommand> combatCommands)
|
||||
{
|
||||
CancellationTokenSource cts = new();
|
||||
_cts.Token.Register(cts.Cancel);
|
||||
combatScenes.BeforeTask(cts);
|
||||
_ct.Register(cts.Cancel);
|
||||
combatScenes.BeforeTask(cts.Token);
|
||||
// 战斗操作
|
||||
var combatTask = new Task(() =>
|
||||
{
|
||||
@@ -307,7 +505,7 @@ public class AutoDomainTask : ISoloTask
|
||||
// 对局结束检测
|
||||
var domainEndTask = DomainEndDetectionTask(cts);
|
||||
// 自动吃药
|
||||
var autoEatRecoveryHpTask = AutoEatRecoveryHpTask(cts);
|
||||
var autoEatRecoveryHpTask = AutoEatRecoveryHpTask(cts.Token);
|
||||
combatTask.Start();
|
||||
domainEndTask.Start();
|
||||
autoEatRecoveryHpTask.Start();
|
||||
@@ -316,7 +514,7 @@ public class AutoDomainTask : ISoloTask
|
||||
|
||||
private void EndFightWait()
|
||||
{
|
||||
if (_cts.Token.IsCancellationRequested)
|
||||
if (_ct.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -325,7 +523,7 @@ public class AutoDomainTask : ISoloTask
|
||||
if (s > 0)
|
||||
{
|
||||
Logger.LogInformation("战斗结束后等待 {Second} 秒", s);
|
||||
Sleep((int)(s * 1000), _cts);
|
||||
Sleep((int)(s * 1000), _ct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +536,7 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
while (!_ct.IsCancellationRequested)
|
||||
{
|
||||
if (IsDomainEnd())
|
||||
{
|
||||
@@ -346,7 +544,7 @@ public class AutoDomainTask : ISoloTask
|
||||
break;
|
||||
}
|
||||
|
||||
await Delay(1000, cts);
|
||||
await Delay(1000, cts.Token);
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -359,17 +557,17 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
|
||||
var endTipsRect = ra.DeriveCrop(AutoFightContext.Instance.FightAssets.EndTipsUpperRect);
|
||||
var endTipsRect = ra.DeriveCrop(AutoFightAssets.Instance.EndTipsUpperRect);
|
||||
var text = OcrFactory.Paddle.Ocr(endTipsRect.SrcGreyMat);
|
||||
if (text.Contains("挑战") || text.Contains("达成"))
|
||||
if (Regex.IsMatch(text, this.challengeCompletedLocalizedString))
|
||||
{
|
||||
Logger.LogInformation("检测到秘境结束提示(挑战达成),结束秘境");
|
||||
return true;
|
||||
}
|
||||
|
||||
endTipsRect = ra.DeriveCrop(AutoFightContext.Instance.FightAssets.EndTipsRect);
|
||||
endTipsRect = ra.DeriveCrop(AutoFightAssets.Instance.EndTipsRect);
|
||||
text = OcrFactory.Paddle.Ocr(endTipsRect.SrcGreyMat);
|
||||
if (text.Contains("自动") || text.Contains("退出"))
|
||||
if (Regex.IsMatch(text, this.autoLeavingLocalizedString))
|
||||
{
|
||||
Logger.LogInformation("检测到秘境结束提示(xxx秒后自动退出),结束秘境");
|
||||
return true;
|
||||
@@ -378,7 +576,7 @@ public class AutoDomainTask : ISoloTask
|
||||
return false;
|
||||
}
|
||||
|
||||
private Task AutoEatRecoveryHpTask(CancellationTokenSource cts)
|
||||
private Task AutoEatRecoveryHpTask(CancellationToken ct)
|
||||
{
|
||||
return new Task(async () =>
|
||||
{
|
||||
@@ -386,6 +584,7 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsTakeFood())
|
||||
{
|
||||
Logger.LogInformation("未装备 “{Tool}”,不启用红血自动吃药功能", "便携营养袋");
|
||||
@@ -394,35 +593,24 @@ public class AutoDomainTask : ISoloTask
|
||||
|
||||
try
|
||||
{
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
while (!_ct.IsCancellationRequested)
|
||||
{
|
||||
if (IsLowHealth())
|
||||
if (Bv.CurrentAvatarIsLowHp(CaptureToRectArea()))
|
||||
{
|
||||
// 模拟按键 "Z"
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_Z);
|
||||
Simulation.SendInput.SimulateAction(GIActions.QuickUseGadget);
|
||||
Logger.LogInformation("检测到红血,按Z吃药");
|
||||
// TODO 吃饱了会一直吃
|
||||
}
|
||||
|
||||
await Delay(500, cts);
|
||||
await Delay(500, ct);
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogDebug(e, "红血自动吃药检测时发生异常");
|
||||
}
|
||||
}, cts.Token);
|
||||
}
|
||||
|
||||
private bool IsLowHealth()
|
||||
{
|
||||
// 获取图像
|
||||
using var ra = CaptureToRectArea();
|
||||
|
||||
// 获取 (808, 1010) 位置的像素颜色
|
||||
var pixelColor = ra.SrcMat.At<Vec3b>(1010, 808);
|
||||
|
||||
// 判断颜色是否是 (255, 90, 90)
|
||||
return pixelColor is { Item2: 255, Item1: 90, Item0: 90 };
|
||||
}, ct);
|
||||
}
|
||||
|
||||
private bool IsTakeFood()
|
||||
@@ -442,10 +630,10 @@ public class AutoDomainTask : ISoloTask
|
||||
private Task FindPetrifiedTree()
|
||||
{
|
||||
CancellationTokenSource treeCts = new();
|
||||
_cts.Token.Register(treeCts.Cancel);
|
||||
_ct.Register(treeCts.Cancel);
|
||||
// 中键回正视角
|
||||
Simulation.SendInput.Mouse.MiddleButtonClick();
|
||||
Sleep(900, _cts);
|
||||
Sleep(900, _ct);
|
||||
|
||||
// 左右移动直到石化古树位于屏幕中心任务
|
||||
var moveAvatarTask = MoveAvatarHorizontallyTask(treeCts);
|
||||
@@ -460,14 +648,18 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
return new Task(() =>
|
||||
{
|
||||
var keyConfig = TaskContext.Instance().Config.KeyBindingsConfig;
|
||||
var moveLeftKey = keyConfig.MoveLeft.ToVK();
|
||||
var moveRightKey = keyConfig.MoveRight.ToVK();
|
||||
var moveForwardKey = keyConfig.MoveForward.ToVK();
|
||||
var captureArea = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
var middleX = captureArea.Width / 2;
|
||||
var leftKeyDown = false;
|
||||
var rightKeyDown = false;
|
||||
var noDetectCount = 0;
|
||||
var prevKey = VK.VK_A;
|
||||
var prevKey = moveLeftKey;
|
||||
var backwardsAndForwardsCount = 0;
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
while (!_ct.IsCancellationRequested)
|
||||
{
|
||||
var treeRect = DetectTree(CaptureToRectArea());
|
||||
if (treeRect != Rect.Empty)
|
||||
@@ -481,13 +673,13 @@ public class AutoDomainTask : ISoloTask
|
||||
if (rightKeyDown)
|
||||
{
|
||||
// 先松开D键
|
||||
_simulator.KeyUp(VK.VK_D);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
|
||||
rightKeyDown = false;
|
||||
}
|
||||
|
||||
if (!leftKeyDown)
|
||||
{
|
||||
_simulator.KeyDown(VK.VK_A);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
|
||||
leftKeyDown = true;
|
||||
}
|
||||
}
|
||||
@@ -499,13 +691,13 @@ public class AutoDomainTask : ISoloTask
|
||||
if (leftKeyDown)
|
||||
{
|
||||
// 先松开A键
|
||||
_simulator.KeyUp(VK.VK_A);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
|
||||
leftKeyDown = false;
|
||||
}
|
||||
|
||||
if (!rightKeyDown)
|
||||
{
|
||||
_simulator.KeyDown(VK.VK_D);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
|
||||
rightKeyDown = true;
|
||||
}
|
||||
}
|
||||
@@ -514,43 +706,49 @@ public class AutoDomainTask : ISoloTask
|
||||
// 树在中间 松开所有键
|
||||
if (rightKeyDown)
|
||||
{
|
||||
_simulator.KeyUp(VK.VK_D);
|
||||
prevKey = VK.VK_D;
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
|
||||
prevKey = moveRightKey;
|
||||
rightKeyDown = false;
|
||||
}
|
||||
|
||||
if (leftKeyDown)
|
||||
{
|
||||
_simulator.KeyUp(VK.VK_A);
|
||||
prevKey = VK.VK_A;
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
|
||||
prevKey = moveLeftKey;
|
||||
leftKeyDown = false;
|
||||
}
|
||||
|
||||
// 松开按键后使用小碎步移动
|
||||
if (treeMiddleX < middleX)
|
||||
{
|
||||
if (prevKey == VK.VK_D)
|
||||
if (prevKey == moveRightKey)
|
||||
{
|
||||
backwardsAndForwardsCount++;
|
||||
}
|
||||
|
||||
_simulator.KeyPress(VK.VK_A, 60);
|
||||
prevKey = VK.VK_A;
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
|
||||
Sleep(60);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
|
||||
prevKey = moveLeftKey;
|
||||
}
|
||||
else if (treeMiddleX > middleX)
|
||||
{
|
||||
if (prevKey == VK.VK_A)
|
||||
if (prevKey == moveLeftKey)
|
||||
{
|
||||
backwardsAndForwardsCount++;
|
||||
}
|
||||
|
||||
_simulator.KeyPress(VK.VK_D, 60);
|
||||
prevKey = VK.VK_D;
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
|
||||
Sleep(60);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
|
||||
prevKey = moveRightKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
_simulator.KeyPress(VK.VK_W, 60);
|
||||
Sleep(500, _cts);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveForwardKey);
|
||||
Sleep(60);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveForwardKey);
|
||||
Sleep(500, _ct);
|
||||
treeCts.Cancel();
|
||||
break;
|
||||
}
|
||||
@@ -565,13 +763,13 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
if (leftKeyDown)
|
||||
{
|
||||
_simulator.KeyUp(VK.VK_A);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveLeftKey);
|
||||
leftKeyDown = false;
|
||||
}
|
||||
|
||||
if (!rightKeyDown)
|
||||
{
|
||||
_simulator.KeyDown(VK.VK_D);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveRightKey);
|
||||
rightKeyDown = true;
|
||||
}
|
||||
}
|
||||
@@ -579,13 +777,13 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
if (rightKeyDown)
|
||||
{
|
||||
_simulator.KeyUp(VK.VK_D);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveRightKey);
|
||||
rightKeyDown = false;
|
||||
}
|
||||
|
||||
if (!leftKeyDown)
|
||||
{
|
||||
_simulator.KeyDown(VK.VK_A);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveLeftKey);
|
||||
leftKeyDown = true;
|
||||
}
|
||||
}
|
||||
@@ -594,13 +792,15 @@ public class AutoDomainTask : ISoloTask
|
||||
if (backwardsAndForwardsCount >= _config.LeftRightMoveTimes)
|
||||
{
|
||||
// 左右移动5次说明已经在树中心了
|
||||
_simulator.KeyPress(VK.VK_W, 60);
|
||||
Sleep(500, _cts);
|
||||
Simulation.SendInput.Keyboard.KeyDown(moveForwardKey);
|
||||
Sleep(60);
|
||||
Simulation.SendInput.Keyboard.KeyUp(moveForwardKey);
|
||||
Sleep(500, _ct);
|
||||
treeCts.Cancel();
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(60, _cts);
|
||||
Sleep(60, _ct);
|
||||
}
|
||||
|
||||
VisionContext.Instance().DrawContent.ClearAll();
|
||||
@@ -640,40 +840,12 @@ public class AutoDomainTask : ISoloTask
|
||||
while (!cts.Token.IsCancellationRequested)
|
||||
{
|
||||
using var captureRegion = CaptureToRectArea();
|
||||
var angle = CameraOrientation.Compute(captureRegion.SrcGreyMat);
|
||||
var angle = CameraOrientation.Compute(captureRegion.SrcMat);
|
||||
CameraOrientation.DrawDirection(captureRegion, angle);
|
||||
if (angle is >= 356 or <= 4)
|
||||
{
|
||||
// 算作对准了
|
||||
continuousCount++;
|
||||
}
|
||||
|
||||
if (angle <= 180)
|
||||
{
|
||||
// 左移视角
|
||||
var moveAngle = angle;
|
||||
if (moveAngle > 2)
|
||||
{
|
||||
moveAngle *= 2;
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(-moveAngle, 0);
|
||||
continuousCount = 0;
|
||||
}
|
||||
else if (angle is > 180 and < 360)
|
||||
{
|
||||
// 右移视角
|
||||
var moveAngle = 360 - angle;
|
||||
if (moveAngle > 2)
|
||||
{
|
||||
moveAngle *= 2;
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(moveAngle, 0);
|
||||
continuousCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 360 度 东方向视角
|
||||
if (continuousCount > 5)
|
||||
{
|
||||
@@ -684,6 +856,33 @@ public class AutoDomainTask : ISoloTask
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continuousCount = 0;
|
||||
}
|
||||
|
||||
if (angle <= 180)
|
||||
{
|
||||
// 左移视角
|
||||
var moveAngle = (int)Math.Round(angle);
|
||||
if (moveAngle > 2)
|
||||
{
|
||||
moveAngle *= 2;
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(-moveAngle, 0);
|
||||
}
|
||||
else if (angle is > 180 and < 360)
|
||||
{
|
||||
// 右移视角
|
||||
var moveAngle = 360 - (int)Math.Round(angle);
|
||||
if (moveAngle > 2)
|
||||
{
|
||||
moveAngle *= 2;
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(moveAngle, 0);
|
||||
}
|
||||
|
||||
Sleep(100);
|
||||
}
|
||||
@@ -701,7 +900,7 @@ public class AutoDomainTask : ISoloTask
|
||||
private bool GettingTreasure(bool recognizeResin, bool isLastTurn)
|
||||
{
|
||||
// 等待窗口弹出
|
||||
Sleep(1500, _cts);
|
||||
Sleep(1500, _ct);
|
||||
|
||||
// 优先使用浓缩树脂
|
||||
var retryTimes = 0;
|
||||
@@ -714,39 +913,53 @@ public class AutoDomainTask : ISoloTask
|
||||
break;
|
||||
}
|
||||
|
||||
var useCondensedResinRa = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.UseCondensedResinRa);
|
||||
var useCondensedResinRa = CaptureToRectArea().Find(AutoFightAssets.Instance.UseCondensedResinRa);
|
||||
if (!useCondensedResinRa.IsEmpty())
|
||||
{
|
||||
useCondensedResinRa.Click();
|
||||
// 点两下 #224 #218
|
||||
// 解决水龙王按下左键后没松开,然后后续点击按下就没反应了
|
||||
Sleep(400, _cts);
|
||||
Sleep(400, _ct);
|
||||
useCondensedResinRa.Click();
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(800, _cts);
|
||||
Sleep(800, _ct);
|
||||
}
|
||||
|
||||
Sleep(1000, _cts);
|
||||
Sleep(1000, _ct);
|
||||
|
||||
var captureArea = TaskContext.Instance().SystemInfo.CaptureAreaRect;
|
||||
var hasSkip = false;
|
||||
var captureArea = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
// 跳过领取动画
|
||||
GameCaptureRegion.GameRegionClick((size, scale) => (size.Width - 140 * scale, 53 * scale));
|
||||
Sleep(200, _cts);
|
||||
GameCaptureRegion.GameRegionClick((size, scale) => (size.Width - 140 * scale, 53 * scale));
|
||||
if (!hasSkip)
|
||||
{
|
||||
TaskContext.Instance().PostMessageSimulator.LeftButtonClick(); // 先随便点一个地方使得跳过出现
|
||||
}
|
||||
|
||||
using var ra = CaptureToRectArea();
|
||||
|
||||
// OCR识别是否有跳过
|
||||
var ocrList = ra.FindMulti(RecognitionObject.Ocr(captureArea.Width - 230 * assetScale, 0, 230 * assetScale - 5, 80 * assetScale));
|
||||
var skipTextRa = ocrList.FirstOrDefault(t => Regex.IsMatch(t.Text, this.skipLocalizedString));
|
||||
if (skipTextRa != null)
|
||||
{
|
||||
hasSkip = true;
|
||||
skipTextRa.Click(); // 有则点击
|
||||
}
|
||||
|
||||
|
||||
// 优先点击继续
|
||||
var ra = CaptureToRectArea();
|
||||
var confirmRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ConfirmRa);
|
||||
using var confirmRectArea = ra.Find(AutoFightAssets.Instance.ConfirmRa);
|
||||
if (!confirmRectArea.IsEmpty())
|
||||
{
|
||||
if (isLastTurn)
|
||||
{
|
||||
// 最后一回合 退出
|
||||
var exitRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ExitRa);
|
||||
var exitRectArea = ra.Find(AutoFightAssets.Instance.ExitRa);
|
||||
if (!exitRectArea.IsEmpty())
|
||||
{
|
||||
exitRectArea.Click();
|
||||
@@ -764,7 +977,7 @@ public class AutoDomainTask : ISoloTask
|
||||
if (condensedResinCount == 0 && fragileResinCount < 20)
|
||||
{
|
||||
// 没有体力了退出
|
||||
var exitRectArea = ra.Find(AutoFightContext.Instance.FightAssets.ExitRa);
|
||||
var exitRectArea = ra.Find(AutoFightAssets.Instance.ExitRa);
|
||||
if (!exitRectArea.IsEmpty())
|
||||
{
|
||||
exitRectArea.Click();
|
||||
@@ -779,7 +992,7 @@ public class AutoDomainTask : ISoloTask
|
||||
}
|
||||
}
|
||||
|
||||
Sleep(300, _cts);
|
||||
Sleep(300, _ct);
|
||||
}
|
||||
|
||||
throw new NormalEndException("未检测到秘境结束,可能是背包物品已满。");
|
||||
@@ -795,7 +1008,7 @@ public class AutoDomainTask : ISoloTask
|
||||
|
||||
var ra = CaptureToRectArea();
|
||||
// 浓缩树脂
|
||||
var condensedResinCountRa = ra.Find(AutoFightContext.Instance.FightAssets.CondensedResinCountRa);
|
||||
var condensedResinCountRa = ra.Find(AutoFightAssets.Instance.CondensedResinCountRa);
|
||||
if (!condensedResinCountRa.IsEmpty())
|
||||
{
|
||||
// 图像右侧就是浓缩树脂数量
|
||||
@@ -806,7 +1019,7 @@ public class AutoDomainTask : ISoloTask
|
||||
}
|
||||
|
||||
// 脆弱树脂
|
||||
var fragileResinCountRa = ra.Find(AutoFightContext.Instance.FightAssets.FragileResinCountRa);
|
||||
var fragileResinCountRa = ra.Find(AutoFightAssets.Instance.FragileResinCountRa);
|
||||
if (!fragileResinCountRa.IsEmpty())
|
||||
{
|
||||
// 图像右侧就是脆弱树脂数量
|
||||
@@ -818,4 +1031,19 @@ public class AutoDomainTask : ISoloTask
|
||||
Logger.LogInformation("剩余:浓缩树脂 {CondensedResinCount} 脆弱树脂 {FragileResinCount}", condensedResinCount, fragileResinCount);
|
||||
return (condensedResinCount, fragileResinCount);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ArtifactSalvage()
|
||||
{
|
||||
if (!_taskParam.AutoArtifactSalvage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(_taskParam.MaxArtifactStar, out var star))
|
||||
{
|
||||
star = 4;
|
||||
}
|
||||
|
||||
await new ArtifactSalvageTask(star).Start(_ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="地脉异常" xml:space="preserve">
|
||||
<value>Ley.*Line.*Disorder</value>
|
||||
</data>
|
||||
<data name="挑战达成" xml:space="preserve">
|
||||
<value>(Challenge|Completed)</value>
|
||||
</data>
|
||||
<data name="点击任意位置关闭" xml:space="preserve">
|
||||
<value>Click.*any.*where.*to.*close</value>
|
||||
</data>
|
||||
<data name="自动退出" xml:space="preserve">
|
||||
<value>Leaving</value>
|
||||
</data>
|
||||
<data name="跳过" xml:space="preserve">
|
||||
<value>Skip</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="地脉异常" xml:space="preserve">
|
||||
<value>Anomalie.*énergétique</value>
|
||||
</data>
|
||||
<data name="挑战达成" xml:space="preserve">
|
||||
<value>(Défi|terminé)</value>
|
||||
</data>
|
||||
<data name="点击任意位置关闭" xml:space="preserve">
|
||||
<value>Cliquez.*pour.*fermer</value>
|
||||
</data>
|
||||
<data name="自动退出" xml:space="preserve">
|
||||
<value>Sortie</value>
|
||||
</data>
|
||||
<data name="跳过" xml:space="preserve">
|
||||
<value>Passer</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="地脉异常" xml:space="preserve">
|
||||
<value>地脉异常</value>
|
||||
</data>
|
||||
<data name="挑战达成" xml:space="preserve">
|
||||
<value>(挑战|达成)</value>
|
||||
</data>
|
||||
<data name="点击任意位置关闭" xml:space="preserve">
|
||||
<value>点击任意位置关闭</value>
|
||||
</data>
|
||||
<data name="自动退出" xml:space="preserve">
|
||||
<value>(自动|退出)</value>
|
||||
</data>
|
||||
<data name="跳过" xml:space="preserve">
|
||||
<value>跳过</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="地脉异常" xml:space="preserve">
|
||||
<value>地[脈服][異翼昊]常</value>
|
||||
</data>
|
||||
<data name="挑战达成" xml:space="preserve">
|
||||
<value>(挑戰|達成)</value>
|
||||
</data>
|
||||
<data name="点击任意位置关闭" xml:space="preserve">
|
||||
<value>點擊任意位置關閉</value>
|
||||
</data>
|
||||
<data name="自动退出" xml:space="preserve">
|
||||
<value>(自動|退出)</value>
|
||||
</data>
|
||||
<data name="跳过" xml:space="preserve">
|
||||
<value>跳過</value>
|
||||
</data>
|
||||
</root>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 607 B |
@@ -9,9 +9,10 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
{
|
||||
public Rect TeamRectNoIndex;
|
||||
public Rect TeamRect;
|
||||
public List<Rect> AvatarSideIconRectList;
|
||||
public List<Rect> AvatarIndexRectList;
|
||||
public List<Rect> AvatarSideIconRectList; // 侧边栏角色头像 非联机状态下
|
||||
public List<Rect> AvatarIndexRectList; // 侧边栏角色头像对应的白色块 非联机状态下
|
||||
public Rect ERect;
|
||||
public Rect ECooldownRect;
|
||||
public Rect QRect;
|
||||
public Rect EndTipsUpperRect; // 挑战达成提示
|
||||
public Rect EndTipsRect;
|
||||
@@ -29,6 +30,16 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
|
||||
public Dictionary<string, string> AvatarCostumeMap;
|
||||
|
||||
// 联机
|
||||
public RecognitionObject OnePRa;
|
||||
|
||||
public RecognitionObject PRa;
|
||||
public Dictionary<string, List<Rect>> AvatarSideIconRectListMap; // 侧边栏角色头像 联机状态下
|
||||
public Dictionary<string, List<Rect>> AvatarIndexRectListMap; // 侧边栏角色头像对应的白色块 联机状态下
|
||||
|
||||
// 小道具位置
|
||||
public Rect GadgetRect;
|
||||
|
||||
private AutoFightAssets()
|
||||
{
|
||||
TeamRectNoIndex = new Rect(CaptureRect.Width - (int)(355 * AssetScale), (int)(220 * AssetScale),
|
||||
@@ -37,8 +48,13 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
(int)(355 * AssetScale), (int)(465 * AssetScale));
|
||||
ERect = new Rect(CaptureRect.Width - (int)(267 * AssetScale), CaptureRect.Height - (int)(132 * AssetScale),
|
||||
(int)(77 * AssetScale), (int)(77 * AssetScale));
|
||||
ECooldownRect = new Rect(CaptureRect.Width - (int)(241 * AssetScale), CaptureRect.Height - (int)(97 * AssetScale),
|
||||
(int)(41 * AssetScale), (int)(18 * AssetScale));
|
||||
QRect = new Rect(CaptureRect.Width - (int)(157 * AssetScale), CaptureRect.Height - (int)(165 * AssetScale),
|
||||
(int)(110 * AssetScale), (int)(110 * AssetScale));
|
||||
// 小道具位置 1920-133,800,60,50
|
||||
GadgetRect = new Rect(CaptureRect.Width - (int)(133 * AssetScale), (int)(800 * AssetScale),
|
||||
(int)(60 * AssetScale), (int)(50 * AssetScale));
|
||||
// 结束提示从中间开始找相对位置
|
||||
EndTipsUpperRect = new Rect(CaptureRect.Width / 2 - (int)(100 * AssetScale), (int)(243 * AssetScale),
|
||||
(int)(200 * AssetScale), (int)(50 * AssetScale));
|
||||
@@ -79,6 +95,78 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
{ "Sea", "海风之梦" },
|
||||
};
|
||||
|
||||
// 联机
|
||||
// 1p_2 与 p_2 为同一位置
|
||||
// 1p_4 与 p_4 为同一位置
|
||||
AvatarSideIconRectListMap = new Dictionary<string, List<Rect>>
|
||||
{
|
||||
{
|
||||
"1p_2", [
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{
|
||||
"1p_3", [
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{ "1p_4", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(515 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
|
||||
{
|
||||
"p_2", [
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(375 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(470 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{ "p_3", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(475 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
|
||||
{ "p_4", [new Rect(CaptureRect.Width - (int)(155 * AssetScale), (int)(515 * AssetScale), (int)(76 * AssetScale), (int)(76 * AssetScale))] },
|
||||
};
|
||||
|
||||
AvatarIndexRectListMap = new Dictionary<string, List<Rect>>
|
||||
{
|
||||
{
|
||||
"1p_2", [
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(508 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{
|
||||
"1p_3", [
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(459 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(555 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{ "1p_4", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(552 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
|
||||
{
|
||||
"p_2", [
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(508 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale)),
|
||||
]
|
||||
},
|
||||
{ "p_3", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(412 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
|
||||
{ "p_4", [new Rect(CaptureRect.Width - (int)(61 * AssetScale), (int)(507 * AssetScale), (int)(28 * AssetScale), (int)(24 * AssetScale))] },
|
||||
};
|
||||
|
||||
// 左上角的 1P 图标
|
||||
OnePRa = new RecognitionObject
|
||||
{
|
||||
Name = "1P",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoFight", "1p.png"),
|
||||
RegionOfInterest = new Rect(0, 0, CaptureRect.Width / 4, CaptureRect.Height / 7),
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
// 右侧联机的 P 图标
|
||||
PRa = new RecognitionObject
|
||||
{
|
||||
Name = "P",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoFight", "p.png"),
|
||||
RegionOfInterest = new Rect(CaptureRect.Width - (int)(CaptureRect.Width / 12.5), CaptureRect.Height / 5, (int)(CaptureRect.Width / 12.5), CaptureRect.Height / 2 - CaptureRect.Width / 7),
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
|
||||
WandererIconRa = new RecognitionObject
|
||||
{
|
||||
Name = "WandererIcon",
|
||||
|
||||
@@ -3,6 +3,10 @@ using System;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动战斗配置
|
||||
/// </summary>
|
||||
@@ -21,10 +25,111 @@ public partial class AutoFightConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _fightFinishDetectEnabled = true;
|
||||
/// <summary>
|
||||
/// 根据技能CD优化出招人员
|
||||
/// 根据填入人或人和cd,来决定当此人元素战技cd未结束时,跳过此人出招,来优化战斗流程,可填入人名或人名数字(用逗号分隔),
|
||||
/// 多种用分号分隔,例如:白术;钟离,12;,如果人名,则用内置cd检查,如果是人名和数字,则把数字当做出招cd(秒)。
|
||||
/// </summary>
|
||||
[ObservableProperty] private string _actionSchedulerByCd = "";
|
||||
|
||||
[Serializable]
|
||||
public partial class FightFinishDetectConfig : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 判断战斗结束读条颜色,不同帧率可能下会有些不同,默认为95,235,255
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _battleEndProgressBarColor = "";
|
||||
|
||||
/// <summary>
|
||||
/// 对于上方颜色地偏差值,即±某个值,例如 6或6,6,6,前者表示所有偏差值都一样,后者则可以分别设置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _battleEndProgressBarColorTolerance = "";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 快速检查战斗结束,在一轮脚本中,可以每隔一定秒数(默认为5)或指定角色操作后,去检查(在每个角色完成该轮脚本时)。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _fastCheckEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 快速检查战斗结束的参数,可填入数字和人名,多种用分号分隔,例如:15,白术;钟离;,如果是数字(小于等于0则不会根据时间去检查),则指定检查间隔,如果是人名,则该角色执行一轮操作后进行检查。同时每轮结束后检查不变。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _fastCheckParams = "";
|
||||
|
||||
/// <summary>
|
||||
/// 检查战斗结束的延时,即角色,默认为1.5秒。也可以指定特定角色之后延时多少时间检查。格式如:2.5;白术,1.5;钟离,1.0;
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _checkEndDelay = "";
|
||||
|
||||
/// <summary>
|
||||
/// 按下切换队伍后去检查屏幕色块的延迟,默认为0.45秒。若频繁误判可以适当提高这个值。确保这个延迟不会真的把队伍配置界面切出来。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _beforeDetectDelay = "";
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 战斗结束相关配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private FightFinishDetectConfig _finishDetectConfig = new();
|
||||
|
||||
/// <summary>
|
||||
/// 检测战斗结束
|
||||
/// 检测战斗结束,默认为每轮脚本后检查
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _pickDropsAfterFightEnabled = true;
|
||||
|
||||
[Serializable]
|
||||
public partial class PickDropsAfterFightConfig : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 前进次数
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _forwardTimes = 6;
|
||||
|
||||
/// <summary>
|
||||
/// 校准次数
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _calibrationTimes = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 衰减因子
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private double _decayFactor = 0.7;
|
||||
|
||||
/// <summary>
|
||||
/// 前进量(秒),设置为0时在[1,3]中随机
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _forwardSeconds = 2;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 掉落寻物相关配置
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private PickDropsAfterFightConfig _pickDropsConfig = new();
|
||||
|
||||
/// <summary>
|
||||
/// 战斗结束后,如果存在枫原万叶,则使用该角色捡材料
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _kazuhaPickupEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗超时,单位秒
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _timeout = 120;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
using BetterGenshinImpact.Model;
|
||||
// using BetterGenshinImpact.Core.Simulator;
|
||||
// using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
// using BetterGenshinImpact.Model;
|
||||
//
|
||||
// namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
/// <summary>
|
||||
/// 自动战斗上下文
|
||||
/// 请在启动BetterGI以后再初始化
|
||||
/// </summary>
|
||||
public class AutoFightContext : Singleton<AutoFightContext>
|
||||
{
|
||||
private AutoFightContext()
|
||||
{
|
||||
Simulator = Simulation.PostMessage(TaskContext.Instance().GameHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// find资源
|
||||
/// </summary>
|
||||
public AutoFightAssets FightAssets => AutoFightAssets.Instance;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗专用的PostMessage模拟键鼠操作
|
||||
/// </summary>
|
||||
public readonly PostMessageSimulator Simulator;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 自动战斗上下文
|
||||
// /// 请在启动BetterGI以后再初始化
|
||||
// /// </summary>
|
||||
// public class AutoFightContext : Singleton<AutoFightContext>
|
||||
// {
|
||||
// private AutoFightContext()
|
||||
// {
|
||||
// Simulator = TaskContext.Instance().PostMessageSimulator;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// find资源
|
||||
// /// </summary>
|
||||
// public AutoFightAssets FightAssets => AutoFightAssets.Instance;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 战斗专用的PostMessage模拟键鼠操作
|
||||
// /// </summary>
|
||||
// public readonly PostMessageSimulator Simulator;
|
||||
// }
|
||||
@@ -2,11 +2,55 @@
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
public class AutoFightParam(string path) : BaseTaskParam
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class AutoFightParam : BaseTaskParam
|
||||
{
|
||||
public string CombatStrategyPath { get; set; } = path;
|
||||
public class FightFinishDetectConfig
|
||||
{
|
||||
public string BattleEndProgressBarColor { get; set; }= "";
|
||||
|
||||
public string BattleEndProgressBarColorTolerance { get; set; }= "";
|
||||
public bool FastCheckEnabled = false;
|
||||
public string FastCheckParams = "";
|
||||
public string CheckEndDelay = "";
|
||||
public string BeforeDetectDelay = "";
|
||||
}
|
||||
|
||||
public AutoFightParam(string path, AutoFightConfig autoFightConfig)
|
||||
{
|
||||
CombatStrategyPath = path;
|
||||
Timeout = autoFightConfig.Timeout;
|
||||
FightFinishDetectEnabled = autoFightConfig.FightFinishDetectEnabled;
|
||||
PickDropsAfterFightEnabled = autoFightConfig.PickDropsAfterFightEnabled;
|
||||
KazuhaPickupEnabled = autoFightConfig.KazuhaPickupEnabled;
|
||||
ActionSchedulerByCd = autoFightConfig.ActionSchedulerByCd;
|
||||
|
||||
FinishDetectConfig.FastCheckEnabled = autoFightConfig.FinishDetectConfig.FastCheckEnabled;
|
||||
FinishDetectConfig.FastCheckParams = autoFightConfig.FinishDetectConfig.FastCheckParams;
|
||||
FinishDetectConfig.CheckEndDelay = autoFightConfig.FinishDetectConfig.CheckEndDelay;
|
||||
FinishDetectConfig.BeforeDetectDelay = autoFightConfig.FinishDetectConfig.BeforeDetectDelay;
|
||||
|
||||
//下面参数固定,只取自动战斗里面的
|
||||
FinishDetectConfig.BattleEndProgressBarColor = TaskContext.Instance().Config.AutoFightConfig.FinishDetectConfig.BattleEndProgressBarColor;
|
||||
FinishDetectConfig.BattleEndProgressBarColorTolerance = TaskContext.Instance().Config.AutoFightConfig.FinishDetectConfig.BattleEndProgressBarColorTolerance;
|
||||
}
|
||||
|
||||
public FightFinishDetectConfig FinishDetectConfig { get; set; } = new();
|
||||
|
||||
public string CombatStrategyPath { get; set; }
|
||||
|
||||
public bool FightFinishDetectEnabled { get; set; } = false;
|
||||
|
||||
public bool PickDropsAfterFightEnabled { get; set; } = false;
|
||||
}
|
||||
|
||||
public int Timeout { get; set; } = 120;
|
||||
|
||||
public bool KazuhaPickupEnabled = true;
|
||||
public string ActionSchedulerByCd = "";
|
||||
|
||||
|
||||
}
|
||||
@@ -1,32 +1,179 @@
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.GameTask.Common.Job;
|
||||
using OpenCvSharp;
|
||||
using Vanara;
|
||||
using Vanara.PInvoke;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
public class AutoFightTask : ISoloTask
|
||||
{
|
||||
public string Name => "自动战斗";
|
||||
|
||||
private readonly AutoFightParam _taskParam;
|
||||
|
||||
private readonly CombatScriptBag _combatScriptBag;
|
||||
|
||||
private CancellationTokenSource? _cts;
|
||||
private CancellationToken _ct;
|
||||
|
||||
private readonly BgiYoloV8Predictor _predictor;
|
||||
|
||||
private DateTime _lastFightFlagTime = DateTime.Now; // 战斗标志最近一次出现的时间
|
||||
|
||||
private readonly double _dpi = TaskContext.Instance().DpiScale;
|
||||
|
||||
|
||||
private class TaskFightFinishDetectConfig
|
||||
{
|
||||
public int DelayTime = 1500;
|
||||
public int DetectDelayTime = 450;
|
||||
public Dictionary<string, int> DelayTimes = new();
|
||||
public double CheckTime = 5;
|
||||
public List<string> CheckNames = new();
|
||||
public bool FastCheckEnabled;
|
||||
|
||||
public TaskFightFinishDetectConfig(AutoFightParam.FightFinishDetectConfig finishDetectConfig)
|
||||
{
|
||||
FastCheckEnabled = finishDetectConfig.FastCheckEnabled;
|
||||
ParseCheckTimeString(finishDetectConfig.FastCheckParams, out CheckTime, CheckNames);
|
||||
ParseFastCheckEndDelayString(finishDetectConfig.CheckEndDelay, out DelayTime, DelayTimes);
|
||||
BattleEndProgressBarColor = ParseStringToTuple(finishDetectConfig.BattleEndProgressBarColor, (95, 235, 255));
|
||||
BattleEndProgressBarColorTolerance = ParseSingleOrCommaSeparated(finishDetectConfig.BattleEndProgressBarColorTolerance, (6, 6, 6));
|
||||
DetectDelayTime = (int)((double.TryParse(finishDetectConfig.BeforeDetectDelay, out var result) ? result : 0.45) * 1000);
|
||||
}
|
||||
|
||||
public (int, int, int) BattleEndProgressBarColor { get; }
|
||||
public (int, int, int) BattleEndProgressBarColorTolerance { get; }
|
||||
|
||||
public static void ParseCheckTimeString(
|
||||
string input,
|
||||
out double checkTime,
|
||||
List<string> names)
|
||||
{
|
||||
checkTime = 5;
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return; // 直接返回
|
||||
}
|
||||
|
||||
var uniqueNames = new HashSet<string>(); // 用于临时去重的集合
|
||||
|
||||
// 按分号分割字符串
|
||||
var segments = input.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var segment in segments)
|
||||
{
|
||||
var trimmedSegment = segment.Trim();
|
||||
|
||||
// 如果是纯数字部分
|
||||
if (double.TryParse(trimmedSegment, NumberStyles.Float, CultureInfo.InvariantCulture, out double number))
|
||||
{
|
||||
checkTime = number; // 更新 CheckTime
|
||||
}
|
||||
else if (!uniqueNames.Contains(trimmedSegment)) // 如果是非数字且不重复
|
||||
{
|
||||
uniqueNames.Add(trimmedSegment); // 添加到集合
|
||||
}
|
||||
}
|
||||
|
||||
names.AddRange(uniqueNames); // 将集合转换为列表
|
||||
}
|
||||
|
||||
public static void ParseFastCheckEndDelayString(
|
||||
string input,
|
||||
out int delayTime,
|
||||
Dictionary<string, int> nameDelayMap)
|
||||
{
|
||||
delayTime = 1500;
|
||||
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return; // 直接返回
|
||||
}
|
||||
|
||||
// 分割字符串,以分号为分隔符
|
||||
var segments = input.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var segment in segments)
|
||||
{
|
||||
var parts = segment.Split(',');
|
||||
|
||||
// 如果是纯数字部分
|
||||
if (parts.Length == 1)
|
||||
{
|
||||
if (double.TryParse(parts[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out double number))
|
||||
{
|
||||
delayTime = (int)(number * 1000); // 更新 delayTime
|
||||
}
|
||||
}
|
||||
// 如果是名字,数字格式
|
||||
else if (parts.Length == 2)
|
||||
{
|
||||
string name = parts[0].Trim();
|
||||
if (double.TryParse(parts[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out double value))
|
||||
{
|
||||
nameDelayMap[name] = (int)(value * 1000); // 更新字典,取最后一个值
|
||||
}
|
||||
}
|
||||
// 其他格式,跳过不处理
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool IsSingleNumber(string input, out int result)
|
||||
{
|
||||
return int.TryParse(input, out result);
|
||||
}
|
||||
|
||||
static (int, int, int) ParseSingleOrCommaSeparated(string input, (int, int, int) defaultValue)
|
||||
{
|
||||
// 如果是单个数字
|
||||
if (IsSingleNumber(input, out var singleNumber))
|
||||
{
|
||||
return (singleNumber, singleNumber, singleNumber);
|
||||
}
|
||||
|
||||
return ParseStringToTuple(input, defaultValue);
|
||||
}
|
||||
|
||||
static (int, int, int) ParseStringToTuple(string input, (int, int, int) defaultValue)
|
||||
{
|
||||
// 尝试按逗号分割字符串
|
||||
var parts = input.Split(',');
|
||||
if (parts.Length == 3 &&
|
||||
int.TryParse(parts[0], out var num1) &&
|
||||
int.TryParse(parts[1], out var num2) &&
|
||||
int.TryParse(parts[2], out var num3))
|
||||
{
|
||||
return (num1, num2, num3);
|
||||
}
|
||||
|
||||
// 如果解析失败,返回默认值
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
private TaskFightFinishDetectConfig _finishDetectConfig;
|
||||
|
||||
public AutoFightTask(AutoFightParam taskParam)
|
||||
{
|
||||
_taskParam = taskParam;
|
||||
@@ -34,13 +181,21 @@ public class AutoFightTask : ISoloTask
|
||||
|
||||
if (_taskParam.FightFinishDetectEnabled)
|
||||
{
|
||||
_predictor = new BgiYoloV8Predictor(@"Assets\Model\World\bgi_world.onnx");
|
||||
_predictor = BgiYoloV8PredictorFactory.GetPredictor(@"Assets\Model\World\bgi_world.onnx");
|
||||
}
|
||||
|
||||
_finishDetectConfig = new TaskFightFinishDetectConfig(_taskParam.FinishDetectConfig);
|
||||
}
|
||||
|
||||
public async Task Start(CancellationTokenSource cts)
|
||||
// 方法1:判断是否是单个数字
|
||||
|
||||
/*public int delayTime=1500;
|
||||
public Dictionary<string, int> delayTimes = new();
|
||||
public double checkTime = 5;
|
||||
public List<string> checkNames = new();*/
|
||||
public async Task Start(CancellationToken ct)
|
||||
{
|
||||
_cts = cts;
|
||||
_ct = ct;
|
||||
|
||||
LogScreenResolution();
|
||||
var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea());
|
||||
@@ -49,121 +204,372 @@ public class AutoFightTask : ISoloTask
|
||||
throw new Exception("识别队伍角色失败");
|
||||
}
|
||||
|
||||
var actionSchedulerByCd = ParseStringToDictionary(_taskParam.ActionSchedulerByCd);
|
||||
var combatCommands = _combatScriptBag.FindCombatScript(combatScenes.Avatars);
|
||||
|
||||
// 新的取消token
|
||||
var cts2 = new CancellationTokenSource();
|
||||
cts.Token.Register(cts2.Cancel);
|
||||
ct.Register(cts2.Cancel);
|
||||
|
||||
combatScenes.BeforeTask(cts2);
|
||||
combatScenes.BeforeTask(cts2.Token);
|
||||
TimeSpan fightTimeout = TimeSpan.FromSeconds(_taskParam.Timeout); // 战斗超时时间
|
||||
Stopwatch timeoutStopwatch = Stopwatch.StartNew();
|
||||
|
||||
Stopwatch checkFightFinishStopwatch = Stopwatch.StartNew();
|
||||
TimeSpan checkFightFinishTime = TimeSpan.FromSeconds(_finishDetectConfig.CheckTime); //检查战斗超时时间的超时时间
|
||||
|
||||
|
||||
//战斗前检查,可做成配置
|
||||
// if (await CheckFightFinish()) {
|
||||
// return;
|
||||
// }
|
||||
var fightEndFlag = false;
|
||||
string lastFightName = "";
|
||||
string skipFightName = "";
|
||||
//统计切换人打架次数
|
||||
var countFight = 0;
|
||||
// 战斗操作
|
||||
var fightTask = Task.Run(() =>
|
||||
var fightTask = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!cts2.Token.IsCancellationRequested)
|
||||
{
|
||||
// 通用化战斗策略
|
||||
foreach (var command in combatCommands)
|
||||
for (var i = 0; i < combatCommands.Count; i++)
|
||||
{
|
||||
var command = combatCommands[i];
|
||||
if (timeoutStopwatch.Elapsed > fightTimeout)
|
||||
{
|
||||
Logger.LogInformation("战斗超时结束");
|
||||
fightEndFlag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//根据元素技能冷却事件优化出招流程,只有当人物切换后才会触发检查
|
||||
double skillCd;
|
||||
if (lastFightName != command.Name && actionSchedulerByCd.TryGetValue(command.Name, out skillCd))
|
||||
{
|
||||
var avatar = combatScenes.SelectAvatar(command.Name);
|
||||
if (avatar == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (skillCd < 0)
|
||||
{
|
||||
skillCd = FindMax([avatar.SkillCd, avatar.SkillHoldCd]);
|
||||
}
|
||||
var dif = (DateTime.UtcNow - avatar.LastSkillTime);
|
||||
//当技能未冷却时,跳过此次出招
|
||||
if ((DateTime.UtcNow - avatar.LastSkillTime).TotalSeconds < skillCd)
|
||||
{
|
||||
if (skipFightName != command.Name)
|
||||
{
|
||||
Logger.LogInformation($"{command.Name}cd冷却为{skillCd}秒,剩余{skillCd - dif.TotalSeconds}秒,跳过此次行动");
|
||||
}
|
||||
skipFightName = command.Name;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
command.Execute(combatScenes);
|
||||
//统计战斗人次
|
||||
if (i == combatCommands.Count - 1 || command.Name != combatCommands[i + 1].Name)
|
||||
{
|
||||
countFight++;
|
||||
}
|
||||
|
||||
lastFightName = command.Name;
|
||||
if (!fightEndFlag && _taskParam is { FightFinishDetectEnabled: true })
|
||||
{
|
||||
//处于最后一个位置,或者当前执行人和下一个人名字不一样的情况,满足一定条件(开启快速检查,并且检查时间大于0或人名存在配置)检查战斗
|
||||
if (i == combatCommands.Count - 1
|
||||
|| (
|
||||
_finishDetectConfig.FastCheckEnabled && command.Name != combatCommands[i + 1].Name &&
|
||||
((_finishDetectConfig.CheckTime > 0 && checkFightFinishStopwatch.Elapsed > checkFightFinishTime)
|
||||
|| _finishDetectConfig.CheckNames.Contains(command.Name))
|
||||
))
|
||||
{
|
||||
checkFightFinishStopwatch.Restart();
|
||||
var delayTime = _finishDetectConfig.DelayTime;
|
||||
var detectDelayTime = _finishDetectConfig.DetectDelayTime;
|
||||
if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time))
|
||||
{
|
||||
delayTime = time;
|
||||
Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation($"延时检查为{delayTime}毫秒");
|
||||
}
|
||||
|
||||
/*if (i<combatCommands.Count - 1)
|
||||
{
|
||||
Logger.LogInformation($"{command.Name}下一个人为{combatCommands[i+1].Name}毫秒");
|
||||
}*/
|
||||
fightEndFlag = await CheckFightFinish(delayTime, detectDelayTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (fightEndFlag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
Debug.WriteLine(e.StackTrace);
|
||||
}
|
||||
}, cts2.Token);
|
||||
|
||||
// 战斗结束检测线程
|
||||
var endTask = Task.Run(async () =>
|
||||
{
|
||||
if (!_taskParam.FightFinishDetectEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
while (!cts2.IsCancellationRequested)
|
||||
{
|
||||
var finish = await CheckFightFinish();
|
||||
if (finish)
|
||||
if (fightEndFlag)
|
||||
{
|
||||
await cts2.CancelAsync();
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(1000, cts2);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
Debug.WriteLine(e.StackTrace);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Simulation.ReleaseAllKey();
|
||||
}
|
||||
}, cts2.Token);
|
||||
|
||||
await Task.WhenAll(fightTask, endTask);
|
||||
await fightTask;
|
||||
|
||||
if (_taskParam is { FightFinishDetectEnabled: true, PickDropsAfterFightEnabled: true })
|
||||
// 战斗结束检测线程
|
||||
// var endTask = Task.Run(async () =>
|
||||
// {
|
||||
// if (!_taskParam.FightFinishDetectEnabled)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// while (!cts2.IsCancellationRequested)
|
||||
// {
|
||||
// var finish = await CheckFightFinish();
|
||||
// if (finish)
|
||||
// {
|
||||
// await cts2.CancelAsync();
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Sleep(1000, cts2.Token);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Debug.WriteLine(e.Message);
|
||||
// Debug.WriteLine(e.StackTrace);
|
||||
// }
|
||||
// }, cts2.Token);
|
||||
//
|
||||
// await Task.WhenAll(fightTask, endTask);
|
||||
if (_taskParam.KazuhaPickupEnabled)
|
||||
{
|
||||
// 队伍中存在万叶的时候使用一次长E
|
||||
var kazuha = combatScenes.Avatars.FirstOrDefault(a => a.Name == "枫原万叶");
|
||||
if (kazuha != null)
|
||||
{
|
||||
var time = DateTime.UtcNow - kazuha.LastSkillTime;
|
||||
//当万叶cd大于3时或战斗人次少于2时(通常无怪物情况下),此时不再触发万叶拾取,
|
||||
if (!(countFight < 2 || lastFightName == "枫原万叶" && time.TotalSeconds > 3))
|
||||
{
|
||||
Logger.LogInformation("使用枫原万叶长E拾取掉落物");
|
||||
await Delay(300, ct);
|
||||
if (kazuha.TrySwitch())
|
||||
{
|
||||
time = DateTime.UtcNow - kazuha.LastSkillTime;
|
||||
if (time.TotalMilliseconds > 0 && time.TotalSeconds <= kazuha.SkillHoldCd)
|
||||
{
|
||||
Logger.LogInformation("枫原万叶长E技能可能处于冷却中,等待 {Time} s", time.TotalSeconds);
|
||||
await Delay((int)Math.Ceiling(time.TotalMilliseconds), ct);
|
||||
}
|
||||
|
||||
kazuha.UseSkill(true);
|
||||
await Task.Delay(100);
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
|
||||
await Delay(1500, ct);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation((countFight < 2 ? "首个人出招就结束战斗,应该无怪物" : "距最近一次万叶出招,时间过短") + ",跳过此次万叶拾取!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_taskParam is { PickDropsAfterFightEnabled: true })
|
||||
{
|
||||
// 执行自动拾取掉落物的功能
|
||||
await new ScanPickTask().Start(ct);
|
||||
}
|
||||
}
|
||||
|
||||
private void LogScreenResolution()
|
||||
{
|
||||
var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
|
||||
if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
|
||||
{
|
||||
Logger.LogWarning("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏可能无法正常使用自动战斗功能 !", gameScreenSize.Width, gameScreenSize.Height);
|
||||
}
|
||||
AssertUtils.CheckGameResolution("自动战斗");
|
||||
}
|
||||
|
||||
private async Task<bool> CheckFightFinish()
|
||||
static bool AreDifferencesWithinBounds((int, int, int) a, (int, int, int) b, (int, int, int) c)
|
||||
{
|
||||
// 计算每个位置的差值绝对值并进行比较
|
||||
return Math.Abs(a.Item1 - b.Item1) < c.Item1 &&
|
||||
Math.Abs(a.Item2 - b.Item2) < c.Item2 &&
|
||||
Math.Abs(a.Item3 - b.Item3) < c.Item3;
|
||||
}
|
||||
|
||||
private async Task<bool> CheckFightFinish(int delayTime = 1500, int detectDelayTime = 450)
|
||||
{
|
||||
// YOLO 判断血条和怪物位置
|
||||
if (HasFightFlag(CaptureToRectArea()))
|
||||
{
|
||||
_lastFightFlagTime = DateTime.Now;
|
||||
return false;
|
||||
}
|
||||
// if (HasFightFlagByYolo(CaptureToRectArea()))
|
||||
// {
|
||||
// _lastFightFlagTime = DateTime.Now;
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
|
||||
//Random random = new Random();
|
||||
//double randomFraction = random.NextDouble(); // 生成 0 到 1 之间的随机小数
|
||||
//此处随机数,防止固定招式下,使按L正好处于招式下,导致无法准确判断战斗结束
|
||||
// double randomNumber = 1 + (randomFraction * (3 - 1));
|
||||
|
||||
// 几秒内没有检测到血条和怪物位置,则开始旋转视角重新检测
|
||||
if ((DateTime.Now - _lastFightFlagTime).TotalSeconds > 5)
|
||||
//if ((DateTime.Now - _lastFightFlagTime).TotalSeconds > randomNumber)
|
||||
//{
|
||||
// 旋转完毕后都没有检测到血条和怪物位置,则按L键确认战斗结束
|
||||
/**
|
||||
Simulation.SendInput.Mouse.MiddleButtonClick();
|
||||
await Delay(300, _ct);
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
// 旋转完毕后都没有检测到血条和怪物位置,则按L键确认战斗结束
|
||||
List<int> angles = [0, 90, 180, 270];
|
||||
var rotateTask = new CameraRotateTask(_cts!);
|
||||
foreach (var a in angles)
|
||||
Simulation.SendInput.Mouse.MoveMouseBy((int)(500 * _dpi), 0);
|
||||
await Delay(800, _ct); // 等待视角稳定
|
||||
if (HasFightFlagByYolo(CaptureToRectArea()))
|
||||
{
|
||||
await rotateTask.WaitUntilRotatedTo(a, 5, 30);
|
||||
await Delay(1000, _cts!); // 等待视角稳定
|
||||
if (HasFightFlag(CaptureToRectArea()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_lastFightFlagTime = DateTime.Now;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 最终方案确认战斗结束
|
||||
}
|
||||
**/
|
||||
//Simulation.SendInput.SimulateAction(GIActions.Drop);//在换队前取消爬墙状态
|
||||
await Delay(delayTime, _ct);
|
||||
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
|
||||
// 最终方案确认战斗结束
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
|
||||
await Delay(detectDelayTime, _ct);
|
||||
var ra = CaptureToRectArea();
|
||||
var b3 = ra.SrcMat.At<Vec3b>(50, 790); //进度条颜色
|
||||
var whiteTile = ra.SrcMat.At<Vec3b>(50, 768); //白块
|
||||
Simulation.SendInput.SimulateAction(GIActions.Drop);
|
||||
if (IsWhite(whiteTile.Item2, whiteTile.Item1, whiteTile.Item0) && IsYellow(b3.Item2, b3.Item1, b3.Item0) /* AreDifferencesWithinBounds(_finishDetectConfig.BattleEndProgressBarColor, (b3.Item0, b3.Item1, b3.Item2), _finishDetectConfig.BattleEndProgressBarColorTolerance)*/)
|
||||
{
|
||||
Logger.LogInformation("识别到战斗结束");
|
||||
return true;
|
||||
}
|
||||
|
||||
Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
|
||||
Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
|
||||
/**
|
||||
if (!Bv.IsInMainUi(ra))
|
||||
{
|
||||
// 如果不在主界面,说明异常,直接结束战斗继续下一步(地图追踪下一步会进入异常处理)
|
||||
Logger.LogInformation("当前不在主界面,直接结束战斗!");
|
||||
return true;
|
||||
}**/
|
||||
|
||||
_lastFightFlagTime = DateTime.Now;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool HasFightFlag(ImageRegion imageRegion)
|
||||
bool IsYellow(int r, int g, int b)
|
||||
{
|
||||
if (RuntimeHelper.IsDebug)
|
||||
//Logger.LogInformation($"IsYellow({r},{g},{b})");
|
||||
// 黄色范围:R高,G高,B低
|
||||
return (r >= 200 && r <= 255) &&
|
||||
(g >= 200 && g <= 255) &&
|
||||
(b >= 0 && b <= 100);
|
||||
}
|
||||
|
||||
bool IsWhite(int r, int g, int b)
|
||||
{
|
||||
//Logger.LogInformation($"IsWhite({r},{g},{b})");
|
||||
// 白色范围:R高,G高,B低
|
||||
return (r >= 240 && r <= 255) &&
|
||||
(g >= 240 && g <= 255) &&
|
||||
(b >= 240 && b <= 255);
|
||||
}
|
||||
static double FindMax(double[] numbers)
|
||||
{
|
||||
if (numbers == null || numbers.Length == 0)
|
||||
{
|
||||
imageRegion.SrcMat.SaveImage(Global.Absolute(@"log\fight\" + $"{DateTime.Now:yyyyMMdd_HHmmss_ffff}.png"));
|
||||
throw new ArgumentException("The array is empty or null.");
|
||||
}
|
||||
|
||||
double max = numbers[0] > 10000 ? 0 : numbers[0];
|
||||
foreach (var num in numbers)
|
||||
{
|
||||
var cpnum = numbers[0] > 10000 ? 0 : num;
|
||||
max = Math.Max(max, num);
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
private static Dictionary<string, double> ParseStringToDictionary(string input, double defaultValue = -1)
|
||||
{
|
||||
var dictionary = new Dictionary<string, double>();
|
||||
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return dictionary; // 返回空字典
|
||||
}
|
||||
|
||||
string[] pairs = input.Split(';', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var pair in pairs)
|
||||
{
|
||||
var parts = pair.Split(',', StringSplitOptions.TrimEntries);
|
||||
|
||||
if (parts.Length > 0)
|
||||
{
|
||||
string name = parts[0];
|
||||
double value = defaultValue;
|
||||
|
||||
if (parts.Length > 1 && double.TryParse(parts[1], out var parsedValue))
|
||||
{
|
||||
value = parsedValue;
|
||||
}
|
||||
|
||||
dictionary[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private bool HasFightFlagByYolo(ImageRegion imageRegion)
|
||||
{
|
||||
// if (RuntimeHelper.IsDebug)
|
||||
// {
|
||||
// imageRegion.SrcMat.SaveImage(Global.Absolute(@"log\fight\" + $"{DateTime.Now:yyyyMMdd_HHmmss_ffff}.png"));
|
||||
// }
|
||||
var dict = _predictor.Detect(imageRegion);
|
||||
return dict.ContainsKey("health_bar") || dict.ContainsKey("enemy_identify");
|
||||
}
|
||||
}
|
||||
|
||||
// 无用
|
||||
// [Obsolete]
|
||||
// private bool HasFightFlagByGadget(ImageRegion imageRegion)
|
||||
// {
|
||||
// // 小道具位置 1920-133,800,60,50
|
||||
// var gadgetMat = imageRegion.DeriveCrop(AutoFightAssets.Instance.GadgetRect).SrcMat;
|
||||
// var list = ContoursHelper.FindSpecifyColorRects(gadgetMat, new Scalar(225, 220, 225), new Scalar(255, 255, 255));
|
||||
// // 要大于 gadgetMat 的 1/2
|
||||
// return list.Any(r => r.Width > gadgetMat.Width / 2 && r.Height > gadgetMat.Height / 2);
|
||||
// }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Service;
|
||||
using System;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -10,24 +10,31 @@ namespace BetterGenshinImpact.GameTask.AutoFight.Config;
|
||||
|
||||
public class DefaultAutoFightConfig
|
||||
{
|
||||
public static List<CombatAvatar> CombatAvatars { get; set; }
|
||||
//public static List<CombatAvatar> CombatAvatars { get; set; }
|
||||
public static List<string> CombatAvatarNames { get; set; }
|
||||
public static Dictionary<string, CombatAvatar> CombatAvatarMap { get; set; }
|
||||
public static Dictionary<string, CombatAvatar> CombatAvatarNameEnMap { get; set; }
|
||||
public static FrozenDictionary<string, string> CombatAvatarAliasToNameMap { get; set; }
|
||||
|
||||
static DefaultAutoFightConfig()
|
||||
{
|
||||
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoFight\Assets\combat_avatar.json"));
|
||||
var config = JsonSerializer.Deserialize<List<CombatAvatar>>(json, ConfigService.JsonOptions);
|
||||
CombatAvatars = config ?? throw new Exception("combat_avatar.json deserialize failed");
|
||||
var config = Newtonsoft.Json.JsonConvert.DeserializeObject<IEnumerable<CombatAvatar>>(json) ?? throw new Exception("combat_avatar.json deserialize failed");
|
||||
//CombatAvatars = config;
|
||||
CombatAvatarNames = config.Select(x => x.Name).ToList();
|
||||
CombatAvatarMap = config.ToDictionary(x => x.Name);
|
||||
CombatAvatarNameEnMap = config.ToDictionary(x => x.NameEn);
|
||||
CombatAvatarAliasToNameMap = config.SelectMany(c => c.Alias.Select(a => new KeyValuePair<string, string>(a, c.Name))).ToFrozenDictionary();
|
||||
}
|
||||
|
||||
public static string AvatarAliasToStandardName(string alias)
|
||||
{
|
||||
var avatar = CombatAvatars.Find(x => x.Alias.Contains(alias)) ?? throw new Exception($"角色名称校验失败:{alias}");
|
||||
return avatar.Name;
|
||||
if (CombatAvatarAliasToNameMap.TryGetValue(alias, out string? name) && name != null)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
throw new Exception($"角色名称校验失败:{alias}");
|
||||
|
||||
// return CombatAvatars.Find(x => x.Alias.Contains(alias))?.Name ?? throw new Exception($"角色名称校验失败:{alias}");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,25 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Simulator.Extensions;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Config;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception;
|
||||
using BetterGenshinImpact.GameTask.AutoTrackPath;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
|
||||
@@ -49,6 +58,11 @@ public class Avatar
|
||||
/// </summary>
|
||||
public double SkillHoldCd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最近一次使用元素战技的时间
|
||||
/// </summary>
|
||||
public DateTime LastSkillTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 元素爆发CD
|
||||
/// </summary>
|
||||
@@ -72,13 +86,14 @@ public class Avatar
|
||||
/// <summary>
|
||||
/// 任务取消令牌
|
||||
/// </summary>
|
||||
public CancellationTokenSource? Cts { get; set; }
|
||||
public CancellationToken Ct { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 战斗场景
|
||||
/// </summary>
|
||||
public CombatScenes CombatScenes { get; set; }
|
||||
|
||||
|
||||
public Avatar(CombatScenes combatScenes, string name, int index, Rect nameRect)
|
||||
{
|
||||
CombatScenes = combatScenes;
|
||||
@@ -99,19 +114,35 @@ public class Avatar
|
||||
/// 通过判断确认按钮
|
||||
/// </summary>
|
||||
/// <param name="region"></param>
|
||||
/// <param name="ct"></param>
|
||||
/// <returns></returns>
|
||||
public void ThrowWhenDefeated(ImageRegion region)
|
||||
public static void ThrowWhenDefeated(ImageRegion region, CancellationToken ct)
|
||||
{
|
||||
using var confirmRectArea = region.Find(AutoFightContext.Instance.FightAssets.ConfirmRa);
|
||||
if (!confirmRectArea.IsEmpty())
|
||||
if (Bv.IsInRevivePrompt(region))
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE);
|
||||
Sleep(600, Cts);
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_M);
|
||||
throw new Exception("存在角色被击败,按 M 键打开地图,并停止自动秘境。");
|
||||
Logger.LogWarning("检测到复苏界面,存在角色被击败,前往七天神像复活");
|
||||
// 先打开地图
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_ESCAPE); // NOTE: 此处按下Esc是为了关闭复苏界面,无需改键
|
||||
Sleep(600, ct);
|
||||
TpForRecover(ct, new RetryException("检测到复苏界面,存在角色被击败,前往七天神像复活"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tp 到七天神像恢复
|
||||
/// </summary>
|
||||
/// <param name="ct"></param>
|
||||
/// <exception cref="RetryException"></exception>
|
||||
public static void TpForRecover(CancellationToken ct, Exception ex)
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenMap);
|
||||
// tp 到七天神像复活
|
||||
var tpTask = new TpTask(ct);
|
||||
tpTask.TpToStatueOfTheSeven().Wait(ct);
|
||||
Logger.LogInformation("血量恢复完成。【设置】-【七天神像设置】可以修改回血相关配置。");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换到本角色
|
||||
/// 切换cd是1秒,如果切换失败,会尝试再次切换,最多尝试5次
|
||||
@@ -120,27 +151,105 @@ public class Avatar
|
||||
{
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var region = CaptureToRectArea();
|
||||
ThrowWhenDefeated(region);
|
||||
ThrowWhenDefeated(region, Ct);
|
||||
|
||||
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
|
||||
if (IsActive(region) && notActiveCount == 3)
|
||||
if (IsActive(region) && notActiveCount == CombatScenes.ExpectedTeamAvatarNum - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_1 + (byte)Index - 1);
|
||||
Simulation.SendInput.SimulateAction(GIActions.Drop);
|
||||
switch (Index)
|
||||
{
|
||||
case 1:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
|
||||
break;
|
||||
case 2:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
|
||||
break;
|
||||
case 3:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
|
||||
break;
|
||||
case 4:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
|
||||
break;
|
||||
case 5:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Debug.WriteLine($"切换到{Index}号位");
|
||||
// Cv2.ImWrite($"log/切换.png", content.CaptureRectArea.SrcMat);
|
||||
Sleep(250, Cts);
|
||||
// Cv2.ImWrite($"log/切换.png", region.SrcMat);
|
||||
Sleep(250, Ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试切换到本角色
|
||||
/// </summary>
|
||||
/// <param name="tryTimes"></param>
|
||||
/// <param name="needLog"></param>
|
||||
/// <returns></returns>
|
||||
public bool TrySwitch(int tryTimes = 4, bool needLog = true)
|
||||
{
|
||||
for (var i = 0; i < tryTimes; i++)
|
||||
{
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var region = CaptureToRectArea();
|
||||
ThrowWhenDefeated(region, Ct);
|
||||
|
||||
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
|
||||
if (IsActive(region) && notActiveCount == CombatScenes.ExpectedTeamAvatarNum - 1)
|
||||
{
|
||||
if (needLog && i > 0)
|
||||
{
|
||||
Logger.LogInformation("成功切换角色:{Name}", Name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Simulation.SendInput.SimulateAction(GIActions.Drop); //反正会重试就不等落地了
|
||||
switch (Index)
|
||||
{
|
||||
case 1:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
|
||||
break;
|
||||
case 2:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
|
||||
break;
|
||||
case 3:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
|
||||
break;
|
||||
case 4:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
|
||||
break;
|
||||
case 5:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(250, Ct);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换到本角色
|
||||
/// 切换cd是1秒,如果切换失败,会尝试再次切换,最多尝试5次
|
||||
@@ -150,7 +259,7 @@ public class Avatar
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var region = CaptureToRectArea();
|
||||
ThrowWhenDefeated(region);
|
||||
ThrowWhenDefeated(region, Ct);
|
||||
|
||||
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
|
||||
if (IsActive(region) && notActiveCount == 3)
|
||||
@@ -158,7 +267,28 @@ public class Avatar
|
||||
return;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_1 + (byte)Index - 1);
|
||||
Simulation.SendInput.SimulateAction(GIActions.Drop);
|
||||
switch (Index)
|
||||
{
|
||||
case 1:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember1);
|
||||
break;
|
||||
case 2:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember2);
|
||||
break;
|
||||
case 3:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember3);
|
||||
break;
|
||||
case 4:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember4);
|
||||
break;
|
||||
case 5:
|
||||
Simulation.SendInput.SimulateAction(GIActions.SwitchMember5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Sleep(250);
|
||||
}
|
||||
}
|
||||
@@ -202,7 +332,7 @@ public class Avatar
|
||||
{
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
// 剪裁出队伍区域
|
||||
var teamRa = region.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRect);
|
||||
var teamRa = region.DeriveCrop(AutoFightAssets.Instance.TeamRect);
|
||||
var blockX = NameRect.X + NameRect.Width * 2 - 10;
|
||||
var block = teamRa.DeriveCrop(new Rect(blockX, NameRect.Y, teamRa.Width - blockX, NameRect.Height * 2));
|
||||
// Cv2.ImWrite($"block_{Name}.png", block.SrcMat);
|
||||
@@ -225,7 +355,7 @@ public class Avatar
|
||||
else
|
||||
{
|
||||
// 剪裁出IndexRect区域
|
||||
var teamRa = region.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRect);
|
||||
var teamRa = region.DeriveCrop(AutoFightAssets.Instance.TeamRect);
|
||||
var blockX = NameRect.X + NameRect.Width * 2 - 10;
|
||||
var indexBlock = teamRa.DeriveCrop(new Rect(blockX + IndexRect.X, NameRect.Y + IndexRect.Y, IndexRect.Width, IndexRect.Height));
|
||||
// Cv2.ImWrite($"indexBlock_{Name}.png", indexBlock.SrcMat);
|
||||
@@ -248,14 +378,14 @@ public class Avatar
|
||||
{
|
||||
while (ms >= 0)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.LeftButtonClick();
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
|
||||
ms -= 200;
|
||||
Sleep(200, Cts);
|
||||
Sleep(200, Ct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +396,7 @@ public class Avatar
|
||||
{
|
||||
for (var i = 0; i < 1; i++)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -275,8 +405,8 @@ public class Avatar
|
||||
{
|
||||
if (Name == "纳西妲")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.KeyDown(User32.VK.VK_E);
|
||||
Sleep(300, Cts);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyDown);
|
||||
Sleep(300, Ct);
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
|
||||
@@ -284,27 +414,34 @@ public class Avatar
|
||||
}
|
||||
|
||||
Sleep(300); // 持续操作不应该被cts取消
|
||||
AutoFightContext.Instance.Simulator.KeyUp(User32.VK.VK_E);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyUp);
|
||||
}
|
||||
else if (Name == "坎蒂丝")
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyDown);
|
||||
Thread.Sleep(3000);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LongKeyPress(User32.VK.VK_E);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.Hold);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_E);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalSkill, KeyType.KeyPress);
|
||||
}
|
||||
|
||||
Sleep(200, Cts);
|
||||
Sleep(200, Ct);
|
||||
|
||||
var region = CaptureToRectArea();
|
||||
ThrowWhenDefeated(region);
|
||||
ThrowWhenDefeated(region, Ct);
|
||||
var cd = GetSkillCurrentCd(region);
|
||||
if (cd > 0)
|
||||
{
|
||||
Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd}" : "{Name} 点按元素战技,cd:{Cd}", Name, cd);
|
||||
// todo 把cd加入执行队列
|
||||
LastSkillTime = DateTime.UtcNow;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -317,8 +454,9 @@ public class Avatar
|
||||
/// </summary>
|
||||
public double GetSkillCurrentCd(ImageRegion imageRegion)
|
||||
{
|
||||
var eRa = imageRegion.DeriveCrop(AutoFightContext.Instance.FightAssets.ERect);
|
||||
var text = OcrFactory.Paddle.Ocr(eRa.SrcGreyMat);
|
||||
var eRa = imageRegion.DeriveCrop(AutoFightAssets.Instance.ECooldownRect);
|
||||
var eRaWhite = OpenCvCommonHelper.InRangeHsv(eRa.SrcMat, new Scalar(0, 0, 235), new Scalar(0, 25, 255));
|
||||
var text = OcrFactory.Paddle.OcrWithoutDetector(eRaWhite);
|
||||
return StringUtils.TryParseDouble(text);
|
||||
}
|
||||
|
||||
@@ -331,21 +469,21 @@ public class Avatar
|
||||
// var isBurstReleased = false;
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_Q);
|
||||
Sleep(200, Cts);
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalBurst);
|
||||
Sleep(200, Ct);
|
||||
|
||||
var region = CaptureToRectArea();
|
||||
ThrowWhenDefeated(region);
|
||||
ThrowWhenDefeated(region, Ct);
|
||||
var notActiveCount = CombatScenes.Avatars.Count(avatar => !avatar.IsActive(region));
|
||||
if (notActiveCount == 0)
|
||||
{
|
||||
// isBurstReleased = true;
|
||||
Sleep(1500, Cts);
|
||||
Sleep(1500, Ct);
|
||||
return;
|
||||
}
|
||||
// else
|
||||
@@ -371,7 +509,7 @@ public class Avatar
|
||||
// /// </summary>
|
||||
// public double GetBurstCurrentCd(CaptureContent content)
|
||||
// {
|
||||
// var qRa = content.CaptureRectArea.Crop(AutoFightContext.Instance.FightAssets.QRect);
|
||||
// var qRa = content.CaptureRectArea.Crop(AutoFightAssets.Instance.QRect);
|
||||
// var text = OcrFactory.Paddle.Ocr(qRa.SrcGreyMat);
|
||||
// return StringUtils.TryParseDouble(text);
|
||||
// }
|
||||
@@ -381,7 +519,7 @@ public class Avatar
|
||||
/// </summary>
|
||||
public void Dash(int ms = 0)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -391,14 +529,14 @@ public class Avatar
|
||||
ms = 200;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.RightButtonDown();
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyDown);
|
||||
Sleep(ms); // 冲刺不能被cts取消
|
||||
AutoFightContext.Instance.Simulator.RightButtonUp();
|
||||
Simulation.SendInput.SimulateAction(GIActions.SprintMouse, KeyType.KeyUp);
|
||||
}
|
||||
|
||||
public void Walk(string key, int ms)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -406,19 +544,19 @@ public class Avatar
|
||||
User32.VK vk = User32.VK.VK_NONAME;
|
||||
if (key == "w")
|
||||
{
|
||||
vk = User32.VK.VK_W;
|
||||
vk = GIActions.MoveForward.ToActionKey().ToVK();
|
||||
}
|
||||
else if (key == "s")
|
||||
{
|
||||
vk = User32.VK.VK_S;
|
||||
vk = GIActions.MoveBackward.ToActionKey().ToVK();
|
||||
}
|
||||
else if (key == "a")
|
||||
{
|
||||
vk = User32.VK.VK_A;
|
||||
vk = GIActions.MoveLeft.ToActionKey().ToVK();
|
||||
}
|
||||
else if (key == "d")
|
||||
{
|
||||
vk = User32.VK.VK_D;
|
||||
vk = GIActions.MoveRight.ToActionKey().ToVK();
|
||||
}
|
||||
|
||||
if (vk == User32.VK.VK_NONAME)
|
||||
@@ -426,9 +564,9 @@ public class Avatar
|
||||
return;
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.KeyDown(vk);
|
||||
Simulation.SendInput.Keyboard.KeyDown(vk);
|
||||
Sleep(ms); // 行走不能被cts取消
|
||||
AutoFightContext.Instance.Simulator.KeyUp(vk);
|
||||
Simulation.SendInput.Keyboard.KeyUp(vk);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -455,7 +593,7 @@ public class Avatar
|
||||
/// </summary>
|
||||
public void Jump()
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.KeyPress(User32.VK.VK_SPACE);
|
||||
Simulation.SendInput.SimulateAction(GIActions.Jump);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -470,26 +608,49 @@ public class Avatar
|
||||
|
||||
if (Name == "那维莱特")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LeftButtonDown();
|
||||
var dpi = TaskContext.Instance().DpiScale;
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
|
||||
while (ms >= 0)
|
||||
{
|
||||
if (Cts is { IsCancellationRequested: true })
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Simulation.SendInput.Mouse.MoveMouseBy(1000, 0);
|
||||
Simulation.SendInput.Mouse.MoveMouseBy((int)(1000 * dpi), 0);
|
||||
ms -= 50;
|
||||
Sleep(50); // 持续操作不应该被cts取消
|
||||
}
|
||||
|
||||
AutoFightContext.Instance.Simulator.LeftButtonUp();
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
|
||||
}
|
||||
else if (Name == "恰斯卡")
|
||||
{
|
||||
var dpi = TaskContext.Instance().DpiScale;
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
|
||||
int cnt = 0;
|
||||
while (ms >= 0)
|
||||
{
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 恰在蓄力时快速转动会把视角趋向于水平,所以在回正的时候不做额外Y轴移动
|
||||
double rate = cnt % 10 < 5 ? 0 : 4.5;//每500ms做一轮上下移动。
|
||||
cnt++;
|
||||
Simulation.SendInput.Mouse.MoveMouseBy((int)(500 * dpi), (int)(rate * 100 * dpi));
|
||||
ms -= 50;
|
||||
Sleep(50);
|
||||
}
|
||||
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LeftButtonDown();
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyDown);
|
||||
Sleep(ms); // 持续操作不应该被cts取消
|
||||
AutoFightContext.Instance.Simulator.LeftButtonUp();
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack, KeyType.KeyUp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,11 +659,11 @@ public class Avatar
|
||||
key = key.ToLower();
|
||||
if (key == "left")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LeftButtonDown();
|
||||
Simulation.SendInput.Mouse.LeftButtonDown();
|
||||
}
|
||||
else if (key == "right")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.RightButtonDown();
|
||||
Simulation.SendInput.Mouse.RightButtonDown();
|
||||
}
|
||||
else if (key == "middle")
|
||||
{
|
||||
@@ -515,11 +676,11 @@ public class Avatar
|
||||
key = key.ToLower();
|
||||
if (key == "left")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LeftButtonUp();
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
}
|
||||
else if (key == "right")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.RightButtonUp();
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
}
|
||||
else if (key == "middle")
|
||||
{
|
||||
@@ -532,11 +693,11 @@ public class Avatar
|
||||
key = key.ToLower();
|
||||
if (key == "left")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.LeftButtonClick();
|
||||
Simulation.SendInput.Mouse.LeftButtonClick();
|
||||
}
|
||||
else if (key == "right")
|
||||
{
|
||||
AutoFightContext.Instance.Simulator.RightButtonClick();
|
||||
Simulation.SendInput.Mouse.RightButtonClick();
|
||||
}
|
||||
else if (key == "middle")
|
||||
{
|
||||
@@ -551,19 +712,79 @@ public class Avatar
|
||||
|
||||
public void KeyDown(string key)
|
||||
{
|
||||
var vk = User32Helper.ToVk(key);
|
||||
AutoFightContext.Instance.Simulator.KeyDown(vk);
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonDown();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonDown();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonDown();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonDown(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyDown(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void KeyUp(string key)
|
||||
{
|
||||
var vk = User32Helper.ToVk(key);
|
||||
AutoFightContext.Instance.Simulator.KeyUp(vk);
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonUp();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonUp();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonUp(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyUp(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void KeyPress(string key)
|
||||
{
|
||||
var vk = User32Helper.ToVk(key);
|
||||
AutoFightContext.Instance.Simulator.KeyPress(vk);
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.ToVk(key));
|
||||
switch (key)
|
||||
{
|
||||
case "VK_LBUTTON":
|
||||
Simulation.SendInput.Mouse.LeftButtonClick();
|
||||
break;
|
||||
case "VK_RBUTTON":
|
||||
Simulation.SendInput.Mouse.RightButtonClick();
|
||||
break;
|
||||
case "VK_MBUTTON":
|
||||
Simulation.SendInput.Mouse.MiddleButtonClick();
|
||||
break;
|
||||
case "VK_XBUTTON1":
|
||||
Simulation.SendInput.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
case "VK_XBUTTON2":
|
||||
Simulation.SendInput.Mouse.XButtonClick(0x0001);
|
||||
break;
|
||||
default:
|
||||
Simulation.SendInput.Keyboard.KeyPress(vk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
@@ -31,7 +32,7 @@ public class CombatScenes : IDisposable
|
||||
/// <summary>
|
||||
/// 当前配队
|
||||
/// </summary>
|
||||
public Avatar[] Avatars { get; set; } = new Avatar[1];
|
||||
public Avatar[] Avatars { get; set; } = [];
|
||||
|
||||
public Dictionary<string, Avatar> AvatarMap { get; set; } = [];
|
||||
|
||||
@@ -43,12 +44,15 @@ public class CombatScenes : IDisposable
|
||||
.WithSessionOptions(BgiSessionOption.Instance.Options)
|
||||
.Build();
|
||||
|
||||
public int ExpectedTeamAvatarNum { get; private set; } = 4;
|
||||
|
||||
/// <summary>
|
||||
/// 通过YOLO分类器识别队伍内角色
|
||||
/// </summary>
|
||||
/// <param name="imageRegion">完整游戏画面的捕获截图</param>
|
||||
public CombatScenes InitializeTeam(ImageRegion imageRegion)
|
||||
{
|
||||
AssertUtils.CheckGameResolution();
|
||||
// 优先取配置
|
||||
if (!string.IsNullOrEmpty(TaskContext.Instance().Config.AutoFightConfig.TeamNames))
|
||||
{
|
||||
@@ -56,14 +60,50 @@ public class CombatScenes : IDisposable
|
||||
return this;
|
||||
}
|
||||
|
||||
// 判断当前是否处于联机状态
|
||||
List<Rect> avatarSideIconRectList;
|
||||
List<Rect> avatarIndexRectList;
|
||||
var pRaList = imageRegion.FindMulti(AutoFightAssets.Instance.PRa);
|
||||
if (pRaList.Count > 0)
|
||||
{
|
||||
var num = pRaList.Count + 1;
|
||||
if (num > 4)
|
||||
{
|
||||
throw new Exception("当前处于联机状态,但是队伍人数超过4人,无法识别");
|
||||
}
|
||||
|
||||
// 联机状态下判断
|
||||
var onePRa = imageRegion.Find(AutoFightAssets.Instance.OnePRa);
|
||||
var p = "p";
|
||||
if (!onePRa.IsEmpty())
|
||||
{
|
||||
Logger.LogInformation("当前处于联机状态,且当前账号是房主,联机人数{Num}人", num);
|
||||
p = "1p";
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation("当前处于联机状态,且在别人世界中,联机人数{Num}人", num);
|
||||
}
|
||||
|
||||
avatarSideIconRectList = AutoFightAssets.Instance.AvatarSideIconRectListMap[$"{p}_{num}"];
|
||||
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectListMap[$"{p}_{num}"];
|
||||
|
||||
ExpectedTeamAvatarNum = avatarSideIconRectList.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
avatarSideIconRectList = AutoFightAssets.Instance.AvatarSideIconRectList;
|
||||
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectList;
|
||||
}
|
||||
|
||||
// 识别队伍
|
||||
var names = new string[4];
|
||||
var displayNames = new string[4];
|
||||
var names = new string[avatarSideIconRectList.Count];
|
||||
var displayNames = new string[avatarSideIconRectList.Count];
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < AutoFightAssets.Instance.AvatarSideIconRectList.Count; i++)
|
||||
for (var i = 0; i < avatarSideIconRectList.Count; i++)
|
||||
{
|
||||
var ra = imageRegion.DeriveCrop(AutoFightAssets.Instance.AvatarSideIconRectList[i]);
|
||||
var ra = imageRegion.DeriveCrop(avatarSideIconRectList[i]);
|
||||
var pair = ClassifyAvatarCnName(ra.SrcBitmap, i + 1);
|
||||
names[i] = pair.Item1;
|
||||
if (!string.IsNullOrEmpty(pair.Item2))
|
||||
@@ -81,14 +121,16 @@ public class CombatScenes : IDisposable
|
||||
displayNames[i] = pair.Item1;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.LogInformation("识别到的队伍角色:{Text}", string.Join(",", displayNames));
|
||||
Avatars = BuildAvatars([.. names]);
|
||||
Avatars = BuildAvatars([.. names], null, avatarIndexRectList);
|
||||
AvatarMap = Avatars.ToDictionary(x => x.Name);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogWarning(e.Message);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -124,18 +166,18 @@ public class CombatScenes : IDisposable
|
||||
if (result.TopClass.Name.Name.StartsWith("Qin") || result.TopClass.Name.Name.Contains("Costume"))
|
||||
{
|
||||
// 降低琴和衣装角色的识别率要求
|
||||
if (result.TopClass.Confidence < 0.6)
|
||||
if (result.TopClass.Confidence < 0.51)
|
||||
{
|
||||
Cv2.ImWrite(@"log\avatar_side_classify_error.png", src.ToMat());
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence},结果:{result.TopClass.Name.Name}");
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence:F1},结果:{result.TopClass.Name.Name}。请重新阅读 BetterGI 文档中的《快速上手》!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.TopClass.Confidence < 0.8)
|
||||
if (result.TopClass.Confidence < 0.7)
|
||||
{
|
||||
Cv2.ImWrite(@"log\avatar_side_classify_error.png", src.ToMat());
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence},结果:{result.TopClass.Name.Name}");
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.TopClass.Confidence:F1},结果:{result.TopClass.Name.Name}。请重新阅读 BetterGI 文档中的《快速上手》!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +206,7 @@ public class CombatScenes : IDisposable
|
||||
|
||||
public bool CheckTeamInitialized()
|
||||
{
|
||||
if (Avatars.Length < 4)
|
||||
if (Avatars.Length != ExpectedTeamAvatarNum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -172,8 +214,18 @@ public class CombatScenes : IDisposable
|
||||
return true;
|
||||
}
|
||||
|
||||
private Avatar[] BuildAvatars(List<string> names, List<Rect>? nameRects = null)
|
||||
private Avatar[] BuildAvatars(List<string> names, List<Rect>? nameRects = null, List<Rect>? avatarIndexRectList = null)
|
||||
{
|
||||
if (avatarIndexRectList == null && ExpectedTeamAvatarNum == 4)
|
||||
{
|
||||
avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectList;
|
||||
}
|
||||
|
||||
if (avatarIndexRectList == null)
|
||||
{
|
||||
throw new Exception("联机状态下,此方法必须传入队伍角色编号位置信息");
|
||||
}
|
||||
|
||||
AvatarCount = names.Count;
|
||||
var avatars = new Avatar[AvatarCount];
|
||||
for (var i = 0; i < AvatarCount; i++)
|
||||
@@ -181,24 +233,42 @@ public class CombatScenes : IDisposable
|
||||
var nameRect = nameRects?[i] ?? Rect.Empty;
|
||||
avatars[i] = new Avatar(this, names[i], i + 1, nameRect)
|
||||
{
|
||||
IndexRect = AutoFightContext.Instance.FightAssets.AvatarIndexRectList[i]
|
||||
IndexRect = avatarIndexRectList[i]
|
||||
};
|
||||
}
|
||||
|
||||
return avatars;
|
||||
}
|
||||
|
||||
public void BeforeTask(CancellationTokenSource cts)
|
||||
public void BeforeTask(CancellationToken ct)
|
||||
{
|
||||
for (var i = 0; i < AvatarCount; i++)
|
||||
{
|
||||
Avatars[i].Cts = cts;
|
||||
Avatars[i].Ct = ct;
|
||||
}
|
||||
}
|
||||
|
||||
public void AfterTask()
|
||||
{
|
||||
// 释放所有按键
|
||||
Simulation.ReleaseAllKey();
|
||||
|
||||
var mwk = SelectAvatar("玛薇卡");
|
||||
if (mwk != null)
|
||||
{
|
||||
foreach (var avatar in Avatars)
|
||||
{
|
||||
if (avatar.Name != "玛薇卡")
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Avatar? SelectAvatar(string name)
|
||||
{
|
||||
return AvatarMap.TryGetValue(name, out var avatar) ? avatar : null;
|
||||
return AvatarMap.GetValueOrDefault(name);
|
||||
}
|
||||
|
||||
#region OCR识别队伍(已弃用)
|
||||
@@ -218,7 +288,7 @@ public class CombatScenes : IDisposable
|
||||
}
|
||||
|
||||
// 剪裁出队伍区域
|
||||
var teamRa = content.CaptureRectArea.DeriveCrop(AutoFightContext.Instance.FightAssets.TeamRectNoIndex);
|
||||
var teamRa = content.CaptureRectArea.DeriveCrop(AutoFightAssets.Instance.TeamRectNoIndex);
|
||||
// 过滤出白色
|
||||
var hsvFilterMat = OpenCvCommonHelper.InRangeHsv(teamRa.SrcMat, new Scalar(0, 0, 210), new Scalar(255, 30, 255));
|
||||
|
||||
@@ -253,10 +323,10 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
// 流浪者特殊处理
|
||||
// 4人以上的队伍,不支持流浪者的识别
|
||||
var wanderer = rectArea.Find(AutoFightContext.Instance.FightAssets.WandererIconRa);
|
||||
var wanderer = rectArea.Find(AutoFightAssets.Instance.WandererIconRa);
|
||||
if (wanderer.IsEmpty())
|
||||
{
|
||||
wanderer = rectArea.Find(AutoFightContext.Instance.FightAssets.WandererIconNoActiveRa);
|
||||
wanderer = rectArea.Find(AutoFightAssets.Instance.WandererIconNoActiveRa);
|
||||
}
|
||||
|
||||
if (wanderer.IsEmpty())
|
||||
@@ -331,4 +401,4 @@ public class CombatScenes : IDisposable
|
||||
{
|
||||
_predictor.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
using BetterGenshinImpact.GameTask.Model.Enum;
|
||||
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.Service;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -53,7 +53,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
if (_cts == null || _cts.Token.IsCancellationRequested)
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_fightTask = FightTask(_cts);
|
||||
_fightTask = FightTask(_cts.Token);
|
||||
if (!_fightTask.IsCompleted)
|
||||
{
|
||||
_fightTask.Start();
|
||||
@@ -65,7 +65,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
if (_cts == null || _cts.Token.IsCancellationRequested)
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_fightTask = FightTask(_cts);
|
||||
_fightTask = FightTask(_cts.Token);
|
||||
if (!_fightTask.IsCompleted)
|
||||
{
|
||||
_fightTask.Start();
|
||||
@@ -126,16 +126,8 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
/// <summary>
|
||||
/// 循环执行战斗宏
|
||||
/// </summary>
|
||||
private Task FightTask(CancellationTokenSource cts)
|
||||
private Task FightTask(CancellationToken ct)
|
||||
{
|
||||
// 切换截图模式
|
||||
var dispatcherCaptureMode = TaskTriggerDispatcher.Instance().GetCacheCaptureMode();
|
||||
if (dispatcherCaptureMode != DispatcherCaptureModeEnum.CacheCaptureWithTrigger)
|
||||
{
|
||||
TaskTriggerDispatcher.Instance().SetCacheCaptureMode(DispatcherCaptureModeEnum.CacheCaptureWithTrigger);
|
||||
Sleep(TaskContext.Instance().Config.TriggerInterval * 2, cts); // 等待缓存图像
|
||||
}
|
||||
|
||||
var imageRegion = CaptureToRectArea();
|
||||
var combatScenes = new CombatScenes().InitializeTeam(imageRegion);
|
||||
if (!combatScenes.CheckTeamInitialized())
|
||||
@@ -162,7 +154,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
return new Task(() =>
|
||||
{
|
||||
Logger.LogInformation("→ {Name}执行宏", activeAvatar.Name);
|
||||
while (!cts.Token.IsCancellationRequested && IsEnabled())
|
||||
while (!ct.IsCancellationRequested && IsEnabled())
|
||||
{
|
||||
if (IsHoldOnMode() && !_isKeyDown)
|
||||
{
|
||||
|
||||
@@ -27,62 +27,74 @@ public class CombatCommand
|
||||
Method = Method.GetEnumByCode(method);
|
||||
|
||||
var parameters = command.Substring(startIndex + 1, endIndex - startIndex - 1);
|
||||
Args = new List<string>(parameters.Split(',', StringSplitOptions.TrimEntries));
|
||||
// 校验参数
|
||||
if (Method == Method.Walk)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 2, "walk方法必须有两个入参,第一个参数是方向,第二个参数是行走时间。例:walk(s, 0.2)");
|
||||
var s = double.Parse(Args[1]);
|
||||
AssertUtils.IsTrue(s > 0, "行走时间必须大于0");
|
||||
}
|
||||
else if (Method == Method.W || Method == Method.A || Method == Method.S || Method == Method.D)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, "w/a/s/d方法必须有一个入参,代表行走时间。例:d(0.5)");
|
||||
}
|
||||
else if (Method == Method.MoveBy)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 2, "moveby方法必须有两个入参,分别是x和y。例:moveby(100, 100))");
|
||||
}
|
||||
else if (Method == Method.KeyDown || Method == Method.KeyUp || Method == Method.KeyPress)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, $"{Method.Alias[0]}方法必须有一个入参,代表按键");
|
||||
try
|
||||
{
|
||||
User32Helper.ToVk(Args[0]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
|
||||
}
|
||||
}
|
||||
Args = [..parameters.Split(',', StringSplitOptions.TrimEntries)];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Method = Method.GetEnumByCode(command);
|
||||
Args = [];
|
||||
}
|
||||
|
||||
// 校验参数
|
||||
if (Method == Method.Walk)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 2, "walk方法必须有两个入参,第一个参数是方向,第二个参数是行走时间。例:walk(s, 0.2)");
|
||||
var s = double.Parse(Args[1]);
|
||||
AssertUtils.IsTrue(s > 0, "行走时间必须大于0");
|
||||
}
|
||||
else if (Method == Method.W || Method == Method.A || Method == Method.S || Method == Method.D)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, "w/a/s/d方法必须有一个入参,代表行走时间。例:d(0.5)");
|
||||
}
|
||||
else if (Method == Method.MoveBy)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 2, "moveby方法必须有两个入参,分别是x和y。例:moveby(100, 100))");
|
||||
}
|
||||
else if (Method == Method.KeyDown || Method == Method.KeyUp || Method == Method.KeyPress)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, $"{Method.Alias[0]}方法必须有一个入参,代表按键");
|
||||
try
|
||||
{
|
||||
User32Helper.ToVk(Args[0]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(CombatScenes combatScenes)
|
||||
{
|
||||
var avatar = combatScenes.SelectAvatar(Name);
|
||||
if (avatar == null)
|
||||
Avatar? avatar;
|
||||
if (Name == CombatScriptParser.CurrentAvatarName)
|
||||
{
|
||||
return;
|
||||
// 如果是当前角色,不进行角色切换
|
||||
avatar = combatScenes.Avatars[0]; // 随便取一个角色
|
||||
}
|
||||
|
||||
// 非宏类脚本,等待切换角色成功
|
||||
if (Method != Method.Wait
|
||||
&& Method != Method.MouseDown
|
||||
&& Method != Method.MouseUp
|
||||
&& Method != Method.Click
|
||||
&& Method != Method.MoveBy
|
||||
&& Method != Method.KeyDown
|
||||
&& Method != Method.KeyUp
|
||||
&& Method != Method.KeyPress)
|
||||
else
|
||||
{
|
||||
avatar.Switch();
|
||||
// 其余情况要进行角色切换
|
||||
avatar = combatScenes.SelectAvatar(Name);
|
||||
if (avatar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// 非宏类脚本,等待切换角色成功
|
||||
if (Method != Method.Wait
|
||||
&& Method != Method.MouseDown
|
||||
&& Method != Method.MouseUp
|
||||
&& Method != Method.Click
|
||||
&& Method != Method.MoveBy
|
||||
&& Method != Method.KeyDown
|
||||
&& Method != Method.KeyUp
|
||||
&& Method != Method.KeyPress)
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Execute(avatar);
|
||||
}
|
||||
|
||||
@@ -235,4 +247,4 @@ public class CombatCommand
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ namespace BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
|
||||
public class CombatScriptParser
|
||||
{
|
||||
public static string CurrentAvatarName = "当前角色";
|
||||
|
||||
public static CombatScriptBag ReadAndParse(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
@@ -50,7 +52,15 @@ public class CombatScriptParser
|
||||
public static CombatScript Parse(string path)
|
||||
{
|
||||
var script = File.ReadAllText(path);
|
||||
var lines = script.Split(["\r\n", "\r", "\n", ";"], StringSplitOptions.RemoveEmptyEntries);
|
||||
var combatScript = ParseContext(script);
|
||||
combatScript.Path = path;
|
||||
combatScript.Name = Path.GetFileNameWithoutExtension(path);
|
||||
return combatScript;
|
||||
}
|
||||
|
||||
public static CombatScript ParseContext(string context, bool validate = true)
|
||||
{
|
||||
var lines = context.Split(["\r\n", "\r", "\n", ";"], StringSplitOptions.RemoveEmptyEntries);
|
||||
var result = new List<string>();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
@@ -66,19 +76,16 @@ public class CombatScriptParser
|
||||
result.Add(l);
|
||||
}
|
||||
|
||||
var combatScript = Parse(result);
|
||||
combatScript.Path = path;
|
||||
combatScript.Name = Path.GetFileNameWithoutExtension(path);
|
||||
return combatScript;
|
||||
return ParseLines(result, validate);
|
||||
}
|
||||
|
||||
public static CombatScript Parse(List<string> lines)
|
||||
private static CombatScript ParseLines(List<string> lines, bool validate = true)
|
||||
{
|
||||
List<CombatCommand> combatCommands = [];
|
||||
HashSet<string> combatAvatarNames = [];
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var oneLineCombatCommands = ParseLine(line, combatAvatarNames);
|
||||
var oneLineCombatCommands = ParseLine(line, combatAvatarNames, validate);
|
||||
combatCommands.AddRange(oneLineCombatCommands);
|
||||
}
|
||||
|
||||
@@ -88,20 +95,29 @@ public class CombatScriptParser
|
||||
return new CombatScript(combatAvatarNames, combatCommands);
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLine(string line, HashSet<string> combatAvatarNames)
|
||||
private static List<CombatCommand> ParseLine(string line, HashSet<string> combatAvatarNames, bool validate = true)
|
||||
{
|
||||
var oneLineCombatCommands = new List<CombatCommand>();
|
||||
// 以空格分隔角色和指令 截取第一个空格前的内容为角色名称,后面的为指令
|
||||
// 20241116更新 不输入角色名称时,直接以当前角色为准
|
||||
var firstSpaceIndex = line.IndexOf(' ');
|
||||
if (firstSpaceIndex < 0)
|
||||
var character = CurrentAvatarName;
|
||||
var commands = line;
|
||||
if (firstSpaceIndex > 0)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
character = line[..firstSpaceIndex];
|
||||
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
|
||||
commands = line[(firstSpaceIndex + 1)..];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (validate)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
}
|
||||
}
|
||||
|
||||
var character = line[..firstSpaceIndex];
|
||||
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
|
||||
var commands = line[(firstSpaceIndex + 1)..];
|
||||
oneLineCombatCommands.AddRange(ParseLineCommands(commands, character));
|
||||
combatAvatarNames.Add(character);
|
||||
return oneLineCombatCommands;
|
||||
@@ -155,4 +171,4 @@ public class CombatScriptParser
|
||||
|
||||
return oneLineCombatCommands;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.0 KiB |