diff --git a/src/wow/guild_crest.ts b/src/wow/guild_crest.ts new file mode 100644 index 0000000..dc85de6 --- /dev/null +++ b/src/wow/guild_crest.ts @@ -0,0 +1,87 @@ +import { KeyId, LinkSelfHref, request } from "../shared/index.ts"; + +interface Emblem { + id: number; + media: KeyId[]; +} + +interface Border { + id: number; + media: KeyId[]; +} + +interface IdRgba { + id: number; + rgba: { + r: number; + g: number; + b: number; + a: number; + }; +} + +interface GuildCrests extends LinkSelfHref { + emblems: Emblem[]; + borders: Border[]; + colors: { + emblems: IdRgba[]; + borders: IdRgba[]; + backgrounds: IdRgba[]; + }; +} + +interface Asset { + key: string; + value: string; +} + +interface GuildCrestBorder extends LinkSelfHref { + assets: Asset[]; + id: number; +} + +interface GuildCrestEmblem extends LinkSelfHref { + assets: Asset[]; + id: number; +} + +/** + * Returns the Guild Crest Components Index + * + * @returns A promise that resolves to an object representing a list of all Guild Crest Components. + */ +export async function guildCrests(): Promise { + return await request({ + method: "GET", + url: "/data/wow/guild-crest/index", + namespace: "static", + }); +} + +/** + * Returns a Guild Crest Border Media + * + * @param borderId - The unique identifier for the Covenant + * @returns A promise that resolves to an object representing details about a Guild Crest Border Media. + */ +export async function guildCrestBorder(borderId: number): Promise { + return await request({ + method: "GET", + url: `/data/wow/media/guild-crest/border/${borderId}`, + namespace: "static", + }); +} + +/** + * Returns a Crest Emblem Media + * + * @param emblemId - The unique identifier for the Crest Emblem Media + * @returns A promise that resolves to an object representing details about a Crest Emblem Media. + */ +export async function guildCrestEmblem(emblemId: number): Promise { + return await request({ + method: "GET", + url: `/data/wow/media/guild-crest/emblem/${emblemId}`, + namespace: "static", + }); +} diff --git a/src/wow/heirloom.ts b/src/wow/heirloom.ts new file mode 100644 index 0000000..51a3072 --- /dev/null +++ b/src/wow/heirloom.ts @@ -0,0 +1,106 @@ +import { KeyId, KeyNameId, LinkSelfHref, LocalizedString, request } from "../shared/index.ts"; + +interface Heirlooms extends LinkSelfHref { + heirlooms: KeyNameId[]; +} + +interface TypeName { + type: string; + name: LocalizedString; +} + +interface ValueDisplayString { + value: number; + display_string: LocalizedString; +} + +interface UpgradeStats { + type: TypeName; + value: number; + display: { + display_string: LocalizedString; + color: { + r: number; + g: number; + b: number; + a: number; + }; + }; +} + +interface Upgrade { + item: { + item: KeyId; + context: number; + bonus_list: number[]; + quality: TypeName; + name: LocalizedString; + media: KeyId; + item_class: KeyNameId; + item_subclass: KeyNameId; + inventory_type: TypeName; + binding: TypeName; + weapon: { + damage: { + min_value: number; + max_value: number; + display_string: LocalizedString; + damage_class: TypeName; + }; + attack_speed: ValueDisplayString; + dps: ValueDisplayString; + }; + stats: UpgradeStats[]; + upgrades: { + value: number; + max_value: number; + display_string: LocalizedString; + }; + requirements: { + level: { + display_string: LocalizedString; + }; + }; + level: ValueDisplayString; + }; + level: number; +} + +interface Heirloom extends LinkSelfHref { + id: number; + item: KeyNameId; + source: { + type: string; + name: LocalizedString; + }; + source_description: LocalizedString; + upgrades: Upgrade[]; + media: KeyId; +} + +/** + * Returns the Heirloom Index + * + * @returns A promise that resolves to an object representing a list of all Heirlooms. + */ +export async function heirlooms(): Promise { + return await request({ + method: "GET", + url: "/data/wow/heirloom/index", + namespace: "static", + }); +} + +/** + * Returns a Heirloom + * + * @param heirloomId - The unique identifier for the Heirloom + * @returns A promise that resolves to an object representing details about a Heirloom. + */ +export async function heirloom(heirloomId: number): Promise { + return await request({ + method: "GET", + url: `/data/wow/heirloom/${heirloomId}`, + namespace: "static", + }); +} diff --git a/src/wow/index.ts b/src/wow/index.ts index 7d51602..c9beeb1 100644 --- a/src/wow/index.ts +++ b/src/wow/index.ts @@ -32,4 +32,8 @@ export { searchCreature, } from "./creature.ts"; +export { guildCrestBorder, guildCrestEmblem, guildCrests } from "./guild_crest.ts"; + +export { heirloom, heirlooms } from "./heirloom.ts"; + export { token } from "./token.ts";