ms-types 0.9.38 → 0.9.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/types/hid.d.ts +7 -0
- package/types/image.d.ts +27 -0
- package/types/lua/hid.lua +5 -0
- package/types/lua/image.lua +7 -0
- package/types/lua/yolo.lua +2 -2
- package/types/yolo.d.ts +1 -1
- package/types/zh/HID/346/250/241/345/235/227.d.ts +7 -0
- package/types/zh/YOLO/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-types",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"vitepress": "^1.6.4",
|
|
20
20
|
"vitepress-theme-teek": "^1.6.2",
|
|
21
|
-
"wrangler": "^4.
|
|
21
|
+
"wrangler": "^4.125.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/types/hid.d.ts
CHANGED
|
@@ -117,6 +117,13 @@ declare namespace hid {
|
|
|
117
117
|
*/
|
|
118
118
|
function setActionDelay(milliseconds: number): boolean;
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* 设置移动完成后的等待毫秒。不调用时固件默认 40ms。
|
|
122
|
+
* @param milliseconds 0 关闭等待,大于 0 覆盖为指定毫秒,小于 0 恢复默认
|
|
123
|
+
* @returns 操作是否成功
|
|
124
|
+
*/
|
|
125
|
+
function setMoveDelay(milliseconds: number): boolean;
|
|
126
|
+
|
|
120
127
|
/**
|
|
121
128
|
* 移动指定坐标
|
|
122
129
|
* @param x 移动坐标的X轴
|
package/types/image.d.ts
CHANGED
|
@@ -293,6 +293,33 @@ declare namespace image {
|
|
|
293
293
|
/** 仅 method=99 返回:命中时模板的纵向缩放比例 */
|
|
294
294
|
scaleY?: number;
|
|
295
295
|
}[];
|
|
296
|
+
/**
|
|
297
|
+
* 按 kjst 模板找图
|
|
298
|
+
* @param imageId 图片id,通常为 `"screen"`
|
|
299
|
+
* @param kjstPath res 下的 kjst 文件名,不要带 `res/` 前缀
|
|
300
|
+
* @returns 矩形数组,坐标已换算到传入图片(`screen` 即屏幕)像素,可直接 click;OCR 命中额外含 `text`
|
|
301
|
+
* @example
|
|
302
|
+
* const hits = image.findImageEx("screen", "login.kjst")
|
|
303
|
+
* if (hits.length > 0) {
|
|
304
|
+
* logi(hits[0].x, hits[0].y)
|
|
305
|
+
* }
|
|
306
|
+
*/
|
|
307
|
+
function findImageEx(
|
|
308
|
+
imageId: string,
|
|
309
|
+
kjstPath: string,
|
|
310
|
+
): {
|
|
311
|
+
index: number;
|
|
312
|
+
x: number;
|
|
313
|
+
y: number;
|
|
314
|
+
width: number;
|
|
315
|
+
height: number;
|
|
316
|
+
confidence: number;
|
|
317
|
+
centerX: number;
|
|
318
|
+
centerY: number;
|
|
319
|
+
ex: number;
|
|
320
|
+
ey: number;
|
|
321
|
+
text?: string;
|
|
322
|
+
}[];
|
|
296
323
|
/**
|
|
297
324
|
* 裁剪图片
|
|
298
325
|
* @param imageId 图片id
|
package/types/lua/hid.lua
CHANGED
|
@@ -50,6 +50,11 @@ function _HID.setJitterValue(value) end
|
|
|
50
50
|
--- @return boolean 成功
|
|
51
51
|
function _HID.setActionDelay(milliseconds) return true end
|
|
52
52
|
|
|
53
|
+
--- 设置移动完成后的等待毫秒。不调用时固件默认 40ms。
|
|
54
|
+
--- @param milliseconds integer 0 关闭等待,大于 0 覆盖毫秒,小于 0 恢复默认
|
|
55
|
+
--- @return boolean 成功
|
|
56
|
+
function _HID.setMoveDelay(milliseconds) return true end
|
|
57
|
+
|
|
53
58
|
--- 移动
|
|
54
59
|
--- @param x integer
|
|
55
60
|
--- @param y integer
|
package/types/lua/image.lua
CHANGED
|
@@ -23,6 +23,7 @@ local _Image = {}
|
|
|
23
23
|
---@field ey integer 右下角y坐标
|
|
24
24
|
---@field scaleX number|nil 仅 method=99:命中时模板横向缩放
|
|
25
25
|
---@field scaleY number|nil 仅 method=99:命中时模板纵向缩放
|
|
26
|
+
---@field text string|nil OCR 命中文字
|
|
26
27
|
|
|
27
28
|
---@class FindImageOptions
|
|
28
29
|
---@field scaleFactors number[]|nil 仅 method=99:模板缩放比例列表
|
|
@@ -144,6 +145,12 @@ function _Image.cmpColor(id, points, threshold) return true end
|
|
|
144
145
|
function _Image.findImage(id, templateImageId, x, y, ex, ey, threshold, limit,
|
|
145
146
|
method, rgb, options) return {} end
|
|
146
147
|
|
|
148
|
+
--- 按 kjst 模板找图
|
|
149
|
+
--- @param id string 图片ID,通常为 screen
|
|
150
|
+
--- @param kjstPath string res 下的 kjst 文件名
|
|
151
|
+
--- @return Rect[] 结果矩形,坐标已换算到传入图(screen 即屏幕)像素,可直接 click;OCR 命中含 text
|
|
152
|
+
function _Image.findImageEx(id, kjstPath) return {} end
|
|
153
|
+
|
|
147
154
|
--- 多点找色
|
|
148
155
|
--- @param id string 图片ID
|
|
149
156
|
--- @param firstColor string 首色 "#RRGGBB" 或 "#RRGGBB"
|
package/types/lua/yolo.lua
CHANGED
|
@@ -14,11 +14,11 @@ local _Yolo = {}
|
|
|
14
14
|
---@field confidence number 置信度
|
|
15
15
|
---@field classId integer 类别 ID
|
|
16
16
|
|
|
17
|
-
--- 加载 YOLO 模型(版本 8/11/26)
|
|
17
|
+
--- 加载 YOLO 模型(版本 5/8/11/26)
|
|
18
18
|
--- @param paramPath string ncnn param 路径
|
|
19
19
|
--- @param binPath string ncnn bin 路径
|
|
20
20
|
--- @param nc integer|nil 标签数量;传 0 或省略时按模型输出推断
|
|
21
|
-
--- @param version integer|nil 模型版本,缺省 0 按 v11
|
|
21
|
+
--- @param version integer|nil 模型版本,缺省 0 按 v11 处理;5 为官方 YOLOv5 6.0/6.2/7.0,兼容官方 export 单输出和三头原始特征
|
|
22
22
|
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
23
23
|
--- @return string|nil 模型ID(失败返回 nil)
|
|
24
24
|
function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
|
package/types/yolo.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare namespace yolo {
|
|
|
52
52
|
* @param paramPath ncnn模型的param文件的绝对路径
|
|
53
53
|
* @param binPath ncnn模型的bin文件绝对路径
|
|
54
54
|
* @param nc 模型的标签数量;传 0 或省略时根据模型输出自动推断,显式传入但不匹配时检测返回空数组
|
|
55
|
-
* @param version 模型版本,默认11, 支持 8 11 26
|
|
55
|
+
* @param version 模型版本,默认11, 支持 5 8 11 26。5 为官方 YOLOv5 6.0/6.2/7.0,兼容官方 export 单输出和三头原始特征
|
|
56
56
|
* @param useGpu 是否使用 GPU 加载
|
|
57
57
|
* @returns 加载成功返回模型ID字符串,失败返回null
|
|
58
58
|
* @example
|
|
@@ -119,6 +119,13 @@ declare namespace $HID {
|
|
|
119
119
|
*/
|
|
120
120
|
function 设置动作延迟(毫秒: 数字): 布尔值;
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* 设置移动完成后的等待毫秒。不调用时固件默认 40ms。
|
|
124
|
+
* @param 毫秒 0 关闭等待,大于 0 覆盖毫秒,小于 0 恢复默认
|
|
125
|
+
* @returns 操作是否成功
|
|
126
|
+
*/
|
|
127
|
+
function 设置移动延迟(毫秒: 数字): 布尔值;
|
|
128
|
+
|
|
122
129
|
/**
|
|
123
130
|
* 移动指定坐标
|
|
124
131
|
* @param 坐标x 移动坐标的X轴
|
|
@@ -55,7 +55,7 @@ declare namespace $YOLO {
|
|
|
55
55
|
* @param ncnn模型的param文件路径 ncnn模型的param文件的绝对路径
|
|
56
56
|
* @param ncnn模型的bin文件路径 ncnn模型的bin文件绝对路径
|
|
57
57
|
* @param 标签数量 模型的标签数量;传 0 或省略时根据模型输出自动推断,显式传入但不匹配时检测返回空数组
|
|
58
|
-
* @param 模型版本 模型版本,默认11, 支持 8 11 26
|
|
58
|
+
* @param 模型版本 模型版本,默认11, 支持 5 8 11 26。5 为官方 YOLOv5 6.0/6.2/7.0,兼容官方 export 单输出和三头原始特征
|
|
59
59
|
* @param useGpu 是否使用 GPU 加载
|
|
60
60
|
* @returns 加载成功返回模型ID字符串,失败返回null
|
|
61
61
|
* @example
|
|
@@ -291,6 +291,33 @@ declare namespace $图片 {
|
|
|
291
291
|
/** 仅方法=99 返回:命中时模板的纵向缩放比例 */
|
|
292
292
|
scaleY?: 数字;
|
|
293
293
|
}[];
|
|
294
|
+
/**
|
|
295
|
+
* 按 kjst 模板找图
|
|
296
|
+
* @param 图片ID 图片id,通常为 `"screen"`
|
|
297
|
+
* @param kjst路径 res 下的 kjst 文件名,不要带 `res/` 前缀
|
|
298
|
+
* @returns 矩形数组,坐标已换算到传入图片(`screen` 即屏幕)像素,可直接点击;OCR 命中额外含 `text`
|
|
299
|
+
* @example
|
|
300
|
+
* const 命中 = $图片.找图Ex("screen", "login.kjst")
|
|
301
|
+
* if (命中.length > 0) {
|
|
302
|
+
* $打印信息日志(命中[0].x, 命中[0].y)
|
|
303
|
+
* }
|
|
304
|
+
*/
|
|
305
|
+
function 找图Ex(
|
|
306
|
+
图片ID: 字符串,
|
|
307
|
+
kjst路径: 字符串,
|
|
308
|
+
): {
|
|
309
|
+
index: 数字;
|
|
310
|
+
x: 数字;
|
|
311
|
+
y: 数字;
|
|
312
|
+
width: 数字;
|
|
313
|
+
height: 数字;
|
|
314
|
+
confidence: 数字;
|
|
315
|
+
centerX: 数字;
|
|
316
|
+
centerY: 数字;
|
|
317
|
+
ex: 数字;
|
|
318
|
+
ey: 数字;
|
|
319
|
+
text?: 字符串;
|
|
320
|
+
}[];
|
|
294
321
|
/**
|
|
295
322
|
* 裁剪图片
|
|
296
323
|
* @param 图片ID
|