打牌一条龙优化:将人物挑战完成判断替换为更可靠的模板识别 (#1307)
This commit is contained in:
BIN
repo/js/七圣召唤七日历练全自动/assets/completed.png
Normal file
BIN
repo/js/七圣召唤七日历练全自动/assets/completed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -161,9 +161,10 @@ async function isTaskRefreshed(filePath, options = {}) {
|
||||
// 如果文件不存在,创建新文件并返回true(视为需要刷新)
|
||||
const createResult = await file.writeText(filePath, '');
|
||||
if (createResult) {
|
||||
log.info("创建新文件成功");
|
||||
await isTaskRefreshed(filePath, options = {});
|
||||
log.info("创建新时间记录文件成功,执行脚本");
|
||||
return true;
|
||||
}
|
||||
else throw new Error(`创建新文件失败`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,13 +343,13 @@ async function captureAndStoreTexts() {
|
||||
for (const pos of positions) {
|
||||
// 创建OCR识别区域
|
||||
const ocrRo = RecognitionObject.ocr(pos.x, pos.y, width, height); //挑战者名字区域
|
||||
const ocrRo2 = RecognitionObject.ocr(pos.x, pos.y + 100, width, height); //挑战是否完成
|
||||
const ocrRo2 = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/completed.png"),pos.x, pos.y + 60, width, height+80);
|
||||
// 在指定区域进行OCR识别
|
||||
const result = captureRegion.find(ocrRo);
|
||||
const result2 = captureRegion.find(ocrRo2);
|
||||
let res2 = captureRegion.find(ocrRo2);
|
||||
if (!result.isEmpty() && result.text) {
|
||||
// 存储识别结果和对应位置
|
||||
if (result2.text == "追踪") {
|
||||
if (res2.isExist()) {
|
||||
log.info(`识别到文本: ${result.text} 位置: (${pos.x}, ${pos.y})`);
|
||||
textArray.push({
|
||||
text: result.text.trim(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "打牌一条龙",
|
||||
"version": "1.9.6",
|
||||
"version": "1.9.7",
|
||||
"description": "已添加 CD 管理,执行完后会检测是否全部挑战成功,之后会记录本次时间进入CD,如果想要重置请前往assets/weekly.txt中删除内容",
|
||||
"authors": [
|
||||
{
|
||||
@@ -11,4 +11,4 @@
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user