Skip to content
Simon Sørensen edited this page Jun 14, 2023 · 7 revisions

unusual-effects

A Node.js wrapper for Team Fortress 2's Unusual particle effects.

Documentation

When you require() the module, the isUnusual, getAllEffects, getEffectById, getEffectByName, getEffectsByType, getEffectsBySeries and getEffectFromObject functions are returned. This page lists all parameters and types available for each function.

However, you can also require individual functions and types exported by the module using destructuring.

Below is a CommonJS example:

// Only require the getEffectByName function
const { getEffectByName} = require('unusual-effects');

A list of exported functions and types is available here.

Functions and Types

Most of the functions use primitive JavaScript types, however, a few use custom interfaces to represent objects and have been made available through TypeScript imports.

isUnusual (effect)

Check if a String or Number is an Unusual effect.

  • effect - Any Unusual effect name or id.

Returns true if the specified effect matches any known Unusual effect, otherwise, false.

getAllEffects()

Get all the Unusual effects currently available in-game.

Returns an array of Unusual effect objects.

getEffectById (id)

Get the Unusual effect whose id property matches the specified string or number.

  • id - The id of the Unusual effect.

Returns an Unusual effect object matching the specified id, or null if no matching Unusual was found.

getEffectByName (effect)

Get the Unusual effect whose name property matches the specified string.

  • effect - The name of the Unusual effect.

Returns an Unusual effect object matching the specified effect, or null if no matching Unusual was found.

getEffectsByType (type)

Get all the Unusual effects whose type property matches the specified string.

  • type - The type of in-game item that an Unusual effect is associated with.

Returns an array of Unusual effect objects matching the specified type.

getEffectsBySeries (series)

Get all the Unusual effects whose series property matches the specified string.

  • series - The series of crates or cases that an Unusual effect is associated with.

Returns an array of Unusual effect objects matching the specified series.

getEffectFromObject (item)

Get an Unusual effect from an EconItem object.

  • item - An EconItem object that represents an item within the Steam economy.

Returns an Unusual effect object matching the specified item, or null if no matching Unusual was found.

Examples

For now, there are some examples available in the test directory.

Support

Feel free to create an issue if you need to report any bugs or have a suggestion for a new feature.