diff --git a/repo/js/AbundantOre/assets/images/amethyst_lump_new.png b/repo/js/AbundantOre/assets/images/amethyst_lump_new.png new file mode 100644 index 000000000..0ced926fb Binary files /dev/null and b/repo/js/AbundantOre/assets/images/amethyst_lump_new.png differ diff --git a/repo/js/AbundantOre/assets/images/condessence_crystal_new.png b/repo/js/AbundantOre/assets/images/condessence_crystal_new.png new file mode 100644 index 000000000..817efe4de Binary files /dev/null and b/repo/js/AbundantOre/assets/images/condessence_crystal_new.png differ diff --git a/repo/js/AbundantOre/assets/images/crystal_chunk_new.png b/repo/js/AbundantOre/assets/images/crystal_chunk_new.png new file mode 100644 index 000000000..34b9bf86f Binary files /dev/null and b/repo/js/AbundantOre/assets/images/crystal_chunk_new.png differ diff --git a/repo/js/AbundantOre/assets/images/rainbowdrop_crystal_new.png b/repo/js/AbundantOre/assets/images/rainbowdrop_crystal_new.png new file mode 100644 index 000000000..5e5015b07 Binary files /dev/null and b/repo/js/AbundantOre/assets/images/rainbowdrop_crystal_new.png differ diff --git a/repo/js/AbundantOre/main.js b/repo/js/AbundantOre/main.js index a07a0092a..d0e19c849 100644 --- a/repo/js/AbundantOre/main.js +++ b/repo/js/AbundantOre/main.js @@ -272,22 +272,26 @@ async function get_inventory() { rainbowdrop_crystals: 0, }; for (const [name, path] of Object.entries(ore_image_map)) { - let match_obj = RecognitionObject.TemplateMatch(file.ReadImageMatSync(path)); - match_obj.threshold = 0.85; - match_obj.Use3Channels = true; - const match_res = game_region.Find(match_obj); - if (match_res.isExist()) { - log.debug(`Found ${name} image at (${match_res.x}, ${match_res.y})`); + for (const suffix of ["", "_new"]) { + const filename_with_suffix = path.replace(".png", suffix + ".png"); + let match_obj = RecognitionObject.TemplateMatch(file.ReadImageMatSync(filename_with_suffix)); + match_obj.threshold = 0.85; + match_obj.Use3Channels = true; + const match_res = game_region.Find(match_obj); + if (match_res.isExist()) { + log.debug(`Found ${name} image at (${match_res.x}, ${match_res.y})`); - const text_x = match_res.x - 0; - const text_y = match_res.y + 120; - const text_w = 120; - const text_h = 40; + const text_x = match_res.x - 0; + const text_y = match_res.y + 120; + const text_w = 120; + const text_h = 40; - const ocr_res = game_region.find(RecognitionObject.ocr(text_x, text_y, text_w, text_h)); + const ocr_res = game_region.find(RecognitionObject.ocr(text_x, text_y, text_w, text_h)); - if (ocr_res) { - inventory_result[name] = Number(ocr_res.text); + if (ocr_res) { + inventory_result[name] = Number(ocr_res.text); + } + break; } } } @@ -512,7 +516,9 @@ async function main() { total_yield_str = "无收获"; } log.info("现有水晶块{a}个,紫晶块{b}个,萃凝晶{c}个,虹滴晶{d}个", latest_inventory.crystal_chunks, latest_inventory.amethyst_lumps, latest_inventory.condessence_crystals, latest_inventory.rainbowdrop_crystals); - log.info("运行{m}分钟,{y}", running_minutes.toFixed(2), total_yield_str); + const summary = `运行${running_minutes.toFixed(2)}分钟,${total_yield_str}`; + log.info(summary); + notification.send(summary); } (async function() { diff --git a/repo/js/AbundantOre/manifest.json b/repo/js/AbundantOre/manifest.json index e4affd814..11c80f0a2 100644 --- a/repo/js/AbundantOre/manifest.json +++ b/repo/js/AbundantOre/manifest.json @@ -2,7 +2,7 @@ "bgi_version": "0.50.0", "manifest_version": 1, "name": "矿产资源批发", - "version": "0.9", + "version": "0.10", "description": "自动记录矿石刷新时间,优先选择效率最高的路线,支持按区域、种类、数量自动规划挖矿路线", "authors": [ {