lol-constants
Version:
League of Legends constants, functions, and types. Provides a plathera of functions to easily convert between ID, Name, and Key for champions, items, summoner spells, and runes.
40 lines (39 loc) • 2.87 kB
TypeScript
import { RuneId, RuneKey, RuneName, RuneTreeId, RuneTreeKey, RuneTreeName, RuneTrees, Runes, StatRuneId, StatRuneName, StatRunes, StatRunesInSlot, StatRunesInSlotArr, statRuneNames } from '../objects/generated/Runes';
import { MergeKeys } from './type';
/** Get a rune by its **id**, **key**, or **name**. */
export declare function getRune(id_key_name: RuneId | RuneKey | RuneName): typeof Runes[keyof typeof Runes];
type StatRune = MergeKeys<typeof StatRunes[keyof typeof StatRunes]>;
type StatRuneInSlot = MergeKeys<typeof StatRunesInSlotArr[number]>;
type SlotOfStatRune<T> = T extends StatRuneId ? keyof typeof StatRunesInSlot[T] : T extends StatRuneName ? keyof typeof StatRunesInSlot[typeof statRuneNames[T]] : undefined;
/**
* Get a stat rune by its **id** or **name**.
*
* ---
* Optionally, receive a `horizontal` and `slot` property in the stat rune object
* by providing a value for the secondary function parameter `slot`.
* `horizontal` provides ids of other stat runes that are in the same row as gotten stat rune.
*/
export declare function getStatRune(id_name: StatRuneId | StatRuneName): StatRune;
/**
* Get a stat rune by its **id** or **name**.
*
* ---
* Optionally, receive a `horizontal` and `slot` property in the stat rune object
* by providing a value for the secondary function parameter `slot`.
* `horizontal` provides ids of other stat runes that are in the same row as gotten stat rune.
*/
export declare function getStatRune<T extends StatRuneId | StatRuneName, S extends SlotOfStatRune<T>>(id_name: T, slot?: S): StatRuneInSlot;
/** Get a rune tree by its **id**, **key**, or **name**. */
export declare function getRuneTree(id_key_name: RuneTreeId | RuneTreeKey | RuneTreeName): typeof RuneTrees[keyof typeof RuneTrees];
export declare function isRuneId(id: number | null | undefined): id is RuneId;
export declare function isRuneKey(key: string | null | undefined): key is RuneKey;
export declare function isRuneName(name: string | null | undefined): name is RuneName;
export declare function isRune(id_key_name: number | string | null | undefined): id_key_name is RuneId | RuneKey | RuneName;
export declare function isStatRuneId(id: number | null | undefined): id is StatRuneId;
export declare function isStatRuneName(name: string | null | undefined): name is StatRuneName;
export declare function isStatRune(id_name: number | string | null | undefined): id_name is StatRuneId | StatRuneName;
export declare function isRuneTreeId(id: number | null | undefined): id is RuneTreeId;
export declare function isRuneTreeKey(key: string | null | undefined): key is RuneTreeKey;
export declare function isRuneTreeName(name: string | null | undefined): name is RuneTreeName;
export declare function isRuneTree(id_key_name: number | string | null | undefined): id_key_name is RuneTreeId | RuneTreeKey | RuneTreeName;
export {};