@bettergi/types 0.1.0 → 0.1.1

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.
@@ -51,7 +51,9 @@ declare global {
51
51
  * 设置战斗策略路径
52
52
  * @param strategyName 策略名称
53
53
  */
54
- setCombatStrategyPath(strategyName?: string): void;
54
+ setCombatStrategyPath(strategyName: string): void;
55
+ // overload
56
+ setCombatStrategyPath(strategyName: string | null): void;
55
57
 
56
58
  /**
57
59
  * 设置使用树脂优先级
@@ -72,7 +72,9 @@ declare global {
72
72
  * 设置战斗策略路径
73
73
  * @param strategyName 战斗策略名称
74
74
  */
75
- setCombatStrategyPath(strategyName?: string): void;
75
+ setCombatStrategyPath(strategyName: string): void;
76
+ // overload
77
+ setCombatStrategyPath(strategyName: string | null): void;
76
78
 
77
79
  /** 设置默认值 */
78
80
  setDefault(): void;
@@ -30,11 +30,19 @@ declare global {
30
30
  * @param successAction 识别成功回调
31
31
  * @param failAction 识别失败回调
32
32
  */
33
- find: (
33
+ find(
34
+ ro: BetterGenshinImpact.Core.Recognition.RecognitionObject
35
+ ): BetterGenshinImpact.GameTask.Model.Area.Region;
36
+ // overload
37
+ find(
34
38
  ro: BetterGenshinImpact.Core.Recognition.RecognitionObject,
35
- successAction?: (region: BetterGenshinImpact.GameTask.Model.Area.Region) => void,
36
- failAction?: () => void
37
- ) => BetterGenshinImpact.GameTask.Model.Area.Region;
39
+ successAction: ((region: BetterGenshinImpact.GameTask.Model.Area.Region) => void) | null
40
+ ): BetterGenshinImpact.GameTask.Model.Area.Region;
41
+ find(
42
+ ro: BetterGenshinImpact.Core.Recognition.RecognitionObject,
43
+ successAction: ((region: BetterGenshinImpact.GameTask.Model.Area.Region) => void) | null,
44
+ failAction: (() => void) | null
45
+ ): BetterGenshinImpact.GameTask.Model.Area.Region;
38
46
 
39
47
  /**
40
48
  * 在本区域内查找识别对象,返回所有找到的结果
@@ -43,21 +51,50 @@ declare global {
43
51
  * @param failAction 识别失败回调
44
52
  * @returns
45
53
  */
46
- findMulti: (
54
+ findMulti(
55
+ ro: BetterGenshinImpact.Core.Recognition.RecognitionObject
56
+ ): System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>;
57
+ // overload
58
+ findMulti(
59
+ ro: BetterGenshinImpact.Core.Recognition.RecognitionObject,
60
+ successAction:
61
+ | ((
62
+ regions: System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>
63
+ ) => void)
64
+ | null
65
+ ): System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>;
66
+ findMulti(
47
67
  ro: BetterGenshinImpact.Core.Recognition.RecognitionObject,
48
- successAction?: (
49
- regions: System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>
50
- ) => void,
51
- failAction?: () => void
52
- ) => System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>;
68
+ successAction:
69
+ | ((
70
+ regions: System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>
71
+ ) => void)
72
+ | null,
73
+ failAction: (() => void) | null
74
+ ): System.Collections.Generic.List<BetterGenshinImpact.GameTask.Model.Area.Region>;
53
75
 
76
+ constructor(mat: Mat, x: number, y: number);
77
+ constructor(
78
+ mat: Mat,
79
+ x: number,
80
+ y: number,
81
+ owner: BetterGenshinImpact.GameTask.Model.Area.Region | null
82
+ );
83
+ // overload
84
+ constructor(
85
+ mat: Mat,
86
+ x: number,
87
+ y: number,
88
+ owner: BetterGenshinImpact.GameTask.Model.Area.Region | null,
89
+ converter: BetterGenshinImpact.GameTask.Model.Area.Converter.INodeConverter | null
90
+ );
54
91
  constructor(
55
92
  mat: Mat,
56
93
  x: number,
57
94
  y: number,
58
- owner?: BetterGenshinImpact.GameTask.Model.Area.Region,
59
- converter?: BetterGenshinImpact.GameTask.Model.Area.Converter.INodeConverter,
60
- drawContent?: BetterGenshinImpact.View.Drawable.DrawContent
95
+ owner: BetterGenshinImpact.GameTask.Model.Area.Region | null,
96
+ converter: BetterGenshinImpact.GameTask.Model.Area.Converter.INodeConverter | null,
97
+ drawContent: BetterGenshinImpact.View.Drawable.DrawContent | null
61
98
  );
62
99
  }
63
100
  }
