├── dnf-script-plugin
├── .gitignore
├── .idea
│ ├── .gitignore
│ ├── compiler.xml
│ ├── deploymentTargetSelector.xml
│ ├── gradle.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ ├── migrations.xml
│ ├── misc.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── libs
│ │ ├── OpencvLibrary-1.0.0-release.aar
│ │ └── Yolov5Library-1.0.0-release.aar
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── info
│ │ │ └── xingxingdd
│ │ │ └── dnf
│ │ │ └── script
│ │ │ └── plugin
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ │ ├── model
│ │ │ │ ├── best.ncnn.bin
│ │ │ │ ├── best.ncnn.param
│ │ │ │ ├── yolov5s.bin
│ │ │ │ └── yolov5s.param
│ │ │ ├── plugin
│ │ │ │ └── index.js
│ │ │ └── template
│ │ │ │ ├── common
│ │ │ │ ├── character-border-empty.jpg
│ │ │ │ ├── character-border-new.jpg
│ │ │ │ ├── confirm.jpg
│ │ │ │ ├── fatigue.jpg
│ │ │ │ ├── position.jpg
│ │ │ │ ├── repeat.jpg
│ │ │ │ ├── rocker.jpg
│ │ │ │ ├── setting.jpg
│ │ │ │ ├── start-game-btn.jpg
│ │ │ │ └── switch-character.jpg
│ │ │ │ ├── dungeons
│ │ │ │ ├── buwanjia
│ │ │ │ │ ├── 1.jpg
│ │ │ │ │ ├── 2.jpg
│ │ │ │ │ ├── 3.jpg
│ │ │ │ │ ├── 4.jpg
│ │ │ │ │ ├── 5.jpg
│ │ │ │ │ ├── 6.jpg
│ │ │ │ │ ├── 7.jpg
│ │ │ │ │ ├── 8.jpg
│ │ │ │ │ ├── 9.jpg
│ │ │ │ │ └── map.jpg
│ │ │ │ └── common
│ │ │ │ │ ├── bwjxlc.jpg
│ │ │ │ │ ├── mxan.jpg
│ │ │ │ │ ├── mxjl.jpg
│ │ │ │ │ ├── mxjwxz.jpg
│ │ │ │ │ ├── mxjxz.jpg
│ │ │ │ │ ├── qyyd.jpg
│ │ │ │ │ ├── repair.jpg
│ │ │ │ │ ├── wnxs.jpg
│ │ │ │ │ └── zdks.jpg
│ │ │ │ └── role
│ │ │ │ └── berserker
│ │ │ │ ├── 1.jpg
│ │ │ │ ├── 10.jpg
│ │ │ │ ├── 11.jpg
│ │ │ │ ├── 12.jpg
│ │ │ │ ├── 2.jpg
│ │ │ │ ├── 3.jpg
│ │ │ │ ├── 4.jpg
│ │ │ │ ├── 5.jpg
│ │ │ │ ├── 6.jpg
│ │ │ │ ├── 7.jpg
│ │ │ │ ├── 8.jpg
│ │ │ │ └── 9.jpg
│ │ ├── java
│ │ │ └── info
│ │ │ │ └── xingxingdd
│ │ │ │ └── dnf
│ │ │ │ └── script
│ │ │ │ └── plugin
│ │ │ │ ├── DnfScriptPlugin.java
│ │ │ │ ├── DnfScriptPluginRegistry.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── utils
│ │ │ │ └── DnfScriptPluginUtils.java
│ │ └── res
│ │ │ ├── drawable
│ │ │ ├── ic_launcher_background.xml
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ │ ├── values-night
│ │ │ └── themes.xml
│ │ │ ├── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── themes.xml
│ │ │ └── xml
│ │ │ ├── backup_rules.xml
│ │ │ └── data_extraction_rules.xml
│ │ └── test
│ │ └── java
│ │ └── info
│ │ └── xingxingdd
│ │ └── dnf
│ │ └── script
│ │ └── plugin
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ ├── libs.versions.toml
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
└── webpack-autojs-master
├── .babelrc
├── .eslintignore
├── .eslintrc.json
├── .gitignore
├── .vs
└── slnx.sqlite
├── LICENSE
├── README.md
├── advancedEngines.js
├── common
├── common.js
└── douyinUtils.js
├── header.txt
├── jsconfig.json
├── package.json
├── scriptConfig.js
├── types
├── adbkit.d.ts
├── auto.d.ts
├── autojs.d.ts
└── modules
│ ├── app.d.ts
│ ├── colors.d.ts
│ ├── console.d.ts
│ ├── coordinate.d.ts
│ ├── device.d.ts
│ ├── dialogs.d.ts
│ ├── engines.d.ts
│ ├── events.d.ts
│ ├── files.d.ts
│ ├── floaty.d.ts
│ ├── global.d.ts
│ ├── http.d.ts
│ ├── images.d.ts
│ ├── keys.d.ts
│ ├── media.d.ts
│ ├── root.d.ts
│ ├── sensors.d.ts
│ ├── storages.d.ts
│ ├── threads.d.ts
│ ├── ui.d.ts
│ └── widgets.d.ts
├── webpack.config.js
└── work
├── dnf
├── 1.jpg
├── common
│ ├── compute.js
│ ├── config.js
│ ├── debuger.js
│ ├── mark.js
│ ├── socket.js
│ └── utils.js
├── content
│ ├── action.js
│ ├── boot.js
│ └── home.js
├── game
│ ├── action
│ │ ├── detector.js
│ │ ├── matcher.js
│ │ ├── ocr.js
│ │ └── processor.js
│ ├── assistant.js
│ ├── config
│ │ └── template.js
│ ├── core
│ │ ├── factory.js
│ │ ├── processor
│ │ │ ├── game_detect_processor.js
│ │ │ └── match_cache_processor.js
│ │ └── scheduler.js
│ ├── engine.js
│ ├── game.js
│ ├── object
│ │ ├── block.js
│ │ ├── coward.js
│ │ └── monster.js
│ ├── pipeline
│ │ ├── keyboard.js
│ │ └── pipeline.js
│ ├── role
│ │ └── berserker.js
│ ├── runtime.js
│ ├── scene
│ │ ├── bwj.js
│ │ ├── dungeons.js
│ │ └── skill.js
│ ├── storategy
│ │ └── storategy.js
│ └── test.js
├── img
│ ├── 分类.png
│ ├── 失败.png
│ ├── 播放.png
│ ├── 播放中.png
│ ├── 设置.png
│ ├── 退出.png
│ └── 首页.png
├── main.js
├── project.json
├── readme.md
└── view
│ ├── debug.js
│ ├── home.js
│ ├── loading.js
│ └── update.js
├── dy
├── float.js
├── img
│ ├── 播放.png
│ ├── 播放中.png
│ └── 退出.png
├── main.js
└── project.json
├── ocr
├── 0.jpg
├── 1.jpg
├── 1.png
├── 2.png
├── binary_image.png
├── main.js
├── models
│ ├── ch_PP-OCRv3_det_slim_infer.nb
│ ├── ch_PP-OCRv3_rec_slim_infer.nb
│ └── ch_ppocr_mobile_v2.0_cls_infer_opt.nb
├── project.json
├── xframe_000245.jpg
├── 开始.png
├── 暂停.png
├── 设置.png
└── 退出.png
├── qq消息
├── main.js
└── project.json
├── test
├── runtime.js
├── test.js
└── test2.js
├── websocket
├── main.js
└── project.json
├── 云控demo
├── project.json
└── test.js
└── 快捷输入
├── main.js
└── project.json
/dnf-script-plugin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/deploymentTargetSelector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dnf-script-plugin/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/dnf-script-plugin/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android.application)
3 | }
4 |
5 | android {
6 | namespace 'info.xingxingdd.dnf.script.plugin'
7 | compileSdk 34
8 |
9 | defaultConfig {
10 | applicationId "info.xingxingdd.dnf.script.plugin"
11 | minSdk 24
12 | targetSdk 34
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 |
33 | implementation libs.appcompat
34 | implementation libs.material
35 | implementation libs.activity
36 | implementation libs.constraintlayout
37 | testImplementation libs.junit
38 | androidTestImplementation libs.ext.junit
39 | androidTestImplementation libs.espresso.core
40 | implementation libs.auto.js.plugin.sdk
41 | implementation libs.gson
42 | implementation(fileTree("libs"))
43 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/app/libs/OpencvLibrary-1.0.0-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/libs/OpencvLibrary-1.0.0-release.aar
--------------------------------------------------------------------------------
/dnf-script-plugin/app/libs/Yolov5Library-1.0.0-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/libs/Yolov5Library-1.0.0-release.aar
--------------------------------------------------------------------------------
/dnf-script-plugin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/androidTest/java/info/xingxingdd/dnf/script/plugin/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("info.xingxingdd.dnf.script.plugin", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/model/best.ncnn.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/model/best.ncnn.bin
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/model/yolov5s.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/model/yolov5s.bin
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/plugin/index.js:
--------------------------------------------------------------------------------
1 | module.exports = function (plugin) {
2 | let runtime = plugin.runtime;
3 | let scope = plugin.topLevelScope;
4 |
5 | function DnfScriptPlugin() {
6 | }
7 |
8 | DnfScriptPlugin.detect = (source, ratioThreshold) => plugin.detect(source, ratioThreshold)
9 |
10 | DnfScriptPlugin.match = (source, template, bounds) => plugin.match(source, template, bounds)
11 |
12 | DnfScriptPlugin.blackScreenDetect = (source) => plugin.blackScreenDetect(source)
13 |
14 | return DnfScriptPlugin;
15 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/character-border-empty.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/character-border-empty.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/character-border-new.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/character-border-new.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/confirm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/confirm.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/fatigue.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/fatigue.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/position.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/position.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/repeat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/repeat.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/rocker.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/rocker.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/setting.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/setting.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/start-game-btn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/start-game-btn.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/common/switch-character.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/common/switch-character.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/1.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/2.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/3.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/4.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/5.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/6.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/7.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/8.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/9.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/map.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/buwanjia/map.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/bwjxlc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/bwjxlc.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxan.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjl.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjl.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjwxz.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjwxz.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjxz.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/mxjxz.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/qyyd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/qyyd.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/repair.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/repair.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/wnxs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/wnxs.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/dungeons/common/zdks.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/dungeons/common/zdks.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/1.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/10.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/11.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/12.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/2.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/3.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/4.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/5.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/6.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/7.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/8.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/assets/template/role/berserker/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/assets/template/role/berserker/9.jpg
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/java/info/xingxingdd/dnf/script/plugin/DnfScriptPlugin.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin;
2 |
3 | import static org.opencv.android.OpenCVLoader.OPENCV_VERSION;
4 |
5 | import android.content.Context;
6 | import android.graphics.Bitmap;
7 | import android.util.Log;
8 |
9 | import org.autojs.plugin.sdk.Plugin;
10 | import org.opencv.android.InstallCallbackInterface;
11 | import org.opencv.android.LoaderCallbackInterface;
12 | import org.opencv.android.OpenCVLoader;
13 | import org.opencv.matcher.BlackImageMatcher;
14 | import org.opencv.matcher.MatchResult;
15 | import org.opencv.matcher.MatchTemplate;
16 | import org.opencv.matcher.TemplateMatcher;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Arrays;
20 | import java.util.HashMap;
21 | import java.util.List;
22 | import java.util.Map;
23 | import java.util.stream.Collectors;
24 |
25 | import info.xingxingdd.dnf.script.plugin.utils.DnfScriptPluginUtils;
26 | import info.xingxingdd.yolov5.library.YoloV5Ncnn;
27 |
28 | public class DnfScriptPlugin extends Plugin {
29 |
30 | private static YoloV5Ncnn yoloV5Ncnn;
31 |
32 | public DnfScriptPlugin(Context context, Context selfContext, Object runtime, Object topLevelScope) {
33 | super(context, selfContext, runtime, topLevelScope);
34 | //初始化opencv
35 | OpenCVLoader.initDebug();
36 | }
37 |
38 | @Override
39 | public String getAssetsScriptDir() {
40 | return "plugin";
41 | }
42 |
43 | public List detect(Bitmap source, float ratioThreshold) {
44 | try {
45 | MatchTemplate sourceTemplate = new MatchTemplate(
46 | source,
47 | (int) (source.getWidth() * 0.35),
48 | (int) (source.getWidth() * 0.65),
49 | (int) (source.getHeight() * 0.35),
50 | (int) (source.getHeight() * 0.65)
51 | );
52 | boolean blackImgDetectResult = BlackImageMatcher.match(sourceTemplate, 10);
53 | if (blackImgDetectResult) {
54 | YoloV5Ncnn.Obj obj = yoloV5Ncnn.new Obj();
55 | obj.label = "black-screen";
56 | obj.w = source.getWidth() * 0.3f;
57 | obj.h = source.getWidth() * 0.3f;
58 | obj.x = source.getWidth() * 0.35f;
59 | obj.w = source.getWidth() * 0.35f;
60 | obj.prob = 1;
61 | return List.of(obj);
62 | }
63 | if (yoloV5Ncnn == null) {
64 | yoloV5Ncnn = YoloV5Ncnn.getInstance(getSelfContext().getAssets(), "model/best.ncnn");
65 | }
66 | YoloV5Ncnn.Obj[] result = yoloV5Ncnn.detect(source, false);
67 | if (result != null && result.length> 0) {
68 | return Arrays.stream(result).filter(r -> r.prob >= ratioThreshold).collect(Collectors.toList());
69 | }
70 | return List.of();
71 | } catch (Throwable e) {
72 | Log.e("检测失败", e.getLocalizedMessage());
73 | return null;
74 | }
75 | }
76 |
77 | public MatchResult match(Bitmap sourceImg, String[] templates, Double[] bounds) {
78 | try {
79 | Log.i("dnf-script-plugin", "宽:" + sourceImg.getWidth() + ",高" + sourceImg.getHeight());
80 | MatchTemplate source = new MatchTemplate(
81 | sourceImg,
82 | (int) (sourceImg.getWidth() * bounds[0]),
83 | (int) (sourceImg.getWidth() * bounds[1]),
84 | (int) (sourceImg.getHeight() * bounds[2]),
85 | (int) (sourceImg.getHeight() * bounds[3])
86 | );
87 | for (String template: templates) {
88 | Bitmap targetImg = DnfScriptPluginUtils.loadBitmap(getSelfContext(), "template/" + template + ".jpg");
89 | if (targetImg == null) {
90 | return null;
91 | }
92 | Log.i("dnf-script-plugin", source.getLeft() + "," + source.getRight() + "," + source.getTop() + "," + source.getBottom());
93 | MatchTemplate target = new MatchTemplate(targetImg);
94 | MatchResult matchResult = TemplateMatcher.match(target, source, 1f);
95 | Log.i("dnf-script-plugin", "匹配结果:" + matchResult);
96 | if (matchResult != null) {
97 | return matchResult;
98 | }
99 | }
100 | } catch (Throwable e) {
101 | Log.e("检测失败", e.getLocalizedMessage());
102 | }
103 | return null;
104 | }
105 |
106 | public boolean blackScreenDetect(Bitmap source) {
107 | MatchTemplate sourceTemplate = new MatchTemplate(
108 | source,
109 | (int) (source.getWidth() * 0.4),
110 | (int) (source.getWidth() * 0.6),
111 | (int) (source.getHeight() * 0.4),
112 | (int) (source.getHeight() * 0.6)
113 | );
114 | boolean detectResult = BlackImageMatcher.match(sourceTemplate, 10);
115 | Log.i("dnf-script-plugin", "识别黑屏结果结果:" + detectResult);
116 | return detectResult;
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/java/info/xingxingdd/dnf/script/plugin/DnfScriptPluginRegistry.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin;
2 |
3 | import org.autojs.plugin.sdk.PluginRegistry;
4 | import org.opencv.android.InstallCallbackInterface;
5 | import org.opencv.android.LoaderCallbackInterface;
6 | import org.opencv.android.OpenCVLoader;
7 |
8 | public class DnfScriptPluginRegistry extends PluginRegistry {
9 |
10 | static {
11 | // 注册默认插件
12 | registerDefaultPlugin(DnfScriptPlugin::new);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/java/info/xingxingdd/dnf/script/plugin/MainActivity.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.activity.EdgeToEdge;
6 | import androidx.appcompat.app.AppCompatActivity;
7 | import androidx.core.graphics.Insets;
8 | import androidx.core.view.ViewCompat;
9 | import androidx.core.view.WindowInsetsCompat;
10 |
11 | public class MainActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | EdgeToEdge.enable(this);
17 | setContentView(R.layout.activity_main);
18 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
19 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
20 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
21 | return insets;
22 | });
23 | }
24 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/java/info/xingxingdd/dnf/script/plugin/utils/DnfScriptPluginUtils.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin.utils;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.util.Log;
7 |
8 | import java.io.InputStream;
9 |
10 | public class DnfScriptPluginUtils {
11 |
12 | public static Bitmap loadBitmap(Context context, String path) {
13 | try (InputStream is = context.getAssets().open(path)) {
14 | return BitmapFactory.decodeStream(is);
15 | } catch (Exception e) {
16 | Log.e("dnf-server", "加载错误:" + e.getLocalizedMessage());
17 | return null;
18 | }
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | dnf-script-plugin
3 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/dnf-script-plugin/app/src/test/java/info/xingxingdd/dnf/script/plugin/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package info.xingxingdd.dnf.script.plugin;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | alias(libs.plugins.android.application) apply false
4 | }
--------------------------------------------------------------------------------
/dnf-script-plugin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/dnf-script-plugin/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.5.1"
3 | autoJsPluginSdk = "0.2"
4 | gson = "2.10.1"
5 | junit = "4.13.2"
6 | junitVersion = "1.1.5"
7 | espressoCore = "3.5.1"
8 | appcompat = "1.6.1"
9 | material = "1.10.0"
10 | activity = "1.8.0"
11 | constraintlayout = "2.1.4"
12 |
13 | [libraries]
14 | auto-js-plugin-sdk = { module = "com.github.hyb1996:Auto.js-Plugin-SDK", version.ref = "autoJsPluginSdk" }
15 | gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
16 | junit = { group = "junit", name = "junit", version.ref = "junit" }
17 | ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
18 | espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
19 | appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
20 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
21 | activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
22 | constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
23 |
24 | [plugins]
25 | android-application = { id = "com.android.application", version.ref = "agp" }
26 |
27 |
--------------------------------------------------------------------------------
/dnf-script-plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/dnf-script-plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/dnf-script-plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Aug 22 23:39:11 CST 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/dnf-script-plugin/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/dnf-script-plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | maven { url 'https://jitpack.io' }
20 | }
21 | }
22 |
23 | rootProject.name = "dnf-script-plugin"
24 | include ':app'
25 |
--------------------------------------------------------------------------------
/webpack-autojs-master/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"],
3 | "plugins": [
4 | ["@babel/plugin-transform-runtime"],
5 | ["@babel/plugin-transform-modules-commonjs"],
6 | ["transform-remove-strict-mode"]
7 | ],
8 | "ignore": [
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/webpack-autojs-master/.eslintignore:
--------------------------------------------------------------------------------
1 | # 把下面 .eslintignore 文件放到当前工作目录里,将忽略 node_modules,bower_components 以及 build/ 目录下除了 build/index.js 的所有文件。
2 |
3 | # /node_modules/* and /bower_components/* ignored by default
4 |
5 | # Ignore built files except build/index.js
6 |
7 | build/*
8 | !build/index.js
9 | ApplicationCenter/autojsDemo/*
10 | ApplicationCenter/pro商店脚本/*
11 |
--------------------------------------------------------------------------------
/webpack-autojs-master/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true
6 | },
7 | "parser": "babel-eslint",
8 | "extends": "eslint:recommended",
9 | "globals": {
10 | "Atomics": "readonly",
11 | "SharedArrayBuffer": "readonly",
12 | "colors": true,
13 | "com": true,
14 | "importClass": true,
15 | "storages": true,
16 | "device": true,
17 | "log": true,
18 | "threads": true,
19 | "exit": true,
20 | "runtime": true,
21 | "java": true,
22 | "importPackage": true,
23 | "YuvImage": true,
24 | "PackageManager": true,
25 | "ImageFormat": true,
26 | "ui": true,
27 | "activity": true,
28 | "View": true,
29 | "context": true,
30 | "ObjectAnimator": true,
31 | "BinaryBitmap": true,
32 | "HybridBinarizer": true,
33 | "RGBLuminanceSource": true,
34 | "MultiFormatReader": true,
35 | "sleep": true,
36 | "util": true,
37 | "android": true,
38 | "Paint": true,
39 | "PorterDuffXfermode": true,
40 | "PorterDuff": true,
41 | "toastLog": true,
42 | "ByteArrayOutputStream": true,
43 | "Rect": true,
44 | "ActivityCompat": true,
45 | "__dirname": true,
46 | "files": true,
47 | "requestScreenCapture": true,
48 | "http": true,
49 | "toast": true,
50 | "engines": true,
51 | "random": true,
52 | "events": true,
53 | "press": true,
54 | "Tap": true,
55 | "gesture": true,
56 | "Swipe": true,
57 | "getPackageName": true,
58 | "shell": true,
59 | "floaty": true,
60 | "currentPackage": true,
61 | "Canvas": true,
62 | "launch": true,
63 | "FileOutputStream": true,
64 | "app": true,
65 | "images": true,
66 | "launchApp": true,
67 | "Bitmap": true,
68 | "className": true,
69 | "Buffer": true,
70 | "idEndsWith": true,
71 | "textEndsWith": true,
72 | "descEndsWith": true,
73 | "text": true,
74 | "back": true,
75 | "textMatches": true,
76 | "textStartsWith": true,
77 | "id": true,
78 | "desc": true,
79 | "descStartsWith": true,
80 | "AnimatorSet": true,
81 | "click": true,
82 | "PendingIntent": true,
83 | "dialogs": true,
84 | "auto": true,
85 | "Settings": true,
86 | "setClip": true,
87 | "Context": true,
88 | "getClip": true,
89 | "DevicePolicyManager": true,
90 | "Intent": true,
91 | "ComponentName": true,
92 | "Cipher": true,
93 | "IvParameterSpec": true,
94 | "SecretKeySpec": true,
95 | "javax": true,
96 | "BASE64Decoder": true,
97 | "NotificationManager": true,
98 | "NotificationChannel": true,
99 | "Uri": true,
100 | "media": true,
101 | "ServerSocket": true,
102 | "DataInputStream": true,
103 | "DataOutputStream": true,
104 | "Socket": true,
105 | "JavaAdapter": true,
106 | "WebChromeClient": true,
107 | "ValueCallback": true,
108 | "captureScreen": true,
109 | "timers": true,
110 |
111 | "_test": true
112 | },
113 | "parserOptions": {
114 | "ecmaVersion": 2018
115 | },
116 | "rules": {
117 | "quotes": "off",
118 | "comma-dangle": ["error", "only-multiline"],
119 | "array-bracket-spacing": [2, "never"],
120 | "no-multiple-empty-lines": "off",
121 | "strict": "off",
122 | "use strict" : "off",
123 | "eslint strict": "off"
124 |
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/webpack-autojs-master/.gitignore:
--------------------------------------------------------------------------------
1 | gitCommand.txt
2 |
3 | # Logs
4 | logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 | ossConfig.js
10 | # Runtime data
11 | pids
12 | *.pid
13 | *.seed
14 | *.pid.lock
15 |
16 | # Directory for instrumented libs generated by jscoverage/JSCover
17 | lib-cov
18 |
19 | # Coverage directory used by tools like istanbul
20 | coverage
21 |
22 | # nyc test coverage
23 | .nyc_output
24 |
25 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
26 | .grunt
27 |
28 | # Bower dependency directory (https://bower.io/)
29 | bower_components
30 |
31 | # node-waf configuration
32 | .lock-wscript
33 |
34 | # Compiled binary addons (https://nodejs.org/api/addons.html)
35 | build/Release
36 |
37 | # Dependency directories
38 | dist/
39 | other/
40 | node_modules/
41 | jspm_packages/
42 |
43 | # TypeScript v1 declaration files
44 | typings/
45 |
46 | # Optional npm cache directory
47 | .npm
48 |
49 | # Optional eslint cache
50 | .eslintcache
51 |
52 | # Optional REPL history
53 | .node_repl_history
54 |
55 | # Output of 'npm pack'
56 | *.tgz
57 |
58 | # Yarn Integrity file
59 | .yarn-integrity
60 |
61 | # dotenv environment variables file
62 | .env
63 | .env.test
64 |
65 | # parcel-bundler cache (https://parceljs.org/)
66 | .cache
67 |
68 | # next.js build output
69 | .next
70 |
71 | # nuxt.js build output
72 | .nuxt
73 |
74 | # vuepress build output
75 | .vuepress/dist
76 |
77 | # Serverless directories
78 | .serverless/
79 |
80 | # FuseBox cache
81 | .fusebox/
82 |
83 | # DynamoDB Local files
84 | .dynamodb/
85 |
86 | /node_modules
87 | coverage
88 | *.log
89 | npm-debug.log
90 | .logs
91 | logs
92 | *.swp
93 | run
94 | *-run
95 | .idea
96 | .DS_Store
97 | .tmp
98 | docs/CONTRIBUTING.md
99 | docs/node_modules
100 | docs/README.md
101 | docs/db.json
102 | docs/source/release/index.md
103 | docs/source/member_guide.md
104 | docs/source/_data/versions.yml
105 | docs/**/contributing.md
106 | docs/public
107 | docs/plugins.png
108 |
109 | package-lock.json
110 | yarn.lock
111 | !test/fixtures/apps/loader-plugin/node_modules
112 | .editorconfig
113 | *clinic-flame*
114 | *clinic-doctor*
115 | .nyc_output/
116 | test/fixtures/apps/app-ts/**/*.js
117 | !test/fixtures/apps/app-ts/node_modules
118 | !test/fixtures/apps/app-ts/node_modules/**/*.js
119 | test/fixtures/apps/app-ts-esm/**/*.js
120 | test/fixtures/apps/app-ts-type-check/**/*.js
121 |
--------------------------------------------------------------------------------
/webpack-autojs-master/.vs/slnx.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/.vs/slnx.sqlite
--------------------------------------------------------------------------------
/webpack-autojs-master/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Chaos
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/webpack-autojs-master/README.md:
--------------------------------------------------------------------------------
1 | # 概述
2 | 本项目是在 https://github.com/snailuncle/webpack-autojs 项目上魔改得来,
3 |
4 | 本项目的目标是做个 [autoxjs](https://github.com/kkevsekk1/AutoX) (新的开源 autojs)项目的开发工具包,即 autox-cli
5 | 满足工程化(远离刀耕火种):自动化管理个js类库,自动对源码,编译、混淆、dex加密、打包、部署,让开发人员专心写业务。
6 | 当然要实现 工程化,你需要有一些nodejs开发基础知识。到目前为止尚未封装出cli和dex加密,但是已经实现了除此之外的所以功能,
7 | 所以刚开始你会看到很多文件,请不要害怕,只关心下面文档中提到的几个文件即可。
8 | 项目 直接将编译和的js 转换为 class 转换为 dex 没有实现自动化,
9 | (除非一开发的功能要授权之类的,其他情况下没有必要,转换为dex。要收费授权,和autojs设计的初衷和开源协议都是背离的。)
10 | 下一步将主要解决这个问题。欢迎有兴趣的fork项目一起实现。
11 |
12 | [优酷视频讲解](https://v.youku.com/v_show/id_XNDg2NjA3NTYyMA==.html)
13 |
14 | ## 项目特性清单
15 | - [x] js源码自动编译,混淆、打包、部署手机、重新运行
16 | - [x] vscode 自动提示方法、和说明,有一部分待完善,欢迎pull代码
17 | - [x] 编译后的js 打包成 dex
18 | - [x] 多项目管理
19 | - [x] 自动识别ui模块,源文件 是"ui"; 开头则,编译后同样有,源文件没有,编译后也没有
20 | - [x] 添加多模块编译,一个项目由多个脚本组成,编译后是不同文件,可以相互调用
21 |
22 | # 使用方法
23 | 1. 你需要安装 nodejs ,安装过程中请注意要 [ 将node添加PATH中 ] 和 安装 npm 这两个选项都要勾选上。(一般的前端工程师都有这个环节)
24 | 2. 安装[vscode](https://code.visualstudio.com/) 并安装 autoxjs开发插件即:[Auto.js-VSCodeExt-Fixed](https://marketplace.visualstudio.com/items?itemName=aaroncheng.auto-js-vsce-fixed) 注意是0.3.11 或以上版本。 (ctr+ shift+p 选择autojs 启动服务)
25 | 3. 安装全局安装 webpack: ``` npm i -g webpack webpack-cli --registry=https://registry.npmmirror.com ```
26 | 4. [下载本项目](https://github.com/kkevsekk1/webpack-autojs/archive/master.zip) 或git clone 项目 ``` git clone https://github.com/kkevsekk1/webpack-autojs.git ```
27 |
28 | 5. cmd 到项目 , 运行命令,安装依赖
29 | ```npm install --registry=https://registry.npmmirror.com ```
30 |
31 | 6. 到这来基本上可以说 开发环境 就完成了,(你还要一部手安装 autoxjs),下面说 这项目的配置文件和开发的形式。
32 |
33 | # 项目开发、编译、打包、部署介绍
34 |
35 | 1. work 目录: 这就是我们项目的总目录,即这里面每一个文件夹是一个autoxjs 项目。比如我们 demo,demo1,dy 即为3个项目。
36 | 2. scriptConfig.js 文件: 我们要如何编译项目即在这个文件中配置,打开文件,有注释的可以按照注释改。
37 | 3. header.txt 无关紧要的文件,里面的内容会原封不动的添加到 编译后的js代码头部
38 | 4. 调整好上面 3处内容 就可用编译了我们的项目了
39 | 5. package.json 这个文件规定 看 第6-9行,有两个命令 start 和 build 分别对应开发环境和生成环境的编译,无需修改。只要知道他们 分别对应 npm run start 和 npm run build 。
40 | 6. 运行 ```npm run start ``` 即开发环境,每次修改代码,代码会自动编译,并且 scriptConfig.js 中的wath配置为'rerun'或'deploy' 那么代码将自动在手机中运行 或自动将重新编译的项目保存到手机中。
41 | 7. dist目录: 运行上面编译命令( start或build),就有编译的结果,编译的结果就 dist目录中,这目录下每一个目录代表的就是一个编译后的autoxjs项目.编译后的目录的名称 可以配置一个前缀,以便和编译前的项目区分(当他们都以项目形式保存手中的时候就很有必要)。
42 | 8.``` npm run start ``` 这个
43 |
44 | # 编译 dex
45 | 1. [使用工具](https://github.com/molysama/auto.pro/wiki/dex) 的来源。我用这个工具来打包,不打算重复造轮子了
46 | 2. [安装jre](https://www.baidu.com/s?ie=UTF-8&wd=jre)
47 | 3. 安装 auto-cli ``` npm i "@auto.pro/cli" -g ```
48 | 4. 运行编译命令 ``` auto-cli dex ./dist/demo/main.js ```
49 | 5. 如果由于愿意写个 webpapck 插件 ,来执行这里几个命令,实现自动化愿意 pull 代码,我没打算对我的代码 编译为dex 再加固,所以没有动力实现这个插件!
50 |
51 | # 其他说明1:
52 | 1. 主要配置文件就一个`scriptConfig.js`
53 | 2. `header.txt` 该文件中的内容会被添加到打包后的文件的头部, 默认为空.
54 | 3. `uiMode` true: ui模式, false 非ui模式
55 | 4. `base64`webpack打包后是否base64编码
56 | 5. `base64RandomStrLength`base64编码后, 在字符串前面添加的随机字符长度
57 | 6. common 这目录是想放在公共通用包,页希望有 要用的符合 闭包规范的autoxjs的lib可以提供,我知道一个叫 [autojs_sdk](https://github.com/kangour/autojs_sdk) 还行,但是这个封装还是不够,我解决还可以有更好的。
58 | 7. plugin 这目录是自定义 webpack 插件,为编译和自动化服务,一般无需关心。
59 |
60 | # 其他说明2:
61 | 1. 目前支持的ui有四种, ` ui.layout, ui.inflate, floaty.rawWindow, floaty.window `
62 | 2. 如果layoutContent是一个字符串变量, 而不是xml的话, 可以尝试, 将`floaty.window`定义为`floatyWindow`, 其他的` ui.layout, ui.inflate, floaty.rawWindow, floaty.window `也一样:
63 | ```
64 | let floatyWindow = floaty.window;
65 | var w = floatyWindow(layoutContent);
66 |
67 | ```
68 | 3. loader文件是`node_modules\webpack-autojs-loader\index.js`
69 |
70 | # 其他说明3:
71 | 1. webview打包推荐: `https://github.com/molysama/auto.pro`
72 | 2. require只能用相对路径, webpack才能正常打包
73 | 3. require如果用绝对路径, 请使用global.require代替 如global.require("D:\\module1.js")
74 |
75 | # 常见错误
76 | 1. xml中使用了圆括号, 由于loader使用了正则匹配, 圆括号会影响正则, 请使用中文括号
77 | 2. require使用了绝对路径, 请避免使用绝对路径,
78 | 3. 如果require用了绝对路径, webpack是找不到的, webpack是电脑使用的工具, 不是手机使用的工具,他找不到/sdcard, 请使用global.require代替
79 | 4. 若果xml中有list, 请不要省略this, 因为loader正则中会区分xml中的{{}}中是不是带了this, 来进行不同的处理
80 | 5. 变量未定义, 请注意所有变量都要先定义, 再使用; 注意js的变量提升, 导致打包后的运行错误.
81 | 6. 如果不定义就使用, 请在变量前面加上 global. 这7个字符, 可以避免一些变量提升导致的错误
82 | 7. 如果导入jar或者dex, 使用java对象, 建议直接使用对象的完整名字, 比如`var url = new java.net.URL(myUrl);`, 而不是`var url = new URL(myUrl);`
83 | ## js转dex, 可以参考此仓库
84 | [batchJs2Dex](https://github.com/snailuncle/batchJs2Dex)
85 |
86 | ## so中执行autojs脚本, 可以参考此仓库
87 | [autojsNativeJs](https://github.com/snailuncle/autojsNativeJs)
88 |
89 | ## 使用webview,等方式构建应用
90 | [auto.pro](https://github.com/molysama/auto.pro) 可以ts 来编写脚本,构建应用。 如果希望该项目应用 自动部署到手机等功能,请自行配置webpack.config.js即可
91 |
--------------------------------------------------------------------------------
/webpack-autojs-master/advancedEngines.js:
--------------------------------------------------------------------------------
1 | module.exports=(()=>{
2 | var advancedEngines = {}
3 |
4 | advancedEngines.execScriptFile=function(path,args,config){
5 | let ss=com.stardust.autojs.script.JavaScriptFileSource(java.io.File(files.path(path)))
6 | return execute(ss,args,config);
7 | }
8 |
9 | advancedEngines.execScript=function(name,script,args,config){
10 | let ss=com.stardust.autojs.script.StringScriptSource(name,script)
11 | return execute(ss,args,config);
12 | }
13 |
14 | advancedEngines.execAutoScript=function(path,args,config){
15 | let ss=com.stardust.autojs.script.AutoFileSource(java.io.File(files.path(path)))
16 | return execute(ss,args,config);
17 | }
18 |
19 | var execute = function(scriptSource,args,config) {
20 | args=args||{}
21 | config=config||{}
22 |
23 | importPackage(com.stardust.autojs.execution)
24 | let listener=
25 | ScriptExecutionListener({
26 | onStart:
27 | function(execution) {
28 | let topScope = execution.getEngine().getRuntime().getTopLevelScope()
29 | let ScriptableObject = org.mozilla.javascript.ScriptableObject
30 | for (let key in args) {
31 | ScriptableObject.putProperty(topScope, key, args[key])
32 | }
33 | }
34 | })
35 | if(!isPro()){
36 | //普通aj
37 | let field=runtime.engines.getClass().getDeclaredField("mEngineService")
38 | field.setAccessible(true)
39 | let service=field.get(runtime.engines)
40 | field.setAccessible(false)
41 | service.execute(scriptSource,listener,fillConfig(config))
42 | }else return runtime.engines.execute(null,ScriptExecutionTask(scriptSource,listener,fillConfig(config)));
43 | }
44 | var fillConfig = function(c) {
45 | var config = new com.stardust.autojs.execution.ExecutionConfig();
46 | c = c || {};
47 | c.path = c.path || files.cwd();
48 | if (c.path) {
49 | config.workingDirectory = c.path;
50 | }
51 | config.delay = c.delay || 0;
52 | config.interval = c.interval || 0;
53 | config.loopTimes = (c.loopTimes === undefined) ? 1 : c.loopTimes;
54 | if (c.arguments) {
55 | var arguments = c.arguments;
56 | for (var key in arguments) {
57 | if (arguments.hasOwnProperty(key)) {
58 | config.setArgument(key, arguments[key]);
59 | }
60 | }
61 | }
62 | if(isPro())config.projectConfig = engines.myEngine().getTag("execution.config").projectConfig;
63 | return config;
64 | }
65 | function isPro(){
66 | return app.autojs.versionName.toLowerCase().indexOf("pro")!=-1
67 | }
68 | return advancedEngines
69 | })()
--------------------------------------------------------------------------------
/webpack-autojs-master/header.txt:
--------------------------------------------------------------------------------
1 | /**
2 | 欢迎使用autox.js插件,由kkevsekk开发,qq: 470722660 ,email: kkevsekk@163.com
3 | 本软件可以免费使用,但是不允许二次开发、以及销售,如需获得最的更多apk 请联系作者。
4 | 开源库地址:https://github.com/kkevsekk1/webpack-autojs
5 | **/
--------------------------------------------------------------------------------
/webpack-autojs-master/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "@/*": ["src/*"]
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "version": "1.0.0",
4 | "private": true,
5 | "description": "",
6 | "scripts": {
7 | "start": "npx webpack --config webpack.config.js --watch --mode=development",
8 | "build": "npx webpack --config webpack.config.js --mode=production"
9 | },
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@babel/core": "^7.4.0",
14 | "@babel/plugin-transform-modules-commonjs": "^7.7.4",
15 | "@babel/plugin-transform-runtime": "^7.6.2",
16 | "@babel/preset-env": "^7.4.2",
17 | "@babel/runtime": "^7.7.4",
18 | "@typescript-eslint/eslint-plugin": "^2.13.0",
19 | "@typescript-eslint/parser": "^2.13.0",
20 | "autox-header-webpack-plugin": "^1.0.3",
21 | "babel-eslint": "^10.1.0",
22 | "babel-loader": "^8.0.5",
23 | "babel-plugin-transform-remove-strict-mode": "0.0.2",
24 | "clean-webpack-plugin": "^3.0.0",
25 | "copy-webpack-plugin": "^6.1.0",
26 | "eslint": "^6.8.0",
27 | "html-webpack-inline-source-plugin": "0.0.10",
28 | "html-webpack-plugin": "^3.2.0",
29 | "javascript-obfuscator": "^2.6.1",
30 | "ts-loader": "^6.2.1",
31 | "typescript": "^3.6.4",
32 | "url-loader": "^1.1.2",
33 | "webpack": "^4.41.4",
34 | "webpack-cli": "^3.3.12",
35 | "webpack-obfuscator": "^2.6.0",
36 | "autox-deploy-webpack-plugin": "git+https://github.com/kkevsekk1/AutoxDeployWebpackPlugin.git",
37 | "randomstring": "^1.1.5",
38 | "webpack-autojs-loader": "^1.1.2"
39 | },
40 | "dependencies": {
41 | "@babel/polyfill": "^7.4.0",
42 | "es6-shim": "^0.35.5"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/webpack-autojs-master/scriptConfig.js:
--------------------------------------------------------------------------------
1 |
2 | //定义要编译的项目,compile, true 表示编译,false,不编译
3 | var projects = [ //项目数组,放的是每一个要编译的项目,
4 | {
5 | id: 1, //项目号
6 | compile: false, //是否编译
7 | name: "云控demo", //项目名称,需要和文件夹名相同
8 | main: "./test.js" //主入文件,入口文件,按autojs目录,一般和project.json 同级
9 | },
10 | {
11 | id: 2, compile: false, name: "dy", main: "./main.js",
12 | others: ['./hssz.js', 'test.js', './main.js'] //其他需要编译的文件,可以包含入口,也可不包含
13 | },
14 | { id: 3, compile: true, name: "快捷输入", main: "./main.js" },
15 | { id: 4, compile: false, name: "websocket", main: "./main.js" },
16 | {
17 | id: 6, compile: false, name: "qq消息", main: "./main.js",
18 | others: ['./main.js'] //其他需要编译的文件,可以包含入口,也可不包含
19 | },
20 | { id: 7, compile: false, name: "dnf", main: "./main.js" },
21 | { id: 8, compile: false, name: "ocr", main: "./main.js" },
22 | ]
23 |
24 | var config = {
25 | watch: "rerun", //watch模式的时候,是自动deploy(部署)、或 rerun(重新运行)、还是none(不操作),
26 | baseDir: "./work", //放置多个项目的工作目录,每一个项目独立文件夹,
27 | base64: false,
28 | projectPrefix: "", //项目编译后,项目目录的前缀,如配置为b_ 则demo项目编译后名称为b_demo ,当希望项目的源码和编译和的代码都保存在手中,就有必要配置这个
29 | advancedEngines: true,
30 | header: "header.txt", //这个文件中放了你可以放一些声明、说明等注释内容
31 | base64RandomStrLength: 100,
32 | target: "node", // web || node
33 | projects: projects,
34 | };
35 |
36 | module.exports = config;
37 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/adbkit.d.ts:
--------------------------------------------------------------------------------
1 |
2 | // import * as a from "adbkit";
3 |
4 | declare module "adbkit" {
5 | import { ReadStream } from "fs";
6 |
7 | export interface TcpUsbServer { }
8 |
9 | export interface Connection { }
10 |
11 | export interface Device {
12 | id: string;
13 | type: string;
14 | }
15 |
16 | export interface Client {
17 | createTcpUsbBridge(serial: string): TcpUsbServer;
18 | connection(): Promise;
19 | version(): any;
20 | listDevices(): Promise;
21 | screencap(serial: string): Promise;
22 | }
23 |
24 | export interface ClientOptions {
25 | host?: string;
26 | port?: number;
27 | bin?: string;
28 | }
29 |
30 | export function createClient(options?: ClientOptions): Client;
31 |
32 | export var KeyCode: any;
33 |
34 | export var util: any;
35 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/auto.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 | ///
5 | ///
6 | ///
7 | ///
8 | ///
9 | ///
10 | ///
11 | ///
12 | ///
13 | ///
14 | ///
15 | ///
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 |
23 |
24 | declare global {
25 |
26 | }
27 |
28 | export { };
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/app.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * app模块提供一系列函数,用于使用其他应用、与其他应用交互。例如发送意图、打开文件、发送邮件等。
3 | */
4 | declare namespace app {
5 |
6 | /**
7 | * 通过应用名称启动应用。如果该名称对应的应用不存在,则返回false; 否则返回true。如果该名称对应多个应用,则只启动其中某一个。
8 | */
9 | function launchApp(appName: string): boolean;
10 |
11 | /**
12 | * 通过应用包名启动应用。如果该包名对应的应用不存在,则返回false;否则返回true。
13 | */
14 | function launch(packageName: string): boolean;
15 |
16 | /**
17 | * 通过应用包名启动应用。如果该包名对应的应用不存在,则返回false;否则返回true。
18 | */
19 | function launchPackage(packageName: string): boolean;
20 |
21 | /**
22 | * 获取应用名称对应的已安装的应用的包名。如果该找不到该应用,返回null;如果该名称对应多个应用,则只返回其中某一个的包名。
23 | */
24 | function getPackageName(appName: string): string;
25 |
26 | /**
27 | * 获取应用包名对应的已安装的应用的名称。如果该找不到该应用,返回null。
28 | */
29 | function getAppName(packageName: string): string;
30 |
31 | /**
32 | * 打开应用的详情页(设置页)。如果找不到该应用,返回false; 否则返回true。
33 | */
34 | function openAppSetting(packageName: string): boolean;
35 |
36 | /**
37 | * 用其他应用查看文件。文件不存在的情况由查看文件的应用处理。如果找不出可以查看该文件的应用,则抛出ActivityNotException。
38 | *
39 | * @throws ActivityNotException
40 | */
41 | function viewFile(path: string): void;
42 |
43 | /**
44 | * 用其他应用编辑文件。文件不存在的情况由编辑文件的应用处理。如果找不出可以编辑该文件的应用,则抛出ActivityNotException。
45 | *
46 | * @throws ActivityNotException
47 | */
48 | function editFile(path: string): void;
49 |
50 | /**
51 | * 卸载应用。执行后会会弹出卸载应用的提示框。如果该包名的应用未安装,由应用卸载程序处理,可能弹出"未找到应用"的提示。
52 | */
53 | function uninstall(packageName: string): void;
54 |
55 | /**
56 | * 用浏览器打开网站url。网站的Url,如果不以"http:// "或"https:// "开头则默认是"http:// "。
57 | */
58 | function openUrl(url: string): void;
59 |
60 | /**
61 | * 发送邮件的参数,这些选项均是可选的。
62 | */
63 | interface SendEmailOptions {
64 | /**
65 | * 收件人的邮件地址。如果有多个收件人,则用字符串数组表示
66 | */
67 | email?: string | string[];
68 | /**
69 | * 抄送收件人的邮件地址。如果有多个抄送收件人,则用字符串数组表示
70 | */
71 | cc?: string | string[];
72 | /**
73 | * 密送收件人的邮件地址。如果有多个密送收件人,则用字符串数组表示
74 | */
75 | bcc?: string | string[];
76 | /**
77 | * 邮件主题(标题)
78 | */
79 | subject?: string;
80 | /**
81 | * 邮件正文
82 | */
83 | text?: string;
84 | /**
85 | * 附件的路径。
86 | */
87 | attachment?: string;
88 | }
89 |
90 | /**
91 | * 根据选项options调用邮箱应用发送邮件。如果没有安装邮箱应用,则抛出ActivityNotException。
92 | */
93 | function sendEmail(options: SendEmailOptions): void;
94 |
95 | /**
96 | * 启动Auto.js的特定界面。该函数在Auto.js内运行则会打开Auto.js内的界面,在打包应用中运行则会打开打包应用的相应界面。
97 | */
98 | function startActivity(name: 'console' | 'settings'): void;
99 |
100 | /**
101 | * Intent(意图) 是一个消息传递对象,您可以使用它从其他应用组件请求操作。尽管 Intent 可以通过多种方式促进组件之间的通信.
102 | */
103 | interface Intent { }
104 |
105 | /**
106 | * 构造意图Intent对象所需设置。
107 | */
108 | interface IntentOptions {
109 | action?: string;
110 | type?: string;
111 | data?: string;
112 | category?: string[];
113 | packageName?: string;
114 | className?: string;
115 | extras?: Object;
116 | }
117 |
118 | /**
119 | * 根据选项,构造一个意图Intent对象。
120 | */
121 | function intent(options: IntentOptions): Intent;
122 |
123 | /**
124 | * 根据选项构造一个Intent,并启动该Activity。
125 | */
126 | function startActivity(intent: Intent): void;
127 |
128 | /**
129 | * 根据选项构造一个Intent,并发送该广播。
130 | */
131 | function sendBroadcast(intent: Intent): void;
132 |
133 | }
134 |
135 | /**
136 | * 通过应用名称启动应用。如果该名称对应的应用不存在,则返回false; 否则返回true。如果该名称对应多个应用,则只启动其中某一个。
137 | */
138 | declare function launchApp(appName: string): boolean;
139 |
140 | /**
141 | * 通过应用包名启动应用。如果该包名对应的应用不存在,则返回false;否则返回true。
142 | */
143 | declare function launch(packageName: string): boolean;
144 |
145 | /**
146 | * 获取应用名称对应的已安装的应用的包名。如果该找不到该应用,返回null;如果该名称对应多个应用,则只返回其中某一个的包名。
147 | */
148 | declare function getPackageName(appName: string): string;
149 |
150 | /**
151 | * 获取应用名称对应的已安装的应用的包名。如果该找不到该应用,返回null;如果该名称对应多个应用,则只返回其中某一个的包名。
152 | */
153 | declare function getPackageName(appName: string): string;
154 |
155 | /**
156 | * 获取应用包名对应的已安装的应用的名称。如果该找不到该应用,返回null。
157 | */
158 | declare function getAppName(packageName: string): string;
159 |
160 | /**
161 | * 打开应用的详情页(设置页)。如果找不到该应用,返回false; 否则返回true。
162 | */
163 | declare function openAppSetting(packageName: string): boolean;
164 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/colors.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace colors {
2 | function toString(color: number): string;
3 | function red(color: number | string): number;
4 | function green(color: number | string): number;
5 | function blue(color: number | string): number;
6 | function alpha(color: number | string): number;
7 | function rgb(red: number, green: number, blue: number): number;
8 | function argb(alpha: number, red: number, green: number, blue: number): number;
9 | function parseColor(colorStr: string): number;
10 | function isSimilar(color1: number | string, color2: number | string, threshold: number, algorithm: 'diff' | 'rgb' | 'rgb+' | 'hs'): boolean;
11 | function equals(color1: number | string, color2: number | string): boolean;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/console.d.ts:
--------------------------------------------------------------------------------
1 | interface Console {
2 | /**
3 | * 显示控制台。这会显示一个控制台的悬浮窗(需要悬浮窗权限)。
4 | */
5 | show(): void;
6 |
7 | /**
8 | * 隐藏控制台悬浮窗。
9 | */
10 | hide(): void;
11 |
12 | /**
13 | * 清空控制台。
14 | */
15 | clear(): void;
16 |
17 | /**
18 | * 打印到控制台,并带上换行符。 可以传入多个参数,第一个参数作为主要信息,其他参数作为类似于 printf(3) 中的代替值(参数都会传给 util.format())。
19 | */
20 | log(data: string, ...args: any[]): void;
21 |
22 | /**
23 | * 与console.log类似,但输出结果以灰色字体显示。输出优先级低于log,用于输出观察性质的信息。
24 | */
25 | verbose(data: string, ...args: any[]): void;
26 |
27 | /**
28 | * 与console.log类似,但输出结果以绿色字体显示。输出优先级高于log, 用于输出重要信息。
29 | */
30 | info(data: string, ...args: any[]): void;
31 |
32 | /**
33 | * 与console.log类似,但输出结果以蓝色字体显示。输出优先级高于info, 用于输出警告信息。
34 | */
35 | warn(data: string, ...args: any[]): void;
36 |
37 | /**
38 | * 与console.log类似,但输出结果以红色字体显示。输出优先级高于warn, 用于输出错误信息。
39 | */
40 | error(data: string, ...args: any[]): void;
41 |
42 | /**
43 | * 断言。如果value为false则输出错误信息message并停止脚本运行。
44 | */
45 | assert(value: boolean, message: string);
46 |
47 | /**
48 | * 与console.log一样输出信息,并在控制台显示输入框等待输入。按控制台的确认按钮后会将输入的字符串用eval计算后返回。
49 | */
50 | input(data: string, ...args: any[]): string | number | boolean;
51 |
52 | /**
53 | * 与console.log一样输出信息,并在控制台显示输入框等待输入。按控制台的确认按钮后会将输入的字符串直接返回。
54 | */
55 | rawInput(data: string, ...args: any[]): string;
56 |
57 | /**
58 | * 设置控制台的大小,单位像素。
59 | */
60 | setSize(wight: number, height: number): void;
61 |
62 | /**
63 | * 设置控制台的位置,单位像素。
64 | */
65 | setPosition(x: number, y: number): void;
66 |
67 | }
68 |
69 | /**
70 | * 打印到控制台,并带上换行符。 可以传入多个参数,第一个参数作为主要信息,其他参数作为类似于 printf(3) 中的代替值(参数都会传给 util.format())。
71 | */
72 | declare function log(data: string, ...args: any[]): void;
73 |
74 | /**
75 | * 相当于log(text)。
76 | */
77 | declare function print(message: string | Object): void;
78 |
79 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/coordinate.d.ts:
--------------------------------------------------------------------------------
1 | /* 基于坐标的触摸模拟 */
2 |
3 | /**
4 | * 设置脚本坐标点击所适合的屏幕宽高。如果脚本运行时,屏幕宽度不一致会自动放缩坐标。
5 | */
6 | declare function setScreenMetrics(width: number, height: number): void;
7 |
8 | /* 安卓7.0以上的触摸和手势模拟 */
9 |
10 | /**
11 | * Android7.0以上
12 | *
13 | * 模拟点击坐标(x, y)大约150毫秒,并返回是否点击成功。只有在点击执行完成后脚本才继续执行。
14 | */
15 | declare function click(x: number, y: number): void;
16 |
17 | /**
18 | * Android7.0以上
19 | *
20 | * 模拟长按坐标(x, y), 并返回是否成功。只有在长按执行完成(大约600毫秒)时脚本才会继续执行。
21 | */
22 | declare function longClick(x: number, y: number): void;
23 |
24 | /**
25 | * Android7.0以上
26 | *
27 | * 模拟按住坐标(x, y), 并返回是否成功。只有按住操作执行完成时脚本才会继续执行。
28 | *
29 | * 如果按住时间过短,那么会被系统认为是点击;如果时长超过500毫秒,则认为是长按。
30 | */
31 | declare function press(x: number, y: number, duration: number): void;
32 |
33 | /**
34 | * 模拟从坐标(x1, y1)滑动到坐标(x2, y2),并返回是否成功。只有滑动操作执行完成时脚本才会继续执行。
35 | */
36 | declare function swipe(x1: number, y1: number, x2: number, y2: number, duration: number): boolean;
37 |
38 | type GesturePoint = [number, number];
39 | /**
40 | * 模拟手势操作。例如gesture(1000, [0, 0], [500, 500], [500, 1000])为模拟一个从(0, 0)到(500, 500)到(500, 100)的手势操作,时长为2秒。
41 | */
42 | declare function gesture(duration: number, point1: GesturePoint, point2: GesturePoint, ...points: GesturePoint[]): void;
43 |
44 | type Gesture = [number, number, GesturePoint, GesturePoint] | [number, GesturePoint, GesturePoint];
45 | /**
46 | * 同时模拟多个手势。每个手势的参数为[delay, duration, 坐标], delay为延迟多久(毫秒)才执行该手势;duration为手势执行时长;坐标为手势经过的点的坐标。其中delay参数可以省略,默认为0。
47 | */
48 | declare function gestures(gesture: Gesture, ...gestures: Gesture[]): void;
49 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/dialogs.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * dialogs 模块提供了简单的对话框支持,可以通过对话框和用户进行交互。
3 | */
4 | declare namespace dialogs {
5 |
6 | /**
7 | * 显示一个只包含“确定”按钮的提示对话框。直至用户点击确定脚本才继续运行。
8 | */
9 | function alert(title: string, content?: string): void;
10 |
11 | /**
12 | * UI模式
13 | *
14 | * 显示一个只包含“确定”按钮的提示对话框。直至用户点击确定脚本才继续运行。
15 | */
16 | function alert(title: string, content?: string, callback?: () => void): Promise;
17 |
18 | /**
19 | * 显示一个包含“确定”和“取消”按钮的提示对话框。如果用户点击“确定”则返回 true ,否则返回 false 。
20 | */
21 | function confirm(title: string, content?: string): boolean;
22 |
23 | /**
24 | * UI模式
25 | *
26 | * 显示一个包含“确定”和“取消”按钮的提示对话框。如果用户点击“确定”则返回 true ,否则返回 false 。
27 | */
28 | function confirm(title: string, content?: string, callback?: (value: boolean) => void): Promise;
29 |
30 | /**
31 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
32 | */
33 | function rawInput(title: string, prefill?: string): string;
34 |
35 | /**
36 | * UI模式
37 | *
38 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
39 | */
40 | function rawInput(title: string, prefill?: string, callback?: (value: string) => void): Promise;
41 |
42 | /**
43 | * 等效于 eval(dialogs.rawInput(title, prefill, callback)), 该函数和rawInput的区别在于,会把输入的字符串用eval计算一遍再返回,返回的可能不是字符串。
44 | */
45 | function input(title: string, prefill?: string): any;
46 |
47 | /**
48 | * UI模式
49 | *
50 | * 等效于 eval(dialogs.rawInput(title, prefill, callback)), 该函数和rawInput的区别在于,会把输入的字符串用eval计算一遍再返回,返回的可能不是字符串。
51 | */
52 | function input(title: string, prefill?: string, callback?: (value: any) => void): Promise;
53 |
54 | /**
55 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
56 | */
57 | function prompt(title: string, prefill?: string): string;
58 |
59 | /**
60 | * UI模式
61 | *
62 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
63 | */
64 | function prompt(title: string, prefill?: string, callback?: (value: string) => void): Promise;
65 |
66 | /**
67 | * 显示一个带有选项列表的对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。
68 | */
69 | function select(title: string, items: string[]): number;
70 |
71 | /**
72 | * UI模式
73 | *
74 | * 显示一个带有选项列表的对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。
75 | */
76 | function select(title: string, items: string[], callback?: (value: number) => void): Promise;
77 |
78 | /**
79 | * 显示一个单选列表对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。
80 | */
81 | function singleChoice(title: string, items: string[], index?: number): number;
82 |
83 | /**
84 | * UI模式
85 | *
86 | * 显示一个单选列表对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。
87 | */
88 | function singleChoice(title: string, items: string[], index?: number, callback?: (choice: number) => void): Promise;
89 |
90 | /**
91 | * 显示一个多选列表对话框,等待用户选择,返回用户选择的选项索引的数组。如果用户取消了选择,返回[]。
92 | */
93 | function multiChoice(title: string, items: string[], indices?: number[]): number[];
94 |
95 | /**
96 | * UI模式
97 | *
98 | * 显示一个多选列表对话框,等待用户选择,返回用户选择的选项索引的数组。如果用户取消了选择,返回[]。
99 | */
100 | function multiChoice(title: string, items: string[], indices?: number[], callback?: (choices: number[]) => void): Promise;
101 |
102 |
103 | }
104 |
105 | /**
106 | * 显示一个只包含“确定”按钮的提示对话框。直至用户点击确定脚本才继续运行。
107 | */
108 | declare function alert(title: string, content?: string): void;
109 |
110 | /**
111 | * UI模式
112 | *
113 | * 显示一个只包含“确定”按钮的提示对话框。直至用户点击确定脚本才继续运行。
114 | *
115 | * 在ui模式下该函数返回一个Promise。
116 | */
117 | declare function alert(title: string, content?: string, callback?: () => void): Promise;
118 |
119 | /**
120 | * 显示一个包含“确定”和“取消”按钮的提示对话框。如果用户点击“确定”则返回 true ,否则返回 false 。
121 | */
122 | declare function confirm(title: string, content?: string): boolean;
123 |
124 | /**
125 | * UI模式
126 | *
127 | * 显示一个包含“确定”和“取消”按钮的提示对话框。如果用户点击“确定”则返回 true ,否则返回 false 。
128 | *
129 | * 在ui模式下该函数返回一个Promise。
130 | */
131 | declare function confirm(title: string, content?: string, callback?: (value: boolean) => void): Promise;
132 |
133 | /**
134 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
135 | */
136 | declare function rawInput(title: string, prefill?: string): string;
137 |
138 | /**
139 | * UI模式
140 | *
141 | * 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。
142 | */
143 | declare function rawInput(title: string, prefill?: string, callback?: (value: string) => void): Promise;
144 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/engines.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * engines模块包含了一些与脚本环境、脚本运行、脚本引擎有关的函数,包括运行其他脚本,关闭脚本等。
3 | */
4 | declare namespace engines {
5 |
6 | /**
7 | * 脚本引擎对象。
8 | */
9 | interface ScriptEngine {
10 |
11 | /**
12 | * 停止脚本引擎的执行。
13 | */
14 | forceStop(): void;
15 |
16 | /**
17 | * 返回脚本执行的路径。对于一个脚本文件而言为这个脚本所在的文件夹;对于其他脚本,例如字符串脚本,则为null或者执行时的设置值。
18 | */
19 | cwd(): string;
20 | }
21 |
22 | /**
23 | * 执行脚本时返回的对象,可以通过他获取执行的引擎、配置等,也可以停止这个执行。
24 | *
25 | * 要停止这个脚本的执行,使用exectuion.getEngine().forceStop().
26 | */
27 | interface ScriptExecution {
28 |
29 | /**
30 | * 返回执行该脚本的脚本引擎对象(ScriptEngine)
31 | */
32 | getEngine(): ScriptEngine;
33 |
34 | /**
35 | * 返回该脚本的运行配置(ScriptConfig)
36 | */
37 | getConfig(): ScriptConfig;
38 | }
39 |
40 | /**
41 | * 运行配置项。
42 | */
43 | interface ScriptConfig {
44 |
45 | /**
46 | * 延迟执行的毫秒数,默认为0。
47 | */
48 | delay?: number;
49 |
50 | /**
51 | * 循环运行次数,默认为1。0为无限循环。
52 | */
53 | loopTimes?: number;
54 |
55 | /**
56 | * 循环运行时两次运行之间的时间间隔,默认为0。
57 | */
58 | interval?: number;
59 |
60 | /**
61 | * 指定脚本运行的目录。这些路径会用于require时寻找模块文件。
62 | */
63 | path?: string | string[];
64 |
65 | /**
66 | * 返回一个字符串数组表示脚本运行时模块寻找的路径。
67 | */
68 | getpath?: string[];
69 | }
70 |
71 | /**
72 | * 在新的脚本环境中运行脚本script。返回一个ScriptExectuion对象。
73 | *
74 | * 所谓新的脚本环境,指定是,脚本中的变量和原脚本的变量是不共享的,并且,脚本会在新的线程中运行。
75 | */
76 | function execScript(name: string, script: string, config?: ScriptConfig): ScriptExecution;
77 |
78 | /**
79 | * 在新的脚本环境中运行脚本文件path:string。返回一个ScriptExecution对象。
80 | */
81 | function execScriptFile(path: string, config?: ScriptConfig): ScriptExecution;
82 |
83 | /**
84 | * 在新的脚本环境中运行录制文件path:string。返回一个ScriptExecution对象。
85 | */
86 | function execAutoFile(path: string, config?: ScriptConfig): ScriptExecution;
87 |
88 | /**
89 | * 停止所有正在运行的脚本。包括当前脚本自身。
90 | */
91 | function stopAll(): void;
92 |
93 | /**
94 | * 停止所有正在运行的脚本并显示停止的脚本数量。包括当前脚本自身。
95 | */
96 | function stopAllAndToast(): void;
97 |
98 | /**
99 | * 返回当前脚本的脚本引擎对象(ScriptEngine)
100 | */
101 | function myEngine(): void;
102 | }
103 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/events.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace events {
2 |
3 | interface KeyEvent {
4 | getAction();
5 | getKeyCode(): number;
6 | getEventTime(): number;
7 | getDownTime(): number;
8 | keyCodeToString(keyCode: number): string;
9 | }
10 |
11 | function emitter(): EventEmitter;
12 |
13 | function observeKey(): void;
14 |
15 | type Keys = 'volume_up' | 'volume_down' | 'home' | 'back' | 'menu';
16 |
17 | function setKeyInterceptionEnabled(key: Keys, enabled: boolean);
18 |
19 | function setKeyInterceptionEnabled(enabled: boolean);
20 |
21 | function onKeyDown(keyName: Keys, listener: (e: KeyEvent) => void): void;
22 |
23 | function onceKeyUp(keyName: Keys, listener: (e: KeyEvent) => void): void;
24 |
25 | function removeAllKeyDownListeners(keyName: Keys): void;
26 |
27 | function removeAllKeyUpListeners(keyName: Keys): void;
28 |
29 | function observeTouch(): void;
30 |
31 | function setTouchEventTimeout(timeout: number): void;
32 |
33 | function getTouchEventTimeout(): number;
34 |
35 | function onTouch(listener: (point: Point) => void): void;
36 |
37 | function removeAllTouchListeners(): void;
38 |
39 | function on(event: 'key' | 'key_down' | 'key_up', listener: (keyCode: number, e: KeyEvent) => void): void;
40 |
41 | function on(event: 'exit', listener: () => void): void;
42 |
43 | function observeNotification(): void;
44 |
45 | function observeToast(): void;
46 |
47 | /**
48 | * 系统Toast对象
49 | */
50 | interface Toast {
51 |
52 | /**
53 | * 获取Toast的文本内容
54 | */
55 | getText(): string;
56 |
57 | /**
58 | * 获取发出Toast的应用包名
59 | */
60 | getPackageName(): void;
61 |
62 | }
63 |
64 | function onToast(listener: (toast: Toast) => void): void;
65 |
66 | /**
67 | * 通知对象,可以获取通知详情,包括通知标题、内容、发出通知的包名、时间等,也可以对通知进行操作,比如点击、删除。
68 | */
69 | interface Notification {
70 | number: number;
71 | when: number;
72 | getPackageName(): string;
73 | getTitle(): string;
74 | getText(): string;
75 | click(): void;
76 | delete(): void;
77 | }
78 |
79 | function on(event: 'notification', listener: (notification: Notification) => void): void;
80 |
81 | }
82 |
83 | /**
84 | * 按键事件中所有可用的按键名称
85 | */
86 | declare enum keys {
87 | home,
88 | back,
89 | menu,
90 | volume_up,
91 | volume_down
92 | }
93 |
94 | interface EventEmitter {
95 | defaultMaxListeners: number;
96 | addListener(eventName: string, listener: (...args: any[]) => void): EventEmitter;
97 | emit(eventName: string, ...args: any[]): boolean;
98 | eventNames(): string[];
99 | getMaxListeners(): number;
100 | listenerCount(eventName: string): number;
101 | on(eventName: string, listener: (...args: any[]) => void): EventEmitter;
102 | once(eventName: string, listener: (...args: any[]) => void): EventEmitter;
103 | prependListener(eventName: string, listener: (...args: any[]) => void): EventEmitter;
104 | prependOnceListener(eventName: string, listener: (...args: any[]) => void): EventEmitter;
105 | removeAllListeners(eventName?: string): EventEmitter;
106 | removeListener(eventName: string, listener: (...args: any[]) => void): EventEmitter;
107 | setMaxListeners(n: number): EventEmitter;
108 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/files.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace files {
2 | type byte = number;
3 | function isFile(path: string): boolean;
4 | function isDir(path: string): boolean;
5 | function isEmptyDir(path: string): boolean;
6 | function join(parent: string, ...child: string[]): string;
7 | function create(path: string): boolean;
8 | function createWithDirs(path: string): boolean;
9 | function exists(path: string): boolean;
10 | function ensureDir(path: string): void;
11 | function read(path: string, encoding?: string): string;
12 | function readBytes(path: string): byte[];
13 | function write(path: string, text, encoding?: string): void;
14 | function writeBytes(path: string, bytes: byte[]): void;
15 | function append(path: string, text: string, encoding?: string): void;
16 | function appendBytes(path: string, text: byte[], encoding?: string): void;
17 | function copy(frompath: string, topath: string): boolean;
18 | function move(frompath: string, topath: string): boolean;
19 | function rename(path: string, newName): boolean;
20 | function renameWithoutExtension(path: string, newName: string): boolean;
21 | function getName(path: string): string;
22 | function getNameWithoutExtension(path: string): string;
23 | function getExtension(path: string): string;
24 | function remove(path: string): boolean;
25 | function removeDir(path: string): boolean;
26 | function getSdcardPath(): string;
27 | function cwd(): string;
28 | function path(relativePath: string): string;
29 | function listDir(path: string, filter: (filename: string) => boolean): string[];
30 | }
31 |
32 | interface ReadableTextFile {
33 | read(): string;
34 | read(maxCount: number): string;
35 | readline(): string;
36 | readlines(): string[];
37 | close(): void;
38 | }
39 |
40 | interface WritableTextFile {
41 | write(text: string): void;
42 | writeline(line: string): void;
43 | writelines(lines: string[]): void;
44 | flush(): void;
45 | close(): void;
46 | }
47 |
48 | declare function open(path: string, mode?: 'r', encoding?: string, bufferSize?: number): ReadableTextFile;
49 | declare function open(path: string, mode?: 'w' | 'a', encoding?: string, bufferSize?: number): WritableTextFile;
50 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/floaty.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace floaty {
2 | function window(layout: any): FloatyWindow;
3 | function closeAll(): void;
4 | interface FloatyWindow {
5 | setAdjustEnabled(enabled: boolean): void;
6 | setPosition(x: number, y: number): void;
7 | getX(): number;
8 | getY(): number;
9 | setSize(width: number, height: number): void;
10 | getWidht(): number;
11 | getHeight(): number;
12 | close(): void;
13 | exitOnClose(): void;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/global.d.ts:
--------------------------------------------------------------------------------
1 | interface Point {
2 | x: number;
3 | y: number;
4 | }
5 |
6 | declare function sleep(n: number): void;
7 |
8 | declare function currentPackage(): string;
9 |
10 | declare function currentActivity(): string;
11 |
12 | declare function setClip(test: string): void;
13 |
14 | declare function getClip(): string;
15 |
16 | declare function toast(message: string): void;
17 |
18 | declare function toastLog(message: string): void;
19 |
20 | declare function waitForActivity(activity: string, period?: number): void;
21 |
22 | declare function waitForPackage(packageName: string, period?: number): void;
23 |
24 | declare function exit(): void;
25 |
26 | declare function random(): number;
27 | declare function random(min: number, max: number): number;
28 |
29 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/http.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare namespace http {
4 | interface HttpRequestOptions {
5 | header: { [key: string]: string },
6 | method: 'GET' | 'POST' | 'PUT' | 'DELET' | 'PATCH';
7 | contentType: string;
8 | body: string | string[] | files.byte[]
9 | }
10 | interface Request {
11 |
12 | }
13 | interface Response {
14 | statusCode: number;
15 | statusMessage: string;
16 | headers: { [key: string]: string };
17 | body: ResponseBody;
18 | request: Request;
19 | url: string;
20 | method: 'GET' | 'POST' | 'PUT' | 'DELET' | 'PATCH';
21 | }
22 | interface ResponseBody {
23 | bytes(): files.byte[];
24 | string(): string;
25 | json(): object;
26 | contentType: string;
27 | }
28 | function get(url: string, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response;
29 | function post(url: string, data: object, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response;
30 | function postJson(url: string, data?: object, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response;
31 |
32 | interface RequestMultipartBody {
33 | file: ReadableTextFile | [string, string] | [string, string, string];
34 | }
35 | function postMultipart(url: string, files: RequestMultipartBody, options?: HttpRequestOptions, callback?: (resp: Response) => void): void;
36 | function postMultipart(url: string, files: { [key: string]: string } & RequestMultipartBody, options?: HttpRequestOptions, callback?: (resp: Response) => void): void;
37 |
38 | function request(url: string, options?: HttpRequestOptions, callback?: (resp: Response) => void): void;
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/images.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | interface Image {
4 | getWidth(): number;
5 | getHeight(): number;
6 | saveTo(path: string): void;
7 | pixel(x: number, y: number): number;
8 | }
9 |
10 |
11 | declare namespace images {
12 | function requestScreenCapture(landscape?: boolean): boolean;
13 | function captureScreen(): Image;
14 | function captureScreen(path: string): void;
15 | function pixel(image: Image, x: number, y: number): number;
16 | function save(image: Image, path: string): void;
17 | function read(path: string): Image;
18 | function load(url: string): Image;
19 | interface FindColorOptions {
20 | region?: [number, number] | [number, number, number, number];
21 | threshold?: number;
22 | }
23 | function clip(image: Image, x: number, y: number, w: number, h: number): Image;
24 | function findColor(image: Image, color: number | string, options?: FindColorOptions): Point;
25 | function findColorInRegion(image: Image, color: number | string, x: number, y: number, width?: number, height?: number, threshold?: number): Point;
26 | function findColorEquals(image: Image, color: number | string, x?: number, y?: number, width?: number, height?: number): Point;
27 | function detectsColor(image: Image, color: number | string, x: number, y: number, threshold?: number, algorithm?: 'diff'): Point;
28 | interface FindImageOptions {
29 | region?: [number, number] | [number, number, number, number];
30 | threshold?: number;
31 | level?: number;
32 | }
33 | function findImage(image: Image, template: Image, options?: FindImageOptions): Point;
34 | function findImageInRegion(image: Image, template: Image, x: number, y: number, width?: number, height?: number, threshold?: number): Point;
35 | function findMultiColors(image: Image, firstColor: number | string, colors: [number, number, number | string][], options?: FindColorOptions): Point;
36 |
37 | function fromBase64(base64: string): Image;
38 | function toBase64(img: Image): string;
39 | }
40 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/keys.d.ts:
--------------------------------------------------------------------------------
1 | declare function back(): boolean;
2 | declare function home(): boolean;
3 | declare function powerDialog(): boolean;
4 | declare function notifications(): boolean;
5 | declare function quickSettings(): boolean;
6 | declare function recents(): boolean;
7 | declare function splitScreen(): boolean;
8 | declare function Home(): void;
9 | declare function Back(): void;
10 | declare function Power(): void;
11 | declare function Menu(): void;
12 | declare function VolumeUp(): void;
13 | declare function VolumeDown(): void;
14 | declare function Camera(): void;
15 | declare function Up(): void;
16 | declare function Down(): void;
17 | declare function Left(): void;
18 | declare function Right(): void;
19 | declare function OK(): void;
20 | declare function Text(text: string): void;
21 | declare function KeyCode(code: number | string): void;
22 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/media.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace media {
2 | function scanFile(path: string): void;
3 | function playMusic(path: string, volume?: number, looping?: boolean);
4 | function musicSeekTo(msec: number): void;
5 | function pauseMusic(): void;
6 | function resumeMusic(): void;
7 | function stopMusic(): void;
8 | function isMusicPlaying(): boolean;
9 | function getMusicDuration(): number;
10 | function getMusicCurrentPosition(): number;
11 | }
12 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/root.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * RootAutomator是一个使用root权限来模拟触摸的对象,用它可以完成触摸与多点触摸,并且这些动作的执行没有延迟。
3 | *
4 | * 一个脚本中最好只存在一个RootAutomator,并且保证脚本结束退出他。
5 | */
6 | declare class RootAutomator {
7 | /**
8 | * 点击位置(x, y)。其中id是一个整数值,用于区分多点触摸,不同的id表示不同的"手指"。
9 | */
10 | tap(x: number, y: number, id?: number): void;
11 |
12 | /**
13 | * 模拟一次从(x1, y1)到(x2, y2)的时间为duration毫秒的滑动。
14 | */
15 | swipe(x1: number, x2: number, y1: number, y2: number, duration?: number): void;
16 |
17 | /**
18 | * 模拟按下位置(x, y),时长为duration毫秒。
19 | */
20 | press(x: number, y: number, duration: number, id?: number): void;
21 |
22 | /**
23 | * 模拟长按位置(x, y)。
24 | */
25 | longPress(x: number, y: number, duration?: number, id?: number): void;
26 |
27 | /**
28 | * 模拟手指按下位置(x, y)。
29 | */
30 | touchDown(x: number, y: number, id?: number): void;
31 |
32 | /**
33 | * 模拟移动手指到位置(x, y)。
34 | */
35 | touchMove(x: number, y: number, id?: number): void;
36 |
37 | /**
38 | * 模拟手指弹起。
39 | */
40 | touchUp(id?: number): void;
41 |
42 | }
43 |
44 | /**
45 | * 需要Root权限
46 | *
47 | * 实验API,请勿过度依赖
48 | *
49 | * 点击位置(x, y), 您可以通过"开发者选项"开启指针位置来确定点击坐标。
50 | */
51 | declare function Tap(x: number, y: number): void;
52 |
53 | /**
54 | * 需要Root权限
55 | *
56 | * 实验API,请勿过度依赖
57 | *
58 | * 滑动。从(x1, y1)位置滑动到(x2, y2)位置。
59 | */
60 | declare function Swipe(x1: number, x2: number, y1: number, y2: number, duration?: number): void;
61 |
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/sensors.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace sensors {
2 | interface SensorEventEmitter {
3 | on(eventName: 'change', callback: (...args: number[]) => void): void;
4 | on(eventName: 'accuracy_change', callback: (accuracy: number) => void): void;
5 | }
6 | function on(eventName: 'unsupported_sensor', callback: (sensorName: string) => void): void;
7 | function register(sensorName: string, delay?: delay): SensorEventEmitter;
8 | function unregister(emitter: SensorEventEmitter);
9 | function unregisterAll(): void;
10 | var ignoresUnsupportedSensor: boolean;
11 | enum delay {
12 | normal,
13 | ui,
14 | game,
15 | fastest
16 | }
17 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/storages.d.ts:
--------------------------------------------------------------------------------
1 | interface Storage {
2 | get(key: string, defaultValue?: T): T;
3 | put(key: string, value: T): void;
4 | remove(key: string): void;
5 | contains(key: string): boolean;
6 | clear(): void;
7 | }
8 |
9 | declare namespace storages {
10 | function create(name: string): Storage;
11 | function remove(name: string): boolean;
12 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/threads.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace threads {
2 |
3 | type ThreadTimerID = number;
4 |
5 | interface Thread {
6 | interrupt(): void;
7 | join(timeout?: number);
8 | isAlive(): boolean;
9 | waitFor(): void;
10 | setTimeout(callback: (...args: any[]) => void, delay: number, ...args: any[]): ThreadTimerID;
11 | setInterval(callback: (...args: any[]) => void, delay: number, ...args: any[]): ThreadTimerID;
12 | setImmediate(callback: (...args: any[]) => void, ...args: any[]): ThreadTimerID;
13 | clearInterval(id: ThreadTimerID): void;
14 | clearTimeout(id: ThreadTimerID): void;
15 | clearImmediate(id: ThreadTimerID): void;
16 | }
17 |
18 | function start(action): Thread;
19 | function shutDownAll(): void;
20 | function currentThread(): Thread;
21 | function disposable(): any;
22 | function atomic(initialValue?: number): any;
23 | function lock(): any;
24 |
25 |
26 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/ui.d.ts:
--------------------------------------------------------------------------------
1 | // interface View {
2 | // w: 'auto' | '*' | number;
3 | // h: 'auto' | '*' | number;
4 | // id: string;
5 | // gravity: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'center_vertical' | 'center_horizontal' | string;
6 | // layout_gravity: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'center_vertical' | 'center_horizontal' | string;
7 | // margin: number | string;
8 | // marginLeft: number;
9 | // marginRight: number;
10 | // marginTop: number;
11 | // marginBottom: number;
12 | // padding
13 | // paddingLeft: number;
14 | // paddingRight: number;
15 | // paddingTop: number;
16 | // paddingBottom: number;
17 | // bg
18 | // alpha
19 | // foreground
20 | // minHeight
21 | // minWidth
22 | // visbility
23 | // rotation
24 | // transformPivotX
25 | // transformPivotY
26 | // style
27 | // }
28 |
29 | // interface UI {
30 | // [id: string]: View | ((...args: any[]) => any);
31 | // layout(xml: any): void;
32 | // inflate(xml: any, parent?: View): void;
33 | // findView(id: string): View;
34 | // finish()
35 | // setContentView(view: View)
36 | // run(callback)
37 | // post(callback, delay?: number): void;
38 | // statusBarColor(color)
39 | // showPopupMenu(view, menu)
40 | // }
41 |
42 | // declare const ui: UI;
43 |
44 | type View = any;
45 |
46 | interface UILike {
47 | toString(): string;
48 | }
49 |
50 | declare namespace ui {
51 | function layout(xml: UILike | any): void;
52 | function inflate(xml: UILike | any, parent?: View): void;
53 | function findView(id: string): View;
54 | function finish()
55 | function setContentView(view: View)
56 | function run(callback)
57 | function post(callback, delay?: number): void;
58 | function statusBarColor(color)
59 | function showPopupMenu(view, menu)
60 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/types/modules/widgets.d.ts:
--------------------------------------------------------------------------------
1 | declare function auto(mode?: 'fast' | 'normal'): void;
2 | declare namespace auto {
3 | function waitFor(): void;
4 | function setMode(mode: 'fast' | 'normal'): void;
5 | }
6 | declare function selector(): UiSelector;
7 | declare function click(text: string, index?: number): boolean;
8 | declare function click(left: number, top: number, bottom: number, right: number): boolean;
9 | declare function longClick(text: string, index?: number): boolean;
10 | declare function scrollUp(index?: number): boolean;
11 | declare function scrollDown(index?: number): boolean;
12 | declare function setText(text: string): boolean;
13 | declare function setText(index: number, text: string): boolean;
14 | declare function input(text: string): boolean;
15 | declare function input(index: number, text: string): boolean;
16 |
17 | declare interface UiSelector {
18 | text(str: string): UiSelector;
19 | textContains(str: string): UiSelector;
20 | textStartsWith(prefix: string): UiSelector;
21 | textEndsWith(suffix: string): UiSelector;
22 | textMatches(reg: string | RegExp): UiSelector;
23 | desc(str: string): UiSelector;
24 | descContains(str: string): UiSelector;
25 | descStartsWith(prefix: string): UiSelector;
26 | descEndsWith(suffix: string): UiSelector;
27 | descMatches(reg: string | RegExp): UiSelector;
28 | id(resId: string): UiSelector;
29 | idContains(str: string): UiSelector;
30 | idStartsWith(prefix: string): UiSelector;
31 | idEndsWith(suffix: string): UiSelector;
32 | idMatches(reg: string | RegExp): UiSelector;
33 | className(str: string): UiSelector;
34 | classNameContains(str: string): UiSelector;
35 | classNameStartsWith(prefix: string): UiSelector;
36 | classNameEndsWith(suffix: string): UiSelector;
37 | classNameMatches(reg: string | RegExp): UiSelector;
38 | packageName(str: string): UiSelector;
39 | packageNameContains(str: string): UiSelector;
40 | packageNameStartsWith(prefix: string): UiSelector;
41 | packageNameEndsWith(suffix: string): UiSelector;
42 | packageNameMatches(reg: string | RegExp): UiSelector;
43 | bounds(left: number, top: number, right: number, buttom: number): UiSelector;
44 | boundsInside(left: number, top: number, right: number, buttom: number): UiSelector;
45 | boundsContains(left: number, top: number, right: number, buttom: number): UiSelector;
46 | drawingOrder(order): UiSelector;
47 | clickable(b: boolean): UiSelector;
48 | longClickable(b: boolean): UiSelector;
49 | checkable(b: boolean): UiSelector;
50 | selected(b: boolean): UiSelector;
51 | enabled(b: boolean): UiSelector;
52 | scrollable(b: boolean): UiSelector;
53 | editable(b: boolean): UiSelector;
54 | multiLine(b: boolean): UiSelector;
55 | findOne(): UiObject;
56 | findOne(timeout: number): UiObject;
57 | findOnce(): UiObject;
58 | findOnce(i: number): UiObject;
59 | find(): UiCollection;
60 | untilFind(): UiCollection;
61 | exists(): boolean;
62 | waitFor(): void;
63 | filter(filter: (obj: UiObject) => boolean)
64 | }
65 |
66 | declare interface UiObject {
67 | click(): boolean;
68 | longClick(): boolean;
69 | setText(text: string): boolean;
70 | copy(): boolean;
71 | cut(): boolean;
72 | paste(): boolean;
73 | setSelection(start, end): boolean;
74 | scrollForward(): boolean;
75 | scrollBackward(): boolean;
76 | select(): boolean;
77 | collapse(): boolean;
78 | expand(): boolean;
79 | show(): boolean;
80 | scrollUp(): boolean;
81 | scrollDown(): boolean;
82 | scrollLeft(): boolean;
83 | scrollRight(): boolean;
84 | children(): UiCollection;
85 | childCount(): number;
86 | child(i: number): UiObject;
87 | parent(): UiObject;
88 | bounds(): Rect;
89 | boundsInParent(): Rect;
90 | drawingOrder(): number;
91 | id(): string;
92 | text(): string;
93 | findByText(str: string): UiCollection;
94 | findOne(selector): UiObject;
95 | find(selector): UiCollection;
96 | }
97 |
98 | declare interface UiCollection {
99 | size(): number;
100 | get(i: number): UiObject;
101 | each(func: (obj: UiObject) => void): void;
102 | empty(): boolean;
103 | nonEmpty(): boolean;
104 | find(selector): UiCollection;
105 | findOne(selector): UiObject;
106 | }
107 |
108 | declare interface Rect {
109 | left: number;
110 | right: number;
111 | top: number;
112 | bottom: number;
113 | centerX(): number;
114 | centerY(): number;
115 | width(): number;
116 | height(): number;
117 | contains(r): Rect;
118 | intersect(r): Rect;
119 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/1.jpg
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/compute.js:
--------------------------------------------------------------------------------
1 | const bottomCenter = function(bounds) {
2 | return {
3 | x: bounds.x + bounds.w / 2,
4 | y: bounds.y + bounds.h
5 | }
6 | }
7 | const angleCalcul = function(source, target) {
8 | const dx = target.x - source.x
9 | const dy = target.y - source.y
10 | const radAngle = Math.atan2(dy, dx)
11 | const degAngle = radAngle * (180 / Math.PI)
12 | return ((degAngle + 360) % 360)
13 | }
14 | const distanceCalcul = function(source, targets) {
15 | let distances = []
16 | let sourceCenter = bottomCenter(source)
17 | for (let index = 0; index < targets.length; index++) {
18 | let target = targets[index]
19 | let targetCenter = bottomCenter(target)
20 | distances.push({
21 | target: target,
22 | sourceCenter: sourceCenter,
23 | targetCenter: targetCenter,
24 | distance: Math.sqrt(Math.pow(targetCenter.x - sourceCenter.x, 2) + Math.pow(targetCenter.y - sourceCenter.y, 2))
25 | })
26 | }
27 | return distances
28 | }
29 | const suitableTarget = function(targets) {
30 | if (!targets || targets.length == 0) {
31 | return null
32 | }
33 | let maxProbItem = null;
34 | let maxProb = -Infinity;
35 |
36 | for (let i = 0; i < targets.length; i++) {
37 | const target = targets[i];
38 | if (target.prob > maxProb) {
39 | maxProb = target.prob;
40 | maxProbItem = target;
41 | }
42 | }
43 | return maxProbItem;
44 | }
45 | const findClosest = function(source, targets) {
46 | if (!source || !targets || targets.length == 0) {
47 | return
48 | }
49 | let closestResult = {distance: 999999}
50 | let distances = distanceCalcul(source, targets)
51 | for (let d of distances) {
52 | if (closestResult["distance"] < d.distance) {
53 | continue
54 | }
55 | closestResult["distance"] = d.distance
56 | closestResult["angle"] = angleCalcul(d.sourceCenter, d.targetCenter);
57 | closestResult["target"] = d.target
58 | closestResult["p1"] = d.sourceCenter
59 | closestResult["p2"] = d.targetCenter
60 | }
61 | return closestResult
62 | }
63 | const findFarthest = function(source, targets) {
64 | console.info("source:" + JSON.stringify(source) + ",target:" + JSON.stringify(targets))
65 | if (!source || !targets) {
66 | return
67 | }
68 | let farthestResult = {distance: 0}
69 | let distances = distanceCalcul(source, targets)
70 | console.log("计算距离:" + JSON.stringify(distances))
71 | for (let d of distances) {
72 | if (farthestResult["distance"] > d.distance) {
73 | continue
74 | }
75 | farthestResult["distance"] = d.distance
76 | farthestResult["angle"] = angleCalcul(d.sourceCenter, d.targetCenter);
77 | farthestResult["target"] = d.target
78 | farthestResult["p1"] = d.sourceCenter
79 | farthestResult["p2"] = d.targetCenter
80 | }
81 | return farthestResult
82 | }
83 | const rockerCoordinate = function(rocker, angleInDegrees) {
84 | if (!angleInDegrees) {
85 | return null
86 | }
87 | let centerX = rocker.x + Math.round(rocker.w / 2)
88 | let centerY = rocker.y + Math.round(rocker.h / 2)
89 | let random = 155 - Math.floor(Math.random() * 10)
90 | if (angleInDegrees == 0 || angleInDegrees == 360) {
91 | return {x: random + centerX, y: centerY}
92 | } else if (angleInDegrees == 90) {
93 | return {x: centerX, y: random + centerY}
94 | } else if (angleInDegrees == 180) {
95 | return {x: -random + centerX, y: centerY}
96 | } else if (angleInDegrees == 270) {
97 | return {x: centerX, y: -random + centerY}
98 | }
99 | console.log("angleInDegrees:" + angleInDegrees)
100 | var angleInRadians = angleInDegrees * (Math.PI / 180);
101 | console.log("angleInRadians:" + angleInRadians)
102 | if ((angleInDegrees > 0 && angleInDegrees <= 45) || angleInDegrees >= 315) {
103 | return {x: random + centerX, y: random * Math.tan(angleInRadians) + centerY}
104 | } else if (angleInDegrees > 45 && angleInDegrees <= 135) {
105 | return {x: random / Math.tan(angleInRadians) + centerX, y: random + centerY}
106 | } else if (angleInDegrees > 135 && angleInDegrees <= 225) {
107 | return {x: -random + centerX, y: -random * Math.tan(angleInRadians) + centerY}
108 | } else {
109 | return {x: -random / Math.tan(angleInRadians) + centerX, y: -random + centerY}
110 | }
111 | }
112 |
113 | exports.suitableTarget = suitableTarget
114 | exports.findClosest = findClosest
115 | exports.findFarthest = findFarthest
116 | exports.rockerCoordinate = rockerCoordinate
117 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/config.js:
--------------------------------------------------------------------------------
1 | exports.config = () => {
2 | return {
3 | "httpServerUrl": "http://192.168.0.104:8080",
4 | "wsServerUrl": "ws://127.0.0.1:5005",
5 | "tempFileDir": ""
6 | }
7 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/debuger.js:
--------------------------------------------------------------------------------
1 | const Debuger = function() {
2 | this.window = undefined,
3 | this.boxs = [],
4 | this.lines = [],
5 | this.boxFont = undefined,
6 | this.textFont = undefined,
7 | this.draw = function(canvas) {
8 | canvas.drawColor(0xFFFFFF, android.graphics.PorterDuff.Mode.CLEAR)
9 | for (let index = 0; index < this.boxs.length; index ++) {
10 | let box = this.boxs[index]
11 | if (box == undefined) {
12 | continue
13 | }
14 | canvas.drawRect(
15 | box.x,
16 | box.y,
17 | box.x + box.w,
18 | box.y + box.h,
19 | this.boxFont
20 | );
21 | canvas.drawText(box.label, box.x, box.y - 10, this.textFont);
22 | }
23 | for (let index = 0; index < this.lines.length; index ++) {
24 | let line = this.lines[index]
25 | if (line == undefined) {
26 | continue
27 | }
28 | canvas.drawLine(
29 | line.x1,
30 | line.y1,
31 | line.x2,
32 | line.y2,
33 | this.boxFont
34 | );
35 | }
36 | }
37 | this.init = function() {
38 | if (this.window) {
39 | return
40 | }
41 | this.window = floaty.rawWindow(
42 |
43 |
44 |
45 |
46 | )
47 | this.window.setSize(-1, -1)
48 | this.window.setTouchable(false)
49 | this.window.borad.on("draw", this.draw.bind(this))
50 | if (this.boxFont == undefined) {
51 | this.boxFont = new Paint()
52 | //设置画笔颜色为红色
53 | this.boxFont.setStyle(android.graphics.Paint.Style.STROKE)
54 | this.boxFont.setColor(colors.RED)
55 | this.boxFont.setStrokeWidth(3)
56 | }
57 | if (this.textFont == undefined) {
58 | this.textFont = new Paint()
59 | this.textFont.setColor(colors.RED)
60 | this.textFont.setTextSize(30)
61 | }
62 | },
63 | this.refresh = function(boxs) {
64 | if (!this.window) {
65 | this.init()
66 | }
67 | this.boxs = boxs == undefined ? [] : boxs
68 | this.lines = []
69 | },
70 | this.title = function(title) {
71 | if (!this.window) {
72 | this.init()
73 | }
74 | this.window.title.setText(title)
75 | }
76 | this.add = function(box) {
77 | if (!this.window) {
78 | this.init()
79 | }
80 | if (!box || box.x == undefined) {
81 | return
82 | }
83 | this.boxs.push(box)
84 | },
85 | this.addLine = function(line) {
86 | if (!this.window) {
87 | this.init()
88 | }
89 | if (!line) {
90 | return
91 | }
92 | this.lines.push(line)
93 | },
94 | this.close = function() {
95 | if (!this.window) {
96 | return
97 | }
98 | this.window.close()
99 | this.window = undefined
100 | }
101 | }
102 | exports.debuger = new Debuger()
103 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/mark.js:
--------------------------------------------------------------------------------
1 | const Marker = function(name, callback) {
2 | this.name = name,
3 | this.callback = callback,
4 | this.boxs = [],
5 | this.boxFont = undefined,
6 | this.textFont = undefined,
7 | this.operateW = undefined,
8 | this.displayW = undefined,
9 | this.draw = function(canvas) {
10 | canvas.drawColor(0xFFFFFF, android.graphics.PorterDuff.Mode.CLEAR)
11 | if (!this.boxs || this.boxs.length == 0) {
12 | return
13 | }
14 | for (let index = 0; index < this.boxs.length; index ++) {
15 | canvas.drawRect(
16 | this.boxs[index].x,
17 | this.boxs[index].y,
18 | this.boxs[index].x + this.boxs[index].w,
19 | this.boxs[index].y + this.boxs[index].h,
20 | this.boxFont
21 | );
22 | canvas.drawText(this.boxs[index].label, this.boxs[index].x, this.boxs[index].y - 10, this.textFont);
23 | }
24 | },
25 | this.init = function() {
26 | this.displayW = floaty.rawWindow(
27 |
28 | )
29 | this.displayW.setTouchable(false)
30 | this.displayW.setSize(-1, -1)
31 | this.displayW.borad.on("draw", this.draw.bind(this))
32 | this.operateW = floaty.rawWindow(
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | )
61 | this.operateW.setPosition(Math.max(device.width, device.height) - 700, 10)
62 | this.operateW.setSize(690, -2)
63 | this.operateW.exit.click(this.close.bind(this))
64 | if (this.boxFont == undefined) {
65 | this.boxFont = new Paint()
66 | this.boxFont.setStyle(android.graphics.Paint.Style.STROKE)
67 | this.boxFont.setColor(colors.RED)
68 | this.boxFont.setStrokeWidth(2)
69 | }
70 | if (this.textFont == undefined) {
71 | this.textFont = new Paint()
72 | this.textFont.setColor(colors.RED)
73 | this.textFont.setTextSize(30)
74 | }
75 | this.boxs.push({x:185,y:720,w:180,h:48})
76 | },
77 | this.close = function() {
78 | if(this.displayW != undefined) {
79 | this.displayW.close()
80 | }
81 | if(this.operateW != undefined) {
82 | this.operateW.close()
83 | }
84 | }
85 | }
86 | exports.createMarker = (callback) => {
87 | let marker = new Marker(callback)
88 | marker.init()
89 | return marker
90 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/socket.js:
--------------------------------------------------------------------------------
1 | importPackage(Packages["okhttp3"]); //导入包
2 | var config = require("./config").config()
3 | var socket = null
4 | var client = null
5 | var status = "closed"
6 | var callback = {}
7 | var generateUUID = () => {
8 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
9 | var r = (Math.random() * 16) | 0,
10 | v = c === 'x' ? r : (r & 0x3) | 0x8;
11 | return v.toString(16);
12 | });
13 | }
14 |
15 | var createConnection = () => {
16 | client = new OkHttpClient.Builder().retryOnConnectionFailure(true).build()
17 | var request = new Request.Builder().url(config.wsServerUrl).build() //vscode 插件的ip地址,
18 | client.dispatcher().cancelAll();//清理一次
19 | listener = {
20 | onOpen: function (webSocket, response) {
21 | webSocket.send("客户端连接")
22 | ui.post(() => toast("客户端连接成功!"))
23 | status = "success"
24 | },
25 | onMessage: function (webSocket, msg) { //msg可能是字符串,也可能是byte数组,取决于服务器送的内容
26 | var obj = JSON.parse(msg)
27 | if (!obj) {
28 | return
29 | }
30 | if (callback[obj.requestId]) {
31 | callback[obj.requestId](obj.data, obj.status)
32 | }
33 | //console.info("是否需要执行返回ack:" + obj.requiredAck)
34 | if (obj.requiredAck) {
35 | var ack = {
36 | "action": "client-ack",
37 | "requestId": obj.requestId
38 | }
39 | sleep(200)
40 | webSocket.send(JSON.stringify(ack))
41 | }
42 | if (obj.status == "processing") {
43 | return
44 | }
45 | if (!callback[obj.requestId]) {
46 | return
47 | }
48 | delete callback[obj.requestId]
49 | },
50 | onClosing: function (webSocket, code, response) {
51 | print("正在关闭")
52 | status = "closed"
53 | socket == null
54 | },
55 | onClosed: function (webSocket, code, response) {
56 | print("已关闭")
57 | status = "closed"
58 | socket == null
59 | },
60 | onFailure: function (webSocket, t, response) {
61 | print(t)
62 | ui.post(() => toast("服务端连接断开!"))
63 | status = "closed"
64 | socket == null
65 | }
66 | }
67 | socket= client.newWebSocket(request, new WebSocketListener(listener))
68 | status = "pending"
69 | }
70 |
71 | exports.connect = () => {
72 | for (var retryTimes = 0; retryTimes < 5; retryTimes++) {
73 | if(status == 'success') {
74 | return
75 | }
76 | createConnection()
77 | while(status == 'pending') {
78 | sleep(500)
79 | }
80 | if(status == 'success') {
81 | return
82 | }
83 | console.info("连接失败,开始重试:" + retryTimes)
84 | sleep(2000)
85 | }
86 | }
87 |
88 | exports.close = () => {
89 | try {
90 | if (socket == null) {
91 | return
92 | }
93 | socket.close(1000, "主动关闭")
94 | } catch(e) {
95 | console.info(e)
96 | }
97 | }
98 |
99 | exports.send = (message, func) => {
100 | if (socket == null) {
101 | createConnection()
102 | }
103 | var requestId = generateUUID()
104 | message.requestId = requestId
105 | callback[requestId] = func
106 | console.info("发送消息:" + JSON.stringify(message))
107 | socket.send(JSON.stringify(message))
108 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/common/utils.js:
--------------------------------------------------------------------------------
1 | var config = require("./config").config()
2 | const storage = storages.create("dnf-server");
3 | exports.loadView = (view) => {
4 | const module = require("../view/" + view)
5 | ui.setContentView(module.view())
6 | if (!module.action) {
7 | return
8 | }
9 | module.action()
10 | }
11 | exports.loadContent = (content, parent) => {
12 | console.log("加载页面:" + content)
13 | if (parent) {
14 | parent.close()
15 | }
16 | const compoment = require("../content/" + content)
17 | compoment.display()
18 | if (!compoment.action) {
19 | return
20 | }
21 | compoment.action()
22 | }
23 |
24 | exports.downloadServer = () => {
25 | log(config)
26 | log(config.httpServerUrl + "/api/resource/download/v0.0.1")
27 | var response = http.get(config.httpServerUrl + "/api/resource/download/v0.0.1")
28 | if (response.statusCode != 200) {
29 | toast("更新系统失败,请重新启动")
30 | return
31 | }
32 | toast("更新系统成功,马上开始安装更新")
33 | var app = response.body.bytes()
34 | files.writeBytes(files.getSdcardPath() + "/dnf-server.apk", app)
35 | var command = "install -g " + files.getSdcardPath() + "/dnf-server.apk"
36 | log(command)
37 | shell("install -g " + files.getSdcardPath() + "/dnf-server.apk" )
38 | toast("安装更新系统成功")
39 | log(shell("pm list features").result)
40 | }
41 |
42 | exports.startServer = () => {
43 | var result = app.startActivity({
44 | packageName: "info.xingxingdd.dnf",
45 | className: "info.xingxingdd.dnf.component.DnfServerActivity"
46 | })
47 | console.info("启动服务结果:", result)
48 | return result
49 | }
50 |
51 | exports.async = (before, task, after, delay) => {
52 | threads.start(() => {
53 | ui.post(before)
54 | task()
55 | if (delay) {
56 | sleep(delay)
57 | }
58 | ui.post(after)
59 | });
60 | }
61 | exports.cache = (key, value, noSerialization) => {
62 | if (!noSerialization) {
63 | value = JSON.stringify(value)
64 | }
65 | storage.put(key, value)
66 | }
67 | exports.acquire = (key, noSerialization) => {
68 | let value = storage.get(key)
69 | if (value && !noSerialization) {
70 | value = JSON.parse(value)
71 | }
72 | return value
73 | }
74 | exports.remove = () => {
75 | storages.remove("dnf-server")
76 | }
77 |
78 | exports.plugin = plugins.load("info.xingxingdd.dnf.script.plugin");
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/content/boot.js:
--------------------------------------------------------------------------------
1 | var utils = require("../common/utils")
2 | exports.display = () => {
3 | var w = floaty.rawWindow(
4 |
5 |
6 | {/*
7 | 角色职业
8 |
9 |
10 |
11 | 搬砖地图
12 |
13 |
14 |
15 | 自动分解
16 |
17 |
18 |
19 |
20 |
21 | 自动出售
22 |
23 |
24 |
25 |
26 |
27 | 启动日志
28 |
29 | */}
30 |
31 |
32 |
33 |
34 | );
35 | w.setSize(-1, -1);
36 | events.observeTouch();
37 | //注册触摸监听器
38 | events.onTouch(function(p){
39 | //触摸事件发生时, 打印出触摸的点的坐标
40 | log(p.x + ", " + p.y);
41 | });
42 | w.launch.click(() => {
43 | utils.async(
44 | () => w.launch.setText("启动服务中..."),
45 | () => {
46 | if (!requestScreenCapture(true)) {
47 | toast("未开启权限,不可使用脚本")
48 | return
49 | }
50 | },//utils.startServer(),
51 | () => utils.loadContent("action", w),
52 | 500
53 | )
54 | })
55 | w.exit.click(() => {
56 | w.exitOnClose()
57 | })
58 | //ui.run(()=>{ w.requestFocus(); })
59 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/content/home.js:
--------------------------------------------------------------------------------
1 | var utils = require("../common/utils")
2 | exports.display = () => {
3 | var w = floaty.rawWindow(
4 |
5 |
6 |
7 |
8 |
9 | {/*
10 |
11 | */}
12 |
65 |
66 | )
67 | w.setSize(-1, -1)
68 |
69 | //设置滑动页面的标题
70 | w.viewpager.setTitles(["搬砖仔列表", "搬砖设置", "系统设置", "系统公告"]);
71 | //让滑动页面和标签栏联动
72 | //w.tabs.setupWithViewPager(w.viewpager);
73 | //w.setTouchable(false)
74 | // w.role_setting.setTextColor(colors.BLACK)
75 | let list = []
76 | w.role_list.setDataSource(list)
77 | w.add.click(() => {
78 | list = list.concat({roleType:"暗狱战狂|大暗黑天",roleName:""})
79 | w.role_list.setDataSource(list)
80 | w.role_list.getAdapter().notifyItemChanged(list.length - 1)
81 | w.role_list.smoothScrollToPosition(list.length - 1)
82 | })
83 | // w.add.click(()=> {
84 | // w.setTouchable(false)
85 | // w.setSize(0, 0)
86 | // })
87 | w.exit.click(()=> {
88 | w.close()
89 | })
90 | ui.run(()=>{ w.requestFocus(); })
91 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/action/detector.js:
--------------------------------------------------------------------------------
1 | const { plugin } = require("../../common/utils")
2 | const { debuger } = require("../../common/debuger")
3 | const ScreenDetector = function() {
4 | this.status = "pending",
5 | this.bottomCenter = function(box) {
6 | return {
7 | x: box.x + box.w / 2,
8 | y: box.y + box.h / 2
9 | }
10 | },
11 | this.angleCalcul = function(source, target) {
12 | const dx = target.x - source.x
13 | const dy = target.y - source.y
14 | const radAngle = Math.atan2(dy, dx)
15 | const degAngle = radAngle * (180 / Math.PI)
16 | return ((degAngle + 360) % 360)
17 | },
18 | this.distanceCalcul = function(source, targets) {
19 | let distances = []
20 | let sourceCenter = this.bottomCenter(source)
21 | for (let target of targets) {
22 | let targetCenter = this.bottomCenter(target)
23 | distances.push({
24 | target: target,
25 | sourceCenter: sourceCenter,
26 | targetCenter: targetCenter,
27 | distance: Math.sqrt(Math.pow(targetCenter.x - sourceCenter.x, 2) + Math.pow(targetCenter.y - sourceCenter.y, 2))
28 | })
29 | }
30 | return distances
31 | },
32 | this.suitableTarget = function(targets) {
33 | if (!targets || targets.length == 0) {
34 | return null
35 | }
36 | let maxProbItem = null;
37 | let maxProb = -Infinity;
38 |
39 | for (let i = 0; i < targets.length; i++) {
40 | const target = targets[i];
41 | if (target.prob > maxProb) {
42 | maxProb = target.prob;
43 | maxProbItem = target;
44 | }
45 | }
46 | return maxProbItem;
47 | },
48 | this.findClosest = function(source, targets) {
49 | if (!source || !targets) {
50 | return
51 | }
52 | let closestResult = {distance: 999999}
53 | let distances = this.distanceCalcul(source, targets)
54 | for (let d of distances) {
55 | if (closestResult["distance"] < d.distance) {
56 | continue
57 | }
58 | closestResult["distance"] = d.distance
59 | closestResult["angle"] = this.angleCalcul(d.sourceCenter, d.targetCenter);
60 | closestResult["target"] = d.target
61 | closestResult["p1"] = d.sourceCenter
62 | closestResult["p2"] = d.targetCenter
63 | }
64 | return closestResult
65 | },
66 | this.findFarthest = function(source, targets) {
67 | if (!source || !targets) {
68 | return
69 | }
70 | let farthestResult = {distance: 0}
71 | let distances = this.distanceCalcul(source, targets)
72 | for (let d of distances) {
73 | if (farthestResult["distance"] > d.distance) {
74 | continue
75 | }
76 | farthestResult["distance"] = d.distance
77 | farthestResult["angle"] = this.angleCalcul(d.sourceCenter, d.targetCenter);
78 | farthestResult["target"] = d.target
79 | farthestResult["p1"] = d.sourceCenter
80 | farthestResult["p2"] = d.targetCenter
81 | }
82 | return farthestResult
83 | },
84 | this.suitableDoor = function(coward, guidance, doors) {
85 | if (!coward || !guidance) {
86 | return null
87 | }
88 | let result = this.findClosest(guidance, doors)
89 | if (!result || result.distance > 100) {
90 | return null
91 | }
92 | return this.findClosest(coward, [result.target])
93 | },
94 | this.process = function(context, result) {
95 | context["objects"] = result
96 | // let coward = this.suitableTarget(result["coward"])
97 | // let monster = this.findClosest(coward, result["monster"])
98 | // let reward = this.findClosest(coward, result["reward"])
99 | // let guidance = this.findFarthest(coward, result["guidance"])
100 | // let door = this.suitableDoor(coward, guidance, result["door"])
101 | // context["objects"] = {
102 | // coward: coward,
103 | // rocker: {},
104 | // skills: {},
105 | // monster: monster,
106 | // reward: reward,
107 | // door: door,
108 | // guidance: guidance
109 | // }
110 | },
111 | this.detect = function(context, callback) {
112 | if (this.status == 'pending') {
113 | this.status = "processing"
114 | let capture = captureScreen()
115 | let bitmap = capture.getBitmap()
116 | let result = plugin.detect(bitmap, 0.8)
117 | //this.process(context, result)
118 | // debuger.refresh()
119 | // for (let box of result) {
120 | // debuger.add(box)
121 | // }
122 | let objects = {}
123 | for (let obj of result) {
124 | if (objects[obj.label] == undefined) {
125 | objects[obj.label] = []
126 | }
127 | objects[obj.label].push(obj)
128 | }
129 | context["objects"] = objects
130 | if (!objects["monster"] && !objects["reward"] && !objects["guidance"]) {
131 | objects["repeat"] = [plugin.match(bitmap, "common/repeat", [0.6, 1, 0, 0.4])]
132 | }
133 | this.status = "pending"
134 | }
135 | return false
136 | }
137 | }
138 | exports.detector = new ScreenDetector()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/action/matcher.js:
--------------------------------------------------------------------------------
1 | const { debuger } = require("../../common/debuger")
2 | const { template } = require("../config/template")
3 | const { plugin } = require("../../common/utils")
4 |
5 | const ScreenMatcher = function() {
6 | this.matching = {},
7 | this.status = "pending",
8 | this.process = function(data) {
9 | if (!data || data.x == undefined || data.x < 0 || data.y < 0) {
10 | return
11 | }
12 | let randomX = data.x + 2 + Math.floor(random() * (data.w - 2))
13 | let randomY = data.y + 2 + Math.floor(random() * (data.h - 2))
14 | click(randomX, randomY)
15 | },
16 | this.match = function(context, target, callback) {
17 | if (this.status != "pending") {
18 | return false
19 | }
20 | this.status = "processing"
21 | let templateConfig = template[target]
22 | if (templateConfig == undefined) {
23 | return true
24 | }
25 | let capture = captureScreen()
26 | if (!capture) {
27 | return false
28 | }
29 | let bitmap = capture.getBitmap()
30 | if (!bitmap) {
31 | return false
32 | }
33 | console.info("开始识别:" + JSON.stringify(templateConfig) + "," + target)
34 | let result = plugin.match(bitmap, target, templateConfig["bounds"])
35 | console.info("识别结果:" + JSON.stringify(result))
36 | if (result != null) {
37 | debuger.add(result)
38 | }
39 | if(callback) {
40 | callback(context, result)
41 | }
42 | this.status = "pending"
43 | return result != null
44 | }
45 | }
46 |
47 | exports.matcher = new ScreenMatcher()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/action/ocr.js:
--------------------------------------------------------------------------------
1 | const socket = require("../../common/socket")
2 | const {debuger} = require("../../common/debuger")
3 | const Ocr = function() {
4 | this.matching = {},
5 | this.detect = function(context, id, label, callback) {
6 | let matchPorcessResult = this.matching[id]
7 | if (matchPorcessResult == "success") {
8 | delete this.matching[id]
9 | return true
10 | }
11 | if (matchPorcessResult == undefined) {
12 | this.matching[id] = "processing"
13 | socket.send({
14 | action: "gen-text-match",
15 | data: {label: label}
16 | }, (data, status) => {
17 | if (status != "success") {
18 | return
19 | }
20 | console.info("识别结果:" + JSON.stringify(data))
21 | if (callback) {
22 | callback(context, data)
23 | } else {
24 | this.process(data)
25 | }
26 | if (data && data.x != undefined) {
27 | debuger.add(data)
28 | this.matching[id] = "success"
29 | } else {
30 | delete this.matching[id]
31 | }
32 | })
33 | }
34 | return false
35 | }
36 | }
37 | exports.ocr = new Ocr()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/action/processor.js:
--------------------------------------------------------------------------------
1 | const { findClosest, findFarthest, suitableTarget } = require("../../common/compute")
2 | const { debuger } = require("../../common/debuger")
3 | const { plugin } = require("../../common/utils")
4 | const Processor = function(properties) {
5 | Object.assign(this, properties || {}, {
6 | dungeons: undefined,
7 | coward: undefined,
8 | strategy: undefined
9 | }),
10 | this.status = "pending",//状态:pending,processing
11 | this.temp = {},//临时变量存储集合
12 | this.refresh = function(coward) {
13 | if (coward == undefined) {
14 | console.log("角色不存在")
15 | } else {
16 | this.coward.refresh(suitableTarget(coward))
17 | }
18 | },
19 | this.figth = function(level, monsters) {
20 | console.info(JSON.stringify(monsters))
21 | if (!monsters || monsters.length == 0) {
22 | return false
23 | }
24 | let closest = findClosest(this.coward.bounds, monsters)
25 | this.coward.move(closest)
26 | this.coward.fight([{code:"1"},{code:"2"}, {code:"1"}])
27 | },
28 | this.pickup = function(rewards) {
29 | if (!rewards || rewards.length == 0) {
30 | return false
31 | }
32 | let closest = findClosest(this.coward.bounds, rewards)
33 | console.info("最近的奖励:" + JSON.stringify(closest))
34 | this.coward.move(closest)
35 | },
36 | this.next = function(level, objects) {
37 | let guidance = this.dungeons.specialRoute(level)
38 | console.info("11" + JSON.stringify(guidance) + "," + JSON.stringify(this.coward))
39 | if (!guidance && objects && objects["guidance"]) {
40 | guidance = findFarthest(this.coward.bounds, objects["guidance"])
41 | }
42 | if (objects["door"] && guidance) {
43 | let door = findClosest(guidance.target, objects["door"])
44 | if (door.distance <= 100) {
45 | guidance = findClosest(this.coward.bounds, [door.target])
46 | }
47 | }
48 | // if (!guidance) {
49 | // guidance = this.dungeons.defaultRoute(level)
50 | // }
51 | this.coward.move(guidance)
52 | this.temp["corrected"] = false
53 | },
54 | this.correction = function() {
55 | if (this.temp["corrected"]) {
56 | return
57 | }
58 | this.temp["level"] = this.dungeons.acquireLevel()
59 | this.temp["corrected"] = true
60 | },
61 | this.process = function(context) {
62 | if (this.status == "pending") {
63 | try {
64 | this.status = "processing"
65 | let objects = context["objects"]
66 | console.log("处理器中获取到结果:" + JSON.stringify(objects))
67 | if (!objects || objects.length == 0) {
68 | return fasle
69 | }
70 | this.refresh(objects["coward"])
71 | //如果出现怪物或者掉落材料,那么将矫正标识标记为需要矫正
72 | // if (objects["monster"] && !this.temp["corrected"]) {
73 | // this.correction()
74 | // }
75 | let level = this.temp["level"] || 1
76 | //有怪物攻击怪物
77 | if(this.figth(level, objects["monster"])) {
78 | return false
79 | }
80 | // //无怪物拾取掉落奖励
81 | if (this.pickup(objects["reward"])) {
82 | return fasle
83 | }
84 | //检测矫正房间号等信息,防止误判
85 | console.info("当前关卡:" + level)
86 | this.next(level, objects)
87 | if (objects["repeat"]) {
88 |
89 | click(objects["repeat"][0].x + 10, objects["repeat"][0].y + 10)
90 | sleep(500)
91 | let target = plugin.match(bitmap, "common/confirm", [0.3, 0.7, 0.3, 0.7])
92 | console.info("识别到确认按钮:" + JSON.stringify(target))
93 | if (target == undefined) {
94 | return false
95 | }
96 | click(target.x + 10, target.y + 10)
97 | }
98 | } catch (e) {
99 | console.error("执行异常" + e)
100 | } finally {
101 | this.status = "pending"
102 | }
103 | }
104 | return false
105 | }
106 | }
107 |
108 | exports.createProcessor = function(properties) {
109 | return new Processor(properties)
110 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/core/factory.js:
--------------------------------------------------------------------------------
1 | const { gameDetectProcessor } = require("./processor/game_detect_processor")
2 |
3 | exports.acquireProcessor = function(type) {
4 | if (type == "game_detect") {
5 | return gameDetectProcessor
6 | }
7 | return undefined
8 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/core/processor/game_detect_processor.js:
--------------------------------------------------------------------------------
1 | const { debuger } = require("../../../common/debuger")
2 | const { plugin } = require("../../../common/utils")
3 | const { findClosest, findFarthest, suitableTarget } = require("../../../common/compute")
4 | const GameDetectProcessor = function() {
5 | this.finish = false,
6 | this.level = 1,
7 | this.refresh = function(coward, objects) {
8 | coward.refresh(suitableTarget(objects) || {})
9 | if (objects == undefined) {
10 | console.log("角色未识别到")
11 | }
12 | return coward
13 | },
14 | this.adjust = function(coward) {
15 | if (!coward || !coward.bounds) {
16 | return
17 | }
18 | let w = Math.max(device.width, device.height)
19 | let h = Math.min(device.width, device.height)
20 | if (coward.bounds.x <= w / 2 && coward.bounds.y <= h / 2) {
21 | coward.move({angle: 45, distance: 100})
22 | }
23 | if (coward.bounds.x <= w / 2 && coward.bounds.y > h / 2) {
24 | coward.move({angle: 315, distance: 100})
25 | }
26 | if (coward.bounds.x > w / 2 && coward.bounds.y <= h / 2) {
27 | coward.move({angle: 135, distance: 100})
28 | }
29 | if (coward.bounds.x > w / 2 && coward.bounds.y > h / 2) {
30 | coward.move({angle: 225, distance: 100})
31 | }
32 | }
33 | this.cont = function(conts) {
34 | let cont = suitableTarget(conts)
35 | console.info("识别到继续:" + (!cont || !cont.x))
36 | if (!cont || !cont.x) {
37 | return false
38 | }
39 | click(cont.x + cont.w / 2, cont.y + cont.h / 2)
40 | sleep(1000)
41 | let capture = captureScreen()
42 | let bitmap = capture.getBitmap()
43 | let target = plugin.match(bitmap, "common/confirm", [0.3, 0.7, 0.3, 0.7])
44 | console.info("识别到确认按钮:" + JSON.stringify(target))
45 | if (target == undefined) {
46 | return true
47 | }
48 | click(target.x + target.w / 2, target.y + target.h / 2)
49 | return true
50 | }
51 | this.figth = function(level, monsters, coward) {
52 | console.info(JSON.stringify(monsters))
53 | if (!monsters || monsters.length == 0) {
54 | return false
55 | }
56 | let closest = findClosest(coward.bounds, monsters)
57 | // debuger.refresh()
58 | // debuger.addLine({x1:closest.p1.x,y1:closest.p1.y,x2:closest.p2.x,y2:closest.p2.y})
59 | coward.move(closest)
60 | if (this.finish) {
61 | console.info("清图之后第一次遇到怪物,释放大技能")
62 | let skills = ["4", "7", "8", "11"]
63 | let random = Math.round(Math.random() * 5)
64 | coward.fight([{code:skills[random]}, {code:"1"}])
65 | this.finish = false
66 | } else {
67 | let skills = ["2", "5", "3", "6", "9"]
68 | let random = Math.round(Math.random() * 2)
69 | coward.fight([{code:skills[random]}, {code:"1"}])
70 | }
71 | return true
72 | },
73 | this.pickup = function(rewards, coward) {
74 | if (!rewards || rewards.length == 0) {
75 | return false
76 | }
77 | let closest = findClosest(coward.bounds, rewards)
78 | console.info("最近的奖励:" + JSON.stringify(closest))
79 | coward.move(closest)
80 | return true
81 | // debuger.refresh()
82 | // debuger.addLine({x1:closest.p1.x,y1:closest.p1.y,x2:closest.p2.x,y2:closest.p2.y})
83 | },
84 | this.next = function(level, objects, coward) {
85 | let guidance = undefined//this.dungeons.specialRoute(level)
86 | if (!guidance && objects && objects["guidance"]) {
87 | guidance = findFarthest(coward.bounds, objects["guidance"])
88 | }
89 | if (objects["door"] && guidance) {
90 | let door = findClosest(guidance.target, objects["door"])
91 | if (door.distance <= 100) {
92 | guidance = findClosest(coward.bounds, [door.target])
93 | }
94 | }
95 | if (!guidance) {
96 | this.adjust(coward)
97 | }
98 | //console.log("识别到路标指引:" + JSON.stringify(guidance))
99 | // if (!guidance) {
100 | // guidance = this.dungeons.defaultRoute(level)
101 | // }
102 | coward.move(guidance)
103 | this.finish = true
104 | // debuger.refresh()
105 | // debuger.addLine({x1:guidance.p1.x,y1:guidance.p1.y,x2:guidance.p2.x,y2:guidance.p2.y})
106 | // this.temp["corrected"] = false
107 | },
108 | this.correction = function() {
109 | if (this.temp["corrected"]) {
110 | return
111 | }
112 | this.temp["level"] = this.dungeons.acquireLevel()
113 | this.temp["corrected"] = true
114 | },
115 | this.process = function(objects, runtime) {
116 | let level = 1
117 | console.log("识别到结果:" + JSON.stringify(objects))
118 | let coward = this.refresh(runtime.coward, objects["coward"])
119 | if(this.figth(level, objects["monster"], coward)) {
120 | return false
121 | }
122 | // //无怪物拾取掉落奖励
123 | if (this.pickup(objects["reward"], coward)) {
124 | return false
125 | }
126 | if (this.cont(objects["continue"])) {
127 | return false
128 | }
129 | //检测矫正房间号等信息,防止误判
130 | console.info("当前关卡:" + level)
131 | this.next(level, objects, coward)
132 | return false
133 | }
134 | }
135 |
136 | exports.gameDetectProcessor = new GameDetectProcessor()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/core/processor/match_cache_processor.js:
--------------------------------------------------------------------------------
1 | const { remove, acquire, cache } = require("../../common/utils")
2 | const Processor = function() {
3 | this.process = function(object, runtime) {
4 | if (object == undefined || object.x == undefined) {
5 | return false
6 | }
7 |
8 | return true
9 | }
10 | }
11 |
12 | exports.matchCacheProcessor = new Processor()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/core/scheduler.js:
--------------------------------------------------------------------------------
1 | const { acquireProcessor } = require("./factory")
2 | const { engine } = require("../engine")
3 | const { acquire } = require("../../common/utils")
4 | const { plugin } = require("../../common/utils")
5 | const { dungeons, skills } = require("../config/template")
6 | const { createCoward } = require("../object/coward")
7 |
8 | const Scheduler = function() {
9 | this.name = "全局脚本调度器",
10 | this.runtime = {current:undefined, subtask: []},
11 | this.tasks = [],
12 | this.config = {},
13 | this.status = "init",
14 | this.switch = function() {
15 | if (this.status != 'init') {
16 | return
17 | }
18 | this.status = "pending"
19 | let current = this.runtime.current + 1 || 0
20 | if (!this.tasks[current]) {
21 | return false
22 | }
23 | this.runtime.current = current
24 | console.log("任务装载开始")
25 | this.load(this.tasks[current])
26 | console.log("任务装在结束")
27 | return true
28 | },
29 | this.init = function() {
30 | this.tasks = acquire("setting::task") || [
31 | {
32 | name: "2009年玩红眼",
33 | career: "berserker",
34 | dungeons: "bwj",
35 | daily: []
36 | }
37 | ]
38 | if (!this.tasks || this.length == 0) {
39 | toast("初始化配置装配失败,请联系开发者!")
40 | return
41 | }
42 | console.log("加载系统任务:" + JSON.stringify(this.tasks))
43 | this.config = acquire("setting::config") || {}
44 | },
45 | this.dispatch = function(type, message) {
46 | if (message != undefined && this.status == "pending") {
47 | this.status = "processing"
48 | let processor = acquireProcessor(type)
49 | if (processor == undefined) {
50 | this.process = "pending"
51 | console.log("未找到合适的事件处理器:" + type)
52 | return true
53 | }
54 | let result = processor.process(message, this.runtime)
55 | if (!this.runtime.subtask) {
56 | this.runtime.subtask = []
57 | }
58 | this.status = "pending"
59 | return result
60 | }
61 | return false
62 | },
63 | this.load = function(task) {
64 | this.runtime.coward = createCoward({skills: skills[task.career]})
65 | console.log("初始化角色:" + this.runtime.coward)
66 | let template = dungeons[task.dungeons]
67 | console.log("初始化角色:" + template)
68 | if (!template) {
69 | return
70 | }
71 | let tasks = []
72 | for (let item of template) {
73 | if (item.type == "match_click") {
74 | tasks.push({
75 | name: "点击按钮",
76 | type: task.type,
77 | action: (context) => {
78 | let capture = captureScreen()
79 | if (capture == undefined) {
80 | return false
81 | }
82 | let bitmap = capture.getBitmap()
83 | let result = plugin.match(bitmap, item.template, item.bounds)
84 | return result
85 | },
86 | interval: 500,
87 | retry: 20
88 | })
89 | }
90 | if (item.type == "game_detect") {
91 | tasks.push({
92 | name: "布万家搬砖检测",
93 | type: "game_detect",
94 | action: (context) => {
95 | let capture = captureScreen()
96 | if (capture == undefined) {
97 | return
98 | }
99 | let bitmap = capture.getBitmap()
100 | let result = plugin.detect(bitmap, 0.8)
101 | let objects = {}
102 | for (let obj of result) {
103 | if (objects[obj.label] == undefined) {
104 | objects[obj.label] = []
105 | }
106 | objects[obj.label].push(obj)
107 | }
108 | return objects
109 | },
110 | interval: 400
111 | })
112 | }
113 | }
114 | engine.submit("_default", tasks)
115 | }
116 | }
117 |
118 | const scheduler = new Scheduler()
119 | scheduler.init()
120 | engine.registerScheduler(scheduler)
121 | exports.scheduler = scheduler
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/object/block.js:
--------------------------------------------------------------------------------
1 | exports.instance = (properties) => {
2 | return new Object({
3 | bounds: properties,
4 | click: function() {
5 | x = this.bounds.x + (1 - Math.floor(random())) * this.bounds.w
6 | y = this.bounds.y + (1 - Math.floor(random())) * this.bounds.h
7 | click(x, y)
8 | },
9 | press: function(time) {
10 | x = this.bounds.x + (1 - Math.floor(random())) * this.bounds.w
11 | y = this.bounds.y + (1 - Math.floor(random())) * this.bounds.h
12 | press(x, y, time)
13 | }
14 | })
15 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/object/coward.js:
--------------------------------------------------------------------------------
1 | const { remove, acquire, cache } = require("../../common/utils")
2 | const { rockerCoordinate } = require("../../common/compute")
3 | const { rocker } = require("../config/template")
4 | const Skill = function(properties) {
5 | Object.assign(this, properties || {
6 | label: undefined,
7 | bounds: undefined,
8 | cooling: undefined,
9 | press: undefined,
10 | cast: undefined,
11 | next: Date.now()
12 | }),
13 | this.release = function() {
14 | let current = Date.now()
15 | if (current < this.next) {
16 | return
17 | }
18 | console.info("释放技能:" + this.label + "," + this.press)
19 | this.next = current + this.cooling
20 | if (this.press == undefined || this.press == 0) {
21 | click(Math.floor(this.bounds.x + this.bounds.w / 2), Math.floor(this.bounds.y + this.bounds.h / 2))
22 | } else {
23 | press(Math.floor(this.bounds.x + this.bounds.w / 2), Math.floor(this.bounds.y + this.bounds.h / 2), this.press)
24 | }
25 | if (this.cast == undefined || this.cast == 0) {
26 | return
27 | }
28 | console.info("释放技能:" + this.label + "," + this.cast)
29 | sleep(this.cast)
30 | }
31 | }
32 | const Coward = function() {
33 | Object.assign(this, {
34 | start: Date.now(),
35 | bounds: {},
36 | rocker: {},
37 | skills: {},
38 | speed: 1,
39 | }),
40 | this.init = function(properties) {
41 | let keyboard = acquire("keyboard")
42 | if(!keyboard) {
43 | toast("未初始化键位,不可使用脚本,请退出脚本重新初始化!")
44 | return
45 | }
46 | for (let name in properties.skills) {
47 | if (keyboard[name] == undefined) {
48 | continue
49 | }
50 | let skill = new Skill(properties.skills[name])
51 | skill.bounds = keyboard[name]
52 | this.skills[name] = skill
53 | }
54 | this.rocker = keyboard["rocker"]
55 | },
56 | this.move = function(target) {
57 | if (this.rocker == undefined || target == null) {
58 | return
59 | }
60 | if (target.angle <= 45 || target > 315) {
61 | target.distance = target.distance - 50
62 | } else if (target.angle > 60 && target.angle <= 120) {
63 | target.distance = target.distance + 300
64 | } else if (target.angle > 45 && target.angle <= 135) {
65 | target.distance = target.distance + 200
66 | } else if (target.angle > 135 && target.angle <= 225) {
67 | target.distance = target.distance - 50
68 | } else if (target.angle > 250 && target.angle <= 300) {
69 | target.distance = target.distance + 300
70 | } else if (target.angle > 225 && target.angle <= 315) {
71 | target.distance = target.distance + 200
72 | }
73 | let o = rockerCoordinate(this.rocker, target.angle)
74 | if (o == undefined) {
75 | press(this.rocker.x + this.rocker.w, this.rocker.y + this.rocker.h / 2, 100)
76 | return
77 | }
78 | console.log("移动:" + JSON.stringify(o) + "," + JSON.stringify(target))
79 | //移动指令
80 | let time = Math.round(target.distance / this.speed)
81 | press(o.x, o.y, time <= 0 ? 50 : time)
82 | },
83 | this.fight = function(fightQueue) {
84 | if (!fightQueue || fightQueue.length == 0) {
85 | return
86 | }
87 | for (let fight of fightQueue) {
88 | let skill = this.skills[fight["code"]]
89 | if (!skill) {
90 | continue
91 | }
92 | skill.release()
93 | }
94 | },
95 | this.refresh = function(bounds) {
96 | if (bounds == undefined || bounds.x == undefined) {
97 | this.move({angle: 0, distance: 250})
98 | }
99 | this.bounds = bounds
100 | },
101 | this.reset = function() {
102 | for (let skill of this.skills) {
103 | skill.next = Date.now()
104 | }
105 | this.bounds = null
106 | }
107 | }
108 | exports.createCoward = (properties) => {
109 | let coward = new Coward()
110 | coward.init(properties)
111 | return coward
112 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/object/monster.js:
--------------------------------------------------------------------------------
1 | exports.instance = (properties) => {
2 | return new Object({
3 | bounds: properties,
4 | focus: function() {
5 | if (!this.bounds.x || !this.bounds.y) {
6 | return null
7 | }
8 | return {
9 | x: this.bounds.x + this.bounds.w / 2,
10 | y: this.bounds.y + this.bounds.h,
11 | }
12 | }
13 | })
14 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/pipeline/pipeline.js:
--------------------------------------------------------------------------------
1 | const Pipeline = function(name, actions) {
2 | this.name = name,
3 | this.flowId = "",
4 | this.actions = actions,
5 | this.load
6 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/role/berserker.js:
--------------------------------------------------------------------------------
1 | const BerserkerConfig = function() {
2 | this.attackStrategy = {
3 |
4 | },
5 | this.skills = {
6 | 1: {
7 | label: "普通攻击",
8 | cooling: 0,
9 | press: 200,
10 | cast: 0
11 | },
12 | 2: {
13 | label: "十字斩",
14 | cooling: 4000,
15 | press: 50,
16 | cast: 100
17 | },
18 | 3: {
19 | label: "崩山击",
20 | cooling: 5000,
21 | press: 0,
22 | cast: 300
23 | },
24 | 4: {
25 | label: "愤怒狂刃",
26 | cooling: 20000,
27 | press: 0,
28 | cast: 1000
29 | },
30 | 5: {
31 | label: "捕梦之手",
32 | cooling: 9100,
33 | press: 0,
34 | cast: 200
35 | },
36 | 6: {
37 | label: "怒气爆发",
38 | cooling: 20000,
39 | press: 0,
40 | cast: 200
41 | },
42 | 7: {
43 | label: "绝念除尘击",
44 | cooling: 20000,
45 | press: 5000,
46 | cast: 600
47 | },
48 | 8: {
49 | label: "爆发之刃",
50 | cooling: 20000,
51 | press: 0,
52 | cast: 400
53 | },
54 | 9: {
55 | label: "暴走",
56 | cooling: 5000,
57 | press: 0,
58 | cast: 50
59 | },
60 | 10: {
61 | label: "愤怒",
62 | cooling: 60000,
63 | press: 300,
64 | cast: 50
65 | },
66 | 11: {
67 | label: "崩山裂地",
68 | cooling: 40000,
69 | press: 0,
70 | cast: 600
71 | },
72 | 12: {
73 | label: "暗狱魔刹",
74 | cooling: 145000,
75 | press: 0,
76 | cast: 200
77 | },
78 | }
79 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/runtime.js:
--------------------------------------------------------------------------------
1 | const Runtime = function(m) {
2 | this.model = m,
3 | this.context = {},
4 | this.tasks = {},
5 | this.objs = {}
6 | }
7 | exports.instance = (m) => new Runtime(m)
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/scene/bwj.js:
--------------------------------------------------------------------------------
1 | const Buwajia = {
2 | _start_matcher: {},
3 | enter_map: [
4 | {
5 | name: "djsjdt",
6 | executor: "matcher",
7 | ext: {target: "1"},
8 | desc: "世界地图"
9 | },
10 | {
11 | name: "djsjdttb",
12 | executor: "matcher",
13 | ext: {target: "2"},
14 | desc: "世界地图按钮",
15 | depend: "djsjdt"
16 | },
17 | {
18 | name: "djsalddal",
19 | executor: "matcher",
20 | ext: {target: "3"},
21 | desc: "阿拉德大陆",
22 | depend: "djsjdttb"
23 | },
24 | {
25 | name: "djbemeggbb",
26 | executor: "matcher",
27 | ext: {target: "4"},
28 | desc: "贝尔玛尔公国北部",
29 | depend: "djsalddal"
30 | },
31 | {
32 | name: "djbemebb",
33 | executor: "matcher",
34 | ext: {target: "5"},
35 | desc: "贝尔玛尔北部",
36 | depend: "djbemeggbb"
37 | },
38 | {
39 | name: "djwnxs",
40 | executor: "matcher",
41 | ext: {target: "6"},
42 | desc: "万年雪山",
43 | depend: "djbemebb"
44 | },
45 | {
46 | name: "djmxj",
47 | executor: "matcher",
48 | ext: {target: "7"},
49 | desc: "冒险级",
50 | depend: "djwnxs"
51 | },
52 | {
53 | name: "djbwjxlc",
54 | executor: "matcher",
55 | ext: {target: "8"},
56 | desc: "布万家修炼场",
57 | depend: "djmxj"
58 | },
59 | {
60 | name: "djkszd",
61 | executor: "matcher",
62 | ext: {target: "9"},
63 | desc: "开始战斗",
64 | depend: "djbwjxlc"
65 | }
66 | ],
67 | _start_detector: {},
68 | play_game: [
69 | {
70 | name: "sbyx",
71 | executor: "detector",
72 | desc: "识别游戏"
73 | },
74 | {
75 | name: "zdznt",
76 | executor: "agent",
77 | desc: "战斗智能体"
78 | }
79 | ]
80 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/scene/dungeons.js:
--------------------------------------------------------------------------------
1 | const {plugin} = require("../../common/utils")
2 | const {debuger} = require("../../common/debuger")
3 | const Dungeons = function(properties) {
4 | Object.assign(this, properties || {
5 | name: undefined,
6 | map: {
7 | template: undefined,
8 | bounds: undefined,
9 | region: undefined,
10 | row: undefined,
11 | col: undefined
12 | },
13 | routes: undefined
14 | }),
15 | this.init = function() {
16 | let capture = captureScreen()
17 | let bitmap = capture.getBitmap()
18 | this.map.bounds = plugin.match(bitmap, this.map.template, this.map.region)
19 | if (this.map.bounds == undefined || this.map.bounds.w <= 100) {
20 | toast("初始化地图失败")
21 | }
22 | }
23 | this.acquireLevel = function() {
24 | if (this.map.template == undefined) {
25 | return null
26 | }
27 | click(Math.max(device.height, device.width) - 100, 100)
28 | sleep(200)
29 | if (this.map.bounds == undefined) {
30 | this.init()
31 | }
32 | let capture = captureScreen()
33 | let bitmap = capture.getBitmap()
34 | let current = plugin.match(bitmap, "common/position", this.map.region)
35 | console.info(JSON.stringify(this.map.bounds))
36 | console.info(JSON.stringify(current))
37 | if (!current || current.x == undefined) {
38 | toast("初始化地图失败,请联系开发者进行处理")
39 | return
40 | }
41 | debuger.refresh()
42 | debuger.add(current)
43 | debuger.add(this.map.bounds)
44 | let row = Math.ceil((current.y - this.map.bounds.y) / (this.map.bounds.h / this.map.row))
45 | let col = Math.ceil((current.x - this.map.bounds.x) / (this.map.bounds.w / this.map.col))
46 | //click(Math.max(device.height, device.width) - 100, 100)
47 | return (row - 1) * this.map.col + col
48 | },
49 | this.defaultRoute = function(level, objects) {},
50 | this.specialRoute = function(level, objects) {}
51 | }
52 |
53 | exports.createDungeons = (properties) => {
54 | return new Dungeons(properties)
55 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/scene/skill.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/game/scene/skill.js
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/storategy/storategy.js:
--------------------------------------------------------------------------------
1 | const Storategy = function(properties) {
2 | Object.assign(this, properties || {
3 | name: undefined,
4 | storategies: undefined
5 | }),
6 | this.fightStorategy = function(level) {
7 | let storategy = this.storategis[level]
8 | if (storategy == undefined) {
9 | return null
10 | }
11 | return storategy
12 | }
13 | }
14 | exports.createStorategy = (properties) => {
15 | return new Storategy(properties)
16 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/game/test.js:
--------------------------------------------------------------------------------
1 | const {debuger} = require("../common/debuger")
2 | const { plugin } = require("../common/utils")
3 | const { findClosest, findFarthest, suitableTarget } = require("../common/compute")
4 | const next = function(objects) {
5 | if (!objects || !objects["guidance"]) {
6 | console.info("未发现路标")
7 | return
8 | }
9 | let guidance = findFarthest(objects["coward"][0], objects["guidance"])
10 | if (objects["door"] && guidance) {
11 | let door = findClosest(guidance.target, objects["door"])
12 | console.info("箭头最近门:" + JSON.stringify(door))
13 | if (door.distance <= 300) {
14 | guidance = findClosest(objects["coward"][0], [door.target])
15 | } else {
16 | console.info("距离超过100")
17 | }
18 | }
19 | debuger.addLine({x1:guidance.p1.x,y1:guidance.p1.y,x2:guidance.p2.x,y2:guidance.p2.y})
20 | }
21 | exports.debug = function() {
22 | requestScreenCapture(true)
23 | for (let i = 0; i < 50; i++) {
24 | let capture = captureScreen()
25 | let bitmap = capture.getBitmap()
26 | let result = plugin.detect(bitmap, 0.8)
27 | console.info(JSON.stringify(result))
28 | debuger.refresh()
29 | for (let obj of result) {
30 | debuger.add(obj)
31 | }
32 | let objects = {}
33 | for (let obj of result) {
34 | if (objects[obj.label] == undefined) {
35 | objects[obj.label] = []
36 | }
37 | objects[obj.label].push(obj)
38 | }
39 | next(objects)
40 | sleep(200)
41 | }
42 | }
43 |
44 | exports.match = function() {
45 | requestScreenCapture(true)
46 | let capture = captureScreen()
47 | let bitmap = capture.getBitmap()
48 | debuger.refresh()
49 | for (let index = 1; index <= 9; index++) {
50 | let target = plugin.match(bitmap, "dungeons/buwanjia/" + index, [0.5, 1, 0, 0.5])
51 | console.info("识别到确认按钮:"+ index + "" + JSON.stringify(target))
52 | if (target != null) {
53 | debuger.add(target)
54 | break
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/分类.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/分类.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/失败.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/失败.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/播放.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/播放.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/播放中.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/播放中.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/设置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/设置.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/退出.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/退出.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/img/首页.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dnf/img/首页.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/main.js:
--------------------------------------------------------------------------------
1 | var utils = require("./common/utils")
2 | var { engine } = require("./game/engine")
3 |
4 | auto();
5 | utils.loadContent("boot")
6 | //主循环,保持进程不会关闭
7 | setInterval(() => engine.boot(), 100)
8 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dnf",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "launchConfig": {
8 | "hideLogs": true
9 | },
10 | "packageName": "com.xingxing.dnf",
11 | "versionName": "1.5.0",
12 | "versionCode": 5,
13 | "type": "module"
14 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/readme.md:
--------------------------------------------------------------------------------
1 | # 需要准备软件工具
2 | + XTerminal 终端连接工具,下载地址:https://xterminal.cn/
3 | + yolov
4 |
5 | # 刷图三要素
6 | + 场景(地图信息,精英怪位置)
7 | + 角色 (职业信息,维护角色状态,键位等信息)
8 | + 默认/具体执行策略 (可针对每个职业和地图以及操作进行编排)
9 |
10 |
11 |
12 | berserker
13 | unattachable_monsters
14 | attachable_monsters
15 | blocked_portal
16 | unblocked_portal
17 | direction_guidance
18 | rocker
19 | skill
20 | attack
21 | setting
22 | disabled_skill
23 | reward
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/view/debug.js:
--------------------------------------------------------------------------------
1 | // exports.view = () => {
2 | // "ui";
3 | // const view = ui.inflate(
4 | //
5 | //
6 | //
7 | //
8 | //
9 | // {/* */}
10 | //
11 | //
12 | //
13 | //
14 | //
15 | // 检测结果
16 | //
17 | //
18 | //
19 | //
20 | //
21 | // 执行结果
22 | //
23 | //
24 | //
25 | //
26 | //
27 | // 识别耗时
28 | //
29 | //
30 | //
31 | //
32 | //
33 | //
34 | // )
35 | // return view
36 | // }
37 | // exports.action = () => {
38 | // var socket = require("../common/socket")
39 | // var position = require("../common/position")
40 | // var game = require("../game/game")
41 | // var utils = require("../common/utils")
42 | // ui.sendDebugMsg.click(function(){
43 | // var filePath = ui.filePath.getText()
44 | // console.info(filePath)
45 | // ui.fileImg.attr("src", "file://" + filePath)
46 | // socket.send({
47 | // action: "debug-img-detection",
48 | // data: {
49 | // "filePath": String(filePath)
50 | // }
51 | // }, data => {
52 | // ui.post(() => {
53 | // ui.detectionResult.setText(data.objs)
54 | // ui.takeUpTime.setText(String(data.takeUpTime/1000000))
55 | // })
56 | // })
57 | // })
58 |
59 | // ui.screenshot.click(function(){
60 | // socket.send({
61 | // action: "screenshot"
62 | // }, data => {
63 | // console.info(data)
64 | // if (!data || !data.screenshot) {
65 | // return
66 | // }
67 | // position.analysis(data.screenshot)
68 | // console.info(position.detect(["角色"]))
69 | // var p = position.detect(["角色"])
70 | // if (p) {
71 | // click(p.x, p.y)
72 | // }
73 | // })
74 | // })
75 | // ui.resetSkill.click(function() {
76 | // // threads.start(() => {
77 | // // // for(var i = 0; i <= 20; i++) {
78 | // // // }
79 | // // sleep(10000)
80 | // // socket.send({
81 | // // action: "reset-skill"
82 | // // }, data => {
83 | // // console.info(data)
84 | // // })
85 | // // })
86 | // home()
87 | // game.open()
88 | // utils.async(
89 | // () => {},
90 | // () => {
91 | // game.enter()
92 | // game.start()
93 | // },
94 | // () => {},
95 | // 1000
96 | // )
97 | // })
98 | // }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/view/home.js:
--------------------------------------------------------------------------------
1 | // exports.view = () => {
2 | // "ui";
3 | // const view = ui.inflate(
4 | //
5 | //
6 | //
7 | // 角色职业
8 | //
9 | //
10 | //
11 | // 搬砖地图
12 | //
13 | //
14 | //
15 | // 自动分解
16 | //
17 | //
18 | //
19 | //
20 | //
21 | // 自动出售
22 | //
23 | //
24 | //
25 | //
26 | //
27 | // 启动日志
28 | //
29 | //
30 | //
31 | //
32 | //
33 | // )
34 | // return view
35 | // }
36 | // exports.action = () => {
37 | // var server = require("../common/socket")
38 | // var utils = require("../common/utils")
39 | // var player = require("../common/player")
40 | // utils.async(
41 | // () => ui.launch.setText("连接服务中..."),
42 | // () => server.connect(),
43 | // () => ui.launch.setText("启动"),
44 | // 500
45 | // )
46 | // ui.launch.click(function(){
47 | // home()
48 | // threads.start(() => {
49 | // sleep(2000)
50 | // player.play()
51 | // })
52 | // });
53 | // ui.debug.click(function(){
54 | // utils.loadView("debug")
55 | // });
56 | // }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/view/loading.js:
--------------------------------------------------------------------------------
1 | exports.view = () => {
2 | const view = ui.inflate(
3 |
4 |
5 |
6 |
7 | )
8 | return view
9 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dnf/view/update.js:
--------------------------------------------------------------------------------
1 | export function view() {
2 | const view = ui.inflate(
3 |
4 |
5 |
6 |
7 |
8 | )
9 | return view
10 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/float.js:
--------------------------------------------------------------------------------
1 | exports.show = () => {
2 | var w = floaty.window(
3 |
4 |
5 |
6 | );
7 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/img/播放.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dy/img/播放.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/img/播放中.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dy/img/播放中.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/img/退出.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/dy/img/退出.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/main.js:
--------------------------------------------------------------------------------
1 |
2 | "ui";
3 | ui.layout(
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | );
16 | ui.filepath.setText(files.getSdcardPath() + "/" + new Date().getTime() + ".csv")
17 | var search = (keyword) => {
18 | var search_input = id("com.ss.android.ugc.aweme:id/et_search_kw").findOne(5000)
19 | if (search_input == null) {
20 | console.info("为空")
21 | return
22 | }
23 | var search_input_b = search_input.bounds()
24 | click(search_input_b.centerX(), search_input_b.centerY());
25 | sleep(1000)
26 | setText(keyword)
27 | var search_btn = desc("搜索").findOne(5000)
28 | if (search_btn == null) {
29 | console.info("为空")
30 | return
31 | }
32 | var search_btn_b = search_btn.bounds()
33 | click(search_btn_b.centerX(), search_btn_b.centerY());
34 | sleep(3000)
35 | var search_item = className("com.lynx.tasm.behavior.ui.LynxFlattenUI").findOne(5000)
36 | var search_item_b = search_item.bounds()
37 | click(search_item_b.centerX(), search_item_b.centerY());
38 | var content = id("com.ss.android.ugc.aweme:id/quw").findOne(5000)
39 | if (content == null) {
40 | console.info("为空")
41 | return
42 | }
43 | sleep(2000)
44 | var img = captureScreen()
45 | let result = gmlkit.ocr(img, "zh");
46 | log(result.text)
47 | }
48 | var process= (keyword) => {
49 | text("抖音").findOne().click()
50 | search(keyword)
51 | }
52 | ui.start.click(function() {
53 | if (!requestScreenCapture()) {
54 | exit()
55 | }
56 | var keyword = ui.keyword.getText()
57 | home()
58 | threads.start(function(){
59 | process(keyword)
60 | });
61 | })
62 | // var w = floaty.window(
63 | //
64 | //
65 | //
66 | //
67 | //
68 | //
69 | //
70 | //
71 | //
72 | //
73 | //
74 | //
75 | //
76 | // );
77 | // w.filepath.setText(files.getSdcardPath() + "/" + new Date().getTime() + ".csv")
78 | // w.setSize(-2, -2);
79 | // w.start.click(() => {
80 | // var float = require("./float")
81 | // if (!requestScreenCapture()) {
82 | // toast('请求截图权限失败')
83 | // return
84 | // }
85 | // float.show()
86 | // w.close()
87 | // })
88 | // w.exit.click(() => {
89 | // w.close()
90 | // })
91 | // setInterval(() => {}, 100000)
--------------------------------------------------------------------------------
/webpack-autojs-master/work/dy/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "抖音采集",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "launchConfig": {
8 | "hideLogs": true
9 | },
10 | "packageName": "com.test.dy",
11 | "versionName": "1.0.0",
12 | "versionCode": 5
13 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/0.jpg
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/1.jpg
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/1.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/2.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/binary_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/binary_image.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/main.js:
--------------------------------------------------------------------------------
1 | let img = images.read("./2.png")
2 | //importClass(com.googlecode.tesseract.android.TessBaseAPI)
3 | //新建OCR实例
4 | //var tessocr = new TessBaseAPI()
5 | // 新增:自定义模型路径(必须是绝对路径), files.path() 将相对路径转为绝对路径
6 | //let myModelPath = files.path("./models");
7 | let start = new Date()
8 | // 识别图片中的文字,返回完整识别信息(兼容百度OCR格式)。
9 | let result = gmlkit.ocr(img, "zh")
10 | log('OCR识别耗时:' + (new Date() - start) + 'ms')
11 | toastLog("完整识别信息: " + JSON.stringify(result))
12 | //toastLog("文本识别信息: " + JSON.stringify(stringList))
13 |
14 | // 回收图片
15 | //img.recycle()
16 | // 释放native内存,非必要,供万一出现内存泄露时使用
17 | // paddle.release()
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/models/ch_PP-OCRv3_det_slim_infer.nb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/models/ch_PP-OCRv3_det_slim_infer.nb
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/models/ch_PP-OCRv3_rec_slim_infer.nb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/models/ch_PP-OCRv3_rec_slim_infer.nb
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/models/ch_ppocr_mobile_v2.0_cls_infer_opt.nb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/models/ch_ppocr_mobile_v2.0_cls_infer_opt.nb
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "abis": [
3 | "arm64-v8a",
4 | "armeabi-v7a",
5 | "x86",
6 | "x86_64"
7 | ],
8 | "assets": [
9 | {
10 | "form": "models",
11 | "to": "/models"
12 | }
13 | ],
14 | "buildDir": "build",
15 | "build": {
16 | "build_id": null,
17 | "build_number": 0,
18 | "build_time": 0
19 | },
20 | "useFeatures": [],
21 | "icon": null,
22 | "ignoredDirs": [],
23 | "launchConfig": {
24 | "displaySplash": false,
25 | "hideLauncher": false,
26 | "hideLogs": true,
27 | "stableMode": false,
28 | "volumeUpcontrol": false,
29 | "permissions": [],
30 | "serviceDesc": "使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。",
31 | "splashIcon": null,
32 | "splashText": "Powered by paddle ocr"
33 | },
34 | "libs": [
35 | "libtesseract.so",
36 | "libc++_shared.so",
37 | "libpaddle_light_api_shared.so",
38 | "libhiai.so",
39 | "libhiai_ir.so",
40 | "libhiai_ir_build.so",
41 | "libNative.so",
42 | "libjackpal-androidterm5.so",
43 | "libjackpal-termexec2.so"
44 | ],
45 |
46 | "main": "main.js",
47 | "name": "PaddleOCR",
48 | "outputPath": null,
49 | "packageName": "com.script.paddleocr.custommodel",
50 | "scripts": {},
51 | "signingConfig": {
52 | "alias": null,
53 | "keystore": null
54 | },
55 | "sourcePath": null,
56 | "versionCode": 1,
57 | "versionName": "1.0.0"
58 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/xframe_000245.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/xframe_000245.jpg
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/开始.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/开始.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/暂停.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/暂停.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/设置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/设置.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/ocr/退出.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xingxing-dd/dnf-script/1b331f3a6d954ddad568907e26a3777b538ffd71/webpack-autojs-master/work/ocr/退出.png
--------------------------------------------------------------------------------
/webpack-autojs-master/work/qq消息/main.js:
--------------------------------------------------------------------------------
1 | const { waitTime } = require("../../common/common");
2 | const common = require("../../common/common");
3 |
4 | var qqmsg={};
5 |
6 | function main(options){
7 | options=options||{};
8 | common.resetConsole();
9 | common.init(options);
10 | qqmsg.toLxr();
11 |
12 | }
13 | qqmsg.init =function(options){
14 |
15 |
16 |
17 | }
18 | qqmsg.toLxr=function(){
19 | common.openApp("QQ");
20 | waitTime(10,"等待qq启动")
21 | click('联系人')
22 | waitTime(1,"联系人")
23 | click('我的好友');
24 | waitTime(1,"联系人")
25 | click('好友');
26 | waitTime(3,"好友列表");
27 | var iconWgs = id("icon").find();
28 | console.log(iconWgs.length);
29 |
30 | for (let index = 0; index < iconWgs.length; index++) {
31 | const element = iconWgs[index];
32 | waitTime(3);
33 | element.click();
34 | console.log(element)
35 | }
36 | }
37 | main();
38 |
39 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/qq消息/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "qq消息",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "libs": [
8 | "libtesseract.so",
9 | "libpng.so",
10 | "libleptonica.so",
11 | "libjpeg.so",
12 | "libjackpal-androidterm5.so",
13 | "libjackpal-termexec2.so"
14 | ],
15 | "launchConfig": {
16 | "hideLogs": true
17 | },
18 | "packageName": "com.example.qqmsg",
19 | "versionName": "1.5.0",
20 | "versionCode": 5
21 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/test/runtime.js:
--------------------------------------------------------------------------------
1 | exports.instance = (m) => {
2 | return new Object({
3 | model: m,
4 | action: null,
5 | coward: null,
6 | monsters: [],
7 | stuffs: []
8 | })
9 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/test/test.js:
--------------------------------------------------------------------------------
1 | // var name = getAppName("info.xingxingdd.dnf");
2 | // console.info("应用名称:" + name)
3 | // var result = app.launch("info.xingxingdd.dnf")
4 | // console.info("启动结果" + result)
5 | // var result = app.startActivity({
6 | // packageName: "info.xingxingdd.dnf",
7 | // className: "info.xingxingdd.dnf.component.DnfServerActivity"
8 | // });
9 | // // app.sendBroadcast({
10 | // // action: "info.xingxingdd.dnf.START_SERVER"
11 | // // })
12 | // importPackage(Packages["okhttp3"]); //导入包
13 | // var client = new OkHttpClient.Builder().retryOnConnectionFailure(true).build();
14 | // var request = new Request.Builder().url("ws://127.0.0.1:5005").build(); //vscode 插件的ip地址,
15 | // client.dispatcher().cancelAll();//清理一次
16 | // myListener = {
17 | // onOpen: function (webSocket, response) {
18 | // webSocket.send("客户端连接");
19 | // },
20 | // onMessage: function (webSocket, msg) { //msg可能是字符串,也可能是byte数组,取决于服务器送的内容
21 | // print("msg");
22 | // print(msg);
23 | // },
24 | // onClosing: function (webSocket, code, response) {
25 | // print("正在关闭");
26 | // },
27 | // onClosed: function (webSocket, code, response) {
28 | // print("已关闭");
29 | // },
30 | // onFailure: function (webSocket, t, response) {
31 | // print("错误");
32 | // print( t);
33 | // }
34 | // }
35 |
36 | // var webSocket= client.newWebSocket(request, new WebSocketListener(myListener)); //创建链接
37 |
38 | // setInterval(() => { // 防止主线程退出
39 |
40 | // }, 1000);
41 | // "ui";
42 | // ui.layout(
43 | //
44 | //
45 | //
46 | // )
47 | // const view = ui.inflate(
48 | //
49 | //
50 | //
51 | // 角色职业
52 | //
53 | //
54 | //
55 | // 角色时装
56 | //
57 | //
58 | //
59 | // 搬砖地图
60 | //
61 | //
62 | //
63 | // 自动分解
64 | //
65 | //
66 | //
67 | //
68 | //
69 | // 自动出售
70 | //
71 | //
72 | //
73 | //
74 | //
75 | // 启动日志
76 | //
77 | //
78 | //
79 | //
80 | // )
81 | // ui.setContentView(view)
82 | // ui.ok.click(function(){
83 | // ui.finish()
84 | // var w = floaty.window(
85 | //
86 | // 悬浮文字
87 | //
88 | // );
89 | // setTimeout(()=>{
90 | // w.close();
91 | // }, 2000);
92 | // })
93 | // var w = floaty.rawWindow(
94 | //
95 | // );
96 |
97 | // w.setSize(-1, -1);
98 | // w.setTouchable(false);
99 | // setTimeout(()=>{
100 | // w.close();
101 | // }, 10000);
102 | // var x = 0
103 | // var y = 0
104 | // var paint = new Paint();
105 | // //设置画笔颜色为红色
106 | // paint.setStyle(android.graphics.Paint.Style.STROKE);
107 | // paint.setColor(colors.RED);
108 | // paint.setStrokeWidth(5);
109 | // //绘制一个从坐标(0, 0)到坐标(100, 100)的正方形
110 | // w.borad.on("draw", function(canvas) {
111 | // canvas.drawColor(0xFFFFFF, android.graphics.PorterDuff.Mode.CLEAR)
112 | // canvas.drawRect(x, y, x+100, x+100, paint);
113 | // })
114 | // for (var i = 0; i < 10; i++) {
115 | // sleep(500)
116 | // x = x + 100
117 | // y = y + 100
118 | // }
119 | // var Obj = function(age) {
120 | // return {
121 | // age: age,
122 | // setAge: function(t){
123 | // this.age = t
124 | // }
125 | // }
126 | // }
127 | // var obj = new Obj(2)
128 | // console.info(obj.age)
129 | // obj.setAge(10)
130 | // console.info(obj.age)
131 | requestScreenCapture();
132 | let dnfScriptPlugin = plugins.load("info.xingxingdd.dnf.script.plugin");
133 | let capture = captureScreen();
134 | let bitmap = capture.getBitmap()
135 | let start = new Date()
136 | let dresult = dnfScriptPlugin.detect(bitmap)
137 | console.log(JSON.stringify(dresult));
138 | log('检测耗时:' + (new Date() - start) + 'ms')
139 | // let result = dnfScriptPlugin.match(bitmap, "template/berserker/1", [0.7, 0.95, 0.85, 0.9])
140 | // console.log(JSON.stringify(result));
--------------------------------------------------------------------------------
/webpack-autojs-master/work/test/test2.js:
--------------------------------------------------------------------------------
1 | // let img = images.read("/storage/emulated/0/DCIM/Screenshots/Screenshot_2024-06-23-12-16-26-555_com.tencent.tmgp.dnf.jpg")
2 | // // PaddleOCR 移动端提供了两种模型:ocr_v2_for_cpu与ocr_v2_for_cpu(slim),此选项用于选择加载的模型,默认true使用v2的slim版(速度更快),false使用v2的普通版(准确率更高)
3 | // let useSlim = true
4 | // let start = new Date()
5 | // // 识别图片中的文字,返回完整识别信息(兼容百度OCR格式)。
6 | // let result = paddle.ocr(img, useSlim)
7 | // log('OCR识别耗时:' + (new Date() - start) + 'ms')
8 | // // 可以使用简化的调用命令,默认参数:cpuThreadNum = 4, useSlim = true
9 | // // const result = paddle.ocr(img)
10 | // toastLog("完整识别信息: " + JSON.stringify(result))
11 | // start = new Date()
12 | // // 识别图片中的文字,只返回文本识别信息(字符串列表)。当前版本可能存在文字顺序错乱的问题 建议先使用detect后自行排序
13 | // const stringList = paddle.ocrText(img, useSlim)
14 | // log('OCR纯文本识别耗时:' + (new Date() - start) + 'ms')
15 | // // 可以使用简化的调用命令,默认参数:cpuThreadNum = 4, useSlim = true
16 | // // const stringList = paddle.ocrText(img)
17 | // toastLog("文本识别信息: " + JSON.stringify(stringList))
18 |
19 | // // 回收图片
20 | // img.recycle()
21 |
22 |
23 | //右上角地图的位置
24 | click(1800, 120)
25 | sleep(500)
26 | //点击万年雪山
27 | click(880,88)
28 | sleep(10000)
29 | //选择等级
30 | click(200,300)
31 | sleep(200)
32 | //选择布万家
33 | click(1450, 850)
--------------------------------------------------------------------------------
/webpack-autojs-master/work/websocket/main.js:
--------------------------------------------------------------------------------
1 | importPackage(Packages["okhttp3"]);
2 | var client = new OkHttpClient.Builder().retryOnConnectionFailure(true).build();
3 |
4 | var request = new Request.Builder().url("ws://192.168.31.164:9317").build();
5 | client.dispatcher().cancelAll();//清理一次
6 | myListener = {
7 | onOpen: function (webSocket, response) {
8 | print("onOpen");
9 | var json = {};
10 | json.type="hello";
11 | json.data= {device_name:"模拟设备",client_version:123,app_version:123,app_version_code:"233"};
12 | var hello=JSON.stringify(json);
13 | webSocket.send(hello);
14 | },
15 | onMessage: function (webSocket, msg) {
16 | print("msg");
17 | print(msg);
18 | },
19 | onClosing: function (webSocket, code, reason) {
20 | print("正在关闭");
21 | },
22 | onClosed: function (webSocket, code, reason) {
23 | print("关闭");
24 | },
25 | onFailure: function (webSocket, t, response) {
26 | print("错误");
27 | print( t);
28 | }
29 | }
30 | var webSocket= client.newWebSocket(request, new WebSocketListener(myListener));
31 |
32 | setInterval(() => {
33 |
34 | }, 1000);
35 |
36 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/websocket/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "websocket",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "packageName": "com.example.websocket",
8 | "versionName": "1.7.0",
9 | "versionCode": 17
10 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/云控demo/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "云控demo",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "packageName": "com.example.demo",
8 | "versionName": "1.7.0",
9 | "versionCode": 17
10 | }
--------------------------------------------------------------------------------
/webpack-autojs-master/work/云控demo/test.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 这个是一个简单的云控 测试demo,可以在本地运行,也可以在远端运行。
4 | * 即应用商店 按照下面的实例写的功能,将能完美的一次性控制多台手机
5 | *
6 | */
7 |
8 | var user = {
9 | name: '张三'
10 | }; //定义一个简单对象
11 |
12 | /**
13 | * 定义主函数,入口函数,
14 | * @param {*} options 服务器端穿过来的参数,
15 | * 在本地测试的是 options 是没有值的。
16 | *
17 | */
18 | function main(options) {
19 | options = options || {};
20 | console.show();
21 | let key=options.key||'touke....'
22 | console.log('options---->',options)
23 | console.log('key---->',key)
24 | console.log(user);
25 | }
26 | //
27 | main();
--------------------------------------------------------------------------------
/webpack-autojs-master/work/快捷输入/main.js:
--------------------------------------------------------------------------------
1 | "ui";
2 |
3 | ui.layout(
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | );
25 | var common = require("../../common/common.js");
26 | const { resetConsole } = require("../../common/common.js");
27 | var filePath = "/sdcard/Download/";
28 | var storage = storages.create("com.example.kjsr");
29 | var totalhs = storage.get("totalhs", 3);
30 | var appName = storage.get("appName", "抖音");
31 | ui.totalhs.setText(totalhs + "");
32 | ui.app.setText(appName);
33 | ui.hs.click(function () {
34 | toast("打开wps,表情编辑话术");
35 | launch("cn.wps.moffice_eng");
36 | totalhs = Number(ui.totalhs.text());
37 | storage.put("totalhs", totalhs);
38 | hszs();
39 | });
40 | ui.openapp.click(function () {
41 | var appName = ui.app.text();
42 | threads.start(function () {
43 | // resetConsole();
44 | readhss();
45 | launchApp(appName);
46 | storage.put("appName", appName);
47 | floatyWindow();
48 | });
49 | });
50 | function hszs() {
51 | threads.start(function () {
52 | for (var index = 0; index <= totalhs; index++) {
53 | common.checkFile(filePath + "hs" + index + ".txt");
54 | }
55 | })
56 | }
57 | function floatyWindow() {
58 | var window = floaty.window(
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | );
69 | window.setPosition(device.width * 0.1, device.height * 0.5);
70 | window.exitOnClose();
71 | window.actions.setDataSource(initKeys());
72 | window.actions.on("item_bind", function (itemView, itemHolder) {
73 | itemView.action.on("click", function () {
74 | var text = itemHolder.item.key;
75 | log(text)
76 | threads.start(function () {
77 | if (text != "del") {
78 | var txt = geths(text);
79 | var edwg = className("android.widget.EditText").findOnce()
80 | if (edwg != null) {
81 | if (edwg.text() != "发送消息...") {
82 | txt = edwg.text() + txt;
83 | }
84 | ui.run(() => {
85 | edwg.setText(txt);
86 | })
87 | }
88 | } else {
89 | var edwg = className("android.widget.EditText").findOnce()
90 | if (edwg != null) {
91 | ui.run(() => {
92 | edwg.setText(" ");
93 | })
94 | }
95 | }
96 | });
97 | });
98 | });
99 | window.tu.click(() => {
100 | window.setAdjustEnabled(!window.isAdjustEnabled());
101 | return true;
102 | });
103 | var yc = false;
104 | window.yc.click(() => {
105 | yc = !yc;
106 | if (yc) {
107 | ui.run(function () {
108 | window.actions.setDataSource([]);
109 | })
110 | } else {
111 | ui.run(function () {
112 | window.actions.setDataSource(initKeys());
113 | })
114 | }
115 | });
116 | }
117 | function initKeys() {
118 | var arr = [];
119 | for (var index = 0; index <= totalhs; index++) {
120 | arr.push({ key: index });
121 | }
122 | arr.push({ key: 'del' });
123 | return arr;
124 | }
125 | function geths(index) {
126 | log(parseInt(index))
127 | log(hss[parseInt(index)]);
128 | return zuhehs(parseInt(index));
129 | }
130 | function randomHs(hs) {
131 | var rs = hs[random(0, hs.length - 1)];
132 | if (rs == "" || rs == null) {
133 | rs = "话术文1件没有内容";
134 | }
135 | return rs;
136 | }
137 | function zuhehs(index) { //组合话术
138 | var result = randomHs(hss[index]);
139 | return result;
140 | }
141 | var hss = [];
142 | function readhss() { //读取话术
143 | var filePath = "/sdcard/Download/";
144 | for (var index = 0; index <= totalhs; index++) {
145 | var bqhss = common.readlines(filePath + "hs" + index + ".txt");
146 | log(bqhss);
147 | hss.push(bqhss);
148 | }
149 | }
150 | setInterval(
151 | function () {
152 | }, 1000
153 | )
154 |
--------------------------------------------------------------------------------
/webpack-autojs-master/work/快捷输入/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "快捷输入",
3 | "main": "main.js",
4 | "ignore": [
5 | "build"
6 | ],
7 | "launchConfig": {
8 | "hideLogs": true
9 | },
10 | "packageName": "com.example.kjsr",
11 | "versionName": "1.5.0",
12 | "versionCode": 5
13 | }
--------------------------------------------------------------------------------