Skip to content

Commit 9432cd1

Browse files
authored
千星支持非成就模式与收藏模式 (#2423)
1 parent 955bd6a commit 9432cd1

File tree

4 files changed

+127
-33
lines changed

4 files changed

+127
-33
lines changed

repo/js/WeeklyThousandStarRealm/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@
2525
- 🧹 自动删除存档,实现成就经验可重复获取
2626
- 📅 自动监测每周经验上限,到达后自动停止
2727
- 🏞️ 完成后自动返回提瓦特大陆,不影响其他自动化脚本
28+
- ⭐ 可刷收藏地图,支持自定义地图名称
2829

2930
---
3031

3132
## 🛠️ 脚本设置项说明
3233

33-
| 配置项 | 描述 | 默认值 |
34-
|--------------|-------------------------------|---------------|
35-
| **runJS** | 我已阅读免责声明(未勾选无法执行) | `` |
36-
| **room** | 奇域关卡关键词或 GUID(仅支持单个;空则使用默认地图) | `37135473336` |
37-
| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` |
38-
| **weekMaxExp** | 每周可获取的经验值上限 | `4000` |
39-
| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` |
34+
| 配置项 | 描述 | 默认值 |
35+
|------------------|------------------------------------|----------------|
36+
| **runJS** | 我已阅读免责声明(未勾选无法执行) | `` |
37+
| **room** | 奇域关卡关键词或 GUID(仅支持单个,空则使用默认地图) | `37135473336` |
38+
| **achievementMode** | 成就模式(请确保地图有成就) | `` |
39+
| **starMode** | 收藏模式(请确保地图未失效,并确保地图已被收藏) | `` |
40+
| **starRoomName** | 收藏模式所使用的地图名称(不是房间ID,是地图名字,需先开启收藏模式) | `碰碰墙` |
41+
| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` |
42+
| **weekMaxExp** | 每周可获取的经验值上限 | `4000` |
43+
| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` |
4044

4145
---
4246

@@ -45,12 +49,7 @@
4549
- 游戏窗口需保持 **16:9** 的宽高比例,否则可能影响图像识别。
4650
- `singleExp` 请填写正确,否则脚本的剩余次数计算会不准确。
4751
- 若默认地图下架,请手动输入可游玩的地图号。
48-
49-
---
50-
51-
## 📅 更新计划
52-
53-
未来可能会支持运行“收藏页面”中的奇域地图。
54-
但由于收藏地图状态不稳定且不适合大多数用户,**暂不确定是否正式加入**
52+
- 勾选收藏模式后,请确保 `starRoomName` 填写正确地图名称。
53+
- 成就模式和收藏模式可以同时开启,但请确保地图符合对应要求。
5554

5655
---

repo/js/WeeklyThousandStarRealm/main.js

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const duration = 1000; // 默认点击等待延时
44

55
const storePath = "data/store.json"
66
const runJS = settings.runJS || false;
7+
const achievementMode = settings.achievementMode || true;
8+
const starMode = settings.starMode || false;
79
const roomID = settings.room || "37135473336";
10+
const starRoomName = settings.starRoomName || "碰碰墙";
811
const userAttempts = Number(settings.thisAttempts || "0");
912
const useFixedAttempts = userAttempts > 0;
1013
const weekMaxExp = Number(settings.weekMaxExp || "4000");
@@ -131,21 +134,23 @@ async function findImageAndClick(path, x, y, w, h, imgAttempts = attempts) {
131134

132135
// 清除游玩数据
133136
async function deleteSource() {
134-
await sleep(duration);
135-
await genshin.returnMainUi();
136-
log.info("开始清除地图数据");
137-
await sleep(duration);
138-
keyPress("VK_B");
139-
await sleep(duration);
140-
await findTextAndClick("管理关卡", 960, 0, 960, 100);
141-
await findTextAndClick("管理", 960, 980, 960, 100);
142-
await findImageAndClick("check_box", 0, 0, 1480, 340);
143-
await findTextAndClick("删除",960, 980, 960, 100);
144-
await findTextAndClick("确认", 960, 600, 960, 400);
145-
await findTextAndClick("确认", 960, 600, 960, 400);
146-
log.info("数据清除完成");
147-
await sleep(duration);
148-
await genshin.returnMainUi();
137+
if (achievementMode) {
138+
await sleep(duration);
139+
await genshin.returnMainUi();
140+
log.info("开始清除地图数据");
141+
await sleep(duration);
142+
keyPress("VK_B");
143+
await sleep(duration);
144+
await findTextAndClick("管理关卡", 960, 0, 960, 100);
145+
await findTextAndClick("管理", 960, 980, 960, 100);
146+
await findImageAndClick("check_box", 0, 0, 1480, 340);
147+
await findTextAndClick("删除",960, 980, 960, 100);
148+
await findTextAndClick("确认", 960, 600, 960, 400);
149+
await findTextAndClick("确认", 960, 600, 960, 400);
150+
log.info("数据清除完成");
151+
await sleep(duration);
152+
await genshin.returnMainUi();
153+
}
149154
}
150155

151156
// 进入千星奇域的全部奇域页面
@@ -166,6 +171,26 @@ async function enterSourcePage() {
166171
await sleep(duration);
167172
}
168173

174+
// 进入千星奇域的收藏奇域页面
175+
async function enterStarSourcePage() {
176+
// 1. 检测是否在房间内,在则退出
177+
const inRoom = await findText("房间", 1500, 0, 420, 500, 5);
178+
if (inRoom) {
179+
keyPress("VK_P");
180+
await sleep(duration);
181+
await findImageAndClick("exit_room", 960, 0, 960, 540);
182+
await findTextAndClick("确认", 960, 600, 960, 400);
183+
await genshin.returnMainUi();
184+
keyPress("VK_B");
185+
} else {
186+
keyPress("VK_F6");
187+
await sleep(duration);
188+
await findTextAndClick("收藏", 0, 850, 300, 230);
189+
}
190+
191+
await sleep(duration);
192+
}
193+
169194
// 创建关卡
170195
async function createMap() {
171196
await findTextAndClick("全部", 1320, 0, 600, 95);
@@ -196,12 +221,47 @@ async function createMap() {
196221
await sleep(duration);
197222
}
198223

224+
// 从收藏创建关卡
225+
async function createStarMap() {
226+
await findTextAndClick("搜索", 0, 0, 1920, 120);
227+
inputText(starRoomName);
228+
await sleep(1000);
229+
await findTextAndClick("搜索", 0, 0, 1920, 120);
230+
await sleep(duration);
231+
click(420, 830);
232+
await sleep(duration);
233+
while (true) {
234+
const result = await findText("房间", 960, 100, 960, 200, 2);
235+
if (result) {
236+
await sleep(duration);
237+
result.click();
238+
await sleep(duration);
239+
break;
240+
} else {
241+
const result2 = await findText("大厅", 960, 600, 960, 400, 2);
242+
if (result2) {
243+
result2.click();
244+
await sleep(duration);
245+
}
246+
}
247+
}
248+
await findText("开始游戏", 960, 540, 960, 540);
249+
click(770, 275);
250+
await sleep(duration);
251+
}
252+
199253
// 游玩关卡
200254
async function playMap() {
201255
const stored = loadWeekData();
202256
const leave = stored ? stored.weekTotal : weekTotal;
203257
const total = useFixedAttempts ? userAttempts : leave;
204-
await createMap();
258+
259+
if (starMode) {
260+
await createStarMap();
261+
} else {
262+
await createMap();
263+
}
264+
205265
while (true) {
206266
await sleep(duration);
207267
const result = await findText("开始游戏", 960, 540, 960, 540, 5);
@@ -217,6 +277,12 @@ async function playMap() {
217277
}
218278
let firstOutputCount = 0;
219279
while (true) {
280+
const whiteText = await findText("空白处", 610, 950, 700, 60, 1);
281+
if (whiteText) {
282+
await sleep(duration);
283+
click(610, 950);
284+
}
285+
220286
const result = await findText("返回大厅", 960, 540, 960, 540, 1);
221287
if (result) {
222288
await sleep(duration);
@@ -262,6 +328,11 @@ async function playMap() {
262328
}
263329
let outputCount = 0;
264330
while (true) {
331+
const whiteText = await findText("空白处", 610, 950, 700, 60, 1);
332+
if (whiteText) {
333+
await sleep(duration);
334+
click(610, 950);
335+
}
265336
const result = await findText("返回大厅", 960, 540, 960, 540, 1);
266337
if (result) {
267338
await sleep(duration);
@@ -328,7 +399,12 @@ async function exitToTeyvat() {
328399
);
329400
}
330401

331-
await enterSourcePage();
402+
if (starMode) {
403+
log.info("已使用收藏模式");
404+
await enterStarSourcePage();
405+
} else {
406+
await enterSourcePage();
407+
}
332408
await playMap();
333409
await exitToTeyvat();
334410
})();

repo/js/WeeklyThousandStarRealm/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 1,
33
"name": "千星奇域每周成就经验刷取",
4-
"version": "1.0",
4+
"version": "2.0",
55
"bgi_version": "0.53.0",
66
"description": "可用于利用成就高经验值刷取经验,默认配置每周刷满需要24分钟",
77
"authors": [

repo/js/WeeklyThousandStarRealm/settings.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,33 @@
22
{
33
"name": "runJS",
44
"type": "checkbox",
5-
"label": "我已阅读说明中的免责声明"
5+
"label": "我已阅读说明中的免责声明",
6+
"default": false
67
},
78
{
89
"type": "input-text",
910
"name": "room",
1011
"label": "奇域关卡关键词或关卡GUID\n(仅支持单个,默认为作者特供地图)",
1112
"default": "37135473336"
1213
},
14+
{
15+
"name": "achievementMode",
16+
"type": "checkbox",
17+
"label": "成就模式(请确保地图有成就)",
18+
"default": true
19+
},
20+
{
21+
"name": "starMode",
22+
"type": "checkbox",
23+
"label": "收藏模式(请确保地图未失效)",
24+
"default": false
25+
},
26+
{
27+
"type": "input-text",
28+
"name": "starRoomName",
29+
"label": "收藏模式所使用的地图名称(不是房间ID,是地图名字)\n请确保收藏模式的开关已开启",
30+
"default": "碰碰墙"
31+
},
1332
{
1433
"type": "input-text",
1534
"name": "thisAttempts",

0 commit comments

Comments
 (0)