@@ -95,7 +95,7 @@ async function recognizeTextInRegion(ocrRegion, timeout = 5000) {
|
|||||||
(async function () {
|
(async function () {
|
||||||
setGameMetrics(1920, 1080, 1);
|
setGameMetrics(1920, 1080, 1);
|
||||||
await genshin.returnMainUi();
|
await genshin.returnMainUi();
|
||||||
const noti = settings.notification || false;
|
const notify = settings.notify || false;
|
||||||
|
|
||||||
// 按下 C 键
|
// 按下 C 键
|
||||||
keyPress("C");
|
keyPress("C");
|
||||||
@@ -134,14 +134,29 @@ async function recognizeTextInRegion(ocrRegion, timeout = 5000) {
|
|||||||
let recognizedText = await recognizeTextInRegion(ocrRegionMora);
|
let recognizedText = await recognizeTextInRegion(ocrRegionMora);
|
||||||
if (recognizedText) {
|
if (recognizedText) {
|
||||||
log.info(`成功识别到摩拉数值: ${recognizedText}`);
|
log.info(`成功识别到摩拉数值: ${recognizedText}`);
|
||||||
if (noti) {
|
if (notify) {
|
||||||
notification.Send(`摩拉数值: ${recognizedText}`);
|
notification.Send(`摩拉数值: ${recognizedText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
const now = new Date();
|
||||||
|
const formattedTime = now.toLocaleString(); // 使用本地时间格式化
|
||||||
|
|
||||||
|
|
||||||
|
// 写入本地文件
|
||||||
|
const filePath = "mora_log.txt";
|
||||||
|
const logContent = `${formattedTime} - 摩拉数值: ${recognizedText}\n`;
|
||||||
|
const result = file.WriteTextSync(filePath, logContent, true); // 追加模式
|
||||||
|
if (result) {
|
||||||
|
log.info("成功将摩拉数值写入日志文件");
|
||||||
|
} else {
|
||||||
|
log.error("写入日志文件失败");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("未能识别到摩拉数值。");
|
log.warn("未能识别到摩拉数值。");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("未能识别到角色菜单或天赋,跳过摩拉数值识别。");
|
log.warn("未能识别到角色菜单或天赋,跳过摩拉数值识别。");
|
||||||
}
|
}
|
||||||
await genshin.returnMainUi();
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "OCR摩拉log",
|
"name": "OCR摩拉log",
|
||||||
"version": "1.0",
|
"version": "1.1",
|
||||||
"description": "OCR识别摩拉输出到log",
|
"description": "至少0.44.3版本。OCR识别摩拉数值输出到本地",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "吉吉喵",
|
"name": "吉吉喵",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "notification",
|
"name": "notify",
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"label": "通知"
|
"label": "通知"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user