Compare commits
367 Commits
f691e7f815
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c4c101ef5 | ||
|
|
a3b3a8c746 | ||
|
|
a26500456d | ||
|
|
eb216dd3b8 | ||
|
|
721b259b02 | ||
|
|
4b6285a232 | ||
|
|
b275caf7c8 | ||
|
|
bbb043e7f4 | ||
|
|
9de10157fc | ||
|
|
4fd7090831 | ||
|
|
e14f59918f | ||
|
|
25e651aad8 | ||
|
|
50da8dfd95 | ||
|
|
6d658e5079 | ||
|
|
7eb7b8131f | ||
|
|
96cfb3dd90 | ||
|
|
4a88eaac02 | ||
|
|
af6355963d | ||
|
|
de6e48946b | ||
|
|
439970db04 | ||
|
|
2bd1122df8 | ||
|
|
da329d7353 | ||
|
|
833a6f1290 | ||
|
|
447a72b303 | ||
|
|
68ffddf868 | ||
|
|
9724dfecf8 | ||
|
|
16e191fd05 | ||
|
|
71823d7b84 | ||
|
|
4d9fb412aa | ||
|
|
7647322f5a | ||
|
|
453aadcd87 | ||
|
|
e6fd631fdd | ||
|
|
fd85cc5816 | ||
|
|
b048e7fb23 | ||
|
|
18fe49b8bd | ||
|
|
fbf7fcd245 | ||
|
|
38f662590c | ||
|
|
1ae6e698a1 | ||
|
|
8b97ee6e81 | ||
|
|
38f81ceebb | ||
|
|
106c9dac4d | ||
|
|
7a8c01d348 | ||
|
|
262f229bf9 | ||
|
|
43c5c89794 | ||
|
|
0431d3998a | ||
|
|
8082a7bdb7 | ||
|
|
e5bd270343 | ||
|
|
9fc55c10ca | ||
|
|
0b0188700c | ||
|
|
d90654503f | ||
|
|
224a476f39 | ||
|
|
feb6361c06 | ||
|
|
aa67aaf70c | ||
|
|
184fb98ba9 | ||
|
|
d88ead299a | ||
|
|
07d7f872c4 | ||
|
|
8d10b74d24 | ||
|
|
b4f4c5bd89 | ||
|
|
e50974b746 | ||
|
|
320af9455f | ||
|
|
118709ed63 | ||
|
|
c93cb92c3a | ||
|
|
9135788e86 | ||
|
|
f7b8a35b0a | ||
|
|
7419d81157 | ||
|
|
4bd431bcb8 | ||
|
|
3770f39246 | ||
|
|
01654f0797 | ||
|
|
7aa6ec4306 | ||
|
|
2f25fd3b6a | ||
|
|
cb4a28bb93 | ||
|
|
67f3b5a571 | ||
|
|
62a04b25ff | ||
|
|
fe8e33e72b | ||
|
|
ad7b99e761 | ||
|
|
16b452985f | ||
|
|
9532762baa | ||
|
|
26d378d1cb | ||
|
|
287b72a377 | ||
|
|
d45eef380a | ||
|
|
b67c244132 | ||
|
|
284aff3f19 | ||
|
|
681508624d | ||
|
|
d910e80e20 | ||
|
|
85688a88fe | ||
|
|
740a5cd2fa | ||
|
|
3eadee4932 | ||
|
|
4c6ae94d65 | ||
|
|
28f7f600da | ||
|
|
b53f94aecb | ||
|
|
9176f1564e | ||
|
|
e4f111b1ab | ||
|
|
f4087871b9 | ||
|
|
fbc9e9b71c | ||
|
|
939a96cf48 | ||
|
|
1dc0c910c7 | ||
|
|
d188ac8a41 | ||
|
|
1f1198f712 | ||
|
|
afd8c2fc60 | ||
|
|
6a7298a6d9 | ||
|
|
a47e786567 | ||
|
|
554ca6068d | ||
|
|
b69c88158e | ||
|
|
1087485a6a | ||
|
|
a49c2a01bc | ||
|
|
eb7e5f7492 | ||
|
|
6e72e32000 | ||
|
|
f5d9456fb3 | ||
|
|
c93537f714 | ||
|
|
c305d02c6e | ||
|
|
84070b09a7 | ||
|
|
7fe9a9e173 | ||
|
|
7dc2fa29f1 | ||
|
|
57881d945b | ||
|
|
c3b5280b72 | ||
|
|
4719de53b5 | ||
|
|
7509996b37 | ||
|
|
278b894135 | ||
|
|
d3fa48dda7 | ||
|
|
9a729b5c80 | ||
|
|
4776b045c9 | ||
|
|
553691c92b | ||
|
|
f0aebe1ba0 | ||
|
|
c61d1111f2 | ||
|
|
eeccb07ea1 | ||
|
|
cf21699739 | ||
|
|
6713bfe4c2 | ||
|
|
7c46fe824e | ||
|
|
e09a2ca287 | ||
|
|
c4bdcdb5a9 | ||
|
|
340c68aee0 | ||
|
|
8cabe52bf1 | ||
|
|
15e958c018 | ||
|
|
a08cd67ae7 | ||
|
|
60996576c6 | ||
|
|
d27600a2e0 | ||
|
|
96e7e9b62d | ||
|
|
a068edd135 | ||
|
|
46f613db00 | ||
|
|
8d84529293 | ||
|
|
00f19aae51 | ||
|
|
db492c39ac | ||
|
|
1cefb7163b | ||
|
|
97fdcc5275 | ||
|
|
99ab3801f9 | ||
|
|
99ddb138e5 | ||
|
|
3a696c4f86 | ||
|
|
63f3aae673 | ||
|
|
aa68e2e683 | ||
|
|
eca4312ad4 | ||
|
|
921c8f4a37 | ||
|
|
60872fd13c | ||
|
|
521b79a6f1 | ||
|
|
6eaf7ce057 | ||
|
|
6733c2a178 | ||
|
|
abc2749375 | ||
|
|
49d408b5d3 | ||
|
|
1b58b1df40 | ||
|
|
92d29a8e31 | ||
|
|
8423ec45c9 | ||
|
|
8342c87404 | ||
|
|
b446f0c98c | ||
|
|
c23b44399a | ||
|
|
8820ec19ab | ||
|
|
6ae02e50ff | ||
|
|
6e406649f3 | ||
|
|
809039b2af | ||
|
|
5b240ba7c5 | ||
|
|
cbbf4dca19 | ||
|
|
0a999bc007 | ||
|
|
a98d4d67dc | ||
|
|
4850932db2 | ||
|
|
eac3b770ea | ||
|
|
9cc7c3ff7a | ||
|
|
57104f4c87 | ||
|
|
64e50be6e4 | ||
|
|
42520b3146 | ||
|
|
4a9987e6c0 | ||
|
|
a3750759ad | ||
|
|
da9e685986 | ||
|
|
647949ceb6 | ||
|
|
cdb67ee605 | ||
|
|
88006f3e9a | ||
|
|
0fdf96e6a1 | ||
|
|
e9d9cf63fc | ||
|
|
d1ab0ef1be | ||
|
|
14c1240b84 | ||
|
|
65fcc41e5b | ||
|
|
6261fd4401 | ||
|
|
66b1828ce2 | ||
|
|
ef496734ba | ||
|
|
35b89ef969 | ||
|
|
1079c19a4d | ||
|
|
e32db94f48 | ||
|
|
78c106c824 | ||
|
|
c458a2e5c8 | ||
|
|
4c1e73d07c | ||
|
|
4633130db1 | ||
|
|
e940b3c4cb | ||
|
|
c44cccff4b | ||
|
|
467df2c001 | ||
|
|
7e29302faf | ||
|
|
5136b3e017 | ||
|
|
001a2f4b59 | ||
|
|
925f354bcd | ||
|
|
84c066b273 | ||
|
|
a462d23010 | ||
|
|
ee6090ac12 | ||
|
|
794dfd4482 | ||
|
|
c483c09030 | ||
|
|
ee3db27d52 | ||
|
|
0c7ee70550 | ||
|
|
5913ed7a87 | ||
|
|
f3db91d934 | ||
|
|
22f1f2d096 | ||
|
|
c68d2ef1b2 | ||
|
|
6a194f73d1 | ||
|
|
3cf91c1f2f | ||
|
|
47d5251d50 | ||
|
|
0af0bd6c96 | ||
|
|
4885f8ddf9 | ||
|
|
75ed4e4073 | ||
|
|
2376205c05 | ||
|
|
80244988a9 | ||
|
|
d4c169aa1e | ||
|
|
b7b5bff5de | ||
|
|
2dad50eae1 | ||
|
|
f3d2358282 | ||
|
|
95b4f78699 | ||
|
|
5ec6ec019d | ||
|
|
5288b82eab | ||
|
|
4097308b1f | ||
|
|
0034c2d2a4 | ||
|
|
86ebf44c08 | ||
|
|
9c1807cf13 | ||
|
|
d7e1c1bb48 | ||
|
|
bfaf0ef86b | ||
|
|
2bb51c8b19 | ||
|
|
37a6de176e | ||
|
|
6904fa2098 | ||
|
|
70278f38ee | ||
|
|
5ebc1bc448 | ||
|
|
4ea13a8677 | ||
|
|
1aa42a7bce | ||
|
|
526b39cb0d | ||
|
|
681e00e130 | ||
|
|
45c99a29ef | ||
|
|
f2bbc3d084 | ||
|
|
19c1732058 | ||
|
|
ac0edb84e9 | ||
|
|
49ab7e9734 | ||
|
|
6dbcb5e3ce | ||
|
|
03cdf124ac | ||
|
|
31a09e87ab | ||
|
|
3a1643607c | ||
|
|
40f0ad5cdb | ||
|
|
ed0ecc630f | ||
|
|
d25caaf0cb | ||
|
|
313db90980 | ||
|
|
6f4b3f7c3f | ||
|
|
6cf7a5cd80 | ||
|
|
c753afa95d | ||
|
|
38c4752764 | ||
|
|
0a074a7bcc | ||
|
|
5b631cb332 | ||
|
|
cbc4e149e6 | ||
|
|
a39c66caa2 | ||
|
|
c1c7dd164e | ||
|
|
657684e8ba | ||
|
|
1dda088628 | ||
|
|
3e03806036 | ||
|
|
feaee63012 | ||
|
|
763c18233b | ||
|
|
aca3ded5ec | ||
|
|
b400ab44f6 | ||
|
|
bf711de78f | ||
|
|
bd001fde7f | ||
|
|
a0bfe339ea | ||
|
|
2c65bf97de | ||
|
|
91b1202abd | ||
|
|
301f490a36 | ||
|
|
39baae8149 | ||
|
|
b504c16aa4 | ||
|
|
9c5f435ed5 | ||
|
|
95ce32c850 | ||
|
|
82535c0e1f | ||
|
|
8a96fe6dff | ||
|
|
c0019cffa7 | ||
|
|
f9f94a938c | ||
|
|
41054f2be7 | ||
|
|
d12e581099 | ||
|
|
f7db4635d7 | ||
|
|
ce4dc2835b | ||
|
|
e769482a79 | ||
|
|
72086ca2cd | ||
|
|
0f3da7a6d0 | ||
|
|
6002f6b54c | ||
|
|
3043bac043 | ||
|
|
a0a89f276e | ||
|
|
69a025f73b | ||
|
|
70d9de119a | ||
|
|
e391e8deaa | ||
|
|
448150efa5 | ||
|
|
c36c5e71bb | ||
|
|
4bbe29efa6 | ||
|
|
7f00c7329b | ||
|
|
22e1a760a6 | ||
|
|
516cbe95e2 | ||
|
|
e5b1016d97 | ||
|
|
5a1912c639 | ||
|
|
b6f91008be | ||
|
|
9323fda85b | ||
|
|
7a219dffa9 | ||
|
|
0bb37a28de | ||
|
|
db09b8eafd | ||
|
|
93e24606d8 | ||
|
|
48d3794483 | ||
|
|
92875ef901 | ||
|
|
3463f42ea1 | ||
|
|
8542f737ff | ||
|
|
d3f26de319 | ||
|
|
5f0ec3ad8d | ||
|
|
83700ee65d | ||
|
|
1b8eba7ed0 | ||
|
|
c3117c9e36 | ||
|
|
da936c762a | ||
|
|
cd51e99ad2 | ||
|
|
7bb23ac1ed | ||
|
|
f0201f39e5 | ||
|
|
1351e9dc09 | ||
|
|
40c0fb33fb | ||
|
|
e63f593b94 | ||
|
|
bb30d03d75 | ||
|
|
0686498c66 | ||
|
|
14a07ca525 | ||
|
|
a2470410d1 | ||
|
|
70a56e5eea | ||
|
|
d8234a0292 | ||
|
|
ae383818c8 | ||
|
|
4c8f275941 | ||
|
|
183a81e77a | ||
|
|
afb3a1dc10 | ||
|
|
5e176b3a2b | ||
|
|
526f74a3a2 | ||
|
|
e7a818654b | ||
|
|
a24eb4d2ee | ||
|
|
37b859e26a | ||
|
|
4b14d2a7dd | ||
|
|
8dfae64252 | ||
|
|
0b0a12d45d | ||
|
|
846f609bb4 | ||
|
|
7facb28fee | ||
|
|
d9b92d1f0d | ||
|
|
fe2e37c9e4 | ||
|
|
5f38a7b81e | ||
|
|
c072a898ae | ||
|
|
523fb15b52 | ||
|
|
9d35cebad5 | ||
|
|
8107688714 | ||
|
|
4866d9f2d5 | ||
|
|
6f562a0179 | ||
|
|
44002ebaa9 | ||
|
|
0c5c58b6ae | ||
|
|
25027af868 | ||
|
|
77c23c1caa | ||
|
|
2ad4565d23 | ||
|
|
ed5b616f58 |
3
.github/workflows/jsonDataValidation.yml
vendored
@@ -74,6 +74,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install packaging semver
|
||||
pip install chardet
|
||||
|
||||
- name: Debug file structure
|
||||
run: |
|
||||
@@ -466,4 +467,4 @@ jobs:
|
||||
repo: context.repo.repo,
|
||||
body: commitMessage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
172
README.md
@@ -6,7 +6,7 @@
|
||||
|
||||
作者Q群:764972801 (非作者请勿加入)
|
||||
|
||||
[如何提交到本仓库?(谁都能看懂的 GitHub Pull Request 使用指南)](https://bgi.huiyadan.com/dev/pr.html)
|
||||
[如何提交到本仓库?(谁都能看懂的 GitHub Pull Request 使用指南)](https://bettergi.com/dev/pr.html)
|
||||
|
||||
## 脚本提交说明
|
||||
|
||||
@@ -15,88 +15,186 @@
|
||||
- 地图追踪脚本提交到 [repo/pathing](https://github.com/babalae/bettergi-scripts-list/tree/main/repo/pathing) 目录;
|
||||
- 七圣召唤脚本提交到 [repo/tcg](https://github.com/babalae/bettergi-scripts-list/tree/main/repo/tcg) 目录。
|
||||
|
||||
|
||||
## 脚本提交规范
|
||||
|
||||
为了保证脚本的规范性和可读性,方便用户清晰了解脚本的用途,制定以下脚本命名规则和脚本文件夹命名规则。
|
||||
|
||||
### 地图追踪脚本
|
||||
|
||||
#### 文件命名规范
|
||||
|
||||
确保脚本文件在同一目录下按预期顺序排列,并一目了然地传达关键信息。地图追踪脚本命名需包含以下核心信息:
|
||||
|
||||
```
|
||||
编号-材料名称-区域(跨区域材料填写)-二级区域(可选)-二级子区域-数量
|
||||
```
|
||||
|
||||
- 编号
|
||||
|
||||
- 两位数,如果单个资源脚本数量超过 `100` 可以考虑使用三位数编号或者使用字母加数字编号,如 A01
|
||||
- 编号的排序应遵循以下两种方式之一:
|
||||
- 按传送点位顺序排序。相邻脚本之间优先保证传送的便捷性,这种编号方式考虑整体采集效率。
|
||||
- 按材料获取效率排序。优先选择资源分布密集或容易采集的点,效率高的路径放在靠前编号,这种编号方式考虑编号靠前脚本的采集效率。
|
||||
|
||||
- 材料名称
|
||||
|
||||
- 采集物(使用游戏内官方名称命名,如 `慕风蘑菇`,`劫波莲`,不应当使用 `绫华突破材料`等不清晰的名称命名)
|
||||
- 掉落物(因掉落物名称与掉落物等级有关,因此不使用掉落物本身命名,而是使用怪物名称命名)
|
||||
- 区域(指 `蒙德` `璃月` `稻妻` `须弥` `枫丹` `纳塔` `至冬`,仅当材料跨区域需标注)
|
||||
|
||||
- 区域(指 `蒙德` `璃月` `稻妻` `须弥` `枫丹` `纳塔` `至冬`,**仅当材料跨区域需标注**)
|
||||
|
||||
- 二级区域(如 `珉林`,根据实际需求标注)
|
||||
|
||||
- 二级子区域(细分地点,如 `绝云间`)
|
||||
|
||||
- 预期采集的数量
|
||||
示例:
|
||||
|
||||
脚本名称**仅限上述**规定的编号、材料名称、区域、二级子区域,原则上不应包含额外的描述或标点符号。
|
||||
|
||||
```
|
||||
✔ 参考示范:
|
||||
01-水晶块-璃月-绝云间-6个
|
||||
02-水晶块-璃月-荻花洲-8个
|
||||
|
||||
❌ 错误示范:
|
||||
01-水晶块-璃月-快速路径-绝云间-6个
|
||||
```
|
||||
脚本名称仅限上述规定的编号、材料名称、区域、二级子区域,不应包含额外的描述或标点符号。如:
|
||||
```
|
||||
❌01-水晶块-璃月-快速路径-绝云间-6个
|
||||
```
|
||||
其他注意事项
|
||||
|
||||
**其他注意事项**
|
||||
|
||||
- 部分采集物没有对应的二级子区域,允许名称的区域部分使用**起始传送锚点**右侧展示的二级区域,或**这条路径的大部分采集物点位**所位于的二级区域
|
||||
|
||||
- 相同**二级子区域**有多条路径时,推荐采用 `编号-材料名称-二级区域-二级子区域及方位-数量` 进行命名。
|
||||
|
||||
- 脚本文件名应当和 `json` 文件中的 `name` 字段相同。
|
||||
|
||||
- 说明文件应当命名为README.md以保证仓库能够正确读取。
|
||||
|
||||
#### 文件夹命名规范
|
||||
|
||||
目的:对脚本按材料分类管理,便于版本控制与团队协作。目录结构应当遵循以下原则:
|
||||
|
||||
- 根据脚本种类选择恰当的一级分类,目前共有六个分类 `锄地专区`、`地方特产`、`敌人与魔物`、`矿物`、`其他`。
|
||||
|
||||
- 一级目录:以材料名称命名,须与文件命名中的材料名称一致。
|
||||
|
||||
- 二级子目录(可选):可根据项目或作者划分,如有必要。
|
||||
示例目录结构如下:
|
||||
```
|
||||
repo/pathing/矿物
|
||||
├─ 水晶块/
|
||||
│ ├─ 01-水晶块-璃月-绝云间-6个
|
||||
│ └─ 02-水晶块-璃月-荻花洲-8个
|
||||
└─ 星银矿石/
|
||||
└─ 01-星银矿石-覆雪之路-7个
|
||||
```
|
||||
如果脚本和原来的地图追踪脚本存在冲突 按照以下原则处理:
|
||||
|
||||
- 示例目录结构如下:
|
||||
|
||||
```
|
||||
repo/pathing/矿物
|
||||
├─ 水晶块
|
||||
│ ├─ 01-水晶块-璃月-绝云间-6个
|
||||
│ └─ 02-水晶块-璃月-荻花洲-8个
|
||||
└─ 星银矿石
|
||||
└─ 01-星银矿石-覆雪之路-7个
|
||||
```
|
||||
|
||||
如果脚本和原来的地图追踪脚本存在冲突 按照以下原则处理:
|
||||
|
||||
- 修复或补充:直接提交到原材料目录。
|
||||
|
||||
- 路线冲突:新建同名目录并添加作者标识:
|
||||
|
||||
1. 将旧脚本目录重命名为 `AA@旧作者名`
|
||||
2. 新脚本放入 `AA@你的名字`
|
||||
3. 例:原 `repo/pathing/AA` 重命名为 `AA@oldauthor` 新目录 `AA@yourname`
|
||||
4. 示例目录结构如下:
|
||||
```
|
||||
repo/pathing/.../
|
||||
└── AA/
|
||||
├── AA@旧作者名
|
||||
└── AA@你的名字
|
||||
```
|
||||
- 示例目录结构如下:
|
||||
|
||||
```
|
||||
repo/pathing/.../
|
||||
└── AA
|
||||
├── AA@旧作者名
|
||||
└── AA@你的名字
|
||||
```
|
||||
|
||||
- 不同采集方式|效率:新建目录添加标识及作者标识:
|
||||
- 不同采集方式|角色|效率:新建目录添加标识及作者标识:
|
||||
|
||||
1. 判断旧脚本目录的采集方式,将旧脚本目录重命名为 `采集方式@旧作者名`
|
||||
2. 新脚本放入 `采集方式@你的名字`
|
||||
3. 示例目录结构如下:
|
||||
```
|
||||
repo/pathing/.../
|
||||
└── AA/
|
||||
├── 无草神@广告位招租
|
||||
├── 有草神@广告位招租
|
||||
└── 效率路线@广告位招租
|
||||
```
|
||||
其他注意事项
|
||||
- 示例目录结构如下:
|
||||
|
||||
```
|
||||
repo/pathing
|
||||
├── 地方特产/区域
|
||||
│ ├── A材料
|
||||
│ │ ├── 无草神@作者广告位招租
|
||||
│ │ ├── 有草神效率路线@作者广告位招租
|
||||
│ │ ├── 有草神全收集@作者广告位招租
|
||||
│ │ └── ...
|
||||
│ └── B材料
|
||||
│ ├── 效率路线@作者广告位招租
|
||||
│ ├── 全收集@作者广告位招租
|
||||
│ └── ...
|
||||
├── 矿物
|
||||
│ ├── 水晶矿
|
||||
│ │ ├── 大剑@作者广告位招租
|
||||
│ │ ├── 钟离@作者广告位招租
|
||||
│ │ ├── 诺艾尔@作者广告位招租
|
||||
│ │ └── ...
|
||||
│ └── 萃凝晶
|
||||
│ ├── 大剑效率路线@作者广告位招租
|
||||
│ ├── 大剑无战斗@作者广告位招租
|
||||
│ └── ...
|
||||
└── ...
|
||||
```
|
||||
|
||||
**其他注意事项**
|
||||
|
||||
- 目录名仅限材料官方名称,不添加版本号或其他标识。
|
||||
|
||||
- 作者标识仅在冲突时追加,格式为“@作者名”,紧随原目录名。
|
||||
- 相同二级子区域有多条路径时,推荐采用 `编号-材料名称-二级区域-二级子区域及方位-数量` 进行命名。
|
||||
|
||||
### JS脚本
|
||||
|
||||
创建JS脚本请参考文档[创建脚本](https://bettergi.com/dev/js/create.html)
|
||||
|
||||
#### 文件夹命名规则
|
||||
|
||||
- 脚本的文件夹名称**应体现脚本的用途**,简要用途可在描述文件[manifest.json](https://bettergi.com/dev/js/create.html#manifest-json)中说明,详细用途可在`README.md`中说明
|
||||
|
||||
- 脚本的主体文件夹名称可采用`英文`、`中文`、`英文缩写+中文`等命名方式,名称中不应包含空格,如:
|
||||
|
||||
```
|
||||
repo/js
|
||||
├── OCR购买材料
|
||||
├── AutoLeyLineOutcrop
|
||||
├── 使用历练点完成每日委托
|
||||
└── ...
|
||||
```
|
||||
|
||||
- 常见的脚本结构目录如下:
|
||||
|
||||
```
|
||||
repo/js
|
||||
└── 你的脚本名称
|
||||
├── Assets
|
||||
│ ├── Pathing
|
||||
│ │ └── xxx.json
|
||||
│ └── RecognitionObject
|
||||
│ └── xxx.png
|
||||
├── main.js
|
||||
├── manifest.json
|
||||
├── settings.json
|
||||
└── README.md
|
||||
```
|
||||
|
||||
- `Assets`用于存放脚本使用到的资源文件,其中
|
||||
|
||||
- `Pathing`用于存放[地图追踪](https://bettergi.com/feats/autos/pathing-dev.html)文件
|
||||
- `RecognitionObject`用于存放[模板匹配](https://bettergi.com/dev/js/rec.html#%E6%A8%A1%E6%9D%BF%E5%8C%B9%E9%85%8D)对象
|
||||
|
||||
**其他注意事项**
|
||||
|
||||
- 脚本使用的资源文件应在`README.md`中注明实际用途
|
||||
|
||||
### 其他
|
||||
|
||||
因早期对脚本管理较为宽松,因此仓库有部分脚本并不符合命名规范,欢迎通过 PR 规范这些名称。
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://next.ossinsight.io/widgets/official/compose-recent-active-contributors?repo_id=866958830&limit=30" target="_blank" style="display: block" align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-recent-active-contributors/thumbnail.png?repo_id=866958830&limit=30&image_size=auto&color_scheme=dark" width="655" height="auto">
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 876 B |
@@ -1 +1 @@
|
||||
{"info":{"name":"","description":"","type":""},"positions":[{"x":3563.2421875,"y":3018.57470703125,"type":"teleport","move_mode":"walk"},{"x":3583.29931640625,"y":3057.534423828125,"type":"path","move_mode":"walk"},{"x":3585.44873046875,"y":3072.050048828125,"type":"path","move_mode":"walk"},{"x":3586.3720703125,"y":3071.326904296875,"type":"path","move_mode":"walk"},{"x":3584.07958984375,"y":3071.462646484375,"type":"path","move_mode":"walk"}]}
|
||||
{"info":{"name":"","description":"","type":""},"positions":[{"x":3563.2421875,"y":3018.57470703125,"type":"teleport","move_mode":"walk"},{"x":3583.29931640625,"y":3057.534423828125,"type":"path","move_mode":"walk"},{"x":3585.44873046875,"y":3072.050048828125,"type":"path","move_mode":"walk"},{"x":3586.3720703125,"y":3071.326904296875,"type":"path","move_mode":"walk"},{"x":3584.07958984375,"y":3071.462646484375,"type":"path","move_mode":"walk"}]}
|
||||
@@ -1,3 +1,3 @@
|
||||
兑换码+截止时间存储地址codes.txt
|
||||
格式 兑换码,xxxx.xx.xx xx:xx:xx
|
||||
兑换码+截止时间存储地址codes.txt
|
||||
格式 兑换码,xxxx.xx.xx xx:xx:xx
|
||||
仅支持国服
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
@@ -1,3 +1,3 @@
|
||||
KG3SZF8EZGQN,2025.7.21 12:00:00
|
||||
DZ2TZX9WHXSS,2025.7.21 12:00:00
|
||||
ZGKBHW9FGXSW,2025.7.21 12:00:00
|
||||
KG3SZF8EZGQN,2025.7.21 12:00:00
|
||||
DZ2TZX9WHXSS,2025.7.21 12:00:00
|
||||
ZGKBHW9FGXSW,2025.7.21 12:00:00
|
||||
@@ -1,117 +1,117 @@
|
||||
(async function () {
|
||||
setGameMetrics(1920, 1080, 1);
|
||||
// 1. 返回主界面,等待1秒
|
||||
await genshin.returnMainUi();
|
||||
await sleep(1000);
|
||||
|
||||
// 2. 通过keyPress点按esc键(VK_ESCAPE),等待2秒。ocr识别设置图片并点击,等待2秒。识别账户图片并点击,等待0.5秒,识别前往兑换图片并点击,等待0.5秒
|
||||
keyPress("ESCAPE");
|
||||
await sleep(2000);
|
||||
|
||||
const settingsRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/settings.png"));
|
||||
const settingsRes = captureGameRegion().find(settingsRo);
|
||||
if (settingsRes.isExist()) {
|
||||
settingsRes.click();
|
||||
}
|
||||
await sleep(2000);
|
||||
|
||||
const accountRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/account.png"));
|
||||
const accountRes = captureGameRegion().find(accountRo);
|
||||
if (accountRes.isExist()) {
|
||||
accountRes.click();
|
||||
}
|
||||
await sleep(500);
|
||||
|
||||
const goToRedeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/go_to_redeem.png"));
|
||||
const goToRedeemRes = captureGameRegion().find(goToRedeemRo);
|
||||
if (goToRedeemRes.isExist()) {
|
||||
goToRedeemRes.click();
|
||||
}
|
||||
await sleep(500);
|
||||
|
||||
// 3. 新建一个txt用于存储兑换码及截止时间,之间换行区分,格式为【兑换码,截止时间】
|
||||
try {
|
||||
const content = file.readTextSync("codes.txt");
|
||||
const codes = content.split('\n');
|
||||
|
||||
for (let i = 0; i < codes.length; i++) {
|
||||
const codeInfo = codes[i].split(',');
|
||||
const code = codeInfo[0];
|
||||
const deadline = codeInfo[1];
|
||||
|
||||
// a. 获取当前时间【xxxx.xx.xx xx:xx:xx】(年月日时分秒),与截止时间进行对比
|
||||
const now = new Date();
|
||||
const currentTime = now.getFullYear() + '.' + String(now.getMonth() + 1).padStart(2, '0') + '.' + String(now.getDate()).padStart(2, '0') + ' ' + String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0') + ':' + String(now.getSeconds()).padStart(2, '0');
|
||||
|
||||
if (currentTime > deadline) {
|
||||
log.info(`兑换码【${code}】已超过截止时间,跳过`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// b. 识别输入兑换码图片并点击
|
||||
const inputCodeRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/input_code.png"));
|
||||
const inputCodeRes = captureGameRegion().find(inputCodeRo);
|
||||
if (inputCodeRes.isExist()) {
|
||||
inputCodeRes.click();
|
||||
}
|
||||
await sleep(300);
|
||||
|
||||
// c. 通过虚拟键代码依次keyPress键入兑换码的每一个字符
|
||||
await inputText(code);
|
||||
await sleep(500);
|
||||
|
||||
// d. 输入完毕后,识别兑换图片并点击,等待1.5秒
|
||||
const redeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/redeem.png"));
|
||||
const redeemRes = captureGameRegion().find(redeemRo);
|
||||
if (redeemRes.isExist()) {
|
||||
redeemRes.click();
|
||||
}
|
||||
await sleep(1500);
|
||||
|
||||
// e. 识别无效图片、已使用图片、过期图片、确认图片、未开启图片
|
||||
const invalidRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/invalid.png"));
|
||||
const invalidRes = captureGameRegion().find(invalidRo);
|
||||
if (invalidRes.isExist()) {
|
||||
log.info(`兑换码【${code}】无效`);
|
||||
}
|
||||
|
||||
const usedRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/used.png"));
|
||||
const usedRes = captureGameRegion().find(usedRo);
|
||||
if (usedRes.isExist()) {
|
||||
log.info(`兑换码【${code}】已使用`);
|
||||
}
|
||||
|
||||
const expiredRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/expired.png"));
|
||||
const expiredRes = captureGameRegion().find(expiredRo);
|
||||
if (expiredRes.isExist()) {
|
||||
log.info(`兑换码【${code}】已过期`);
|
||||
}
|
||||
|
||||
const notopenRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/not_open.png"));
|
||||
const notopenRes = captureGameRegion().find(notopenRo);
|
||||
if (notopenRes.isExist()) {
|
||||
log.info(`兑换码【${code}】未开启`);
|
||||
}
|
||||
|
||||
const confirmRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/confirm.png"));
|
||||
const confirmRes = captureGameRegion().find(confirmRo);
|
||||
if (confirmRes.isExist()) {
|
||||
log.info(`兑换码【${code}】成功兑换`);
|
||||
confirmRes.click();
|
||||
}
|
||||
|
||||
// f. 识别清除图片并点击,若未识别到则不做处理
|
||||
const clearRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/clear.png"));
|
||||
const clearRes = captureGameRegion().find(clearRo);
|
||||
if (clearRes.isExist()) {
|
||||
clearRes.click();
|
||||
}
|
||||
await sleep(4000);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(`读取兑换码文件失败: ${error}`);
|
||||
}
|
||||
|
||||
// 4. 所有兑换码兑换完成后返回主界面
|
||||
await genshin.returnMainUi();
|
||||
(async function () {
|
||||
setGameMetrics(1920, 1080, 1);
|
||||
// 1. 返回主界面,等待1秒
|
||||
await genshin.returnMainUi();
|
||||
await sleep(1000);
|
||||
|
||||
// 2. 通过keyPress点按esc键(VK_ESCAPE),等待2秒。ocr识别设置图片并点击,等待2秒。识别账户图片并点击,等待0.5秒,识别前往兑换图片并点击,等待0.5秒
|
||||
keyPress("ESCAPE");
|
||||
await sleep(2000);
|
||||
|
||||
const settingsRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/settings.png"));
|
||||
const settingsRes = captureGameRegion().find(settingsRo);
|
||||
if (settingsRes.isExist()) {
|
||||
settingsRes.click();
|
||||
}
|
||||
await sleep(2000);
|
||||
|
||||
const accountRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/account.png"));
|
||||
const accountRes = captureGameRegion().find(accountRo);
|
||||
if (accountRes.isExist()) {
|
||||
accountRes.click();
|
||||
}
|
||||
await sleep(500);
|
||||
|
||||
const goToRedeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/go_to_redeem.png"));
|
||||
const goToRedeemRes = captureGameRegion().find(goToRedeemRo);
|
||||
if (goToRedeemRes.isExist()) {
|
||||
goToRedeemRes.click();
|
||||
}
|
||||
await sleep(500);
|
||||
|
||||
// 3. 新建一个txt用于存储兑换码及截止时间,之间换行区分,格式为【兑换码,截止时间】
|
||||
try {
|
||||
const content = file.readTextSync("codes.txt");
|
||||
const codes = content.split('\n');
|
||||
|
||||
for (let i = 0; i < codes.length; i++) {
|
||||
const codeInfo = codes[i].split(',');
|
||||
const code = codeInfo[0];
|
||||
const deadline = codeInfo[1];
|
||||
|
||||
// a. 获取当前时间【xxxx.xx.xx xx:xx:xx】(年月日时分秒),与截止时间进行对比
|
||||
const now = new Date();
|
||||
const currentTime = now.getFullYear() + '.' + String(now.getMonth() + 1).padStart(2, '0') + '.' + String(now.getDate()).padStart(2, '0') + ' ' + String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0') + ':' + String(now.getSeconds()).padStart(2, '0');
|
||||
|
||||
if (currentTime > deadline) {
|
||||
log.info(`兑换码【${code}】已超过截止时间,跳过`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// b. 识别输入兑换码图片并点击
|
||||
const inputCodeRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/input_code.png"));
|
||||
const inputCodeRes = captureGameRegion().find(inputCodeRo);
|
||||
if (inputCodeRes.isExist()) {
|
||||
inputCodeRes.click();
|
||||
}
|
||||
await sleep(300);
|
||||
|
||||
// c. 通过虚拟键代码依次keyPress键入兑换码的每一个字符
|
||||
await inputText(code);
|
||||
await sleep(500);
|
||||
|
||||
// d. 输入完毕后,识别兑换图片并点击,等待1.5秒
|
||||
const redeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/redeem.png"));
|
||||
const redeemRes = captureGameRegion().find(redeemRo);
|
||||
if (redeemRes.isExist()) {
|
||||
redeemRes.click();
|
||||
}
|
||||
await sleep(1500);
|
||||
|
||||
// e. 识别无效图片、已使用图片、过期图片、确认图片、未开启图片
|
||||
const invalidRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/invalid.png"));
|
||||
const invalidRes = captureGameRegion().find(invalidRo);
|
||||
if (invalidRes.isExist()) {
|
||||
log.info(`兑换码【${code}】无效`);
|
||||
}
|
||||
|
||||
const usedRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/used.png"));
|
||||
const usedRes = captureGameRegion().find(usedRo);
|
||||
if (usedRes.isExist()) {
|
||||
log.info(`兑换码【${code}】已使用`);
|
||||
}
|
||||
|
||||
const expiredRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/expired.png"));
|
||||
const expiredRes = captureGameRegion().find(expiredRo);
|
||||
if (expiredRes.isExist()) {
|
||||
log.info(`兑换码【${code}】已过期`);
|
||||
}
|
||||
|
||||
const notopenRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/not_open.png"));
|
||||
const notopenRes = captureGameRegion().find(notopenRo);
|
||||
if (notopenRes.isExist()) {
|
||||
log.info(`兑换码【${code}】未开启`);
|
||||
}
|
||||
|
||||
const confirmRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/confirm.png"));
|
||||
const confirmRes = captureGameRegion().find(confirmRo);
|
||||
if (confirmRes.isExist()) {
|
||||
log.info(`兑换码【${code}】成功兑换`);
|
||||
confirmRes.click();
|
||||
}
|
||||
|
||||
// f. 识别清除图片并点击,若未识别到则不做处理
|
||||
const clearRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/clear.png"));
|
||||
const clearRes = captureGameRegion().find(clearRo);
|
||||
if (clearRes.isExist()) {
|
||||
clearRes.click();
|
||||
}
|
||||
await sleep(4000);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(`读取兑换码文件失败: ${error}`);
|
||||
}
|
||||
|
||||
// 4. 所有兑换码兑换完成后返回主界面
|
||||
await genshin.returnMainUi();
|
||||
})();
|
||||
@@ -9,6 +9,10 @@
|
||||
"links": "https://github.com/bling-yshs"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"尘歌壶",
|
||||
"购买物品"
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js"
|
||||
}
|
||||
105
archive/js/AutoStygianOnslaught/README.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# 自动幽境危战注意事项
|
||||
|
||||
## 零、前言
|
||||
|
||||
- 当前文档处于测试阶段,注意事项可能尚不完善,敬请谅解。
|
||||
- 如发现BUG,请通过QQ:119996800联系我们,您的反馈将非常受欢迎。
|
||||
- 本脚本基于地脉花和首领一条龙脚本进行改造。
|
||||
- 脚本仅供娱乐使用,请在下载后24小时内删除。
|
||||
|
||||
## 一、省流注意事项
|
||||
|
||||
1. **使用前准备**:
|
||||
- 请在`<<幽境危战>>`中配置好战斗队伍。
|
||||
2. **黑名单建议**:
|
||||
- 根目录下有文件内含建议加入`自动拾取黑名单`的名称,请检查并添加。
|
||||
3. **战斗实力**:
|
||||
- 请确保队伍具备足够的战斗实力,当前版本在战斗失败或执行错误,只会重试`一次`。
|
||||
4. **自动拾取功能**:
|
||||
- 为避免不必要的干扰,建议关闭自动拾取功能。
|
||||
|
||||
## 二、配置简介
|
||||
|
||||
1. **圣遗物奖励**:
|
||||
- 默认设置下,脚本不会修改圣遗物奖励。
|
||||
|
||||
2. **Boss挑战关卡选择**:
|
||||
- 必填项:请从上往下选择第几个Boss挑战关卡`(1至3)`,否则脚本将无法执行。
|
||||
|
||||
3. **挑战次数**:
|
||||
- 默认设置为`15`次,期间若树脂耗尽,脚本将自动结束。
|
||||
|
||||
4. **树脂顺序设定**:
|
||||
- 使用`/`隔开数字来设定树脂使用顺序,如`1/2`表示先使用浓缩树脂,再使用原粹树脂。
|
||||
- 树脂类型对应关系:
|
||||
- 1 = 浓缩树脂
|
||||
- 2 = 原粹树脂
|
||||
- 3 = 脆弱树脂
|
||||
- 4 = 须臾树脂
|
||||
- 默认设置:`1/2`,表示先使用浓缩树脂,再使用原粹树脂,不填的不使用"。
|
||||
|
||||
5. **最长战斗超时时间**:
|
||||
- 默认设置为`240`秒,一般情况下无需修改。
|
||||
|
||||
6. **开始战斗后的移动时间**:
|
||||
- 默认设置为`1`秒(注意单位为`秒`),由于战斗开始位置离Boss较远,请根据实际情况设定,一般情况下默认设置即可。
|
||||
|
||||
## 三、更新说明
|
||||
|
||||
### v.1.0版本(20250627)
|
||||
|
||||
- **功能**:脚本发布。
|
||||
|
||||
### v.1.1版本
|
||||
|
||||
- **备注**:此版本信息被省略。
|
||||
|
||||
### v.1.2版本(20250627)
|
||||
|
||||
- **新增功能**:
|
||||
1. 添加圣遗物`奖励选择`功能。
|
||||
2. 添加自动选择`难度`功能。
|
||||
- **优化**:
|
||||
1. 优化逻辑处理。
|
||||
2. 加大战斗完成识别区域。
|
||||
|
||||
### v.1.3版本(20250628)
|
||||
|
||||
- **新增功能**:
|
||||
1. 添加`自动重试`,战斗失败或执行错误会`重试一次`。
|
||||
- **优化**:
|
||||
2. 优化退出点击时序和逻辑。
|
||||
3. 优化进入秘境后向前走的逻辑。
|
||||
4. 优化LOG输出显示内容。
|
||||
- **修复**
|
||||
1. 修复默认状态下,选择长夜套的BUG。
|
||||
|
||||
### v.1.4版本(20250629)
|
||||
|
||||
- **新增功能**:
|
||||
1. 添加领奖后的树脂识别,不足时退出秘境,防止多打一次。
|
||||
- **优化**:
|
||||
1. 优化`再次挑战`挑战的点击逻辑,添加重试。
|
||||
2. 优化相关自动拾取代码。
|
||||
3. 优化`难度选择`和`圣遗物选择`的识别范围。
|
||||
|
||||
### v.1.5版本(20250630)
|
||||
|
||||
- **新增功能**:
|
||||
1. 自动战斗失败原地`重试2次`,失败后再退出秘境重试。
|
||||
- **优化**:
|
||||
1. 优化`LOG`显示。
|
||||
2. 优化`完全没有树脂`情况弹窗提示处理。
|
||||
3. 优化删除拾取`黑名单`文件(0.47.0后不会乱触发了)。
|
||||
4. 优化各种`异常状态`的退出处理方法。
|
||||
5. 优化当有须臾树脂时,脆弱树脂不显示时的处理。
|
||||
|
||||
### v.1.6版本:20250702
|
||||
|
||||
- **优化**:
|
||||
1. 优化没找到地脉花领奖的超时退出处理。
|
||||
2. 优化树脂识别OCR区域。
|
||||
3. 优化LOG和代码写法和整理。
|
||||
|
||||
|
||||
|
||||
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_1.bmp
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_10.bmp
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_11.bmp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_12.bmp
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_13.bmp
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_14.bmp
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_15.bmp
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_16.bmp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_17.bmp
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_18.bmp
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_2.bmp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_3.bmp
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_4.bmp
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_5.bmp
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_6.bmp
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_7.bmp
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_8.bmp
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/Artifacts/artifact_9.bmp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 11 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/box.png
Normal file
|
After Width: | Height: | Size: 1018 B |
BIN
archive/js/AutoStygianOnslaught/assets/condensed_resin_count.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/fragile_resin_count.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/moment_resin_count.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/one.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
archive/js/AutoStygianOnslaught/assets/original_resin_count.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
26
archive/js/AutoStygianOnslaught/assets/全自动幽境危战.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "全自动幽境危战",
|
||||
"type": "collect",
|
||||
"author": "LCB-茶包",
|
||||
"version": "1.0",
|
||||
"description": "",
|
||||
"bgi_version": "0.44.8"
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"id": 1,
|
||||
"x": -194.198,
|
||||
"y": 984.095,
|
||||
"move_mode": "walk",
|
||||
"type": "teleport"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"x": -194.25293,
|
||||
"y": 980.6616,
|
||||
"move_mode": "walk",
|
||||
"type": "target"
|
||||
}
|
||||
]
|
||||
}
|
||||
815
archive/js/AutoStygianOnslaught/main.js
Normal file
@@ -0,0 +1,815 @@
|
||||
(async function () {
|
||||
|
||||
let challengeNum = settings.challengeNum;//挑战次数
|
||||
if (challengeNum === undefined || challengeNum === ""){challengeNum = 15; }//挑战次数
|
||||
let challengeName = settings.challengeName;//挑战BOSS
|
||||
if (challengeName === undefined || challengeName === ""){throw new Error("挑战Boss未配置,请在JS配置中选择...")}//初始化处理
|
||||
let Startforward = settings.Startforward*1000 ? settings.Startforward*1000 : 1000;//开始战斗的前进时间
|
||||
var Fighttimeout = settings.timeout * 1000 ? settings.timeout * 1000 : 240000;//战斗超时时间,默认为240秒
|
||||
const ocrRegion1 = { x: 643, y: 58, width: 800, height: 800 }; // 上方挑战成功区域
|
||||
const ocrRegion2 = { x: 780, y: 406, width: 370, height: 135 }; // 中间挑战失败区域
|
||||
const ocrRo1 = RecognitionObject.ocr(ocrRegion1.x, ocrRegion1.y, ocrRegion1.width, ocrRegion1.height);//上方挑战成功区域OCR对象
|
||||
const ocrRo2 = RecognitionObject.ocr(ocrRegion2.x, ocrRegion2.y, ocrRegion2.width, ocrRegion2.height);//中间挑战失败区域OCR对象
|
||||
var Rewardsuse = settings.Rewardsuse ? settings.Rewardsuse : "1/2";//树脂使用类型,默认为1/2,即浓缩树脂和原粹树脂
|
||||
var resinTypes = Rewardsuse.split("/");
|
||||
var rewards = [];
|
||||
var onerewards, secendrewards, threendrewards, fourdrewards;
|
||||
for (var i = 0; i < resinTypes.length; i++) {
|
||||
var resinType = parseInt(resinTypes[i]);
|
||||
if (isNaN(resinType) || resinType < 1 || resinType > 4) {
|
||||
throw new Error("设定的树脂类型无效或缺失,请重新配置");
|
||||
}
|
||||
rewards.push(resinType);
|
||||
}
|
||||
const resinTypeMap = ["","使用1个浓缩树脂,获取2倍产出", "使用20个原粹树脂", "使用1个脆弱树脂,获取3倍产出", "使用1个须臾树脂,获取3倍产出"];//识别树脂领奖文字
|
||||
const golbalRewards = ["","浓缩树脂","原粹树脂","脆弱树脂","须臾树脂"]; // 对应四种树脂
|
||||
// 根据 rewards 数组长度,依次赋值给对应的变量
|
||||
if (rewards.length > 0) onerewards = golbalRewards[rewards[0]];
|
||||
if (rewards.length > 1) secendrewards = golbalRewards[rewards[1]];
|
||||
if (rewards.length > 2) threendrewards = golbalRewards[rewards[2]];
|
||||
if (rewards.length > 3) fourdrewards = golbalRewards[rewards[3]];
|
||||
const golbalRewardText = [onerewards, secendrewards, threendrewards, fourdrewards].filter(Boolean);//过滤树脂使用类型
|
||||
|
||||
var advanceNum = 0;//前进寻找地脉之花次数
|
||||
var verticalNum = 0;//重试寻找地脉之花次数
|
||||
var resinAgain = false;//是否重试标志
|
||||
|
||||
var Artifacts = settings.Artifacts ? settings.Artifacts : "保持圣遗物奖励不变";
|
||||
|
||||
//映射所有圣遗物对应需要识别的图片
|
||||
var artifactImageMap = {
|
||||
"长夜之誓 / 深廊终曲": "assets/Artifacts/artifact_1.bmp",
|
||||
"黑曜秘典 / 烬城勇者绘卷": "assets/Artifacts/artifact_2.bmp",
|
||||
"谐律异想断章 / 未竟的遐思": "assets/Artifacts/artifact_3.bmp",
|
||||
"回声之林夜话 / 昔时之歌": "assets/Artifacts/artifact_4.bmp",
|
||||
"逐影猎人 / 黄金剧团": "assets/Artifacts/artifact_5.bmp",
|
||||
"水仙之梦 / 花海甘露之光": "assets/Artifacts/artifact_6.bmp",
|
||||
"乐园遗落之花 / 沙上楼阁史话": "assets/Artifacts/artifact_7.bmp",
|
||||
"深林的记忆 / 饰金之梦": "assets/Artifacts/artifact_8.bmp",
|
||||
"来歆余响 / 辰砂往生录": "assets/Artifacts/artifact_9.bmp",
|
||||
"华馆梦醒形骸记 / 海染砗磲": "assets/Artifacts/artifact_10.bmp",
|
||||
"绝缘之旗印 / 追忆之注连": "assets/Artifacts/artifact_11.bmp",
|
||||
"昔日宗室之仪 / 染血的骑士道": "assets/Artifacts/artifact_12.bmp",
|
||||
"渡过烈火的贤人 / 炽烈的炎之魔女": "assets/Artifacts/artifact_13.bmp",
|
||||
"悠古的磐岩 / 逆飞的流星": "assets/Artifacts/artifact_14.bmp",
|
||||
"千岩牢固 / 苍白之火": "assets/Artifacts/artifact_15.bmp",
|
||||
"冰风迷途的勇士 / 沉沦之心": "assets/Artifacts/artifact_16.bmp",
|
||||
"翠绿之影 / 被怜爱的少女": "assets/Artifacts/artifact_17.bmp",
|
||||
"如雷的盛怒 / 平息鸣雷的尊者": "assets/Artifacts/artifact_18.bmp"
|
||||
};
|
||||
|
||||
//树脂识别图片
|
||||
var condensedResin = "assets/condensed_resin_count.png";
|
||||
var originalResin = "assets/original_resin_count.png";
|
||||
var fragileResin = "assets/fragile_resin_count.png";
|
||||
var momentResin = "assets/moment_resin_count.png";
|
||||
var oneResin = "assets/one.png";
|
||||
|
||||
//文字识别封装函数
|
||||
async function Textocr(wenzi="空参数",chaotime=10,clickocr=0,debugcode=0,x=0,y=0,w=1920,h=1080) {
|
||||
const startTime = new Date();
|
||||
for (let ii = 0; ii < 10; ii++)
|
||||
{
|
||||
// 获取一张截图
|
||||
let captureRegion = captureGameRegion();
|
||||
let res1
|
||||
// 对整个区域进行 OCR
|
||||
let resList = captureRegion.findMulti(RecognitionObject.ocr(x,y,w,h));
|
||||
//log.info("OCR 全区域识别结果数量 {len}", resList.count);
|
||||
for (let i = 0; i < resList.count; i++)
|
||||
{ // 遍历的是 C# 的 List 对象,所以要用 count,而不是 length
|
||||
let res = resList[i];
|
||||
res1=res.text
|
||||
if (res.text===wenzi) {
|
||||
log.info(`识别到 ·${res1}·`);
|
||||
if (debugcode===1){if (x===0 & y===0){log.info("全图代码位置:({x},{y},{h},{w})", res.x-10, res.y-10, res.width+10, res.Height+10);return result = { text: res.text, x: res.x, y: res.y, found: true }}}else{if (x===0 & y===0){log.info("文本OCR完成'{text}'", res.text);}}
|
||||
if (clickocr===1){await sleep(1000);await click(res.x, res.y);}else{}
|
||||
if (clickocr===2){await sleep(100);await keyPress("F");}else{}
|
||||
return result = { text: res.text, x: res.x, y: res.y, found: true }
|
||||
}
|
||||
if (debugcode===2 && !res.isEmpty()){
|
||||
// log.info("({x},{y},{h},{w})", res.x-10, res.y-10, res.width+10, res.Height+10);
|
||||
return result = { text: res.text, x: res.x, y: res.y, found: true }
|
||||
}
|
||||
}
|
||||
const NowTime = new Date();
|
||||
if (Math.abs(NowTime - startTime)>chaotime*1000){if (x===0 & y===0){log.info(`${chaotime}秒超时退出,"${wenzi}"未找到`);}return result = {found: false };}else{ii=8;if (x !== 861){if(debugcode!==3){await keyPress("VK_W");}};}
|
||||
await sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
// 图片识别封装函数
|
||||
async function imageRecognition(imagefilePath="空参数",timeout=10,afterBehavior=0,debugmodel=0,xa=0,ya=0,wa=1920,ha=1080) {
|
||||
const startTime = new Date();
|
||||
const Imagidentify = RecognitionObject.TemplateMatch(file.ReadImageMatSync(imagefilePath));
|
||||
for (let ii = 0; ii < 10; ii++) {
|
||||
captureRegion = captureGameRegion(); // 获取一张截图
|
||||
res = captureRegion.DeriveCrop(xa, ya, wa, ha).Find(Imagidentify);
|
||||
if (res.isEmpty()) {
|
||||
if (debugmodel===1 & xa===0 & ya===0){log.info("未识别页面元素")};
|
||||
} else {
|
||||
if (afterBehavior===1){if (xa===0 & ya===0){log.info("点击模式:开");}await sleep(1000);click(res.x+xa, res.y+ya);}else{if (debugmodel===1 & xa===0 & ya===0){log.info("点击模式:关")}}
|
||||
if (afterBehavior===2){if (xa===0 & ya===0){log.info("F模式:开");}await sleep(1000);keyPress("F");}else{if (debugmodel===1 & xa===0 & ya===0){log.info("F模式:关")}}
|
||||
if (debugmodel===1 & xa===0 & ya===0){log.info("全图代码位置:({x},{y},{h},{w})", res.x+xa, res.y+ya, res.width, res.Height);}else{ log.info("识别到页面元素");}
|
||||
|
||||
return result = { x: res.x+xa, y: res.y+ya, w:res.width,h:res.Height,found: true }
|
||||
}
|
||||
const NowTime = new Date();
|
||||
if ((NowTime - startTime)>timeout*1000){if (debugmodel===1 & xa===0 & ya===0){log.info(`${timeout}秒超时退出,未找到图片`);}return result = {found: false };}else{ii=8}
|
||||
await sleep(200);
|
||||
}
|
||||
await sleep(1200);
|
||||
}
|
||||
|
||||
//树脂数量获取函数
|
||||
async function getRemainResinStatus() {
|
||||
var condensedResinCount = 0; // 浓缩树脂
|
||||
var originalResinCount = 0; // 原粹树脂
|
||||
var fragileResinCount = 0; // 脆弱树脂
|
||||
var momentResinCount = 0; // 须臾树脂
|
||||
|
||||
var originalResinCountRa = await imageRecognition(originalResin,0.3, 0, 0,1500,0,200,90);
|
||||
if (originalResinCountRa.found) {
|
||||
// await moveMouseTo(originalResinCountRa.x,originalResinCountRa.y);
|
||||
let countArea = await Textocr("",1, 0, 2,originalResinCountRa.x+originalResinCountRa.w,originalResinCountRa.y,originalResinCountRa.w*3,originalResinCountRa.h);//
|
||||
if (countArea.found){
|
||||
log.info("原粹树脂识别数量结果:"+ countArea.text);
|
||||
let match = countArea.text.match(/(\d+)\s*[/1]\s*(2|20|200)/);
|
||||
if (match) {
|
||||
originalResinCount = match[1];
|
||||
// log.info("脆弱树脂识别数量提取:"+ originalResinCount);
|
||||
}
|
||||
else{
|
||||
log.info("原粹树脂识别数量提取失败");
|
||||
}
|
||||
}
|
||||
else{
|
||||
log.info("原粹树脂识别数量结果::无");
|
||||
}
|
||||
|
||||
} else {
|
||||
log.info("未检测到原粹树脂图标");
|
||||
}
|
||||
|
||||
// 浓缩树脂
|
||||
var condensedResinCountRa = await imageRecognition(condensedResin,0.1, 0, 0,960,0,800,100);
|
||||
if (condensedResinCountRa.found) {
|
||||
// await moveMouseTo(condensedResinCountRa.x,condensedResinCountRa.y);
|
||||
let countArea = await Textocr("",0.5, 0, 2,condensedResinCountRa.x+condensedResinCountRa.w,condensedResinCountRa.y,condensedResinCountRa.w,condensedResinCountRa.h);//
|
||||
if (countArea.found){
|
||||
// log.info("浓缩树脂识别数量结果: "+ countArea.text);
|
||||
condensedResinCount = countArea.text
|
||||
}
|
||||
else{
|
||||
condensedResinCount = "1";
|
||||
log.info("浓缩树脂识别数量结果:1");//不知道为什么,1无法识别,0是不显示图标的,所以就当时1了,反正也没啥影响
|
||||
}
|
||||
|
||||
} else {
|
||||
log.info("未检测到浓缩树脂图标");
|
||||
}
|
||||
|
||||
var momentResinCountRa = await imageRecognition(momentResin,0.1, 0, 1,1170,0,300,100);
|
||||
if (momentResinCountRa.found) {
|
||||
// await moveMouseTo(momentResinCountRa.x,momentResinCountRa.y);
|
||||
let countArea = await Textocr("",0.5, 0, 2,momentResinCountRa.x+momentResinCountRa.w+20,momentResinCountRa.y-15,60,40);//
|
||||
if (countArea.found){
|
||||
//log.info("须臾树脂识别数量结果:"+ countArea.text);
|
||||
momentResinCount = countArea.text
|
||||
}
|
||||
else{
|
||||
var oneRa = await imageRecognition(oneResin,0.1, 0, 1,momentResinCountRa.x+momentResinCountRa.w+20,momentResinCountRa.y-15,60,40);
|
||||
if (oneRa.found){
|
||||
momentResinCount = "1";
|
||||
}else{
|
||||
log.info("须臾树脂强制为 1 ");
|
||||
momentResinCount = "1";
|
||||
}
|
||||
}
|
||||
log.info("脆弱树脂强制为 1 ");//须臾树脂出现,脆弱树脂不显示,强制设置为1,情况非常少,大不了打多一次
|
||||
fragileResinCount = "1";
|
||||
}else
|
||||
{
|
||||
var fragileResinCountRa = await imageRecognition(fragileResin,0.1, 0, 1,1170,0,300,100);
|
||||
if (fragileResinCountRa.found) {
|
||||
// await moveMouseTo(fragileResinCountRa.x+fragileResinCountRa.w+20,fragileResinCountRa.y-15);
|
||||
let countArea = await Textocr("",0.5, 0, 2,fragileResinCountRa.x+fragileResinCountRa.w+20,fragileResinCountRa.y-15,60,40);//
|
||||
if (countArea.found){
|
||||
// log.info("脆弱树脂识别数量结果:"+ countArea.text);
|
||||
fragileResinCount = countArea.text
|
||||
}
|
||||
else{
|
||||
var oneRa = await imageRecognition(oneResin,0.1, 0, 1,fragileResinCountRa.x+fragileResinCountRa.w+20,fragileResinCountRa.y-15,60,40);
|
||||
if (oneRa.found){
|
||||
fragileResinCount = "1";
|
||||
}else{
|
||||
fragileResinCount = "1";
|
||||
log.info("脆弱树脂识别强制为 1 ");//有图标说明至少为1
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
log.info("未检测到脆弱树脂图标");
|
||||
}
|
||||
}
|
||||
|
||||
log.info("树脂状态:浓缩{0} 原粹{1} 脆弱{2} 须臾{3}", condensedResinCount, originalResinCount, fragileResinCount,momentResinCount)
|
||||
return {condensedResinCount,originalResinCount,fragileResinCount,momentResinCount}
|
||||
}
|
||||
|
||||
//征讨之花领奖寻找函数
|
||||
const autoNavigateToReward = async () => {
|
||||
// 定义识别对象
|
||||
const boxIconRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/box.png"));
|
||||
|
||||
advanceNum = 0;//前进次数
|
||||
//调整为俯视视野
|
||||
middleButtonClick();
|
||||
await sleep(800);
|
||||
moveMouseBy(0, 1030);
|
||||
await sleep(400);
|
||||
moveMouseBy(0, 920);
|
||||
await sleep(400);
|
||||
moveMouseBy(0, 710);
|
||||
log.info("开始领奖");
|
||||
|
||||
while (true) {
|
||||
// 1. 优先检查是否已到达领奖点
|
||||
let captureRegion = captureGameRegion();
|
||||
let rewardTextArea = captureRegion.DeriveCrop(1210, 515, 200, 50);
|
||||
let rewardResult = rewardTextArea.find(RecognitionObject.ocrThis);
|
||||
// 检测到特点文字则结束!!!
|
||||
if (rewardResult.text == "激活地脉之花") {
|
||||
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
|
||||
return true;
|
||||
}
|
||||
else if(advanceNum > 40){
|
||||
await getOut();
|
||||
await await genshin.returnMainUi();
|
||||
throw new Error('前进时间超时');
|
||||
}
|
||||
// 2. 未到达领奖点,则调整视野
|
||||
for(let i = 0; i < 100; i++){
|
||||
captureRegion = captureGameRegion();
|
||||
let iconRes = captureRegion.Find(boxIconRo);
|
||||
let climbTextArea = captureRegion.DeriveCrop(1808, 1030, 25, 25);
|
||||
let climbResult = climbTextArea.find(RecognitionObject.ocrThis);
|
||||
// 检查是否处于攀爬状态
|
||||
if (climbResult.isEmpty()){
|
||||
let SHU = Textocr("地脉之花", 0.3, 1, 0, 840,225, 230, 125);
|
||||
if (SHU.found){
|
||||
return true;
|
||||
}
|
||||
log.info("检侧到页面错误,尝试脱离");
|
||||
await keyDown("w");
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(500);
|
||||
await keyDown("w");
|
||||
await sleep(5000);
|
||||
await keyUp("w");
|
||||
}
|
||||
|
||||
if (iconRes.x >= 920 && iconRes.x <= 980 && iconRes.y <= 540) {
|
||||
advanceNum++;
|
||||
log.info(`视野已调正,前进第${advanceNum}次`);
|
||||
break;
|
||||
} else {
|
||||
// 小幅度调整
|
||||
if(iconRes.y >= 520) moveMouseBy(0, 920);
|
||||
let adjustAmount = iconRes.x < 920 ? -20 : 20;
|
||||
let distanceToCenter = Math.abs(iconRes.x - 920); // 计算与920的距离
|
||||
let scaleFactor = Math.max(1, Math.floor(distanceToCenter / 50)); // 根据距离缩放,最小为1
|
||||
let adjustAmount2 = iconRes.y < 540 ? scaleFactor : 10;
|
||||
moveMouseBy(adjustAmount * adjustAmount2, 0);
|
||||
await sleep(100);
|
||||
}
|
||||
|
||||
if(i > 97) {
|
||||
if (verticalNum >= 2) {
|
||||
verticalNum = 0;
|
||||
await getOut();
|
||||
await await genshin.returnMainUi();
|
||||
throw new Error('领取超时');
|
||||
}
|
||||
log.info("领取超时,重新尝试1次");
|
||||
await sleep(1000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 3. 前进一小步
|
||||
keyDown("w");
|
||||
await sleep(600);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
let earthlyVeins = await Textocr("地脉之花", 0.1, 0, 0, 840,225, 230, 125)
|
||||
if (earthlyVeins.found) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//向前寻找钥匙函数
|
||||
async function readyFightIn(){
|
||||
var startTime = new Date();
|
||||
await sleep(500);
|
||||
var NowTime = new Date();
|
||||
keyDown("w");
|
||||
while ((NowTime - startTime)<15*1000){
|
||||
const result = await Textocr("战斗准备",0,0,3,1198,492,150,80);
|
||||
const result2 = await Textocr("开始挑战",0,0,3,1554,970,360, 105);
|
||||
if (result.found || result2.found) {
|
||||
keyPress("F");keyPress("F");keyPress("F");keyPress("F");
|
||||
keyUp("w");
|
||||
return true;
|
||||
}
|
||||
keyDown("w");
|
||||
keyPress("F");
|
||||
NowTime = new Date();
|
||||
}
|
||||
await keyUp("w");
|
||||
return false
|
||||
}
|
||||
|
||||
//异步检测战斗执行函数,来自D捣蛋&秋云佬的全自动地脉花的代码
|
||||
async function autoFight(timeout) {
|
||||
const cts = new CancellationTokenSource();
|
||||
log.info("开始战斗");
|
||||
dispatcher.RunTask(new SoloTask("AutoFight"), cts);
|
||||
let fightResult = await recognizeTextInRegion(timeout);
|
||||
logFightResult = fightResult ? "成功" : "失败";
|
||||
log.info(`战斗结束,战斗结果:${logFightResult}`);
|
||||
cts.cancel();
|
||||
return fightResult;
|
||||
}
|
||||
|
||||
//异步检测战斗结果函数
|
||||
async function recognizeTextInRegion(timeout) {
|
||||
return new Promise((resolve, reject) => {
|
||||
(async () => {
|
||||
try {
|
||||
let startTime = Date.now();
|
||||
const successKeywords = ["挑战完成","战斗完成"];
|
||||
const failureKeywords = ["战斗失败","挑战失败"];
|
||||
|
||||
// 循环检测直到超时
|
||||
while (Date.now() - startTime < timeout) {
|
||||
try {
|
||||
let captureRegion = captureGameRegion();
|
||||
let result = captureRegion.find(ocrRo1);
|
||||
let result2 = captureRegion.find(ocrRo2);
|
||||
let text = result.text;
|
||||
let text2 = result2.text;
|
||||
|
||||
// 检查成功关键词
|
||||
for (let keyword of successKeywords) {
|
||||
if (text.includes(keyword)) {
|
||||
log.info("检测到战斗成功关键词: {0}", keyword);
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查失败关键词--
|
||||
for (let keyword of failureKeywords) {
|
||||
if (text2.includes(keyword)) {
|
||||
log.warn("检测到战斗失败关键词: {0}", keyword);
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
log.error("OCR过程中出错: {0}", error);
|
||||
}
|
||||
|
||||
await sleep(1000); // 检查间隔
|
||||
}
|
||||
|
||||
log.warn("在超时时间内未检测到战斗结果");
|
||||
resolve(false);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
//圣遗物奖励更换函数
|
||||
async function selectionHolyRelics() {
|
||||
|
||||
let artifactImagePath = artifactImageMap[Artifacts];
|
||||
// 检查artifactImagePath是否存在
|
||||
if (!artifactImagePath) {
|
||||
throw new Error(`未找到与Artifacts值'${Artifacts}'对应的图片路径`);
|
||||
}
|
||||
let modifiedPath = artifactImagePath.slice(0, -4);
|
||||
let newImagePath = modifiedPath + "in.bmp";
|
||||
|
||||
await sleep(500);
|
||||
await click(116,980) // 领取奖励切换按钮
|
||||
await sleep(100);
|
||||
await click(116,980) // 领取奖励切换按钮
|
||||
await sleep(100);
|
||||
|
||||
let rewardSettings = await Textocr("奖励设置",15,0,0,882,34,161,52);//这个时候有人申请进入世界会遮住,真是尴尬啊,不过不影响大局。
|
||||
if (!rewardSettings.found) {await genshin.returnMainUi();return false;}
|
||||
await click(1642,159);
|
||||
await sleep(100);
|
||||
await click(1642,159);
|
||||
await sleep(100);
|
||||
|
||||
let YOffset = 0; // Y轴偏移量,根据需要调整
|
||||
|
||||
//滚轮预操作
|
||||
await moveMouseTo(1642,159);
|
||||
await sleep(100);
|
||||
await leftButtonDown();
|
||||
await sleep(100);
|
||||
await moveMouseTo(1642,155);
|
||||
|
||||
const maxRetries = 9; // 最大重试次数
|
||||
let retries = 0; // 当前重试次数
|
||||
while (retries < maxRetries) {
|
||||
let result1 = await imageRecognition(newImagePath,1, 0, 0,1166,141,210,857);//
|
||||
if (result1.found) {
|
||||
await leftButtonUp();
|
||||
await sleep(500);
|
||||
await click(result.x-500,result.y);
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
return true
|
||||
}
|
||||
retries++; // 重试次数加1
|
||||
//滚轮操作
|
||||
YOffset += 100;
|
||||
if (retries === maxRetries || retries+YOffset > 1080) {
|
||||
await leftButtonUp();
|
||||
await sleep(100);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await genshin.returnMainUi();
|
||||
return false;
|
||||
}
|
||||
await moveMouseTo(1642,155+YOffset);
|
||||
await sleep(500);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 领取奖励函数
|
||||
async function claimRewards() {
|
||||
// log.info(`尝试领取奖励,优先${onerewards}'`);
|
||||
let SHUN01 = await Textocr("激活地脉之花",0.6,2,0,1188,358,200,400);
|
||||
let SHUN02 = await Textocr("地脉之花", 0.2, 1, 0, 840,225, 230, 125);
|
||||
if (SHUN01.found || SHUN02.found) {
|
||||
log.info("找到地脉之花,开始领取奖励...");
|
||||
}
|
||||
else
|
||||
{
|
||||
log.warn("未找到地脉之花,尝试向前寻找...")
|
||||
await keyDown("W");await sleep(300);await keyUp("W");
|
||||
await keyPress("F");
|
||||
await sleep(1000);
|
||||
}
|
||||
|
||||
await sleep(300);
|
||||
|
||||
for (let j = 0;j < 2;j++) {
|
||||
|
||||
for (let i = 0;i < rewards.length;i++) {
|
||||
let SHU = await Textocr(resinTypeMap[rewards[i]],0.3,0,0,510,380,640,600);
|
||||
if (SHU.found){
|
||||
if (resinTypeMap[rewards[i]] == "使用20个原粹树脂")
|
||||
{
|
||||
let BUC = await Textocr("补充",0.2,0,0,1150,440,210,130);
|
||||
if (BUC.found) {continue;}
|
||||
}
|
||||
await sleep(100);
|
||||
await click(SHU.x+550,SHU.y)
|
||||
await sleep(100);
|
||||
await click(SHU.x+550,SHU.y)
|
||||
await sleep(300);
|
||||
log.info(`${resinTypeMap[rewards[i]]} 获取奖励...`);
|
||||
|
||||
await Textocr("锁定辅助",10,0,0,1768,0,115,90);
|
||||
let { condensedResinCount, originalResinCount, fragileResinCount , momentResinCount} = await getRemainResinStatus();
|
||||
let shouldExit = true;
|
||||
|
||||
if (resinTypes.includes("1"))
|
||||
{
|
||||
shouldExit &= (parseInt(condensedResinCount, 10) == 0);
|
||||
}
|
||||
if (resinTypes.includes("2"))
|
||||
{
|
||||
shouldExit &= (parseInt(originalResinCount, 10) < 20);
|
||||
}
|
||||
if (resinTypes.includes("3"))
|
||||
{
|
||||
shouldExit &= (parseInt(fragileResinCount, 10) == 0);
|
||||
}
|
||||
if (resinTypes.includes("4"))
|
||||
{
|
||||
shouldExit &= (parseInt(momentResinCount, 10) == 0);
|
||||
}
|
||||
|
||||
if (shouldExit)
|
||||
{
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
return false;
|
||||
}
|
||||
log.warn("还有树脂...");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
await sleep(500);
|
||||
}
|
||||
log.warn("未找到树脂,结束领取奖励...");
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 进入秘境入口函数
|
||||
async function VeinEntrance() {
|
||||
for (let i = 0;i < 2;i++) {
|
||||
let JIECHU = await Textocr("F",2,2,0,1098,519,35,32);
|
||||
if (JIECHU.found)
|
||||
{
|
||||
await keyPress("F");
|
||||
await keyPress("F");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(i == 1){
|
||||
log.warn("没找入口,尝试强制转圈寻找...");
|
||||
await keyDown("W");keyPress("F");await sleep(500);keyPress("F");await keyUp("W");
|
||||
await keyDown("D");keyPress("F");await sleep(500);keyPress("F");await keyUp("D");
|
||||
await keyDown("S");keyPress("F");await sleep(500);keyPress("F");await keyUp("S");
|
||||
await keyDown("A");keyPress("F");await sleep(500);keyPress("F");await keyUp("A");
|
||||
await keyDown("W");keyPress("F");await sleep(500);keyPress("F");await keyUp("W");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//秘境内退出函数
|
||||
async function getOut() {
|
||||
|
||||
for (let i = 0;i < 2;i++){
|
||||
log.info("尝试退出挑战...");
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
let exitChallenge0 = await Textocr("退出挑战",0.5,1,0,866,719,274,86);
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
let exitChallenge1 = await Textocr("退出挑战",0.5,1,0,866,719,274,86);
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
let exitChallenge2 = await Textocr("退出挑战",0.5,1,0,866,719,274,86);
|
||||
if (!exitChallenge2.found){break}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log.warn("自动幽境危战版本:v1.6");
|
||||
log.warn("请保证队伍战斗实力,战斗失败或执行错误,会重试两次...");
|
||||
log.warn("使用前请在 <<幽境危战>> 中配置好战斗队伍...");
|
||||
log.info("使用树脂类型数量:{0} ", rewards.length)
|
||||
log.info(`使用树脂顺序:${golbalRewardText.join(" ->")}`);
|
||||
log.info("圣遗物奖励选择:{0} ", Artifacts)
|
||||
|
||||
//重试两次
|
||||
for (let j = 0;j < 2;j++) {
|
||||
|
||||
resinAgain = false; //重试标志
|
||||
|
||||
try{
|
||||
//1.导航进入页面
|
||||
await genshin.returnMainUi();
|
||||
await pathingScript.runFile(`assets/全自动幽境危战.json`);
|
||||
await VeinEntrance();
|
||||
|
||||
//2.难度确认和选择
|
||||
let intoAction = await Textocr("单人挑战",10,0,0,1554,970,360, 105);
|
||||
if (!intoAction.found){
|
||||
await genshin.returnMainUi();
|
||||
throw new Error("未进入挑战页面,停止执行...")
|
||||
}
|
||||
let adjustmentType = await Textocr("至危挑战", 1, 0, 0,797,144,223,84);
|
||||
if (adjustmentType.found) {
|
||||
log.warn("找到至危挑战,尝试切换...")
|
||||
await sleep(500);
|
||||
await click(adjustmentType.x,adjustmentType.y)
|
||||
await sleep(500);
|
||||
}
|
||||
let hardMode = await Textocr("困难", 0.3, 0, 0,1049,157,72,47);
|
||||
let hardMode2 = await Textocr("困难", 0.2, 0, 0,805,156,83,47);
|
||||
if (hardMode.found || hardMode2.found) {
|
||||
log.warn("确认困难模式...")
|
||||
}
|
||||
else{
|
||||
log.warn("未找到困难模式,尝试切换...")
|
||||
await sleep(500);
|
||||
await click(1096,186);
|
||||
await sleep(500);
|
||||
await click(1093,399);
|
||||
}
|
||||
|
||||
//3.圣遗物奖励选择
|
||||
if (Artifacts != "保持圣遗物奖励不变"){
|
||||
let artifact = await imageRecognition(artifactImageMap[Artifacts],0.2,0,0,186,972,71,71);
|
||||
if (!artifact.found) {
|
||||
log.warn("圣遗物奖励和设定不一致,尝试切换...")
|
||||
if (!await selectionHolyRelics()){await genshin.returnMainUi();throw new Error("圣遗物奖励设置错误,停止执行...")}
|
||||
}
|
||||
else{
|
||||
log.warn("圣遗物奖励一致,无需切换 {0} ", Artifacts)
|
||||
}
|
||||
}
|
||||
|
||||
//4.进入秘境
|
||||
await sleep(500);
|
||||
await click(intoAction.x,intoAction.y)
|
||||
await sleep(1000);
|
||||
await click(intoAction.x,intoAction.y)
|
||||
let enter = await Textocr("Enter",15,0,0,18,990,156,71,71);
|
||||
if (!enter.found){
|
||||
await genshin.returnMainUi();
|
||||
throw new Error("未进入秘境,停止执行...")
|
||||
}
|
||||
|
||||
//5.向前走进入挑战
|
||||
if (!(await readyFightIn())){
|
||||
await getOut();
|
||||
await genshin.returnMainUi();
|
||||
throw new Error("未进入准备战斗,停止执行...")
|
||||
}
|
||||
await sleep(1000);
|
||||
|
||||
//6.选择挑战boss
|
||||
log.info("选择挑战Boss:'{0}' 挑战次数:'{1}'", challengeName,challengeNum)
|
||||
log.info(`期间树脂耗尽会自动退出秘境...`);
|
||||
const clickCoordinates = [ { x: 207, y: 349 }, { x: 239, y: 531 }, { x: 227, y: 713 } ]; // Boss坐标1~3
|
||||
await click(clickCoordinates[challengeName - 1].x, clickCoordinates[challengeName - 1].y);
|
||||
|
||||
//6.5选择队员-苏婷老师-待写
|
||||
//log.warn("队伍选择功能等伟大的苏苏老师考完试做...")
|
||||
|
||||
//7.开始挑战
|
||||
await Textocr("开始挑战",1,1,0,1554,970,360, 105);
|
||||
var resinexhaustion = false; // 条件1:树脂耗尽
|
||||
|
||||
//8.战斗循环
|
||||
for (let i = 0;i < challengeNum; i++) {
|
||||
|
||||
log.info("进入战斗环境,开始第 {0} 次战斗", i+1)
|
||||
|
||||
//8.1自动战斗
|
||||
for (let fightCount = 0; fightCount < 3; fightCount++) {
|
||||
|
||||
let battleBegins = await Textocr("战斗开始",20,0,0,877,235,164,50);
|
||||
if (!battleBegins.found){
|
||||
await getOut();
|
||||
throw new Error("未进入战斗环境,停止执行...")
|
||||
}
|
||||
|
||||
try {
|
||||
await keyDown("w");
|
||||
await sleep(Startforward);
|
||||
await keyUp("w");
|
||||
|
||||
if(!await autoFight(Fighttimeout)){
|
||||
|
||||
resinAgain = true;
|
||||
|
||||
if (fightCount >= 2){
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
let Again = await Textocr("再次挑战",10,1,0,1059,920,177,65);
|
||||
if (!Again.found)break;
|
||||
await sleep(1000);
|
||||
log.warn("战斗失败,第 {0} 次重试...", fightCount+1)
|
||||
throw new Error(`战斗失败,第 ${fightCount+1} 次重试...`)
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
resinAgain= false;
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
if (fightCount < 2)continue;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
//8.2领取奖励
|
||||
if (resinAgain != true) {
|
||||
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
|
||||
while((await Textocr("Enter",5,0,0,18,990,156,80).found) == false)
|
||||
{
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
}
|
||||
|
||||
log.info("幽境危战:第 {0} 次领奖...", i+1)
|
||||
|
||||
if(!(await autoNavigateToReward())){verticalNum++;continue;}
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
if (!(await claimRewards())) {
|
||||
resinexhaustion = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (challengeNum != i+1)
|
||||
{
|
||||
let challengeAgian = await Textocr("再次挑战",10,0,0,1094,958,200,70);
|
||||
if (!challengeAgian.found){
|
||||
await getOut();
|
||||
throw new Error("未找到·再次挑战·按键,停止执行...")
|
||||
}
|
||||
for (let retry = 0; retry < 5 && challengeAgian.found; retry++) {
|
||||
challengeAgian = await Textocr("再次挑战",0.2,0,0,1094,958,200,70);
|
||||
if (challengeAgian.found){
|
||||
await sleep(500);
|
||||
await click(challengeAgian.x, challengeAgian.y);
|
||||
await sleep(1000);
|
||||
}
|
||||
await sleep(200);
|
||||
}
|
||||
let resinTips = await Textocr("提示",2,0,0,840,225, 230, 125);
|
||||
if (resinTips.found){
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(200);
|
||||
log.info(`树脂提示已耗尽,...`);
|
||||
resinexhaustion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//8.3判断继续或退出
|
||||
if (challengeNum == i+1 || resinexhaustion == true || resinAgain == true ){
|
||||
log.info(resinAgain ? "累计战斗失败 3 次,退出秘境..."
|
||||
: (challengeNum == i+1) ? `完成 ${i+1}/${challengeNum} 次战斗,退出挑战...`: `树脂耗尽,退出挑战...`);
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
|
||||
var exitTimeout = 0;
|
||||
while(exitTimeout < 20) {
|
||||
let exitChallenge = await Textocr("退出挑战",0.3,0,0,866,719,274,86);
|
||||
if (exitChallenge.found) {
|
||||
await sleep(1000);
|
||||
await click(exitChallenge.x, exitChallenge.y);
|
||||
await sleep(1000);
|
||||
break;
|
||||
}
|
||||
let exitChallenge2 = await Textocr("退出挑战",0.3,1,0,866,719,274,86);
|
||||
log.info("尝试退出挑战...");
|
||||
await sleep(1000);
|
||||
await keyPress("VK_ESCAPE");
|
||||
await sleep(1000);
|
||||
exitTimeout++;
|
||||
}
|
||||
await genshin.returnMainUi();
|
||||
if (resinAgain == true){throw new Error("执行重试错误...")}
|
||||
return true;
|
||||
}
|
||||
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
//9.执行错误,重试处理
|
||||
log.error(`执行过程中发生错误:${error.message}`);
|
||||
resinAgain = true;
|
||||
await genshin.returnMainUi();
|
||||
continue;
|
||||
}finally{
|
||||
//10.结束脚本
|
||||
await genshin.returnMainUi();
|
||||
if (resinAgain == false) log.info(`Auto自动幽境危战结束...`);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
18
archive/js/AutoStygianOnslaught/manifest.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "自动幽境危战",
|
||||
"version": "1.6",
|
||||
"tags": [
|
||||
"幽境危战"
|
||||
],
|
||||
"bgi_version": "0.44.8",
|
||||
"description": "请先配置好秘境内的队伍,幽境危战战斗失败或执行错误会重试一次,请保证队伍实力",
|
||||
"authors": [
|
||||
{
|
||||
"name": "LCB-茶包",
|
||||
"links": "https://github.com/kaedelcb"
|
||||
}
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js"
|
||||
}
|
||||
58
archive/js/AutoStygianOnslaught/settings.json
Normal file
@@ -0,0 +1,58 @@
|
||||
[
|
||||
{
|
||||
"name": "Artifacts",
|
||||
"type": "select",
|
||||
"label": "圣遗物奖励,默认不修改圣遗物奖励",
|
||||
"options": [
|
||||
"保持圣遗物奖励不变",
|
||||
"长夜之誓 / 深廊终曲",
|
||||
"黑曜秘典 / 烬城勇者绘卷",
|
||||
"谐律异想断章 / 未竟的遐思" ,
|
||||
"回声之林夜话 / 昔时之歌" ,
|
||||
"逐影猎人 / 黄金剧团" ,
|
||||
"水仙之梦 / 花海甘露之光" ,
|
||||
"乐园遗落之花 / 沙上楼阁史话" ,
|
||||
"深林的记忆 / 饰金之梦" ,
|
||||
"来歆余响 / 辰砂往生录" ,
|
||||
"华馆梦醒形骸记 / 海染砗磲" ,
|
||||
"绝缘之旗印 / 追忆之注连" ,
|
||||
"昔日宗室之仪 / 染血的骑士道" ,
|
||||
"渡过烈火的贤人 / 炽烈的炎之魔女" ,
|
||||
"悠古的磐岩 / 逆飞的流星",
|
||||
"千岩牢固 / 苍白之火" ,
|
||||
"冰风迷途的勇士 / 沉沦之心" ,
|
||||
"翠绿之影 / 被怜爱的少女" ,
|
||||
"如雷的盛怒 / 平息鸣雷的尊者"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "challengeName",
|
||||
"type": "select",
|
||||
"label": "必填:从上往下(1~3),选择第几个Boss挑战关卡",
|
||||
"options": [
|
||||
"1",
|
||||
"2",
|
||||
"3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "challengeNum",
|
||||
"type": "input-text",
|
||||
"label": "挑战次数,默认15次,期间树脂耗尽会自动结束"
|
||||
},
|
||||
{
|
||||
"name": "Rewardsuse",
|
||||
"type": "input-text",
|
||||
"label": "树脂顺序,1=浓缩树脂/2=原粹树脂/3=脆弱树脂/4=须臾树脂\n用`/`隔开,填写对应的树脂数字即可,默认:1/2\n表示先使用浓缩树脂,再使用原粹树脂,不填的不使用"
|
||||
},
|
||||
{
|
||||
"name": "Fighttimeout",
|
||||
"type": "input-text",
|
||||
"label": "最长战斗超时时间,单位秒,默认240秒"
|
||||
},
|
||||
{
|
||||
"name": "Startforward",
|
||||
"type": "input-text",
|
||||
"label": "开始战斗后,向前移动的时间,默认1秒(注意单位:秒)"
|
||||
}
|
||||
]
|
||||