ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
74 lines (73 loc) • 2.85 kB
TypeScript
import { DeepRequired, TeeSkinEyeVariant, TeeSkinRenderOptions } from './TeeSkinUtils.js';
/**
* All the assets I found in the teeworlds repo under datasrc/skins
* @internal
*/
export declare const TeeSkin7AssetTypes: {
readonly body: readonly ["bat", "bear", "beaver", "dog", "force", "fox", "hippo", "kitty", "koala", "monkey", "mouse", "piglet", "raccoon", "spiky", "standard", "x_ninja"];
readonly marking: readonly ["bear", "belly1", "belly2", "blush", "bug", "cammo1", "cammo2", "cammostripes", "coonfluff", "donny", "downdony", "duodonny", "fox", "hipbel", "lowcross", "lowpaint", "marksman", "mice", "mixture1", "mixture2", "monkey", "panda1", "panda2", "purelove", "saddo", "setisu", "sidemarks", "singu", "stripe", "striped", "stripes", "stripes2", "thunder", "tiger1", "tiger2", "toptri", "triangular", "tricircular", "tripledon", "tritri", "twinbelly", "twincross", "twintri", "uppy", "warpaint", "warstripes", "whisker", "wildpaint", "wildpatch", "yinyang"];
readonly decoration: readonly ["hair", "twinbopp", "twinmello", "twinpen", "unibop", "unimelo", "unipento"];
readonly feet: readonly ["standard"];
readonly eyes: readonly ["colorable", "negative", "standard", "standardreal", "x_ninja"];
};
/**
* 0.7 Skin asset type
*/
export type AssetType = keyof typeof TeeSkin7AssetTypes;
/**
* 0.7 Skin asset name
*/
export type Asset<T extends AssetType> = (typeof TeeSkin7AssetTypes)[T][number];
/**
* Util function to assert if a given string is a valid asset name.
*/
export declare function assertSkinPart<T extends AssetType>(type: T, name?: string): name is Asset<T>;
/**
* Options for {@link TeeSkin7}
*/
export interface TeeSkin7Options {
body?: Asset<'body'>;
marking?: Asset<'marking'> | null;
decoration?: Asset<'decoration'> | null;
feet?: Asset<'feet'>;
eyes?: Asset<'eyes'>;
}
/**
* Class used to render TW 0.7 skins (teeworlds).
*/
export declare class TeeSkin7 {
/**
* 0.7 Tee Skin part responses cache. (48h default TTL)
*/
private static cache;
/**
* Sets the TTL (Time-To-Live) for objects in cache.
*/
static setTTL: (ttlMS?: number) => void;
/**
* Clears the {@link TeeSkin7.cache}.
*/
static clearCache: () => Promise<void>;
/**
* Options for this instance.
*/
opts: DeepRequired<TeeSkin7Options>;
/**
* Construct a new {@link TeeSkin7} instance.
*/
constructor(options?: TeeSkin7Options);
/**
* Renders the tee skin image.
*/
render(
/**
* Render options to use.
*/
options?: Omit<TeeSkinRenderOptions, 'eyeVariant'> & {
eyeVariant?: Exclude<TeeSkinEyeVariant, TeeSkinEyeVariant.dead>;
}): Promise<Buffer>;
/**
* Fetch skin parts and store the response buffer in the cache.
*/
private static makeRequest;
}