0.0.6 • Published 2 years ago

tf2-get-player-items v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

node-tf2-get-player-items

📖 Table of Contents

👋 Introduction

This module is a wrapper for the IEconItems/GetPlayerItems API specific for a user's backpack. It allows you to get the items for a player, providing game-specific item information not normally provided within the other generic inventory APIs.

🔌 Getting Started

You can install this module with npm within your project by running the command:

npm install tf2-get-player-items

getTF2PlayerItems

The module simply exports a simple function getTF2PlayerItems.

Example Usage
import { getTF2PlayerItems } from `tf2-get-player-items`;

const steamid: string = `76561198081082634`;
const steamAPIKey: string = `abcdefghijk123456`; // your Steam API key

const playerItems: TF2PlayerItemsSchema = await getTF2PlayerItems(steamid, steamAPIKey);

The Schema

The response returned from the API is a JSON object with the following structure:

{
    result: TF2PlayerItemsSchema;
}

Deconstructing this, we get the TF2PlayerItemsSchema interface.

The schema is a simple object with the following properties:

  • status: A number representing the status of the request.
  • num_backpack_slots: A number representing the number of slots in the player's backpack.
  • backpack: An array of TF2PlayerItemsSchemaItem objects.
TF2PlayerItemsSchemaItem

The TF2PlayerItemsSchemaItem interface is a simple object with the following properties:

  • id: A number representing the item's ID.
  • original_id: A number representing the item's original ID.
  • defindex: A number representing the item's defindex.
  • level: A number representing the item's level.
  • quality: A number representing the item's quality.
  • inventory: See Inventory Token
  • quantity: A number representing the item's quantity.
  • origin?: An integer representing the item's origin.
  • style?: A number representing the item's style.
  • equipped?: Represents the item's equipped status.
    • class: A number representing the item's class.
    • slot: A number representing the item's slot.
  • flag_cannot_trade?: A boolean representing whether or not the item cannot be traded.
  • flag_cannot_craft?: A boolean representing whether or not the item cannot be crafted.
  • custom_name: A string representing the item's custom name.
  • custom_desc: A string representing the item's custom description.
  • contained_item: A TF2PlayerItemsSchemaItem representing the item's contained item.
  • attributes: An array representing the item's attributes.
    • defindex: A number representing the attribute's defindex.
    • value: A number representing the attribute's value.
    • float_value?: A number representing the attribute's float value.
    • account_info: Represents account info associated with an attribute
      • steamid: A string representing the attribute's account ID.
      • personaname: A string representing the attribute's account name.

📚 Helpful Resources

0.0.5

2 years ago

0.0.6

2 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago