cs2schema
Version:
A TypeScript SDK for Counter-Strike 2 schema data with ID/name resolution utilities
109 lines (108 loc) • 2.68 kB
TypeScript
export interface BaseItem {
market_hash_name: string;
[key: string]: any;
}
export interface Collection {
key: string;
name: string;
has_crate?: boolean;
has_souvenir?: boolean;
}
export interface Rarity {
key: string;
name: string;
color?: string;
}
export interface StickerItem extends BaseItem {
}
export interface Stickers {
[key: string]: StickerItem;
}
export interface KeychainItem extends BaseItem {
}
export interface Keychains {
[key: string]: KeychainItem;
}
export interface CollectibleItem extends BaseItem {
}
export interface Collectibles {
[key: string]: CollectibleItem;
}
export interface ContainerItem extends BaseItem {
}
export interface Containers {
[key: string]: ContainerItem;
}
export interface AgentItem extends BaseItem {
}
export interface Agents {
[key: string]: AgentItem;
}
export interface CustomStickerItem extends BaseItem {
}
export interface CustomStickers {
[key: string]: CustomStickerItem;
}
export interface MusicKitItem extends BaseItem {
}
export interface MusicKits {
[key: string]: MusicKitItem;
}
export interface Paint {
name: string;
[key: string]: any;
}
export interface WeaponItem {
name: string;
type?: string;
paints: {
[key: string]: Paint;
};
[key: string]: any;
}
export interface ProcessedWeaponItem extends BaseItem, Paint {
}
export interface Weapons {
[key: string]: WeaponItem;
}
export interface Schema {
collections: Collection[];
rarities: Rarity[];
stickers: Stickers;
keychains: Keychains;
collectibles: Collectibles;
containers: Containers;
agents: Agents;
custom_stickers: CustomStickers;
music_kits: MusicKits;
weapons: Weapons;
}
export type ItemCategory = "stickers" | "keychains" | "collectibles" | "containers" | "agents" | "custom_stickers" | "music_kits" | "weapons";
export type ItemType = StickerItem | KeychainItem | CollectibleItem | ContainerItem | AgentItem | CustomStickerItem | MusicKitItem | ProcessedWeaponItem;
export interface ResolveResult<T = ItemType> {
id: string;
item: T;
category: ItemCategory;
}
export interface WeaponSkinResolveResult extends ResolveResult<ProcessedWeaponItem> {
weaponId: string;
}
export interface SearchOptions {
caseSensitive?: boolean;
exactMatch?: boolean;
category?: ItemCategory;
}
export interface WeaponWearState {
name: string;
minFloat: number;
maxFloat: number;
}
export interface GeneratedMarketHashName {
baseName: string;
wearState: string;
fullName: string;
minFloat: number;
maxFloat: number;
collection?: string;
isSouvenir?: boolean;
}