Giter VIP home page Giter VIP logo

node-tf2-backpack's Introduction

node-tf2-backpack

Typed module to parse the backpack property from node-tf2.
Using this you no longer have to retrieve your own (bots) backpack from the steam API, which has been having issues with increasing ratelimits.

Installation

npm install tf2-backpack
import { BackpackParser } from 'tf2-backpack';
const parser = new BackpackParser(itemsGame);
// or
const tf2backpack = require('tf2-backpack');
const parser = new tf2backpack.BackpackParser(itemsGame);

Docs

Constructor(itemsGame)

  • itemsGame - itemSchema property from node-tf2. See the docs.

Constructs a new BackpackParser.
It is recommended that you save the itemSchema. It is not emitted on every connection, as it is cached. Currently working on figuring out a way to maybe force a refresh, but no promises.

Alternatively, you can also use any vdf parser module and use items_game from items_game.txt (you can find this here or the schema as items_game_url) as input.
Or items-game.json from node-tf2-static-schema
They're the same

parseBackpack

parseBackpack(backpack: NodeTF2Backpack, mapToString = false): Item<string | number>[] {}
  • backpack - backpack property from node-tf2. See the docs.
  • mapToString - set to true to return spells, parts, sheen, killstreaker, killstreakTier and wear as names instead of IDs
  • Returns Item<string | number>[]

Other

Since there are no standardized skus for some properties, this module also provides the following exports:

  • spellNames - spell defindex to name
  • sheens
  • killstreakers
  • parts - strange parts

mapHexToPaintName

mapHexToPaintName(primaryColor?: string, secondaryColor?: string): string {}
  • primaryColor - Primary color of the paint can, the paint property from parseBackpack output

  • secondaryColor - Secondary color of the paint can, the paint_other property from parseBackpack output

  • Returns string - Name of the paint

node-tf2-backpack's People

Contributors

moder112 avatar nicklason avatar zeusjunior avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.