From 39cc07694a04e5451f525e48d85ab3378cb95a25 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 15 Dec 2023 17:00:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20=E6=B7=BB=E5=8A=A0=20wiki=20?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=B1=BB=E5=9E=8B=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/index.ts | 14 +- src/plugins/Hutao/types/Base.d.ts | 29 ++- src/plugins/Hutao/types/Character.d.ts | 257 +++++++++++++++++++++++++ src/types/App/Character.d.ts | 64 +++++- src/views/WIKI/t-character.vue | 30 ++- 5 files changed, 379 insertions(+), 15 deletions(-) create mode 100644 src/plugins/Hutao/types/Character.d.ts diff --git a/src/data/index.ts b/src/data/index.ts index 2fadd4e9..23c6100d 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -1,11 +1,9 @@ /** - * @file data index - * @description data index - * @author BTMuli - * @since Alpha v0.1.5 + * @file src/data/index.ts + * @description 数据文件入口 + * @since Beta v0.3.8 */ -// Data import achievements from "./app/achievements.json"; import achievementSeries from "./app/achievementSeries.json"; import calendar from "./app/calendar.json"; @@ -26,11 +24,15 @@ const wikiFiles = import.meta.glob("./wiki/**/*.json"); /** * @description 动态读取wiki文件 - * @since Alpha v0.1.5 + * @since Beta v0.3.8 * @param {string} dir 目录 * @param {string} name 文件名 * @returns {Promise} 文件内容 */ +export async function getWikiData( + dir: "Character", + name: string, +): Promise<{ default: TGApp.App.Character.WikiItem } | undefined>; export async function getWikiData(dir: string, name: string): Promise { return await wikiFiles[`./wiki/${dir}/${name}.json`](); } diff --git a/src/plugins/Hutao/types/Base.d.ts b/src/plugins/Hutao/types/Base.d.ts index 32979aa2..a650e895 100644 --- a/src/plugins/Hutao/types/Base.d.ts +++ b/src/plugins/Hutao/types/Base.d.ts @@ -1,13 +1,12 @@ /** - * @file src plugins Hutao types Base.d.ts + * @file src/plugins/Hutao/types/Base.d.ts * @description Hutao 插件基础类型定义文件 - * @author BTMuli - * @since Alpha v0.2.1 + * @since Beta v0.3.8 */ /** * @description Hutao 插件基础类型 - * @since Alpha v0.2.1 + * @since Beta v0.3.8 * @namespace Base * @return Base */ @@ -21,9 +20,29 @@ declare namespace TGApp.Plugins.Hutao.Base { * @property {any} data 数据 * @return Response */ - export interface Response { + interface Response { retcode?: number; message?: string; data?: any; } + + /** + * @description 武器类型枚举,英文-中文对照 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Base + * @enum {string} + * @property {string} sword 单手剑 + * @property {string} claymore 双手剑 + * @property {string} pole 长柄武器 + * @property {string} bow 弓 + * @property {string} catalyst 法器 + * @return WeaponTypeEnum + */ + const enum WeaponType { + sword = "单手剑", + claymore = "双手剑", + pole = "长柄武器", + bow = "弓", + catalyst = "法器", + } } diff --git a/src/plugins/Hutao/types/Character.d.ts b/src/plugins/Hutao/types/Character.d.ts new file mode 100644 index 00000000..ae9037be --- /dev/null +++ b/src/plugins/Hutao/types/Character.d.ts @@ -0,0 +1,257 @@ +/** + * @file plugins/Hutao/types/Character.d.ts + * @description 角色类型定义 + * @since Beta v0.3.8 + */ + +/** + * @description 角色类型 namespace + * @since Beta v0.3.8 + * @namespace TGApp.Plugins.Hutao.Character + * @memberof TGApp.Plugins.Hutao + */ +declare namespace TGApp.Plugins.Hutao.Character { + /** + * @description 元数据-胡桃 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem => Rhi + * @property {number} Id 角色编号 + * @property {number} PromoteId 未知 + * @property {number} Sort 排序 + * @property {number} Body 未知 + * @property {string} Icon 角色头像 + * @property {string} SideIcon 角色侧面头像 + * @property {string} Name 角色名称 + * @property {string} Description 角色简介 + * @property {string} BeginTime 上线时间 // 2021-03-02T16:00:00+08:00 + * @property {number} Quality 角色星级 + * @property {TGApp.Plugins.Hutao.Base.WeaponType} Weapon 武器类型 + * @property {RhiBaseValue} BaseValue 角色基础属性 + * @property {RhiGrowCurve[]} GrowCurves 未知 + * @property {RhiSkillDepot} SkillDepot 角色技能 + * @property {RhiFetterInfo} FetterInfo 好感信息 + * @property {RhiCostume[]} Costumes 角色皮肤 + * @property {number[]} CultivationItems 角色培养材料 + * @return RawHutaoItem + */ + interface RawHutaoItem { + Id: number; + PromoteId: number; + Sort: number; + Body: number; + Icon: string; + SideIcon: string; + Name: string; + Description: string; + BeginTime: string; + Quality: number; + Weapon: TGApp.Plugins.Hutao.Base.WeaponType; + BaseValue: RhiBaseValue; + GrowCurves: RhiGrowCurve[]; + SkillDepot: RhiSkillDepot; + FetterInfo: RhiFetterInfo; + Costumes: RhiCostume[]; + CultivationItems: number[]; + } + + /** + * @description 元数据-胡桃-基础属性 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.BaseValue => Rhi.BaseValue + * @property {number} HpBase 生命值 + * @property {number} AttackBase 攻击力 + * @property {number} DefenseBase 防御力 + * @return RhiBaseValue + */ + interface RhiBaseValue { + HpBase: number; + AttackBase: number; + DefenseBase: number; + } + + /** + * @description 元数据-胡桃-成长曲线 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.GrowCurves => Rhi.GrowCurves + * @property {number} Type 未知 + * @property {number} Value 未知 + * @return RhiGrowCurve + */ + interface RhiGrowCurve { + Type: number; + Value: number; + } + + /** + * @description 元数据-胡桃-技能 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.SkillDepot => Rhi.SkillDepot + * @property {number} Arkhe 未知 + * @property {RhisdSkill[]} Skills 角色技能 + * @property {RhisdSkill} EnergySkill 角色元素爆发 + * @property {RhisdSkill[]} Inherents 角色天赋 + * @property {RhisdTalent[]} Talents 角色天赋 + * @return RhiSkillDepot + */ + interface RhiSkillDepot { + Arkhe: number; + Skills: RhisdSkill[]; + EnergySkill: RhisdSkill; + Inherents: RhisdSkill[]; + Talents: RhisdTalent[]; + } + + /** + * @description 元数据-胡桃-技能 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.SkillDepot.Skill => RhisdSkill + * @property {number} GroupId 技能组编号 + * @property {string[]} Proud.Description 技能描述 + * @property {RhiParameter[]} Proud.Parameters 技能参数 + * @property {number} Id 技能编号 + * @property {string} Name 技能名称 + * @property {string} Description 技能描述 + * @property {string} Icon 技能图标 + * @return RhisdSkill + */ + interface RhisdSkill { + GroupId: number; + Proud: { + Description: string[]; + Parameters: RhiParameter[]; + }; + Id: number; + Name: string; + Description: string; + Icon: string; + } + + /** + * @description 元数据-胡桃-技能-参数 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.SkillDepot.Skill.Proud.Parameters => RhiParameter + * @property {number} Level 技能等级 + * @property {number[]} Parameters 技能参数 + * @return RhiParameter + */ + interface RhiParameter { + Level: number; + Parameters: number[]; + } + + /** + * @description 元数据-胡桃-技能-天赋 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.SkillDepot.Talents => RhisdTalent + * @property {number} Id 天赋编号 + * @property {string} Name 天赋名称 + * @property {string} Description 天赋描述 + * @property {string} Icon 天赋图标 + * @return RhisdTalent + */ + interface RhisdTalent { + Id: number; + Name: string; + Description: string; + Icon: string; + } + + /** + * @description 元数据-胡桃-好感信息 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.FetterInfo => RhiFetterInfo + * @property {string} Title 角色称号 + * @property {string} Detail 角色简介 + * @property {number} Association 角色地区 + * @property {string} Native 角色地区 + * @property {number} BirthMonth 角色生日-月 + * @property {number} BirthDay 角色生日-日 + * @property {string} VisionBefore 角色元素类型 + * @property {string} VisionAfter 未知 + * @property {string} ConstellationBefore 角色星座 + * @property {string} ConstellationAfter 未知 + * @property {string} CvChinese 角色声优-中文 + * @property {string} CvJapanese 角色声优-日文 + * @property {string} CvEnglish 角色声优-英文 + * @property {string} CvKorean 角色声优-韩文 + * @property {number} CookBonus.OriginItemId 角色特殊料理编号 + * @property {number} CookBonus.ItemId 角色特殊料理编号 + * @property {number[]} CookBonus.InputList 角色特殊料理材料 + * @property {RhiFetter[]} Fetters 角色语音 + * @property {RhiFetter[]} FetterStories 角色好感故事 + * @return RhiFetterInfo + */ + interface RhiFetterInfo { + Title: string; + Detail: string; + Association: number; + Native: string; + BirthMonth: number; + BirthDay: number; + VisionBefore: string; + VisionAfter: string; + ConstellationBefore: string; + ConstellationAfter: string; + CvChinese: string; + CvJapanese: string; + CvEnglish: string; + CvKorean: string; + CookBonus: { + OriginItemId: number; + ItemId: number; + InputList: number[]; + }; + Fetters: RhiFetter[]; + FetterStories: RhiFetter[]; + } + + /** + * @description 元数据-胡桃-好感信息-语音 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.FetterInfo.Fetters => RhiFetter + * @property {string} Title 语音标题 + * @property {string} Context 语音内容 + * @return RhiFetter + */ + interface RhiFetter { + Title: string; + Context: string; + } + + /** + * @description 元数据-胡桃-皮肤 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Character + * @description RawHutaoItem.Costumes => RhiCostume + * @property {number} Id 皮肤编号 + * @property {string} Name 皮肤名称 + * @property {string} Description 皮肤描述 + * @property {boolean} IsDefault 是否默认皮肤 + * @property {string} [FrontIcon] 非默认皮肤头像 + * @property {string} [SideIcon] 非默认皮肤侧面头像 + * @return RhiCostume + */ + type RhiCostume = { + Id: number; + Name: string; + Description: string; + } & ( + | { + FrontIcon: string; + SideIcon: string; + IsDefault: false; + } + | { + IsDefault: true; + } + ); +} diff --git a/src/types/App/Character.d.ts b/src/types/App/Character.d.ts index d5511572..f0e8ffcb 100644 --- a/src/types/App/Character.d.ts +++ b/src/types/App/Character.d.ts @@ -1,8 +1,7 @@ /** - * @file types App Character.d.ts + * @file types/App/Character.d.ts * @description 角色相关类型定义文件 - * @author BTMuli - * @since Alpha v0.2.2 + * @since Beta v0.3.8 */ declare namespace TGApp.App.Character { @@ -32,4 +31,63 @@ declare namespace TGApp.App.Character { weapon: string; nameCard: string; } + + /** + * @description Wiki 详细数据 + * @since Beta v0.3.8 + * @interface WikiItem + * @memberof TGApp.Plugins.Hutao.Character + * @property {number} id 角色编号 + * @property {string} name 角色名称 + * @property {string} title 角色称号 + * @property {string} description 角色简介 + * @property {object} brief 角色简介 + * @property {string} brief.camp 角色地区 + * @property {string} brief.constellation 角色星座 + * @property {string} brief.birth 角色生日 + * @property {object} brief.cv 角色声优 + * @property {string} brief.cv.cn 角色声优-中文 + * @property {string} brief.cv.jp 角色声优-日文 + * @property {string} brief.cv.en 角色声优-英文 + * @property {string} brief.cv.kr 角色声优-韩文 + * @property {number} star 角色星级 + * @property {string} element 角色元素类型 + * @property {TGApp.Plugins.Hutao.Base.WeaponType} weapon 角色武器类型 + * @property {TGApp.App.Calendar.Material[]} materials 角色培养材料 + * @property {object} skills 角色技能 + * @property {TGApp.Plugins.Hutao.Character.RhisdSkill[]} skills.normal 正常技能-普攻、战技、元素爆发 + * @property {TGApp.Plugins.Hutao.Character.RhisdSkill[]} skills.special 特殊技能 + * @property {TGApp.Plugins.Hutao.Character.RhisdTalent[]} constellation 角色命座 + * @property {TGApp.Plugins.Hutao.Character.RhiFetter[]} talks 闲聊 + * @property {TGApp.Plugins.Hutao.Character.RhiFetter[]} stories 故事 + * @return WikiItem + */ + interface WikiItem { + id: number; + name: string; + title: string; + description: string; + brief: { + camp: string; + constellation: string; + birth: string; + cv: { + cn: string; + jp: string; + en: string; + kr: string; + }; + }; + star: number; + element: string; + weapon: TGApp.Plugins.Hutao.Base.WeaponType; + materials: TGApp.App.Calendar.Material[]; + skills: { + normal: TGApp.Plugins.Hutao.Character.RhisdSkill[]; + special: TGApp.Plugins.Hutao.Character.RhisdSkill[]; + }; + constellation: TGApp.Plugins.Hutao.Character.RhisdTalent[]; + talks: TGApp.Plugins.Hutao.Character.RhiFetter[]; + stories: TGApp.Plugins.Hutao.Character.RhiFetter[]; + } } diff --git a/src/views/WIKI/t-character.vue b/src/views/WIKI/t-character.vue index b9e34153..87acedcb 100644 --- a/src/views/WIKI/t-character.vue +++ b/src/views/WIKI/t-character.vue @@ -1 +1,29 @@ -