fix: 错误的锚点放置

This commit is contained in:
秋云
2025-05-29 15:23:41 +08:00
parent 0ca7c2b07c
commit 1deee10842
2 changed files with 9 additions and 12 deletions

View File

@@ -78,6 +78,7 @@ async function FeatherFailing() {
log.info("传送点图标已识别,点击传送"); log.info("传送点图标已识别,点击传送");
result.click(); result.click();
await sleep(1000); await sleep(1000);
let totalHours = 999;
if (settings.autoPortableWaypoint) { if (settings.autoPortableWaypoint) {
let result = captureGameRegion().find(ocrRo); let result = captureGameRegion().find(ocrRo);
log.info("识别到锚点文字: " + result.text); log.info("识别到锚点文字: " + result.text);
@@ -85,8 +86,6 @@ async function FeatherFailing() {
// 使用正则表达式匹配不同的时间格式 // 使用正则表达式匹配不同的时间格式
const dayHourPattern = /(\d+)天(\d+)小时/; // X天X小时格式 const dayHourPattern = /(\d+)天(\d+)小时/; // X天X小时格式
const hourOnlyPattern = /(\d+)小时/; // X小时格式 const hourOnlyPattern = /(\d+)小时/; // X小时格式
let totalHours = 0;
let dayMatch = result.text.match(dayHourPattern); let dayMatch = result.text.match(dayHourPattern);
let hourMatch = result.text.match(hourOnlyPattern); let hourMatch = result.text.match(hourOnlyPattern);
@@ -103,19 +102,19 @@ async function FeatherFailing() {
} else { } else {
log.warn("无法解析锚点剩余时间格式,本次不放置锚点"); log.warn("无法解析锚点剩余时间格式,本次不放置锚点");
} }
// 判断是否需要放置锚点
if (totalHours < settings.autoPortableWaypointHours) {
await PlacePortableWaypoint();
} else {
log.info(`剩余时间${totalHours}小时,大于设定阈值${settings.autoPortableWaypointHours}小时,不放置锚点`);
}
} }
result = captureGameRegion().find(goTeleportRo); result = captureGameRegion().find(goTeleportRo);
result.click(); result.click();
await sleep(1000); await sleep(1000);
await genshin.returnMainUi(); await genshin.returnMainUi();
await sleep(1000); await sleep(1000);
if (settings.autoPortableWaypoint) {
if (totalHours < settings.autoPortableWaypointHours) {
await PlacePortableWaypoint();
} else {
log.info(`剩余时间${totalHours}小时,大于设定阈值${settings.autoPortableWaypointHours}小时,不放置锚点`);
}
}
} else { } else {
log.warn("传送点图标未识别,没有放置传送点"); log.warn("传送点图标未识别,没有放置传送点");
await genshin.tp(3347.59, 2756.12); await genshin.tp(3347.59, 2756.12);
@@ -136,10 +135,8 @@ async function FeatherFailing() {
if (settings.autoPortableWaypoint) { if (settings.autoPortableWaypoint) {
await PlacePortableWaypoint(); await PlacePortableWaypoint();
} }
} }
for (let i = 0; i < 30; i++) { for (let i = 0; i < 30; i++) {
keyDown("W"); keyDown("W");
await sleep(50); await sleep(50);

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 1, "manifest_version": 1,
"name": "摔落保护:提瓦特反牛顿机制", "name": "摔落保护:提瓦特反牛顿机制",
"version": "1.1.1", "version": "1.1.2",
"description": "利用游戏机制获取免疫摔落伤害的buff", "description": "利用游戏机制获取免疫摔落伤害的buff",
"authors": [ "authors": [
{ {