mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 10:10:47 +01:00
Add skins overview for champions
This commit is contained in:
@@ -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<Array<Skin>> {
|
||||
let res = await axios.get(`${this.getClientPath(args)}/v1/skins.json`);
|
||||
return Object.entries(res.data).map(([key, value]) => new Skin(value));
|
||||
}
|
||||
}
|
||||
@@ -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<SkinLine>;
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user