diff --git a/src/data/index.ts b/src/data/index.ts index 23c6100d..46862d91 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -33,6 +33,10 @@ export async function getWikiData( dir: "Character", name: string, ): Promise<{ default: TGApp.App.Character.WikiItem } | undefined>; +export async function getWikiData( + dir: "Weapon", + name: string, +): Promise<{ default: TGApp.App.Weapon.WikiItem } | undefined>; export async function getWikiData(dir: string, name: string): Promise { return await wikiFiles[`./wiki/${dir}/${name}.json`](); } diff --git a/src/pages/WIKI/Weapon.vue b/src/pages/WIKI/Weapon.vue index 593edcec..249b6fc7 100644 --- a/src/pages/WIKI/Weapon.vue +++ b/src/pages/WIKI/Weapon.vue @@ -13,18 +13,25 @@ import { ref, computed } from "vue"; import TibWikiWeapon from "../../components/itembox/tib-wiki-weapon.vue"; import { AppWeaponData } from "../../data"; import Mys from "../../plugins/Mys"; -import { createTGWindow } from "../../utils/TGWindow"; +import { useAppStore } from "../../store/modules/app"; +import { createTGWindow, createWiki } from "../../utils/TGWindow"; // snackbar const snackbar = ref(false); // data const cardsInfo = computed(() => AppWeaponData); +const appStore = useAppStore(); function toOuter(item: TGApp.App.Weapon.WikiBriefInfo): void { if (item.contentId === 0) { snackbar.value = true; return; } + // 如果是调试环境,打开 wiki 页面 + if (appStore.devMode) { + createWiki("Weapon", item.id.toString()); + return; + } const url = Mys.Api.Obc.replace("{contentId}", item.contentId.toString()); createTGWindow(url, "Sub_window", `Content_${item.contentId} ${item.name}`, 1200, 800, true); } diff --git a/src/plugins/Hutao/types/Material.d.ts b/src/plugins/Hutao/types/Material.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/plugins/Hutao/types/Weapon.d.ts b/src/plugins/Hutao/types/Weapon.d.ts new file mode 100644 index 00000000..79c4b968 --- /dev/null +++ b/src/plugins/Hutao/types/Weapon.d.ts @@ -0,0 +1,68 @@ +/** + * @file plugins/Hutao/types/Weapon.d.ts + * @description 武器组件类型定义 + * @since Beta v0.3.8 + */ + +/** + * @description 武器类型 namespace + * @since Beta v0.3.8 + * @namespace TGApp.Plugins.Hutao.Weapon + * @memberof TGApp.Plugins.Hutao + */ +declare namespace TGApp.Plugins.Hutao.Weapon { + /** + * @description 元数据-胡桃 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Weapon + * @description RawHutaoItem => Rhi + * @property {number} Id 角色编号 + * @property {number} PromoteId 未知 + * @property {TGApp.Plugins.Hutao.Base.WeaponType} WeaponType 武器类型 + * @property {number} RankLevel 武器星级 + * @property {string} Name 武器名称 + * @property {string} Description 武器简介 + * @property {string} Icon 武器图标 + * @property {string} AwakenIcon 武器觉醒图标 + * @property {number} GrowCurves.InitValue 未知 + * @property {number} GrowCurves.Type 未知 + * @property {number} GrowCurves.Value 未知 + * @property {RhiAffix} Affix 精炼描述 + * @property {number[]} CultivationItems 武器培养材料 + * @return RawHutaoItem + */ + interface RawHutaoItem { + Id: number; + PromoteId: number; + WeaponType: TGApp.Plugins.Hutao.Base.WeaponType; + RankLevel: number; + Name: string; + Description: string; + Icon: string; + AwakenIcon: string; + GrowCurves: { + InitValue: number; + Type: number; + Value: number; + }; + Affix: RhiAffix; + CultivationItems: number[]; + } + + /** + * @description 精炼描述 + * @since Beta v0.3.8 + * @memberof TGApp.Plugins.Hutao.Weapon + * @interface RhiAffix + * @property {string} Name 精炼名称 + * @property {Array<{Level: number; Description: string}>} Description 精炼描述 + * @return RhiAffix + */ + interface RhiAffix { + Name: string; + Description: Array<{ + Level: number; + Description: string; + }>; + } +} diff --git a/src/types/App/Weapon.d.ts b/src/types/App/Weapon.d.ts index 9cdbbd74..1f97a1d5 100644 --- a/src/types/App/Weapon.d.ts +++ b/src/types/App/Weapon.d.ts @@ -1,8 +1,7 @@ /** - * @file types App Weapon.d.ts + * @file types/App/Weapon.d.ts * @description 本应用的武器类型定义文件 - * @author BTMuli - * @since Alpha v0.1.5 + * @since Beta v0.3.8 */ declare namespace TGApp.App.Weapon { @@ -28,4 +27,30 @@ declare namespace TGApp.App.Weapon { weaponIcon: string; icon: string; } + + /** + * @description 转换后的武器数据 + * @since Beta v0.3.8 + * @interface WikiItem + * @memberof TGApp.App.Weapon + * @property {number} id 武器 id + * @property {string} name 武器名称 + * @property {string} description 武器简介 + * @property {number} star 武器星级 + * @property {string} weapon 武器类型 + * @property {TGApp.App.Calendar.Material[]} materials 武器培养材料 + * @property {TGACore.Components.Weapon.RhiAffix} affix 精炼描述 + * @property {string} story 武器故事 + * @return WikiItem + */ + interface WikiItem { + id: number; + name: string; + description: string; + star: number; + weapon: string; + materials: TGApp.App.Calendar.Material[]; + affix: TGACore.Components.Weapon.RhiAffix; + story: string; + } } diff --git a/src/utils/TGWindow.ts b/src/utils/TGWindow.ts index dfdd651b..26231e65 100644 --- a/src/utils/TGWindow.ts +++ b/src/utils/TGWindow.ts @@ -127,7 +127,6 @@ export function createAnno(item: TGApp.App.Announcement.ListCard): void { * @returns {void} */ export function createWiki(dir: string, name: string): void { - // if(dir !== "Character") return; const dirName = dir === "GCG" ? dir : dir.toLowerCase(); const wikiPath = `/wiki/detail/${dirName}/${name}`; createTGWindow(wikiPath, "Sub_window", `Wiki_${dirName}_${name}`, 960, 720, false, false); diff --git a/src/views/WIKI/t-weapon.vue b/src/views/WIKI/t-weapon.vue index 1931f12f..352e08f7 100644 --- a/src/views/WIKI/t-weapon.vue +++ b/src/views/WIKI/t-weapon.vue @@ -1,25 +1,53 @@ - +