From f709d682aa8f116c465b6c7ed0d762ef0f4f37e6 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Mon, 15 May 2023 18:35:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20=E6=A0=B9=E6=8D=AE=20JS?= =?UTF-8?q?ON=20=E5=A2=9E=E6=94=B9=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/app/index.ts | 15 ++++--- src/types/Calendar.d.ts | 89 ++++++++++++++++++----------------------- src/types/Material.d.ts | 31 ++++++++++++++ 3 files changed, 79 insertions(+), 56 deletions(-) create mode 100644 src/types/Material.d.ts diff --git a/src/data/app/index.ts b/src/data/app/index.ts index 1c1ddc2e..a33dea13 100644 --- a/src/data/app/index.ts +++ b/src/data/app/index.ts @@ -2,7 +2,7 @@ * @file data app index * @description data app index * @author BTMuli - * @since Alpha v0.1.4 + * @since Alpha v0.2.0 */ // Data @@ -11,7 +11,8 @@ import achievementSeries from "./achievementSeries.json"; import calendar from "./calendar.json"; import character from "./character.json"; import GCG from "./GCG.json"; -import nameCards from "./nameCards.json"; +import material from "./material.json"; +import nameCards from "./namecard.json"; import weapon from "./weapon.json"; export const AppDataList = [ @@ -25,7 +26,7 @@ export const AppDataList = [ }, { name: "calendar.json", - data: calendar as Record, + data: calendar as BTMuli.Genshin.Calendar.Data[], }, { name: "character.json", @@ -36,7 +37,11 @@ export const AppDataList = [ data: GCG as BTMuli.Genshin.Wiki.GCG.BriefInfo[], }, { - name: "nameCards.json", + name: "material.json", + data: material as BTMuli.Genshin.Material.BriefInfo[], + }, + { + name: "namecard.json", data: nameCards as BTMuli.Genshin.NameCard[], }, { @@ -48,7 +53,7 @@ export const AppDataList = [ export const AppData = { achievements: achievements as BTMuli.Genshin.Achievement[], achievementSeries: achievementSeries as BTMuli.Genshin.AchievementSeries[], - calendar: calendar as Record, + calendar: calendar as BTMuli.Genshin.Calendar.Data[], character: character as BTMuli.Genshin.Wiki.Character.BriefInfo[], GCG: GCG as BTMuli.Genshin.Wiki.GCG.BriefInfo[], nameCards: nameCards as BTMuli.Genshin.NameCard[], diff --git a/src/types/Calendar.d.ts b/src/types/Calendar.d.ts index a1436f37..e1222f38 100644 --- a/src/types/Calendar.d.ts +++ b/src/types/Calendar.d.ts @@ -2,68 +2,55 @@ * @file core types TGCalendar.d.ts * @description 本应用的素材日历类型定义 * @author BTMuli - * @since Alpha v0.1.3 + * @since Alpha v0.1.5 */ declare namespace BTMuli.Genshin.Calendar { /** * @description 素材日历接口 * @interface Data - * @since Alpha v0.1.3 - * @property {Record} characters - 该天的角色相关数据 - * @property {Record} weapons - 该天的武器相关数据 + * @since Alpha v0.1.5 + * @property {number} id - 日历项 id + * @property {number} content_id - 观测枢的 content_id + * @property {Array} drop_day - 掉落日 + * @property {string} name - 日历项名称 + * @property {string} item_type - 日历项类型 + * @property {number} star - 日历项星级 + * @property {string} bg - 日历项背景 + * @property {string} icon - 日历项图标 + * @property {string} weapon_type - 武器类型 + * @property {string} element - 角色元素 + * @property {BTMuli.Genshin.Material.BriefInfo[]} materials - 素材简要信息 + * @property {CalendarSource} source - 日历项来源 * @returns {Data} */ export interface Data { - characters: Record - weapons: Record - } - - /** - * @description 单日单秘境的素材日历接口 - * @interface CharaacterItem - * @since Alpha v0.1.3 - * @property {string} title - 地区 秘境名称 - * @property {Material[]} materials - 素材 url - * @property {BTMuli.Genshin.Wiki.Character.BriefInfo[]} contents - 角色/武器的简要信息 - * @returns {CharaacterItem} - */ - export interface CharaacterItem { - title: string - materials: Material[] - contents: BTMuli.Genshin.Wiki.Character.BriefInfo[] - } - - /** - * @description 单日单秘境的素材日历接口 - * @interface WeaponItem - * @since Alpha v0.1.3 - * @property {string} title - 地区 秘境名称 - * @property {Material[]} materials - 素材 url - * @property {BTMuli.Genshin.Wiki.Weapon.BriefInfo[]} contents - 角色/武器的简要信息 - * @returns {WeaponItem} - */ - export interface WeaponItem { - title: string - materials: Material[] - contents: BTMuli.Genshin.Wiki.Weapon.BriefInfo[] - } - - /** - * @description 材料类型 - * @interface Material - * @since Alpha v0.1.3 - * @property {number} id - 角色/武器的 id - * @property {number} star - 角色/武器的星级 - * @property {number} content_id - 观测枢的 content_id - * @property {string} name - 名称 - * @property {string} icon - 图标 url - */ - export interface Material { - id?: number - star: number + id: number content_id: number + drop_day: number[] name: string + item_type: string + star: number + bg: string icon: string + weapon_type: string + element?: string + materials: BTMuli.Genshin.Material.BriefInfo[] + source: CalendarSource + } + + /** + * @description 素材日历来源 + * @interface CalendarSource + * @since Alpha v0.1.5 + * @property {string} type - 来源类型 + * @property {string} area - 来源区域 + * @property {string} name - 来源名称 + * @return {CalendarSource} + */ + export interface CalendarSource { + type: string + area: string + name: string } } diff --git a/src/types/Material.d.ts b/src/types/Material.d.ts new file mode 100644 index 00000000..114514df --- /dev/null +++ b/src/types/Material.d.ts @@ -0,0 +1,31 @@ +/** + * @file types Material.d.ts + * @description 素材相关类型定义 + * @author BTMuli + * @since Alpha v0.1。5 + */ + +declare namespace BTMuli.Genshin.Material { + /** + * @description 简要信息 + * @interface BriefInfo + * @since Alpha v0.1.5 + * @property {number} id - 素材 id + * @property {number} content_id - 观测枢的 content_id + * @property {string} name - 素材名称 + * @property {string} type - 素材类型 + * @property {number} star - 素材星级 + * @property {string} bg - 素材背景 + * @property {string} icon - 素材图标 + * @returns {BriefInfo} + */ + export interface BriefInfo { + id: number + content_id?: number + name: string + type: string + star: number + bg: string + icon: string + } +}