@bettergi/types 0.1.17 → 0.1.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettergi/types",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "BetterGI TypeScript 类型定义",
5
5
  "type": "module",
6
6
  "author": "Bread Grocery<https://github.com/breadgrocery>",
@@ -1,20 +1,29 @@
1
1
  import type {
2
2
  ClrHostValue,
3
+ DoubleHost,
3
4
  EnumTypeTrait,
4
5
  HostType,
5
6
  PublicDefaultConstructorTrait,
6
- ReferenceTypeTrait
7
+ ReferenceTypeTrait,
8
+ StrongNumeric,
9
+ ValueTypeTrait
7
10
  } from "../../../Microsoft/ClearScript/HostType";
11
+ import type { HostVariableOut } from "../../../Microsoft/ClearScript/HostVariable";
12
+ import type { VoidResult } from "../../../Microsoft/ClearScript/VoidResult";
13
+ import "../../../OpenCvSharp/Rect";
8
14
  import "../../../OpenCvSharp/Size";
9
15
  import "../../../System/Enum";
10
16
  import "../../../System/IComparable";
11
17
  import "../../../System/IConvertible";
18
+ import "../../../System/IEquatable";
12
19
  import "../../../System/IFormattable";
13
20
  import "../../../System/ISpanFormattable";
14
21
  import "../../../System/Nullable";
22
+ import "../../../System/ValueType";
15
23
 
16
24
  /**
17
25
  * 参考搜索的锚定方式;元素在画布右/下侧时通常使用右/下锚定,在左/上侧时通常使用左/上锚定,居中元素使用中心锚定并按画布中心加偏移缩放
26
+ * Auto 按参考包围盒所在区域分别选择水平和垂直锚定,用于模拟游戏 UI 的响应式布局
18
27
  * @since 0.49.0
19
28
  */
20
29
  declare const searchAnchorModeBrand: unique symbol;
