千星支持非成就模式与收藏模式 (#2423)

This commit is contained in:
躁动的氨气
2025-12-01 22:17:03 +08:00
committed by GitHub
parent 955bd6a629
commit 9432cd1fe6
4 changed files with 127 additions and 33 deletions

View File

@@ -25,18 +25,22 @@
- 🧹 自动删除存档,实现成就经验可重复获取
- 📅 自动监测每周经验上限,到达后自动停止
- 🏞️ 完成后自动返回提瓦特大陆,不影响其他自动化脚本
- ⭐ 可刷收藏地图,支持自定义地图名称
---
## 🛠️ 脚本设置项说明
| 配置项 | 描述 | 默认值 |
|--------------|-------------------------------|---------------|
| **runJS** | 我已阅读免责声明(未勾选无法执行) | `否` |
| **room** | 奇域关卡关键词或 GUID仅支持单个空则使用默认地图) | `37135473336` |
| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` |
| **weekMaxExp** | 每周可获取的经验值上限 | `4000` |
| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` |
| 配置项 | 描述 | 默认值 |
|------------------|------------------------------------|----------------|
| **runJS** | 我已阅读免责声明(未勾选无法执行) | `否` |
| **room** | 奇域关卡关键词或 GUID仅支持单个空则使用默认地图) | `37135473336` |
| **achievementMode** | 成就模式(请确保地图有成就) | `` |
| **starMode** | 收藏模式(请确保地图未失效,并确保地图已被收藏) | `否` |
| **starRoomName** | 收藏模式所使用的地图名称不是房间ID是地图名字需先开启收藏模式 | `碰碰墙` |
| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` |
| **weekMaxExp** | 每周可获取的经验值上限 | `4000` |
| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` |
---
@@ -45,12 +49,7 @@
- 游戏窗口需保持 **16:9** 的宽高比例,否则可能影响图像识别。
- `singleExp` 请填写正确,否则脚本的剩余次数计算会不准确。
- 若默认地图下架,请手动输入可游玩的地图号。
---
## 📅 更新计划
未来可能会支持运行“收藏页面”中的奇域地图。
但由于收藏地图状态不稳定且不适合大多数用户,**暂不确定是否正式加入**。
- 勾选收藏模式后,请确保 `starRoomName` 填写正确地图名称。
- 成就模式和收藏模式可以同时开启,但请确保地图符合对应要求。
---

View File