@@ -66,62 +66,96 @@ declare global {
66
66
  moveTo(x: number, y: number, w: number, h: number): void;
67
67
 
68
68
  /** 绘制当前区域 */
69
- drawSelf(name: string, pen?: System.Drawing.Pen): void;
69
+ drawSelf(name: string): void;
70
+ // overload
71
+ drawSelf(name: string, pen: System.Drawing.Pen | null): void;
70
72
 
71
73
  /** 绘制矩形区域 */
74
+ drawRect(x: number, y: number, w: number, h: number, name: string): void;
75
+ // overload
72
76
  drawRect(
73
77
  x: number,
74
78
  y: number,
75
79
  w: number,
76
80
  h: number,
77
81
  name: string,
78
- pen?: System.Drawing.Pen
82
+ pen: System.Drawing.Pen | null
79
83
  ): void;
80
84
 
81
85
  /** 绘制矩形区域 */
82
- drawRect(rect: Rect, name: string, pen?: System.Drawing.Pen): void;
86
+ drawRect(rect: Rect, name: string): void;
87
+ // overload
88
+ drawRect(rect: Rect, name: string, pen: System.Drawing.Pen | null): void;
83
89
 
84
90
  /** 将 [当前区域] 转换成 [遮罩窗口绘制矩形] */
91
+ selfToRectDrawable(name: string): BetterGenshinImpact.View.Drawable.RectDrawable;
92
+ // overload
85
93
  selfToRectDrawable(
86
94
  name: string,
87
- pen?: System.Drawing.Pen
95
+ pen: System.Drawing.Pen | null
88
96
  ): BetterGenshinImpact.View.Drawable.RectDrawable;
89
97
 
90
98
  /** 将 [区域] 转换成 [遮罩窗口绘制矩形] */
99
+ toRectDrawable(rect: Rect, name: string): BetterGenshinImpact.View.Drawable.RectDrawable;
100
+ // overload
91
101
  toRectDrawable(
92
102
  rect: Rect,
93
103
  name: string,
94
- pen?: System.Drawing.Pen
104
+ pen: System.Drawing.Pen | null
95
105
  ): BetterGenshinImpact.View.Drawable.RectDrawable;
96
106
 
97
107
  /** 将 [区域] 转换成 [遮罩窗口绘制矩形] */
108
+ toRectDrawable(
109
+ x: number,
110
+ y: number,
111
+ w: number,
112
+ h: number,
113
+ name: string
114
+ ): BetterGenshinImpact.View.Drawable.RectDrawable;
115
+ // overload
98
116
  toRectDrawable(
99
117
  x: number,
100
118
  y: number,
101
119
  w: number,
102
120
  h: number,
103
121
  name: string,
104
- pen?: System.Drawing.Pen
122
+ pen: System.Drawing.Pen | null
105
123
  ): BetterGenshinImpact.View.Drawable.RectDrawable;
106
124
 
107
125
  /** 将 [直线] 转换成 [遮罩窗口绘制直线] */
126
+ toLineDrawable(
127
+ x1: number,
128
+ y1: number,
129
+ x2: number,
130
+ y2: number,
131
+ name: string
132
+ ): BetterGenshinImpact.View.Drawable.LineDrawable;
133
+ // overload
108
134
  toLineDrawable(
109
135
  x1: number,
110
136
  y1: number,
111
137
  x2: number,
112
138
  y2: number,
113
139
  name: string,
114
- pen?: System.Drawing.Pen
140
+ pen: System.Drawing.Pen | null
115
141
  ): BetterGenshinImpact.View.Drawable.LineDrawable;
116
142
 
117
143
  /** 绘制直线 */
144
+ drawLine(
145
+ x1: number,
146
+ y1: number,
147
+ x2: number,
148
+ y2: number,
149
+ name: string
150
+ ): BetterGenshinImpact.View.Drawable.LineDrawable;
151
+ // overload
118
152
  drawLine(
119
153
  x1: number,
120
154
  y1: number,
121
155
  x2: number,
122
156
  y2: number,
123
157
  name: string,
124
- pen?: System.Drawing.Pen
158
+ pen: System.Drawing.Pen | null
125
159
  ): BetterGenshinImpact.View.Drawable.LineDrawable;
126
160
 
127
161
  /** 将当前区域的截图转换成矩形类型的区域 */
@@ -177,13 +211,22 @@ declare global {
177
211
 
178
212
  constructor();
179
213
 
214
+ constructor(x: number, y: number, width: number, height: number);
215
+ // overload
216
+ constructor(
217
+ x: number,
218
+ y: number,
219
+ width: number,
220
+ height: number,
221
+ owner: BetterGenshinImpact.GameTask.Model.Area.Region | null
222
+ );
180
223
  constructor(
181
224
  x: number,
182
225
  y: number,
183
226
  width: number,
184
227
  height: number,
185
- owner?: BetterGenshinImpact.GameTask.Model.Area.Region,
186
- converter?: BetterGenshinImpact.GameTask.Model.Area.Converter.INodeConverter
228
+ owner: BetterGenshinImpact.GameTask.Model.Area.Region | null,
229
+ converter: BetterGenshinImpact.GameTask.Model.Area.Converter.INodeConverter | null
187
230
  );
188
231
  }
189
232
  }
