diff --git a/core/client.ts b/core/client.ts index 5faa628..217e8fd 100644 --- a/core/client.ts +++ b/core/client.ts @@ -1,4 +1,4 @@ -import { Champion, ChampionSummary, Item, LocaleVersionArgs, Perk, SummonerEmote, SummonerIcon, WardSkin, Companion, Loot, CherryAugment, Universe, TftItem, TftMapSkin, TftDamageSkin } from './models'; +import { Champion, ChampionSummary, Item, LocaleVersionArgs, Perk, SummonerEmote, SummonerIcon, WardSkin, Companion, Loot, CherryAugment, Universe, TftItem, TftMapSkin, TftDamageSkin, Skin } from './models'; import axios from "axios"; export abstract class ApiObject { @@ -24,6 +24,7 @@ export class Client { public tftItems: TftItemApi; public tftMapSkins: TftMapSkinApi; public tftDamageSkins: TftDamageSkinApi; + public skins: SkinApi; constructor() { this.items = new ItemApi(); @@ -40,6 +41,7 @@ export class Client { this.tftItems = new TftItemApi(); this.tftMapSkins = new TftMapSkinApi(); this.tftDamageSkins = new TftDamageSkinApi(); + this.skins = new SkinApi(); } } @@ -139,4 +141,11 @@ export class TftDamageSkinApi extends ApiObject { let res = await axios.get(`${this.getClientPath(args)}/v1/tftdamageskins.json`); return res.data.map((x: any) => new TftDamageSkin(x)); } +} + +export class SkinApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/skins.json`); + return Object.entries(res.data).map(([key, value]) => new Skin(value)); + } } \ No newline at end of file diff --git a/core/models.ts b/core/models.ts index 2e14dda..16a2b5a 100644 --- a/core/models.ts +++ b/core/models.ts @@ -74,6 +74,12 @@ export class Skin extends CommunityDragonObject { rarity: string; isLegacy: boolean; loadScreenPath: string; + splashPath: string; + uncenteredSplashPath: string; + tilePath: string; + description?: string; + skinLines?: Array; + constructor(json: any) { super(); @@ -84,11 +90,38 @@ export class Skin extends CommunityDragonObject { this.rarity = json.rarity; this.isLegacy = json.isLegacy; this.loadScreenPath = json.loadScreenPath; + this.splashPath = json.splashPath; + this.uncenteredSplashPath = json.uncenteredSplashPath; + this.tilePath = json.tilePath; + this.description = json.description; + this.skinLines = json.skinLines?.map((x: any) => new SkinLine(x)) ?? null; } getLoadScreen(version: string): string { return this.resolveGamePath({path: this.loadScreenPath, version: version}); } + + getSplash(args: LocaleVersionArgs): string { + return this.resolveClientPath({path: this.splashPath, args: args}); + } + + getUncenteredSplash(args: LocaleVersionArgs): string { + return this.resolveClientPath({path: this.uncenteredSplashPath, args: args}); + } + + getTile(args: LocaleVersionArgs): string { + return this.resolveClientPath({path: this.tilePath, args: args}); + } +} + +export class SkinLine extends CommunityDragonObject { + id: number; + + constructor(json: any) { + super(); + + this.id = json.id; + } } export class Passive extends CommunityDragonObject { diff --git a/pages/champions/overview/[id].vue b/pages/champions/overview/[id].vue index 7f390d9..5852710 100644 --- a/pages/champions/overview/[id].vue +++ b/pages/champions/overview/[id].vue @@ -27,7 +27,9 @@
- + + +