@@ -4,7 +4,10 @@ const duration = 1000; // 默认点击等待延时
const storePath = "data/store.json"
const runJS = settings.runJS || false;
const achievementMode = settings.achievementMode || true;
const starMode = settings.starMode || false;
const roomID = settings.room || "37135473336";
const starRoomName = settings.starRoomName || "碰碰墙";
const userAttempts = Number(settings.thisAttempts || "0");
const useFixedAttempts = userAttempts > 0;
const weekMaxExp = Number(settings.weekMaxExp || "4000");
@@ -131,21 +134,23 @@ async function findImageAndClick(path, x, y, w, h, imgAttempts = attempts) {
// 清除游玩数据
async function deleteSource() {
await sleep(duration);
await genshin.returnMainUi();
log.info("开始清除地图数据");
await sleep(duration);
keyPress("VK_B");
await sleep(duration);
await findTextAndClick("管理关卡", 960, 0, 960, 100);
await findTextAndClick("管理", 960, 980, 960, 100);
await findImageAndClick("check_box", 0, 0, 1480, 340);
await findTextAndClick("删除",960, 980, 960, 100);
await findTextAndClick("确认", 960, 600, 960, 400);
await findTextAndClick("确认", 960, 600, 960, 400);
log.info("数据清除完成");
await sleep(duration);
await genshin.returnMainUi();
if (achievementMode) {
await sleep(duration);
await genshin.returnMainUi();
log.info("开始清除地图数据");
await sleep(duration);
keyPress("VK_B");
await sleep(duration);
await findTextAndClick("管理关卡", 960, 0, 960, 100);
await findTextAndClick("管理", 960, 980, 960, 100);
await findImageAndClick("check_box", 0, 0, 1480, 340);
await findTextAndClick("删除",960, 980, 960, 100);
await findTextAndClick("确认", 960, 600, 960, 400);
await findTextAndClick("确认", 960, 600, 960, 400);
log.info("数据清除完成");
await sleep(duration);
await genshin.returnMainUi();
}
}
// 进入千星奇域的全部奇域页面
@@ -166,6 +171,26 @@ async function enterSourcePage() {
await sleep(duration);
}
// 进入千星奇域的收藏奇域页面
async function enterStarSourcePage() {
// 1. 检测是否在房间内,在则退出
const inRoom = await findText("房间", 1500, 0, 420, 500, 5);
if (inRoom) {
keyPress("VK_P");
await sleep(duration);
await findImageAndClick("exit_room", 960, 0, 960, 540);
await findTextAndClick("确认", 960, 600, 960, 400);
await genshin.returnMainUi();
keyPress("VK_B");
} else {
keyPress("VK_F6");
await sleep(duration);
await findTextAndClick("收藏", 0, 850, 300, 230);
}
await sleep(duration);
}
// 创建关卡
async function createMap() {
await findTextAndClick("全部", 1320, 0, 600, 95);
@@ -196,12 +221,47 @@ async function createMap() {
await sleep(duration);
}
// 从收藏创建关卡
async function createStarMap() {
await findTextAndClick("搜索", 0, 0, 1920, 120);
inputText(starRoomName);
await sleep(1000);
await findTextAndClick("搜索", 0, 0, 1920, 120);
await sleep(duration);
click(420, 830);
await sleep(duration);
while (true) {
const result = await findText("房间", 960, 100, 960, 200, 2);
if (result) {
await sleep(duration);
result.click();
await sleep(duration);
break;
} else {
const result2 = await findText("大厅", 960, 600, 960, 400, 2);
if (result2) {
result2.click();
await sleep(duration);
}
}
}
await findText("开始游戏", 960, 540, 960, 540);
click(770, 275);
await sleep(duration);
}
// 游玩关卡
async function playMap() {
const stored = loadWeekData();
const leave = stored ? stored.weekTotal : weekTotal;
const total = useFixedAttempts ? userAttempts : leave;
await createMap();
if (starMode) {
await createStarMap();
} else {
await createMap();
}
while (true) {
await sleep(duration);
const result = await findText("开始游戏", 960, 540, 960, 540, 5);
@@ -217,6 +277,12 @@ async function playMap() {
}
let firstOutputCount = 0;
while (true) {
const whiteText = await findText("空白处", 610, 950, 700, 60, 1);
if (whiteText) {
await sleep(duration);
click(610, 950);
}
const result = await findText("返回大厅", 960, 540, 960, 540, 1);
if (result) {
await sleep(duration);
@@ -262,6 +328,11 @@ async function playMap() {
}
let outputCount = 0;
while (true) {
const whiteText = await findText("空白处", 610, 950, 700, 60, 1);
if (whiteText) {
await sleep(duration);
click(610, 950);
}
const result = await findText("返回大厅", 960, 540, 960, 540, 1);
if (result) {
await sleep(duration);
@@ -328,7 +399,12 @@ async function exitToTeyvat() {
);
}
await enterSourcePage();
if (starMode) {
log.info("已使用收藏模式");
await enterStarSourcePage();
} else {
await enterSourcePage();
}
await playMap();
await exitToTeyvat();
})();

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "千星奇域每周成就经验刷取",
"version": "1.0",
"version": "2.0",
"bgi_version": "0.53.0",
"description": "可用于利用成就高经验值刷取经验默认配置每周刷满需要24分钟",
"authors": [

View File

@@ -2,7 +2,8 @@
{
"name": "runJS",
"type": "checkbox",
"label": "我已阅读说明中的免责声明"
"label": "我已阅读说明中的免责声明",
"default": false
},
{
"type": "input-text",
@@ -10,6 +11,24 @@
"label": "奇域关卡关键词或关卡GUID\n仅支持单个默认为作者特供地图",
"default": "37135473336"
},
{
"name": "achievementMode",
"type": "checkbox",
"label": "成就模式(请确保地图有成就)",
"default": true
},
{
"name": "starMode",
"type": "checkbox",
"label": "收藏模式(请确保地图未失效)",
"default": false
},
{
"type": "input-text",
"name": "starRoomName",
"label": "收藏模式所使用的地图名称不是房间ID是地图名字\n请确保收藏模式的开关已开启",
"default": "碰碰墙"
},
{
"type": "input-text",
"name": "thisAttempts",