@@ -30,7 +39,7 @@ declare global {
30
39
 
31
40
  export interface SearchAnchorModeHostType extends HostType<SearchAnchorMode, EnumTypeTrait> {
32
41
  /**
33
- * 自动选择锚定方式
42
+ * 按参考包围盒中心的 0.4/0.6 分区模拟游戏 UI 的响应式布局
34
43
  * @since 0.49.0
35
44
  */
36
45
  readonly auto: SearchAnchorMode;
@@ -74,10 +83,20 @@ export interface SearchOptions extends ClrHostValue {
74
83
  */
75
84
  anchorMode: BetterGenshinImpact.Core.Recognition.SearchAnchorMode;
76
85
  /**
77
- * 在预测框外额外扩展的像素大小;未指定时默认四周各扩展 10px
86
+ * 参考画布坐标系中的独立搜索框;未指定时以 `RecognitionObject.referenceBoundingBox` 为基础搜索框,指定后与参考包围盒使用相同缩放和锚定规则转换到当前截图坐标系
87
+ * @since 0.64.0
88
+ */
89
+ referenceSearchBox: OpenCvSharp.Rect | null;
90
+ /**
91
+ * 在基础搜索框外额外扩展的像素大小,Width 用于左右,Height 用于上下;未指定时默认四周各扩展 10px;当 expandPercent 有值时不生效
78
92
  * @since 0.49.0
79
93
  */
80
94
  expandSize: OpenCvSharp.Size | null;
95
+ /**
96
+ * 按当前截图宽高计算的四边扩展比例;左右乘截图宽度,上下乘截图高度,例如 0.05 表示 5%;优先于 expandSize,显式设置全零比例可关闭默认的 10px 扩展
97
+ * @since 0.64.0
98
+ */
99
+ expandPercent: BetterGenshinImpact.Core.Recognition.SearchExpandRatio | null;
81
100
  }
82
101
 
83
102
  declare global {
@@ -97,4 +116,98 @@ export interface SearchOptionsHostType extends HostType<
97
116
  new (): SearchOptions;
98
117
  }
99
118
 
119
+ /**
120
+ * 搜索区域四边的扩展比例,属性顺序与 XAML Thickness 的四参数顺序一致:Left、Top、Right、Bottom;值为直接参与计算的小数比例,例如 0.05 表示 5%
121
+ * @since 0.64.0
122
+ */
123
+ declare const searchExpandRatioBrand: unique symbol;
124
+ export interface SearchExpandRatio extends ClrHostValue {
125
+ readonly [searchExpandRatioBrand]: true;
126
+ /**
127
+ * 左侧扩展比例,以当前截图宽度为基准
128
+ * @since 0.64.0
129
+ */
130
+ left: number;
131
+ /**
132
+ * 上侧扩展比例,以当前截图高度为基准
133
+ * @since 0.64.0
134
+ */
135
+ top: number;
136
+ /**
137
+ * 右侧扩展比例,以当前截图宽度为基准
138
+ * @since 0.64.0
139
+ */
140
+ right: number;
141
+ /**
142
+ * 下侧扩展比例,以当前截图高度为基准
143
+ * @since 0.64.0
144
+ */
145
+ bottom: number;
146
+ /**
147
+ * 四边比例是否均为有限且非负的数字;大于 1 的比例合法,最终搜索区域会被裁剪到截图边界
148
+ * @since 0.64.0
149
+ */
150
+ readonly isValid: boolean;
151
+ /**
152
+ * 比较是否相等
153
+ * @param obj 比较对象
154
+ * @since 0.64.0
155
+ */
156
+ equals(obj: unknown | null): boolean;
157
+ /**
158
+ * 比较是否相等
159
+ * @param other 另一扩展比例
160
+ * @since 0.64.0
161
+ */
162
+ equals(other: BetterGenshinImpact.Core.Recognition.SearchExpandRatio): boolean;
163
+ /**
164
+ * 返回哈希码
165
+ * @since 0.64.0
166
+ */
167
+ getHashCode(): number;
168
+ /**
169
+ * 返回字符串表示
170
+ * @since 0.64.0
171
+ */
172
+ toString(): string;
173
+ /**
174
+ * 解构为左右上下四边比例
175
+ * @param left 左侧扩展比例
176
+ * @param top 上侧扩展比例
177
+ * @param right 右侧扩展比例
178
+ * @param bottom 下侧扩展比例
179
+ * @returns ClearScript 宿主空结果
180
+ * @since 0.64.0
181
+ */
182
+ deconstruct(
183
+ left: HostVariableOut<number>,
184
+ top: HostVariableOut<number>,
185
+ right: HostVariableOut<number>,
186
+ bottom: HostVariableOut<number>
187
+ ): VoidResult;
188
+ }
189
+
190
+ declare global {
191
+ namespace BetterGenshinImpact.Core.Recognition {
192
+ type SearchExpandRatio = import("./SearchOptions").SearchExpandRatio;
193
+ }
194
+ }
195
+
196
+ export interface SearchExpandRatioHostType extends HostType<SearchExpandRatio, ValueTypeTrait> {
197
+ /**
198
+ * 按左右上下四边比例构造
199
+ * @param left 左侧扩展比例,以当前截图宽度为基准
200
+ * @param top 上侧扩展比例,以当前截图高度为基准
201
+ * @param right 右侧扩展比例,以当前截图宽度为基准
202
+ * @param bottom 下侧扩展比例,以当前截图高度为基准
203
+ * @since 0.64.0
204
+ */
205
+ new (
206
+ left: number | StrongNumeric<DoubleHost>,
207
+ top: number | StrongNumeric<DoubleHost>,
208
+ right: number | StrongNumeric<DoubleHost>,
209
+ bottom: number | StrongNumeric<DoubleHost>
210
+ ): SearchExpandRatio;
211
+ }
212
+
100
213
  export {};
@@ -282,7 +282,7 @@ export interface Genshin extends ClrHostValue {
282
282
  /**
283
283
  * 按槽位重组当前队伍角色
284
284
  * 未传入或空字符串的槽位跳过;重组队伍槽位角色,不是按数字键切换当前出战角色
285
- * 示例:`await genshin.switchCharacter("胡桃", "夜兰", "", "钟离")`
285
+ * 默认按队伍物理槽位解释;物理槽位示例:`await genshin.switchCharacter("胡桃", "夜兰", "", "钟离")`
286
286
  * @param slot1 1 号位角色名,空字符串表示跳过
287
287
  * @param slot2 2 号位角色名,空字符串表示跳过
288
288
  * @param slot3 3 号位角色名,空字符串表示跳过
@@ -304,6 +304,25 @@ export interface Genshin extends ClrHostValue {
304
304
  slot3: "" | AvatarName,
305
305
  slot4: "" | AvatarName
306
306
  ): Promise<boolean>;
307
+ /**
308
+ * 按槽位重组当前队伍角色
309
+ * `usePhysicalSlots` 为 true 时按队伍物理槽位解释 slot1-slot4,为 false 时按当前玩家可控角色顺序解释
310
+ * 可控顺序示例:`await genshin.switchCharacter("胡桃", "夜兰", "", "", false)`
311
+ * @param slot1 1 号位角色名,空字符串表示跳过
312
+ * @param slot2 2 号位角色名,空字符串表示跳过
313
+ * @param slot3 3 号位角色名,空字符串表示跳过
314
+ * @param slot4 4 号位角色名,空字符串表示跳过
315
+ * @param usePhysicalSlots 是否按队伍物理槽位解释,默认 true
316
+ * @returns 在任务完成后兑现是否成功的 Promise;完成保存并返回主界面为 true,参数无效、目标角色未找到或流程失败为 false
317
+ * @since 0.64.0
318
+ */
319
+ switchCharacter(
320
+ slot1: "" | AvatarName,
321
+ slot2: "" | AvatarName,
322
+ slot3: "" | AvatarName,
323
+ slot4: "" | AvatarName,
324
+ usePhysicalSlots: boolean
325
+ ): Promise<boolean>;
307
326
  /**
308
327
  * 清除当前调度器的队伍缓存
309
328
  * @returns ClearScript 宿主空结果
@@ -62,6 +62,9 @@ export type BossName =
62
62
  | "霜夜巡天灵主"
63
63
  | "蕴光月幻蝶"
64
64
  | "重拳出击鸭"
65
+ // 至冬
66
+ | "不灭衍生造物"
67
+ | "嵌合翼骏狮"
65
68
  | "" // 未指定
66
69
  | (string & {});
67
70
 
@@ -56,7 +56,7 @@ export interface AutoDomainParam extends Omit<
56
56
  */
57
57
  partyName: string;
58
58
  /**
59
- * 需要刷取的秘境名称;空字符串表示未指定
59
+ * 需要刷取的秘境名称;空字符串表示未指定,`根据提升指南选择秘境` 表示按冒险手册提升指南选择
60
60
  * @since 0.52.0
61
61
  */
62
62
  domainName: DomainName;
@@ -27,10 +27,11 @@ export type ArtifactStar = "1" | "2" | "3" | "4" | (string & {});
27
27
 
28
28
  /**
29
29
  * 可自动刷取的秘境名称
30
- * 来源:`MapLazyAssets` 从 `tp.json` 提取的 BlessDomain / ForgeryDomain / MasteryDomain 点位名
30
+ * 来源:`MapLazyAssets` 从 `tp.json` 提取的 BlessDomain / ForgeryDomain / MasteryDomain 点位名;`根据提升指南选择秘境` 为 `AutoDomainTask.DevelopmentGuideOption` 固定选项
31
31
  * @since 0.52.0
32
32
  */
33
33
  export type DomainName =
34
+ | "根据提升指南选择秘境"
34
35
  | "铭记之谷"
35
36
  | "忘却之峡"
36
37
  | "仲夏庭园"
@@ -66,6 +67,9 @@ export type DomainName =
66
67
  | "失落的月庭"
67
68
  | "月童的库藏"
68
69
  | "山风的荆冕"
70
+ | "荒坠的圣迹"
71
+ | "逆悬的冰河"
72
+ | "妄念的创痕"
69
73
  | "" // 未指定
70
74
  | (string & {});
71
75
 
@@ -116,6 +120,11 @@ declare global {
116
120
  }
117
121
 
118
122
  export interface AutoDomainTaskHostType extends HostType<AutoDomainTask, ReferenceTypeTrait> {
123
+ /**
124
+ * 按提升指南选择秘境的固定选项名
125
+ * @since 0.65.0
126
+ */
127
+ readonly developmentGuideOption: "根据提升指南选择秘境";
119
128
  /**
120
129
  * 使用自动秘境参数创建任务
121
130
  * @param taskParam 自动秘境参数
@@ -25,19 +25,20 @@ export type OnlyPickEliteDropsMode =
25
25
  | (string & {});
26
26
 
27
27
  /**
28
- * 战斗策略名称;`根据队伍自动选择` 表示按当前队伍匹配策略目录,其余为 `User/AutoFight` 下策略文件名(不含扩展名)
28
+ * 战斗策略名称;`根据队伍自动选择` 表示按当前队伍匹配策略目录,`自动连招(实验)` 为 LLM 行为树固定名且不对应策略文件,其余为 `User/AutoFight` 下策略文件名(不含扩展名)
29
29
  * @since 0.52.0
30
30
  */
31
- export type CombatStrategyName = "根据队伍自动选择" | (string & {});
31
+ export type CombatStrategyName = "根据队伍自动选择" | "自动连招(实验)" | (string & {});
32
32
 
33
33
  /**
34
34
  * 战斗策略文件种类标识
35
- * 与上游 `AutoFightParam.ResolveStrategyPath` 返回的第二项对齐:优先命中 `.json`,否则回退 `.txt`;自动选队目录亦标为 `txt`
35
+ * 与上游 `AutoFightParam.ResolveStrategyPath` 返回的第二项对齐:优先命中 `.json`,否则回退 `.txt`;自动选队目录亦标为 `txt`;`自动连招(实验)` 标为 `combo`
36
36
  * @since 0.52.0
37
37
  */
38
38
  export type StrategyFileKind =
39
39
  | "json" // JSON 战斗策略
40
40
  | "txt" // 文本 / 简易策略(含「根据队伍自动选择」目录)
41
+ | "combo" // 自动连招(LLM 行为树),不对应策略文件
41
42
  | (string & {});
42
43
 
43
44
  /**
@@ -74,7 +75,6 @@ export interface AutoFightConfig
74
75
  | "pickDropsAfterFightEnabled"
75
76
  | "pickDropsAfterFightSeconds"
76
77
  | "qinDoublePickUp"
77
- | "skipModel"
78
78
  | "strategyName"
79
79
  | "swimmingEnabled"
80
80
  | "teamNames"
@@ -145,12 +145,12 @@ export interface AutoFightConfig
145
145
  */
146
146
  onlyPickEliteDropsMode: OnlyPickEliteDropsMode;
147
147
  /**
148
- * 是否在战斗结束后拾取掉落物
148
+ * 是否在战斗结束后光柱扫描掉落物,默认开启
149
149
  * @since 0.52.0
150
150
  */
151
151
  pickDropsAfterFightEnabled: boolean;
152
152
  /**
153
- * 战斗结束后拾取掉落物的等待时长,单位秒,默认 15
153
+ * 战斗结束后光柱扫描掉落物的持续时长,单位秒,默认 15
154
154
  * @since 0.52.0
155
155
  */
156
156
  pickDropsAfterFightSeconds: number;
@@ -160,12 +160,7 @@ export interface AutoFightConfig
160
160
  */
161
161
  qinDoublePickUp: boolean;
162
162
  /**
163
- * 是否启用跳过模型
164
- * @since 0.52.0
165
- */
166
- skipModel: boolean;
167
- /**
168
- * 战斗策略名称,`根据队伍自动选择` 表示按当前队伍匹配策略
163
+ * 战斗策略名称,`根据队伍自动选择` 表示按当前队伍匹配策略,`自动连招(实验)` 为 LLM 行为树固定名
169
164
  * @since 0.52.0
170
165
  */
171
166
  strategyName: CombatStrategyName;
@@ -220,14 +215,16 @@ export interface AutoFightConfig_FightFinishDetectConfig
220
215
  extends
221
216
  Omit<
222
217
  CommunityToolkit.Mvvm.ComponentModel.ObservableObject,
223
- | "battleEndProgressBarColor"
224
- | "battleEndProgressBarColorTolerance"
225
218
  | "beforeDetectDelay"
219
+ | "blockCheckBeforeBattleSeconds"
220
+ | "checkAfterSwitchAvatar"
226
221
  | "checkBeforeBurst"
227
222
  | "checkEndDelay"
228
223
  | "fastCheckEnabled"
229
224
  | "fastCheckParams"
230
225
  | "isFirstCheck"
226
+ | "paimonEndCheckDelay"
227
+ | "paimonEndCheckEnabled"
231
228
  | "rotaryFactor"
232
229
  | "rotateFindEnemyEnabled"
233
230
  | "skipFightEndCheckWhenEnemyVisible"
@@ -235,16 +232,6 @@ export interface AutoFightConfig_FightFinishDetectConfig
235
232
  System.ComponentModel.INotifyPropertyChangedInput,
236
233
  System.ComponentModel.INotifyPropertyChangingInput {
237
234
  readonly [autoFightConfig_FightFinishDetectConfigBrand]: true;
238
- /**
239
- * 战斗结束进度条颜色容差,`6` 表示三通道相同容差,`6,6,6` 可分别设置,格式为 RGB
240
- * @since 0.52.0
241
- */
242
- battleEndProgressBarColorTolerance: string;
243
- /**
244
- * 判断战斗结束的进度条颜色,`RGB` 格式,默认 `95,235,255`
245
- * @since 0.52.0
246
- */
247
- battleEndProgressBarColor: string;
248
235
  /**
249
236
  * 按下切换队伍后检测屏幕色块的延迟,单位秒,默认 `0.4`,频繁误判时可适当提高
250
237
  * @since 0.52.0
@@ -256,20 +243,25 @@ export interface AutoFightConfig_FightFinishDetectConfig
256
243
  */
257
244
  checkBeforeBurst: boolean;
258
245
  /**
259
- * 检查战斗结束前的延时,单位秒,可指定角色,格式如 `2.5;白术,1.5;钟离,1.0;`
246
+ * 触发战斗结束检查前的延时,单位秒,确保动作后摇结束;也可为角色单独指定,格式如 `0.4` 或 `0.4;钟离,1.5`
260
247
  * @since 0.52.0
261
248
  */
262
249
  checkEndDelay: string;
263
250
  /**
264
- * 是否启用快速检查战斗结束
251
+ * 是否启用快速检查战斗结束;完成一轮动作后若满足条件则触发一次检查,默认关闭
265
252
  * @since 0.52.0
266
253
  */
267
254
  fastCheckEnabled: boolean;
268
255
  /**
269
- * 快速检查参数,数字为间隔秒数,人名为该角色执行一轮后检查,分号分隔,例如 `15,白术;钟离;`
256
+ * 快速检查参数;数字为距上次检查的间隔秒数,人名为对应角色动作后触发,多项用分号分隔,格式如 `5` 或 `5;白术;`
270
257
  * @since 0.52.0
271
258
  */
272
259
  fastCheckParams: string;
260
+ /**
261
+ * 是否在切人后再执行战斗结束检查;无需等待上一动作后摇,目前仅 JSON 策略下生效
262
+ * @since 0.64.0
263
+ */
264
+ checkAfterSwitchAvatar: boolean;
273
265
  /**
274
266
  * 是否在首次检查时进行面敌
275
267
  * @since 0.52.0
@@ -286,10 +278,25 @@ export interface AutoFightConfig_FightFinishDetectConfig
286
278
  */
287
279
  rotateFindEnemyEnabled: boolean;
288
280
  /**
289
- * 是否在敌人可见时跳过战斗结束检查;与旋转寻找敌人互斥
281
+ * 是否在敌人可见时跳过战斗结束检查;检测到敌人血条时跳过,与旋转寻找敌人互斥
290
282
  * @since 0.63.0
291
283
  */
292
284
  skipFightEndCheckWhenEnemyVisible: boolean;
285
+ /**
286
+ * 开战后阻断战斗结束检查的时长,单位秒;默认 0 不阻断,大于 0 时该时间内的检查视为战斗未结束
287
+ * @since 0.64.0
288
+ */
289
+ blockCheckBeforeBattleSeconds: number;
290
+ /**
291
+ * 是否启用派蒙辅助检测;按 L 后当派蒙头像可见时提前跳出战斗结束检测,默认关闭
292
+ * @since 0.64.0
293
+ */
294
+ paimonEndCheckEnabled: boolean;
295
+ /**
296
+ * 派蒙辅助检测延时,单位秒,默认 0.2
297
+ * @since 0.64.0
298
+ */
299
+ paimonEndCheckDelay: number;
293
300
  }
294
301
 
295
302
  export interface AutoFightConfig_FightFinishDetectConfigHostType extends HostType<
@@ -69,12 +69,12 @@ export interface AutoFightParam extends Omit<
69
69
  */
70
70
  fightFinishDetectEnabled: boolean;
71
71
  /**
72
- * 是否在战斗结束后拾取掉落物
72
+ * 是否在战斗结束后光柱扫描掉落物,默认开启
73
73
  * @since 0.52.0
74
74
  */
75
75
  pickDropsAfterFightEnabled: boolean;
76
76
  /**
77
- * 战斗结束后拾取掉落物的等待时长,单位秒,默认 15
77
+ * 战斗结束后光柱扫描掉落物的持续时长,单位秒,默认 15
78
78
  * @since 0.52.0
79
79
  */
80
80
  pickDropsAfterFightSeconds: number;
@@ -201,28 +201,23 @@ export interface AutoFightParam extends Omit<
201
201
  declare const autoFightParam_FightFinishDetectConfigBrand: unique symbol;
202
202
  export interface AutoFightParam_FightFinishDetectConfig extends ClrHostValue {
203
203
  readonly [autoFightParam_FightFinishDetectConfigBrand]: true;
204
- /**
205
- * 判断战斗结束的进度条颜色,`RGB` 格式,默认 `95,235,255`
206
- * @since 0.52.0
207
- */
208
- battleEndProgressBarColor: string;
209
- /**
210
- * 战斗结束进度条颜色容差,`6` 表示三通道相同容差,`6,6,6` 可分别设置
211
- * @since 0.52.0
212
- */
213
- battleEndProgressBarColorTolerance: string;
214
204
  /**
215
205
  * 是否启用快速检查战斗结束
216
206
  * @since 0.52.0
217
207
  */
218
208
  fastCheckEnabled: boolean;
219
209
  /**
220
- * 快速检查参数,数字为间隔秒数,人名为该角色执行一轮后检查,分号分隔
210
+ * 快速检查参数;数字为距上次检查的间隔秒数,人名为对应角色动作后触发,多项用分号分隔
221
211
  * @since 0.52.0
222
212
  */
223
213
  fastCheckParams: string;
224
214
  /**
225
- * 检查战斗结束前的延时,单位秒,可指定角色
215
+ * 是否在切人后再执行战斗结束检查;无需等待上一动作后摇,目前仅 JSON 策略下生效
216
+ * @since 0.64.0
217
+ */
218
+ checkAfterSwitchAvatar: boolean;
219
+ /**
220
+ * 触发战斗结束检查前的延时,单位秒,确保动作后摇结束;也可为角色单独指定
226
221
  * @since 0.52.0
227
222
  */
228
223
  checkEndDelay: string;
@@ -237,10 +232,25 @@ export interface AutoFightParam_FightFinishDetectConfig extends ClrHostValue {
237
232
  */
238
233
  rotateFindEnemyEnabled: boolean;
239
234
  /**
240
- * 是否在敌人可见时跳过战斗结束检查
235
+ * 是否在敌人可见时跳过战斗结束检查;检测到敌人血条时跳过,与旋转寻找敌人互斥
241
236
  * @since 0.63.0
242
237
  */
243
238
  skipFightEndCheckWhenEnemyVisible: boolean;
239
+ /**
240
+ * 开战后阻断战斗结束检查的时长,单位秒;默认 0 不阻断,大于 0 时该时间内的检查视为战斗未结束
241
+ * @since 0.64.0
242
+ */
243
+ blockCheckBeforeBattleSeconds: number;
244
+ /**
245
+ * 是否启用派蒙辅助检测;按 L 后当派蒙头像可见时提前跳出战斗结束检测
246
+ * @since 0.64.0
247
+ */
248
+ paimonEndCheckEnabled: boolean;
249
+ /**
250
+ * 派蒙辅助检测延时,单位秒
251
+ * @since 0.64.0
252
+ */
253
+ paimonEndCheckDelay: number;
244
254
  }
245
255
 
246
256
  export interface AutoFightParam_FightFinishDetectConfigHostType extends HostType<
@@ -268,6 +278,11 @@ declare global {
268
278
  }
269
279
 
270
280
  export interface AutoFightParamHostType extends HostType<AutoFightParam, ReferenceTypeTrait> {
281
+ /**
282
+ * 自动连招(LLM 行为树)策略的固定名称;不对应策略文件,命中时路由到自动连招任务
283
+ * @since 0.65.0
284
+ */
285
+ readonly comboStrategyName: "自动连招(实验)";
271
286
  /**
272
287
  * 使用指定策略路径与自动战斗配置构造参数
273
288
  * @param path 战斗策略文件或策略目录路径
@@ -291,7 +306,7 @@ export interface AutoFightParamHostType extends HostType<AutoFightParam, Referen
291
306
  */
292
307
  swimmingEnabled: boolean;
293
308
  /**
294
- * 解析策略文件路径,优先检测 `.json`,未命中则回退 `.txt`
309
+ * 解析策略文件路径,优先检测 `.json`,未命中则回退 `.txt`;`自动连招(实验)` 返回策略名本身且种类为 `combo`
295
310
  * @param strategyName 策略名称(不含扩展名)
296
311
  * @returns 完整路径与策略文件种类组成的元组
297
312
  * @since 0.52.0
@@ -5,11 +5,15 @@ import type {
5
5
  ReferenceTypeTrait,
6
6
  StrongNumeric
7
7
  } from "../../../Microsoft/ClearScript/HostType";
8
+ import type { HostVariableOut } from "../../../Microsoft/ClearScript/HostVariable";
9
+ import type { VoidResult } from "../../../Microsoft/ClearScript/VoidResult";
10
+ import "../../../System/Collections/Generic/Dictionary";
11
+ import "../../../System/Collections/Generic/List";
12
+ import "../../../System/DateTime";
8
13
  import "../../../System/Threading/CancellationToken";
9
14
  import "../AutoPathing/Model/WaypointForTrack";
10
15
  import "../ISoloTask";
11
16
  import "./AutoFightParam";
12
- import "./Model/CombatScenes";
13
17
 
14
18
  /**
15
19
  * 自动战斗独立任务
@@ -23,12 +27,6 @@ export interface AutoFightTask extends ClrHostValue, BetterGenshinImpact.GameTas
23
27
  * @since 0.52.0
24
28
  */
25
29
  readonly name: string;
26
- /**
27
- * 识别当前队伍战斗场景,失败时最多重试 5 次
28
- * @returns 已初始化的战斗场景
29
- * @since 0.52.0
30
- */
31
- getCombatScenesWithRetry(): BetterGenshinImpact.GameTask.AutoFight.Model.CombatScenes;
32
30
  /**
33
31
  * 启动自动战斗任务
34
32
  * @param ct 取消令牌
@@ -51,6 +49,122 @@ export interface AutoFightTask extends ClrHostValue, BetterGenshinImpact.GameTas
51
49
  ): Promise<boolean>;
52
50
  }
53
51
 
52
+ /**
53
+ * 战斗结束检测的运行时配置,由自动战斗参数解析而来,供 TXT 与 JSON 策略共用
54
+ * @since 0.64.0
55
+ */
56
+ declare const autoFightTask_TaskFightFinishDetectConfigBrand: unique symbol;
57
+ export interface AutoFightTask_TaskFightFinishDetectConfig extends ClrHostValue {
58
+ readonly [autoFightTask_TaskFightFinishDetectConfigBrand]: true;
59
+ /**
60
+ * 检查战斗结束前的默认延时,单位毫秒,默认 1500
61
+ * @since 0.64.0
62
+ */
63
+ delayTime: number;
64
+ /**
65
+ * 按下切换队伍后检测色块的延时,单位毫秒,默认 450
66
+ * @since 0.64.0
67
+ */
68
+ detectDelayTime: number;
69
+ /**
70
+ * 按角色名覆盖的检查延时,单位毫秒
71
+ * @since 0.64.0
72
+ */
73
+ delayTimes: System.Collections.Generic.Dictionary<string, number>;
74
+ /**
75
+ * 快速检查间隔,单位秒,默认 5
76
+ * @since 0.64.0
77
+ */
78
+ checkTime: number;
79
+ /**
80
+ * 触发快速检查的角色名列表
81
+ * @since 0.64.0
82
+ */
83
+ checkNames: System.Collections.Generic.List<string>;
84
+ /**
85
+ * 是否启用快速检查战斗结束
86
+ * @since 0.64.0
87
+ */
88
+ fastCheckEnabled: boolean;
89
+ /**
90
+ * 是否在切人后再执行战斗结束检查;无需等待上一动作后摇,目前仅 JSON 策略下生效
91
+ * @since 0.64.0
92
+ */
93
+ checkAfterSwitchAvatar: boolean;
94
+ /**
95
+ * 是否启用旋转寻找敌人
96
+ * @since 0.64.0
97
+ */
98
+ rotateFindEnemyEnabled: boolean;
99
+ /**
100
+ * 是否在敌人可见时跳过战斗结束检查;检测到敌人血条时跳过,与旋转寻找敌人互斥
101
+ * @since 0.64.0
102
+ */
103
+ skipFightEndCheckWhenEnemyVisible: boolean;
104
+ /**
105
+ * 开战后阻断战斗结束检查的时长,单位秒;默认 0 不阻断,大于 0 时该时间内的检查视为战斗未结束
106
+ * @since 0.64.0
107
+ */
108
+ blockCheckBeforeBattleSeconds: number;
109
+ /**
110
+ * 是否启用派蒙辅助检测;按 L 后当派蒙头像可见时提前跳出战斗结束检测
111
+ * @since 0.64.0
112
+ */
113
+ paimonEndCheckEnabled: boolean;
114
+ /**
115
+ * 派蒙辅助检测延时,单位毫秒
116
+ * @since 0.64.0
117
+ */
118
+ paimonEndCheckDelayMs: number;
119
+ }
120
+
121
+ export interface AutoFightTask_TaskFightFinishDetectConfigHostType extends HostType<
122
+ AutoFightTask_TaskFightFinishDetectConfig,
123
+ ReferenceTypeTrait
124
+ > {
125
+ /**
126
+ * 由自动战斗参数中的战斗结束检测配置构造运行时配置
127
+ * @param finishDetectConfig 自动战斗参数中的战斗结束检测配置
128
+ * @since 0.64.0
129
+ */
130
+ new (
131
+ finishDetectConfig: BetterGenshinImpact.GameTask.AutoFight.AutoFightParam.FightFinishDetectConfig
132
+ ): AutoFightTask_TaskFightFinishDetectConfig;
133
+ /**
134
+ * 解析快速检查参数字符串
135
+ * @param input 快速检查参数;数字为间隔秒数,人名为对应角色动作后触发,分号分隔
136
+ * @param checkTime 解析得到的检查间隔秒数
137
+ * @param names 解析得到的角色名列表,方法会追加去重后的人名
138
+ * @returns ClearScript 宿主空结果
139
+ * @since 0.64.0
140
+ */
141
+ parseCheckTimeString(
142
+ input: string,
143
+ checkTime: HostVariableOut<number>,
144
+ names: System.Collections.Generic.List<string>
145
+ ): VoidResult;
146
+ /**
147
+ * 解析检查结束延时字符串
148
+ * @param input 延时配置;纯数字为默认秒数,`名字,秒数` 为角色覆盖,分号分隔
149
+ * @param delayTime 解析得到的默认延时,单位毫秒
150
+ * @param nameDelayMap 角色名到延时毫秒的映射,方法会写入覆盖值
151
+ * @returns ClearScript 宿主空结果
152
+ * @since 0.64.0
153
+ */
154
+ parseFastCheckEndDelayString(
155
+ input: string,
156
+ delayTime: HostVariableOut<number>,
157
+ nameDelayMap: System.Collections.Generic.Dictionary<string, number>
158
+ ): VoidResult;
159
+ }
160
+
161
+ declare global {
162
+ namespace BetterGenshinImpact.GameTask.AutoFight.AutoFightTask {
163
+ type TaskFightFinishDetectConfig =
164
+ import("./AutoFightTask").AutoFightTask_TaskFightFinishDetectConfig;
165
+ }
166
+ }
167
+
54
168
  declare global {
55
169
  namespace BetterGenshinImpact.GameTask.AutoFight {
56
170
  type AutoFightTask = import("./AutoFightTask").AutoFightTask;
@@ -64,6 +178,12 @@ export interface AutoFightTaskHostType extends HostType<AutoFightTask, Reference
64
178
  * @since 0.52.0
65
179
  */
66
180
  new (taskParam: BetterGenshinImpact.GameTask.AutoFight.AutoFightParam): AutoFightTask;
181
+ /**
182
+ * 重置「敌人可见时跳过战斗结束检查」的连续跳过计数;每场战斗开始时调用,TXT 与 JSON 策略共用
183
+ * @returns ClearScript 宿主空结果
184
+ * @since 0.64.0
185
+ */
186
+ resetSkipCheckCounter(): VoidResult;
67
187
  /**
68
188
  * 全局战斗进行中标志
69
189
  * @since 0.52.0
@@ -74,6 +194,41 @@ export interface AutoFightTaskHostType extends HostType<AutoFightTask, Reference
74
194
  * @since 0.52.0
75
195
  */
76
196
  fightWaypoint: BetterGenshinImpact.GameTask.AutoPathing.Model.WaypointForTrack;
197
+ /**
198
+ * 最近一次战斗结束检查的时间;TXT 与 JSON 策略共用,供更快触发检查判断间隔
199
+ * @since 0.64.0
200
+ */
201
+ lastFightFinishCheckTime: System.DateTime;
202
+ /**
203
+ * 本次战斗的开战时间;TXT 与 JSON 策略共用,供开战后一段时间阻断战斗结束检查
204
+ * @since 0.64.0
205
+ */
206
+ fightStartTime: System.DateTime;
207
+ /**
208
+ * 检查战斗是否已结束;TXT 与 JSON 策略共用的统一实现
209
+ * @param finishDetectConfig 战斗结束检测运行时配置
210
+ * @param ct 取消令牌
211
+ * @param delayTime 检查前延时,单位毫秒,默认 1500
212
+ * @param detectDelayTime 切换队伍后检测色块的延时,单位毫秒,默认 450
213
+ * @returns 在检测完成后兑现是否结束的 Promise
214
+ * @since 0.64.0
215
+ */
216
+ checkFightFinish(
217
+ finishDetectConfig: BetterGenshinImpact.GameTask.AutoFight.AutoFightTask.TaskFightFinishDetectConfig,
218
+ ct: System.Threading.CancellationToken
219
+ ): Promise<boolean>;
220
+ checkFightFinish(
221
+ finishDetectConfig: BetterGenshinImpact.GameTask.AutoFight.AutoFightTask.TaskFightFinishDetectConfig,
222
+ ct: System.Threading.CancellationToken,
223
+ delayTime: number | StrongNumeric<Int32Host>
224
+ ): Promise<boolean>;
225
+ checkFightFinish(
226
+ finishDetectConfig: BetterGenshinImpact.GameTask.AutoFight.AutoFightTask.TaskFightFinishDetectConfig,
227
+ ct: System.Threading.CancellationToken,
228
+ delayTime: number | StrongNumeric<Int32Host>,
229
+ detectDelayTime: number | StrongNumeric<Int32Host>
230
+ ): Promise<boolean>;
231
+ readonly TaskFightFinishDetectConfig: AutoFightTask_TaskFightFinishDetectConfigHostType;
77
232
  }
78
233
 
79
234
  export {};
@@ -11,8 +11,8 @@ import "../../../../OpenCvSharp/Rect";
11
11
  import "../../../../System/DateTime";
12
12
  import "../../../../System/Nullable";
13
13
  import "../../../../System/Threading/CancellationToken";
14
- import "../../../../System/WebSocket";
15
14
  import type { KeyCode } from "../../../Helpers/User32Helper";
15
+ import "../../AutoGeniusInvokation/Exception/RetryException";
16
16
  import "../../Model/Area/ImageRegion";
17
17
  import "../Config/CombatAvatar";
18
18
  import "./CombatScenes";
@@ -123,8 +123,8 @@ export type AvatarName =
123
123
  | "丝柯克"
124
124
  | "塔利雅"
125
125
  | "伊涅芙"
126
- | "奇偶(男)"
127
- | "奇偶(女)"
126
+ | "奇偶·男性"
127
+ | "奇偶·女性"
128
128
  | "菈乌玛"
129
129
  | "菲林斯"
130
130
  | "爱诺"
@@ -469,13 +469,16 @@ export interface AvatarHostType extends HostType<Avatar, ReferenceTypeTrait> {
469
469
  ct: System.Threading.CancellationToken
470
470
  ): VoidResult;
471
471
  /**
472
- * 传送到七天神像恢复角色状态
472
+ * 传送到七天神像恢复角色状态;完成后抛出传入的重试异常
473
473
  * @param ct 取消令牌
474
- * @param ex 触发恢复的异常
474
+ * @param retryException 触发恢复后用于重试当前任务的异常
475
475
  * @returns ClearScript 宿主空结果
476
476
  * @since 0.50.0
477
477
  */
478
- tpForRecover(ct: System.Threading.CancellationToken, ex: System.Exception): VoidResult;
478
+ tpForRecover(
479
+ ct: System.Threading.CancellationToken,
480
+ retryException: BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception.RetryException
481
+ ): VoidResult;
479
482
  /**
480
483
  * 从配置字符串中查找角色冷却秒数
481
484
  * @param avatarName 角色名称
@@ -246,6 +246,12 @@ export interface CombatScenesHostType extends HostType<CombatScenes, ReferenceTy
246
246
  logger: Microsoft.Extensions.Logging.ILogger | null,
247
247
  systemInfo: BetterGenshinImpact.GameTask.Model.ISystemInfo | null
248
248
  ): CombatScenes;
249
+ /**
250
+ * 截屏识别队伍角色并初始化战斗场景,失败时最多重试 5 次,间隔 1 秒
251
+ * @returns 已初始化的战斗场景
252
+ * @since 0.65.0
253
+ */
254
+ getCombatScenesWithRetry(): CombatScenes;
249
255
  }
250
256
 
251
257
  export {};
@@ -0,0 +1,42 @@
1
+ import type {
2
+ HostType,
3
+ PublicDefaultConstructorTrait,
4
+ ReferenceTypeTrait
5
+ } from "../../../../Microsoft/ClearScript/HostType";
6
+ import "../../../../System/Runtime/Serialization/ISerializable";
7
+ import "../../../../System/WebSocket";
8
+
9
+ /**
10
+ * 需要重试当前任务时抛出的异常
11
+ * @since 0.65.0
12
+ */
13
+ declare const retryExceptionBrand: unique symbol;
14
+ export interface RetryException
15
+ extends System.Exception, System.Runtime.Serialization.ISerializableInput {
16
+ readonly [retryExceptionBrand]: true;
17
+ }
18
+
19
+ declare global {
20
+ namespace BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception {
21
+ type RetryException = import("./RetryException").RetryException;
22
+ }
23
+ }
24
+
25
+ export interface RetryExceptionHostType extends HostType<
26
+ RetryException,
27
+ ReferenceTypeTrait & PublicDefaultConstructorTrait
28
+ > {
29
+ /**
30
+ * 构造实例
31
+ * @since 0.65.0
32
+ */
33
+ new (): RetryException;
34
+ /**
35
+ * 使用说明信息构造实例
36
+ * @param message 异常说明
37
+ * @since 0.65.0
38
+ */
39
+ new (message: string): RetryException;
40
+ }
41
+
42
+ export {};
@@ -24,7 +24,6 @@ export interface AutoLeyLineOutcropConfig
24
24
  | "fightConfig"
25
25
  | "friendshipTeam"
26
26
  | "isGoToSynthesizer"
27
- | "isNotification"
28
27
  | "isResinExhaustionMode"
29
28
  | "leyLineOutcropType"
30
29
  | "openModeCountMin"
@@ -32,7 +31,6 @@ export interface AutoLeyLineOutcropConfig
32
31
  | "scanDropsAfterRewardSeconds"
33
32
  | "team"
34
33
  | "timeout"
35
- | "useAdventurerHandbook"
36
34
  | "useFragileResin"
37
35
  | "useTransientResin"
38
36
  >,
@@ -64,11 +62,6 @@ export interface AutoLeyLineOutcropConfig
64
62
  * @since 0.58.0
65
63
  */
66
64
  isGoToSynthesizer: boolean;
67
- /**
68
- * 是否通过 BetterGI 通知系统发送详细通知
69
- * @since 0.58.0
70
- */
71
- isNotification: boolean;
72
65
  /**
73
66
  * 是否开启树脂耗尽模式
74
67
  * @since 0.58.0
@@ -104,11 +97,6 @@ export interface AutoLeyLineOutcropConfig
104
97
  * @since 0.58.0
105
98
  */
106
99
  timeout: number;
107
- /**
108
- * 是否使用冒险之证寻找地脉花
109
- * @since 0.58.0
110
- */
111
- useAdventurerHandbook: boolean;
112
100
  /**
113
101
  * 是否允许使用脆弱树脂
114
102
  * @since 0.58.0
@@ -147,30 +147,23 @@ export interface AutoLeyLineOutcropFightConfig_FightFinishDetectConfig
147
147
  extends
148
148
  Omit<
149
149
  CommunityToolkit.Mvvm.ComponentModel.ObservableObject,
150
- | "battleEndProgressBarColor"
151
- | "battleEndProgressBarColorTolerance"
152
150
  | "beforeDetectDelay"
151
+ | "blockCheckBeforeBattleSeconds"
152
+ | "checkAfterSwitchAvatar"
153
153
  | "checkBeforeBurst"
154
154
  | "checkEndDelay"
155
155
  | "fastCheckEnabled"
156
156
  | "fastCheckParams"
157
157
  | "isFirstCheck"
158
+ | "paimonEndCheckDelay"
159
+ | "paimonEndCheckEnabled"
158
160
  | "rotaryFactor"
159
161
  | "rotateFindEnemyEnabled"
162
+ | "skipFightEndCheckWhenEnemyVisible"
160
163
  >,
161
164
  System.ComponentModel.INotifyPropertyChangedInput,
162
165
  System.ComponentModel.INotifyPropertyChangingInput {
163
166
  readonly [autoLeyLineOutcropFightConfig_FightFinishDetectConfigBrand]: true;
164
- /**
165
- * 战斗结束进度条颜色容差,`6` 表示三通道相同容差,`6,6,6` 可分别设置
166
- * @since 0.58.0
167
- */
168
- battleEndProgressBarColorTolerance: string;
169
- /**
170
- * 判断战斗结束的进度条颜色,`RGB` 格式
171
- * @since 0.58.0
172
- */
173
- battleEndProgressBarColor: string;
174
167
  /**
175
168
  * 按下切换队伍后检测屏幕色块的延迟,单位秒
176
169
  * @since 0.58.0
@@ -196,6 +189,11 @@ export interface AutoLeyLineOutcropFightConfig_FightFinishDetectConfig
196
189
  * @since 0.58.0
197
190
  */
198
191
  fastCheckParams: string;
192
+ /**
193
+ * 是否在切人后再执行战斗结束检查;无需等待上一动作后摇,目前仅 JSON 策略下生效
194
+ * @since 0.64.0
195
+ */
196
+ checkAfterSwitchAvatar: boolean;
199
197
  /**
200
198
  * 是否在首次检查时进行面敌
201
199
  * @since 0.58.0
@@ -211,6 +209,26 @@ export interface AutoLeyLineOutcropFightConfig_FightFinishDetectConfig
211
209
  * @since 0.58.0
212
210
  */
213
211
  rotateFindEnemyEnabled: boolean;
212
+ /**
213
+ * 是否在敌人可见时跳过战斗结束检查;检测到敌人血条时跳过,与旋转寻找敌人互斥
214
+ * @since 0.64.0
215
+ */
216
+ skipFightEndCheckWhenEnemyVisible: boolean;
217
+ /**
218
+ * 开战后阻断战斗结束检查的时长,单位秒;默认 0 不阻断,大于 0 时该时间内的检查视为战斗未结束
219
+ * @since 0.64.0
220
+ */
221
+ blockCheckBeforeBattleSeconds: number;
222
+ /**
223
+ * 是否启用派蒙辅助检测;按 L 后当派蒙头像可见时提前跳出战斗结束检测
224
+ * @since 0.64.0
225
+ */
226
+ paimonEndCheckEnabled: boolean;
227
+ /**
228
+ * 派蒙辅助检测延时,单位秒
229
+ * @since 0.64.0
230
+ */
231
+ paimonEndCheckDelay: number;
214
232
  }
215
233
 
216
234
  export interface AutoLeyLineOutcropFightConfig_FightFinishDetectConfigHostType extends HostType<
@@ -30,7 +30,6 @@ export interface AutoLeyLineOutcropParam extends Omit<
30
30
  | "fightConfig"
31
31
  | "friendshipTeam"
32
32
  | "isGoToSynthesizer"
33
- | "isNotification"
34
33
  | "isResinExhaustionMode"
35
34
  | "leyLineOutcropType"
36
35
  | "openModeCountMin"
@@ -40,7 +39,6 @@ export interface AutoLeyLineOutcropParam extends Omit<
40
39
  | "setDefault"
41
40
  | "team"
42
41
  | "timeout"
43
- | "useAdventurerHandbook"
44
42
  | "useFragileResin"
45
43
  | "useTransientResin"
46
44
  > {
@@ -70,11 +68,6 @@ export interface AutoLeyLineOutcropParam extends Omit<
70
68
  * @since 0.58.0
71
69
  */
72
70
  isResinExhaustionMode: boolean;
73
- /**
74
- * 是否使用冒险之证寻找地脉花
75
- * @since 0.58.0
76
- */
77
- useAdventurerHandbook: boolean;
78
71
  /**
79
72
  * 好感队名称
80
73
  * @since 0.58.0
@@ -110,11 +103,6 @@ export interface AutoLeyLineOutcropParam extends Omit<
110
103
  * @since 0.58.0
111
104
  */
112
105
  useTransientResin: boolean;
113
- /**
114
- * 是否通过 BetterGI 通知系统发送详细通知
115
- * @since 0.58.0
116
- */
117
- isNotification: boolean;
118
106
  /**
119
107
  * 是否在领取奖励后扫描掉落物光柱
120
108
  * @since 0.59.0
@@ -56,6 +56,8 @@ export type HurryOnAvatar =
56
56
  | "流浪者"
57
57
  | "伊法"
58
58
  | "希诺宁"
59
+ | "法尔伽"
60
+ | "夜兰"
59
61
  | (string & {});
60
62
 
61
63
  /**