* 识别体力与树脂数量 * 璃月6-奥藏山 * update repo.json * 地图追踪 星银矿石 (#1025) * Add files via upload * 自动修复 JSON 格式和版本号 [ci skip] * Delete repo/pathing/矿物/星银矿石/desktop.ini * Add files via upload --------- Co-authored-by: GitHub Actions Bot <actions@github.com> * Update main.js (#1024) 手动终止夹断 * update repo.json * 6.7 富Abpro (#1022) * Add files via upload * Add files via upload * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/000【激活程序】稻妻大炮.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/404须弥-天臂池七天神像4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/601纳塔-流泉之众4.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/602纳塔-悬木人声望2.json * Delete repo/js/AutoArtifactsPro/assets/ArtifactsPath/A路线/01普通/603纳塔-花羽会西2.json * Add files via upload * update repo.json * `七圣召唤七日历练`: 修复牌币已满时卡在出战界面的问题 (#1017) * update repo.json * js:狗粮重置版1.2更新 (#1026) * update repo.json * fix: 修复部分情况下未找到图标直接结束 * temp * add: 璃月7 * feat: 新的数据结构 * add: 合并代码,功能待实现 --------- Co-authored-by: 寒烟 <2841974482@qq.com> Co-authored-by: physligl <181079228+physligl@users.noreply.github.com> Co-authored-by: Tooltingsu <143606015+Tooltingsu@users.noreply.github.com> Co-authored-by: GitHub Actions Bot <actions@github.com> Co-authored-by: JJMdzh <jjjjedyx@qq.com> Co-authored-by: 汐 <121607261+jiegedabaobei@users.noreply.github.com> Co-authored-by: Patrick-Ze <19711799+Patrick-Ze@users.noreply.github.com> Co-authored-by: mno <718135749@qq.com> Co-authored-by: 秋云 <physligl@gmail.com>
149 lines
4.4 KiB
JavaScript
149 lines
4.4 KiB
JavaScript
/*
|
||
代码迁移中,还未完成适配
|
||
*/
|
||
|
||
|
||
const CondensedRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("RecognitionObject/Condensed Resin.png"));
|
||
const FragileRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("RecognitionObject/Fragile Resin.png"));
|
||
const TemporaryRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("RecognitionObject/5.png"));
|
||
CondensedRo.threshold = 0.70;
|
||
CondensedRo.Use3Channels = true;
|
||
FragileRo.threshold = 0.70;
|
||
FragileRo.Use3Channels = true;
|
||
|
||
this.recognitionResin =
|
||
async function() {
|
||
let totalRunNum = 0;
|
||
await genshin.returnMainUi();
|
||
await sleep(2000);
|
||
keyPress("m");
|
||
await sleep(2000);
|
||
|
||
let captureRegion = captureGameRegion();
|
||
let resList = captureRegion.findMulti(RecognitionObject.ocr(1043, 5, 300, 100));
|
||
let IsOver = false
|
||
|
||
for (let i = 0; i < resList.count; i++) {
|
||
let resStamina = resList[i];
|
||
log.info(`第 ${i + 1} 个结果: ${resStamina.text}`);
|
||
await sleep(2000);
|
||
|
||
// 提取/前面的数字
|
||
const rawText = resStamina.text;
|
||
const splitResult = rawText.split('/'); // 用/分割字符串
|
||
|
||
// 确保分割后得到两部分且第一部分是有效数字
|
||
if (splitResult.length >= 1) {
|
||
const staminaValue = parseInt(splitResult[0]); // 只取第一部分
|
||
|
||
if (!isNaN(staminaValue)) {
|
||
log.info(`提取的体力值: ${staminaValue}`);
|
||
|
||
if (staminaValue >= 40) {
|
||
IsOver = true;
|
||
}
|
||
break;
|
||
} else {
|
||
log.warn("无效的数字格式");
|
||
}
|
||
} else {
|
||
log.warn("未找到/分隔符");
|
||
}
|
||
|
||
await sleep(2000)
|
||
await genshin.returnMainUi();
|
||
keyPress("b");
|
||
await sleep(2000);
|
||
click(1245, 50);
|
||
await sleep(2000);
|
||
|
||
// 浓缩树脂识别
|
||
let Condensed = captureGameRegion().find(CondensedRo);
|
||
let Isfive = false;
|
||
if (Condensed.isExist()) {
|
||
log.info("识别到浓缩树脂");
|
||
let CondensedX = Math.round(Condensed.x + Condensed.width / 2 - 20)
|
||
let Condensedy = Math.round(Condensed.y + Condensed.height / 2 + 60)
|
||
log.info(`点击坐标: (${CondensedX}, ${Condensedy})`);
|
||
|
||
let captureRegion = captureGameRegion();
|
||
let Condensedres = captureRegion.findMulti(RecognitionObject.ocr(CondensedX, Condensedy, 50, 50));
|
||
for (let i = 0; i < Condensedres.count; i++) {
|
||
let resCondensed = Condensedres[i];
|
||
log.info(`浓缩树脂: ${resCondensed.text}`);
|
||
await sleep(2000);
|
||
if (resCondensed.text == 5) {
|
||
Isfive = true;
|
||
log.info("浓缩树脂已满")
|
||
await sleep(2000);
|
||
|
||
}
|
||
}
|
||
}
|
||
// 脆弱树脂识别
|
||
let Fragile = captureGameRegion().find(FragileRo);
|
||
if (Fragile.isExist()) {
|
||
log.info("识别到脆弱树脂");
|
||
|
||
let FragileX = Math.round(Fragile.x + Fragile.width / 2 - 20)
|
||
let Fragiley = Math.round(Fragile.y + Fragile.height / 2 + 60)
|
||
|
||
let captureRegion = captureGameRegion();
|
||
let Fragileres = captureRegion.findMulti(RecognitionObject.ocr(FragileX, Fragiley, 50, 50));
|
||
|
||
if (Fragileres.count === 0) {
|
||
log.error("OCR识别失败:未能识别到脆弱树脂数量");
|
||
} else {
|
||
for (let i = 0; i < Fragileres.count; i++) {
|
||
let resFragile = Fragileres[i];
|
||
if (resFragile.text && resFragile.text.trim() !== "") {
|
||
log.info("脆弱树脂数量: " + resFragile.text);
|
||
} else {
|
||
log.warn("OCR识别结果为空或无效");
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
log.info("未识别到脆弱树脂");
|
||
await sleep(2000);
|
||
}
|
||
// 须臾树脂识别
|
||
let Temporary = captureGameRegion().find(TemporaryRo);
|
||
if (Temporary.isExist()) {
|
||
log.info("识别到须臾树脂");
|
||
|
||
let TemporaryX = Math.round(Temporary.x + Temporary.width / 2 - 20)
|
||
let Temporaryy = Math.round(Temporary.y + Temporary.height / 2 + 40)
|
||
log.info(`点击坐标: (${TemporaryX}, ${Temporaryy})`);
|
||
|
||
let captureRegion = captureGameRegion();
|
||
let Temporaryres = captureRegion.findMulti(RecognitionObject.ocr(TemporaryX, Temporaryy, 50, 50));
|
||
} else {
|
||
log.info("未识别到脆弱树脂");
|
||
}
|
||
|
||
if (Temporaryres.count === 0) {
|
||
log.error("OCR识别失败:未能识别到须臾树脂数量");
|
||
} else {
|
||
for (let i = 0; i < Temporaryres.count; i++) {
|
||
let resTemporary = Temporaryres[i];
|
||
if (resTemporary.text && resTemporary.text.trim() !== "") {
|
||
log.info("须臾树脂数量: " + resTemporary.text);
|
||
} else {
|
||
log.warn("OCR识别结果为空或无效");
|
||
}
|
||
await sleep(2000);
|
||
}
|
||
}
|
||
|
||
|
||
// 尝试调用任务
|
||
|
||
|
||
if (IsOver && Isfive == true) {
|
||
log.info("需要前往合成台"); // 输出 true
|
||
} else {
|
||
log.info("不需要前往合成台");
|
||
}
|
||
}
|
||
} |