@@ -16,9 +16,11 @@ declare global {
16
16
  /** 区域面积是否为空 */
17
17
  isEmpty: boolean;
18
18
 
19
- constructor(rect: Rect, pen?: System.Drawing.Pen, name?: string);
20
-
21
- constructor(rect: Rect, name?: string);
19
+ constructor(rect: Rect);
20
+ // overload
21
+ constructor(rect: Rect, name: string | null);
22
+ constructor(rect: Rect, pen: System.Drawing.Pen | null);
23
+ constructor(rect: Rect, pen: System.Drawing.Pen | null, name: string | null);
22
24
  }
23
25
  }
24
26
  }
@@ -25,14 +25,18 @@ declare global {
25
25
  asReadOnly(): System.Collections.Generic.IReadOnlyList<T>;
26
26
 
27
27
  /** @deprecated Not yet supported */
28
- binarySearch(item: T, comparer?: (a: T, b: T) => number): number;
28
+ binarySearch(item: T): number;
29
+ // overload
30
+ binarySearch(item: T, comparer: ((a: T, b: T) => number) | null): number;
29
31
 
30
32
  /** @deprecated Not yet supported */
33
+ binarySearch(index: number, count: number, item: T): number;
34
+ // overload
31
35
  binarySearch(
32
36
  index: number,
33
37
  count: number,
34
38
  item: T,
35
- comparer?: (a: T, b: T) => number
39
+ comparer: ((a: T, b: T) => number) | null
36
40
  ): number;
37
41
 
38
42
  clear(): void;
@@ -45,9 +45,13 @@ declare global {
45
45
  * @param soloTask 独立任务
46
46
  * @since 0.45.1
47
47
  */
48
+ function runTask(
49
+ soloTask: BetterGenshinImpact.Core.Script.Dependence.Model.SoloTask
50
+ ): Promise<void>;
51
+ // overload
48
52
  function runTask(
49
53
  soloTask: BetterGenshinImpact.Core.Script.Dependence.Model.SoloTask,
50
- customCt?: System.Threading.CancellationToken
54
+ customCt: System.Threading.CancellationToken | null
51
55
  ): Promise<void>;
52
56
 
53
57
  /**
@@ -67,9 +71,13 @@ declare global {
67
71
  * @param param 秘境任务参数
68
72
  * @since 0.52.0
69
73
  */
74
+ function runAutoDomainTask(
75
+ param: BetterGenshinImpact.GameTask.AutoDomain.AutoDomainParam
76
+ ): Promise<void>;
77
+ // overload
70
78
  function runAutoDomainTask(
71
79
  param: BetterGenshinImpact.GameTask.AutoDomain.AutoDomainParam,
72
- customCt?: System.Threading.CancellationToken
80
+ customCt: System.Threading.CancellationToken | null
73
81
  ): Promise<void>;
74
82
 
75
83
  /**
@@ -77,9 +85,13 @@ declare global {
77
85
  * @param param 战斗任务参数
78
86
  * @since 0.52.0
79
87
  */
88
+ function runAutoFightTask(
89
+ param: BetterGenshinImpact.GameTask.AutoFight.AutoFightParam
90
+ ): Promise<void>;
91
+ // overload
80
92
  function runAutoFightTask(
81
93
  param: BetterGenshinImpact.GameTask.AutoFight.AutoFightParam,
82
- customCt?: System.Threading.CancellationToken
94
+ customCt: System.Threading.CancellationToken | null
83
95
  ): Promise<void>;
84
96
  }
85
97
  }
