Skip to content

Commit b5562a0

Browse files
committed
🏷️ 更新UIGF类型,适配UIGF4.2
1 parent 0fecfb4 commit b5562a0

1 file changed

Lines changed: 31 additions & 25 deletions

File tree

src/types/Plugins/UIGF.d.ts

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* UIGF 标准类型定义文件
3-
* @since Beta v0.8.4
4-
* @remarks UIGF v3.0 | UIGF v4.1
3+
* @since Beta v0.9.5
4+
* @remarks UIGF v3.0 | UIGF v4.2
55
*/
66

77
declare namespace TGApp.Plugins.UIGF {
@@ -18,16 +18,34 @@ declare namespace TGApp.Plugins.UIGF {
1818
};
1919

2020
/**
21-
* UIGF 数据, v4.0
22-
* @since Beta v0.8.4
21+
* Root键
22+
* @since Beta v0.9.5
23+
* @remarks hk4e - 祈愿数据
24+
* @remarks hk4e_ugc - 颂愿数据
2325
*/
24-
type Schema4 = {
26+
type Schema4RootKey = "hk4e" | "hk4e_ugc";
27+
28+
/**
29+
* Root键对应类型
30+
* @since Beta v0.9.5
31+
*/
32+
type Schema4RootType<T extends Schema4RootKey> = T extends "hk4e"
33+
? Array<GachaHk4e>
34+
: T extends "hk4e_ugc"
35+
? Array<GachaUgc>
36+
: never;
37+
38+
/**
39+
* UIGF 数据, v4.2
40+
* @since Beta v0.9.5
41+
*/
42+
type Schema4<K extends Schema4RootKey = never> = {
2543
/** 头部信息 */
2644
info: Info4;
27-
/** 祈愿列表,原神数据 */
28-
hk4e: Array<GachaHk4e>;
29-
/** 祈愿列表,千星奇域数据 */
30-
hk4e_ugc?: Array<GachaUgc>;
45+
} & {
46+
[P in K]: Schema4RootType<P>;
47+
} & {
48+
[P in Exclude<Schema4RootKey, K>]?: Schema4RootType<P>;
3149
};
3250

3351
/**
@@ -83,13 +101,13 @@ declare namespace TGApp.Plugins.UIGF {
83101
timezone: number;
84102
/** 语言 */
85103
lang?: string;
104+
/** 祈愿数据 */
86105
list: Array<GachaItem>;
87106
};
88107

89108
/**
90109
* UIGF4 祈愿项,千星奇域
91-
* @since Beta v0.8.4
92-
* @remarks 该标准尚未最终确定
110+
* @since Beta v0.9.5
93111
*/
94112
type GachaUgc = {
95113
/** UID */
@@ -98,9 +116,7 @@ declare namespace TGApp.Plugins.UIGF {
98116
timezone: number;
99117
/** 语言 */
100118
lang?: string;
101-
/** 服务器区域 */
102-
region: string;
103-
/** 祈愿列表 */
119+
/** 颂愿数据 */
104120
list: Array<GachaItemB>;
105121
};
106122

@@ -132,8 +148,7 @@ declare namespace TGApp.Plugins.UIGF {
132148

133149
/**
134150
* UIGF 祈愿项-千星奇域
135-
* @since Beta v0.8.4
136-
* @remarks 该标准尚未最终确定
151+
* @since Beta v0.9.5
137152
*/
138153
type GachaItemB = {
139154
/** id */
@@ -148,17 +163,8 @@ declare namespace TGApp.Plugins.UIGF {
148163
item_name: string;
149164
/** 稀有度 */
150165
rank_type: string;
151-
/** 是否限定 */
152-
is_up: string;
153166
/** 时间 yyyy-MM-dd HH:mm:ss */
154167
time: string;
155-
/**
156-
* 祈愿类型
157-
* @remarks
158-
* 1000-常驻池
159-
* 2000-活动池
160-
*/
161-
gacha_type: string;
162168
/** 祈愿类型,用于接口请求 */
163169
op_gacha_type: string;
164170
};

0 commit comments

Comments
 (0)