diff --git a/repo/js/SkipMonthlyCard/README.md b/repo/js/SkipMonthlyCard/README.md new file mode 100644 index 000000000..afbb43e1c --- /dev/null +++ b/repo/js/SkipMonthlyCard/README.md @@ -0,0 +1 @@ +可用于少女月卡临时使用或4点前一会儿启动一直等待月卡直到领取完毕 \ No newline at end of file diff --git a/repo/js/SkipMonthlyCard/assets/girl_moon.png b/repo/js/SkipMonthlyCard/assets/girl_moon.png new file mode 100644 index 000000000..61af702f7 Binary files /dev/null and b/repo/js/SkipMonthlyCard/assets/girl_moon.png differ diff --git a/repo/js/SkipMonthlyCard/assets/paimon_menu.png b/repo/js/SkipMonthlyCard/assets/paimon_menu.png new file mode 100644 index 000000000..c424325b1 Binary files /dev/null and b/repo/js/SkipMonthlyCard/assets/paimon_menu.png differ diff --git a/repo/js/SkipMonthlyCard/assets/primogem.png b/repo/js/SkipMonthlyCard/assets/primogem.png new file mode 100644 index 000000000..65a585f1d Binary files /dev/null and b/repo/js/SkipMonthlyCard/assets/primogem.png differ diff --git a/repo/js/SkipMonthlyCard/assets/welkin_moon_logo.png b/repo/js/SkipMonthlyCard/assets/welkin_moon_logo.png new file mode 100644 index 000000000..950203406 Binary files /dev/null and b/repo/js/SkipMonthlyCard/assets/welkin_moon_logo.png differ diff --git a/repo/js/SkipMonthlyCard/main.js b/repo/js/SkipMonthlyCard/main.js new file mode 100644 index 000000000..eb9fc4706 --- /dev/null +++ b/repo/js/SkipMonthlyCard/main.js @@ -0,0 +1,73 @@ +// 图片资源缓存 +const img_cache = {}; +const template_cache = {}; + +// 获取图片资源 +function getImgMat(path) { + if (!img_cache[path]) { + img_cache[path] = file.readImageMatSync('assets/' + path + '.png'); + } + return img_cache[path]; +} + +// 获取模板 +function getTemplate(path) { + if (!template_cache[path]) { + const img_mat = getImgMat(path); + template_cache[path] = RecognitionObject.TemplateMatch( + img_mat, + 0, 0, 1920, 1080 + ); + } + return template_cache[path]; +} + +// 查找图片 +async function findImage(path) { + const searchImg = getTemplate(path); + + const captureRegion = captureGameRegion(); + const result = captureRegion.find(searchImg); + captureRegion.dispose(); + + return result.isExist(); +} + +(async function () { + let success = false; + await genshin.returnMainUi(); + + while (true) { + const result1 = await findImage("girl_moon"); + const result2 = await findImage("welkin_moon_logo"); + if (result1 || result2) { + log.info("点击月神"); + await sleep(200); + click(100, 100); + await sleep(200); + } + + const stone = await findImage("primogem"); + if (stone) { + log.info("点击原石"); + while (true) { + await sleep(200); + click(100, 100); + await sleep(200); + const isInMainUI = await findImage("paimon_menu"); + if (isInMainUI) { + log.info("已进入主页面"); + success = true; + await sleep(500); + break; + } + } + } + + if (success) { + break; + } + + await sleep(2000); + } +})(); diff --git a/repo/js/SkipMonthlyCard/manifest.json b/repo/js/SkipMonthlyCard/manifest.json new file mode 100644 index 000000000..5878deaf4 --- /dev/null +++ b/repo/js/SkipMonthlyCard/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 1, + "name": "自动月卡", + "version": "0.5", + "bgi_version": "0.54.0", + "description": "一直等待直到点击掉月卡", + "authors": [ + { + "name": "躁动的氨气", + "links": "https://github.com/zaodonganqi" + } + ], + "main": "main.js" +} \ No newline at end of file