@@ -79,7 +79,9 @@ declare global {
79
79
  * @param forceCountry 强制指定移动大地图时先切换的国家(默认值:无)
80
80
  * @since 0.44.2
81
81
  */
82
- function moveMapTo(x: number, y: number, forceCountry?: Area): Promise<void>;
82
+ function moveMapTo(x: number, y: number): Promise<void>;
83
+ // overload
84
+ function moveMapTo(x: number, y: number, forceCountry: Area | null): Promise<void>;
83
85
 
84
86
  /**
85
87
  * 移动[指定大地图]到指定坐标
@@ -89,11 +91,13 @@ declare global {
89
91
  * @param forceCountry 强制指定移动大地图时先切换的国家(默认值:无)
90
92
  * @since 0.44.9
91
93
  */
94
+ function moveIndependentMapTo(x: number, y: number, mapName: BigMap): Promise<void>;
95
+ // overload
92
96
  function moveIndependentMapTo(
93
97
  x: number,
94
98
  y: number,
95
99
  mapName: BigMap,
96
- forceCountry?: Area
100
+ forceCountry: Area | null
97
101
  ): Promise<void>;
98
102
 
99
103
  /**
@@ -142,7 +146,9 @@ declare global {
142
146
  * @param cacheTimeMs 缓存时间(毫秒,默认值:900)
143
147
  * @since 0.44.9
144
148
  */
145
- function getPositionFromMap(mapName: BigMap, cacheTimeMs?: number): Point2f;
149
+ function getPositionFromMap(mapName: BigMap): Point2f;
150
+ // overload
151
+ function getPositionFromMap(mapName: BigMap, cacheTimeMs: number | null): Point2f;
146
152
 
147
153
  /**
148
154
  * 获取当前在小地图上的 [指定大地图] 位置坐标(仅在给定坐标附近匹配)
@@ -179,10 +185,13 @@ declare global {
179
185
  * @param isOrange 是否为橙色选项(默认值:false)
180
186
  * @since 0.37.4
181
187
  */
188
+ function chooseTalkOption(option: string): Promise<void>;
189
+ // overload
190
+ function chooseTalkOption(option: string, skipTimes: number | null): Promise<void>;
182
191
  function chooseTalkOption(
183
192
  option: string,
184
- skipTimes?: number,
185
- isOrange?: boolean
193
+ skipTimes: number | null,
194
+ isOrange: boolean | null
186
195
  ): Promise<void>;
187
196
 
188
197
  /**
@@ -37,7 +37,9 @@ declare global {
37
37
  * @param dpi - DPI(默认值:1)
38
38
  * @since 0.34.5
39
39
  */
40
- function setGameMetrics(w: number, h: number, dpi?: number): void;
40
+ function setGameMetrics(w: number, h: number): void;
41
+ // overload
42
+ function setGameMetrics(w: number, h: number, dpi: number | null): void;
41
43
 
42
44
  /**
43
45
  * 相对当前鼠标位置移动光标
package/modules/http.d.ts CHANGED
@@ -9,11 +9,14 @@ declare global {
9
9
  * @param headersJson 请求头(可选)
10
10
  * @since 0.52.0
11
11
  */
12
+ function request(method: HttpMethod, url: string): Promise<HttpReponse>;
13
+ // overload
14
+ function request(method: HttpMethod, url: string, body: string | null): Promise<HttpReponse>;
12
15
  function request(
13
16
  method: HttpMethod,
14
17
  url: string,
15
- body?: string,
16
- headersJson?: string
18
+ body: string | null,
19
+ headersJson: string | null
17
20
  ): Promise<HttpReponse>;
18
21
  }
19
22
  }
package/modules/log.d.ts CHANGED
@@ -7,7 +7,7 @@ declare global {
7
7
  * @param args 占位参数
8
8
  * @since 0.32.0
9
9
  */
10
- function debug(message?: string, ...args: any[]): void;
10
+ function debug(message: string, ...args: any[]): void;
11
11
 
12
12
  /**
13
13
  * 输出提示信息
@@ -15,7 +15,7 @@ declare global {
15
15
  * @param args 占位参数
16
16
  * @since 0.32.0
17
17
  */
18
- function info(message?: string, ...args: any[]): void;
18
+ function info(message: string, ...args: any[]): void;
19
19
 
20
20
  /**
21
21
  * 输出警告信息
@@ -23,7 +23,7 @@ declare global {
23
23
  * @param args 占位参数
24
24
  * @since 0.32.0
25
25
  */
26
- function warn(message?: string, ...args: any[]): void;
26
+ function warn(message: string, ...args: any[]): void;
27
27
 
28
28
  /**
29
29
  * 输出错误信息
@@ -31,7 +31,7 @@ declare global {
31
31
  * @param args 占位参数
32
32
  * @since 0.32.0
33
33
  */
34
- function error(message?: string, ...args: any[]): void;
34
+ function error(message: string, ...args: any[]): void;
35
35
  }
36
36
  }
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettergi/types",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript Definitions for BetterGI JavaScript",
5
5
  "type": "module",
6
6
  "author": "Bread Grocery<https://github.com/breadgrocery>",