mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-21 04:19:51 +08:00
fix(地脉花): 截图释放
This commit is contained in:
@@ -500,8 +500,10 @@ async function openOutcrop(targetPath) {
|
||||
captureRegion = captureGameRegion();
|
||||
if (recognizeFightText(captureRegion)) {
|
||||
recognized = true;
|
||||
captureRegion.dispose();
|
||||
break;
|
||||
}
|
||||
captureRegion.dispose();
|
||||
keyPress("F");
|
||||
await sleep(500);
|
||||
}
|
||||
@@ -640,38 +642,42 @@ async function startRewardTextDetection(cts) {
|
||||
// 首先检查异常界面
|
||||
let captureRegion = captureGameRegion();
|
||||
|
||||
// 检查是否误触发其他页面
|
||||
if (captureRegion.Find(paimonMenuRo).IsEmpty()) {
|
||||
log.debug("误触发其他页面,尝试关闭页面");
|
||||
await genshin.returnMainUi();
|
||||
await sleep(300);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 检查是否误触发其他页面
|
||||
if (captureRegion.Find(paimonMenuRo).IsEmpty()) {
|
||||
log.debug("误触发其他页面,尝试关闭页面");
|
||||
await genshin.returnMainUi();
|
||||
await sleep(300);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查是否已经到达领奖界面
|
||||
let resList = captureRegion.findMulti(ocrRoThis); // 使用预定义的ocrRoThis对象
|
||||
if (resList && resList.count > 0) {
|
||||
for (let i = 0; i < resList.count; i++) {
|
||||
if (resList[i].text.includes("原粹树脂")) {
|
||||
log.debug("已到达领取页面,可以领奖");
|
||||
resolve(true);
|
||||
return;
|
||||
// 检查是否已经到达领奖界面
|
||||
let resList = captureRegion.findMulti(ocrRoThis); // 使用预定义的ocrRoThis对象
|
||||
if (resList && resList.count > 0) {
|
||||
for (let i = 0; i < resList.count; i++) {
|
||||
if (resList[i].text.includes("原粹树脂")) {
|
||||
log.debug("已到达领取页面,可以领奖");
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let ocrResults = captureRegion.findMulti(ocrRo3);
|
||||
let ocrResults = captureRegion.findMulti(ocrRo3);
|
||||
|
||||
if (ocrResults && ocrResults.count > 0) {
|
||||
for (let i = 0; i < ocrResults.count; i++) {
|
||||
if (ocrResults[i].text.includes("接触") ||
|
||||
ocrResults[i].text.includes("地脉") ||
|
||||
ocrResults[i].text.includes("之花")) {
|
||||
log.debug("检测到文字: " + ocrResults[i].text);
|
||||
resolve(true);
|
||||
return;
|
||||
if (ocrResults && ocrResults.count > 0) {
|
||||
for (let i = 0; i < ocrResults.count; i++) {
|
||||
if (ocrResults[i].text.includes("接触") ||
|
||||
ocrResults[i].text.includes("地脉") ||
|
||||
ocrResults[i].text.includes("之花")) {
|
||||
log.debug("检测到文字: " + ocrResults[i].text);
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
captureRegion.dispose();
|
||||
}
|
||||
|
||||
await sleep(200);
|
||||
@@ -740,7 +746,7 @@ async function adjustViewForReward(boxIconRo, token) {
|
||||
|
||||
let captureRegion = captureGameRegion();
|
||||
let iconRes = captureRegion.Find(boxIconRo);
|
||||
|
||||
captureRegion.dispose();
|
||||
if (!iconRes.isExist()) {
|
||||
log.warn("未找到图标,等待一下");
|
||||
await sleep(1000);
|
||||
@@ -801,7 +807,9 @@ async function closeCustomMarks() {
|
||||
click(60, 1020);
|
||||
await sleep(600);
|
||||
|
||||
let button = captureGameRegion().find(openRo);
|
||||
let captureRegion1 = captureGameRegion();
|
||||
let button = captureRegion1.find(openRo);
|
||||
captureRegion1.dispose();
|
||||
if (button.isExist()) {
|
||||
marksStatus = false;
|
||||
log.info("关闭自定义标记");
|
||||
@@ -825,7 +833,9 @@ async function openCustomMarks() {
|
||||
click(60, 1020);
|
||||
await sleep(600);
|
||||
|
||||
let button = captureGameRegion().find(closeRo);
|
||||
let captureRegion2 = captureGameRegion();
|
||||
let button = captureRegion2.find(closeRo);
|
||||
captureRegion2.dispose();
|
||||
if (button.isExist()) {
|
||||
for (let i = 0; i < button.count; i++) {
|
||||
let b = button[i];
|
||||
|
||||
@@ -13,7 +13,9 @@ this.clickWithVerification = async function(x, y, targetText, maxRetries = 20) {
|
||||
await sleep(400);
|
||||
|
||||
// 验证目标文字是否消失
|
||||
let resList = captureGameRegion().findMulti(ocrRoThis);
|
||||
let captureRegion = captureGameRegion();
|
||||
let resList = captureRegion.findMulti(ocrRoThis);
|
||||
captureRegion.dispose();
|
||||
let textFound = false;
|
||||
|
||||
if (resList && resList.count > 0) {
|
||||
@@ -50,7 +52,9 @@ this.attemptReward = async function (retryCount = 0) {
|
||||
await sleep(500);
|
||||
|
||||
// 识别是否为地脉之花界面
|
||||
let resList = captureGameRegion().findMulti(ocrRoThis); // 使用预定义的ocrRoThis对象
|
||||
let captureRegion = captureGameRegion();
|
||||
let resList = captureRegion.findMulti(ocrRoThis); // 使用预定义的ocrRoThis对象
|
||||
captureRegion.dispose();
|
||||
let isValid = false;
|
||||
let condensedResin = null;
|
||||
let originalResin = null;
|
||||
|
||||
@@ -46,7 +46,9 @@ async function (type) {
|
||||
? "assets/icon/Blossom_of_Revelation.png"
|
||||
: "assets/icon/Blossom_of_Wealth.png";
|
||||
|
||||
const flowerList = captureGameRegion().findMulti(RecognitionObject.TemplateMatch(file.ReadImageMatSync(iconPath)));
|
||||
const captureRegion = captureGameRegion();
|
||||
const flowerList = captureRegion.findMulti(RecognitionObject.TemplateMatch(file.ReadImageMatSync(iconPath)));
|
||||
captureRegion.dispose();
|
||||
|
||||
if (flowerList && flowerList.count > 0) {
|
||||
currentFlower = flowerList[0];
|
||||
|
||||
@@ -25,7 +25,9 @@ this.findLeyLineOutcropByBook = async function (country, type) {
|
||||
await sleep(1000);
|
||||
click(1300, 800); //点击推荐
|
||||
await sleep(1000);
|
||||
let resList = captureGameRegion().findMulti(ocrRoThis);
|
||||
let captureRegion1 = captureGameRegion();
|
||||
let resList = captureRegion1.findMulti(ocrRoThis);
|
||||
captureRegion1.dispose();
|
||||
for (let i = 0; i < resList.count; i++) {
|
||||
let res = resList[i];
|
||||
if (res.text.includes(country)) {
|
||||
@@ -33,7 +35,9 @@ this.findLeyLineOutcropByBook = async function (country, type) {
|
||||
}
|
||||
}
|
||||
await sleep(1000);
|
||||
let resList2 = captureGameRegion().findMulti(ocrRoThis);
|
||||
let captureRegion2 = captureGameRegion();
|
||||
let resList2 = captureRegion2.findMulti(ocrRoThis);
|
||||
captureRegion2.dispose();
|
||||
for (let i = 0; i < resList2.count; i++) {
|
||||
let res = resList2[i];
|
||||
if (res.text.includes("停止追踪")) {
|
||||
@@ -53,7 +57,9 @@ this.findLeyLineOutcropByBook = async function (country, type) {
|
||||
// 取消追踪
|
||||
click(960, 540);
|
||||
await sleep(1000);
|
||||
let zhuizong = captureGameRegion().findMulti(ocrRoThis);
|
||||
let captureRegion3 = captureGameRegion();
|
||||
let zhuizong = captureRegion3.findMulti(ocrRoThis);
|
||||
captureRegion3.dispose();
|
||||
if (zhuizong && zhuizong.count > 0) {
|
||||
for (let i = 0; i < zhuizong.count; i++) {
|
||||
if (zhuizong[i].text.includes("停止追踪")) {
|
||||
|
||||
@@ -21,6 +21,7 @@ async function() {
|
||||
|
||||
let captureRegion = captureGameRegion();
|
||||
let resList = captureRegion.findMulti(RecognitionObject.ocr(1043, 5, 300, 100));
|
||||
captureRegion.dispose();
|
||||
let IsOver = false
|
||||
|
||||
for (let i = 0; i < resList.count; i++) {
|
||||
@@ -59,6 +60,7 @@ async function() {
|
||||
|
||||
// 浓缩树脂识别
|
||||
let Condensed = captureGameRegion().find(CondensedRo);
|
||||
Condensed.dispose();
|
||||
let Isfive = false;
|
||||
if (Condensed.isExist()) {
|
||||
log.info("识别到浓缩树脂");
|
||||
@@ -68,6 +70,7 @@ async function() {
|
||||
|
||||
let captureRegion = captureGameRegion();
|
||||
let Condensedres = captureRegion.findMulti(RecognitionObject.ocr(CondensedX, Condensedy, 50, 50));
|
||||
captureRegion.dispose();
|
||||
for (let i = 0; i < Condensedres.count; i++) {
|
||||
let resCondensed = Condensedres[i];
|
||||
log.info(`浓缩树脂: ${resCondensed.text}`);
|
||||
@@ -81,7 +84,9 @@ async function() {
|
||||
}
|
||||
}
|
||||
// 脆弱树脂识别
|
||||
let Fragile = captureGameRegion().find(FragileRo);
|
||||
let FragileCapture = captureGameRegion();
|
||||
let Fragile = FragileCapture.find(FragileRo);
|
||||
FragileCapture.dispose();
|
||||
if (Fragile.isExist()) {
|
||||
log.info("识别到脆弱树脂");
|
||||
|
||||
@@ -90,6 +95,7 @@ async function() {
|
||||
|
||||
let captureRegion = captureGameRegion();
|
||||
let Fragileres = captureRegion.findMulti(RecognitionObject.ocr(FragileX, Fragiley, 50, 50));
|
||||
captureRegion.dispose();
|
||||
|
||||
if (Fragileres.count === 0) {
|
||||
log.error("OCR识别失败:未能识别到脆弱树脂数量");
|
||||
@@ -108,7 +114,10 @@ async function() {
|
||||
await sleep(2000);
|
||||
}
|
||||
// 须臾树脂识别
|
||||
let Temporary = captureGameRegion().find(TemporaryRo);
|
||||
let TemporaryCapture = captureGameRegion();
|
||||
let Temporary = TemporaryCapture.find(TemporaryRo);
|
||||
TemporaryCapture.dispose();
|
||||
let Temporaryres = null;
|
||||
if (Temporary.isExist()) {
|
||||
log.info("识别到须臾树脂");
|
||||
|
||||
@@ -117,12 +126,13 @@ async function() {
|
||||
log.info(`点击坐标: (${TemporaryX}, ${Temporaryy})`);
|
||||
|
||||
let captureRegion = captureGameRegion();
|
||||
let Temporaryres = captureRegion.findMulti(RecognitionObject.ocr(TemporaryX, Temporaryy, 50, 50));
|
||||
Temporaryres = captureRegion.findMulti(RecognitionObject.ocr(TemporaryX, Temporaryy, 50, 50));
|
||||
captureRegion.dispose();
|
||||
} else {
|
||||
log.info("未识别到脆弱树脂");
|
||||
log.info("未识别到须臾树脂");
|
||||
}
|
||||
|
||||
if (Temporaryres.count === 0) {
|
||||
if (Temporaryres && Temporaryres.count === 0) {
|
||||
log.error("OCR识别失败:未能识别到须臾树脂数量");
|
||||
} else {
|
||||
for (let i = 0; i < Temporaryres.count; i++) {
|
||||
|
||||
@@ -15,8 +15,9 @@ async function (timeout) {
|
||||
|
||||
// 循环检测直到超时
|
||||
while (Date.now() - startTime < timeout) {
|
||||
let captureRegion = null;
|
||||
try {
|
||||
let captureRegion = captureGameRegion();
|
||||
captureRegion = captureGameRegion();
|
||||
let result = captureRegion.find(ocrRo1);
|
||||
let text = result.text;
|
||||
|
||||
@@ -56,7 +57,11 @@ async function (timeout) {
|
||||
catch (error) {
|
||||
log.error("OCR过程中出错: {0}", error);
|
||||
}
|
||||
|
||||
finally {
|
||||
if (captureRegion) {
|
||||
captureRegion.dispose();
|
||||
}
|
||||
}
|
||||
await sleep(1000); // 检查间隔
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user