diff --git a/repo/js/FeatherFalling/assets/icon/GoTeleport.png b/repo/js/FeatherFalling/assets/icon/GoTeleport.png new file mode 100644 index 00000000..9bbdedb7 Binary files /dev/null and b/repo/js/FeatherFalling/assets/icon/GoTeleport.png differ diff --git a/repo/js/FeatherFalling/assets/icon/PortableWaypoint.png b/repo/js/FeatherFalling/assets/icon/PortableWaypoint.png new file mode 100644 index 00000000..810d4bb4 Binary files /dev/null and b/repo/js/FeatherFalling/assets/icon/PortableWaypoint.png differ diff --git a/repo/js/FeatherFalling/assets/icon/SwimState.png b/repo/js/FeatherFalling/assets/icon/SwimState.png new file mode 100644 index 00000000..40aaa484 Binary files /dev/null and b/repo/js/FeatherFalling/assets/icon/SwimState.png differ diff --git a/repo/js/FeatherFalling/assets/pathing/信仰之跃.json b/repo/js/FeatherFalling/assets/pathing/信仰之跃.json new file mode 100644 index 00000000..35739713 --- /dev/null +++ b/repo/js/FeatherFalling/assets/pathing/信仰之跃.json @@ -0,0 +1,32 @@ +{ + "info": { + "name": "信仰之跃", + "type": "collect", + "author": "mno", + "version": "1.0", + "description": "", + "map_name": "Teyvat", + "bgi_version": "0.45.0" + }, + "positions": [ + { + "id": 1, + "x": 508.03515625, + "y": -630.49072265625, + "action": "", + "move_mode": "walk", + "action_params": "", + "type": "teleport", + "locked": false + }, + { + "id": 2, + "x": 499.87890625, + "y": -686.18310546875, + "action": "stop_flying", + "move_mode": "fly", + "action_params": "10000", + "type": "path" + } + ] +} \ No newline at end of file diff --git a/repo/js/FeatherFalling/assets/pathing/原始胎海.json b/repo/js/FeatherFalling/assets/pathing/原始胎海.json new file mode 100644 index 00000000..6536cbff --- /dev/null +++ b/repo/js/FeatherFalling/assets/pathing/原始胎海.json @@ -0,0 +1,24 @@ +{ + "info": { + "name": "原始胎海", + "type": "collect", + "author": "秋云", + "version": "1.0", + "description": "", + "map_name": "Teyvat", + "bgi_version": "0.45.0", + "tags": [], + "last_modified_time": 1748249620442 + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "dash", + "type": "path", + "x": 3387.220703125, + "y": 2575.370849609375, + "action_params": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/FeatherFalling/main.js b/repo/js/FeatherFalling/main.js new file mode 100644 index 00000000..71761edf --- /dev/null +++ b/repo/js/FeatherFalling/main.js @@ -0,0 +1,81 @@ +const tpIconRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/icon/PortableWaypoint.png")); +const goTeleportRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/icon/GoTeleport.png")); +const swimStateRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/icon/SwimState.png"), + 1400, 900, 1920-1400, 1080-900); +tpIconRo.threshold = 0.70; +tpIconRo.Use3Channels = true; +swimStateRo.threshold = 0.50; +(async function () { + await FeatherFailing(); +})(); + +async function switchPartyIfNeeded(partyName) { + if (!partyName) { + await genshin.returnMainUi(); + return; + } + try { + log.info("正在尝试切换至" + partyName); + if(!await genshin.switchParty(partyName)){ + log.info("切换队伍失败,前往七天神像重试"); + await genshin.tpToStatueOfTheSeven(); + await genshin.switchParty(partyName); + } + } catch { + log.error("队伍切换失败,可能处于联机模式或其他不可切换状态"); + notification.error(`队伍切换失败,可能处于联机模式或其他不可切换状态`); + await genshin.returnMainUi(); + } +} + +async function FeatherFailing() { + await genshin.tpToStatueOfTheSeven(); + await switchPartyIfNeeded(settings.partyName) + keyPress("VK_M"); + await sleep(1000); + await genshin.setBigMapZoomLevel(3.0); + await genshin.moveMapTo(3419, 2739, `枫丹`); + await genshin.setBigMapZoomLevel(1.0); + let result = captureGameRegion().find(tpIconRo); + if (result.isExist()) { + log.info("传送点图标已识别,点击传送"); + } else { + throw new Error("传送点图标未识别,没有放置传送点"); + } + result.click(); + await sleep(1000); + result = captureGameRegion().find(goTeleportRo); + result.click(); + await sleep(1000); + await genshin.returnMainUi(); + await sleep(1000); + + for (let i = 0; i < 20; i++) { + keyDown("W"); + await sleep(50); + keyUp("W"); + await sleep(300); + result = captureGameRegion().find(swimStateRo); + if (result.isExist()) { + log.info("已进入游泳状态"); + break; + } + } + keyDown("VK_LCONTROL"); + for (let i = 0; i < 100; i++) { + await sleep(1000); + point = genshin.getPositionFromMap(); + log.info("当前坐标:({x}, {y})", point.x, point.y); + if (point.x > 3000 && point.y > 2400 && point.x < 4000 && point.y < 3200) { + log.info("小地图已经可以看到提瓦特大陆了", point.x, point.y); + break; + } + } + await pathingScript.runFile("assets/pathing/原始胎海.json"); + await sleep(25000); + keyUp("VK_LCONTROL"); + log.info("我已无敌!"); + if(settings.Test){ + await pathingScript.runFile("assets/pathing/信仰之跃.json"); + } +} \ No newline at end of file diff --git a/repo/js/FeatherFalling/manifest.json b/repo/js/FeatherFalling/manifest.json new file mode 100644 index 00000000..647069b0 --- /dev/null +++ b/repo/js/FeatherFalling/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 1, + "name": "摔落保护:提瓦特反牛顿机制", + "version": "1.0", + "description": "利用游戏机制获取免疫摔落伤害的buff", + "authors": [ + { + "name": "秋云", + "link": "https://github.com/physligl" + } + ], + "settings_ui": "settings.json", + "main": "main.js" +} \ No newline at end of file diff --git a/repo/js/FeatherFalling/settings.json b/repo/js/FeatherFalling/settings.json new file mode 100644 index 00000000..d124ca5b --- /dev/null +++ b/repo/js/FeatherFalling/settings.json @@ -0,0 +1,12 @@ +[ + { + "name": "partyName", + "type": "input-text", + "label": "需要摔落保护的队伍名称" + }, + { + "name": "test", + "type": "checkbox", + "label": "是否想看看效果" + } +] \ No newline at end of file