
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@automatedtf/sherpa
Advanced tools
### π Table of Contents - [π Introduction](#-introduction) - [π Getting Started](#-getting-started) - [ItemInstance](#iteminstance) - [Getting a Backpack](#getting-a-backpack) - [getUsedSlots](#getusedslots) - [getItemByAssetId]
Sherpa provides a simplified representation of a player's Team Fortress 2 backpack, utilising @automatedtf/catalog
to fully represent items each as compactly as a single SKU string.
You can install this module with npm within your project by running the command:
npm install @automatedtf/sherpa
One of the key types within this module is the ItemInstance
interface. It details the least sufficient information required to uniquely identify an item instance within TF2.
interface ItemInstance {
appid: number; // Game id (440 for TF2, 730 for CS:GO)
assetid: string; // Steam-given id for possession of item
instanceid: string; // Internal Steam field for item information caching
classid: string; // Internal Steam field for item information caching
icon_url: string; // Image url hash to attach onto CDN link for display purposes
sku: string; // Item SKU generated from `@automatedtf/catalog`
base_sku: string; // Base SKU for item without any additional item modifications
}
A class object CItemInstance
can be used as a container to extract the properties of an ItemInstance
object from EconItem
.
class CItemInstance implements ItemInstance {
appid: number; // Game id (440 for TF2, 730 for CS:GO)
assetid: string; // Steam-given id for possession of item
instanceid: string; // Internal Steam field for item information caching
classid: string; // Internal Steam field for item information caching
icon_url: string; // Image url hash to attach onto CDN link for display purposes
sku: string; // Item SKU generated from `@automatedtf/catalog`
base_sku: string; // Base SKU for item without any additional item modifications
...
}
You would then be able to create an instance of CItemInstance
by passing in an EconItem
object and then turn it into a ItemInstance
object by calling toItemInstance()
on it.
const econItem: EconItem = ...; // get some EconItem object from somewhere
const itemInstance: ItemInstance = new CItemInstance(econItem).toItemInstance();
For interacting with the module, getTF2Backpack
should be your main entry point. You should query for a user's backpack by using their steamid64.
const steamid = "76561198081082634";
...
const backpack = await getTF2Backpack(steamid);
After resolving and getting a Backpack
from getTF2Backpack
, you will have access to a number of methods.
const totalNumberOfItems: number = backpack.getUsedSlots();
Gets the total number of item instances recorded within the user's backpack, even if they have gone over their maximum number of inventory slots.
const assetidOfItemToFind: string = "837141231";
const item: ItemInstance = backpack.getItemByAssetId(assetidOfItemToFind);
Gets the specific item instance with that assetid
. As assetid
is unique to every item instance, we can return the specific item saved within the dictionary indexed by assetid
.
// Warning: Case sensitive!
const nameOfItemsToFind: string = "Scream Fortress XII War Paint Case";
const items: ItemInstance[] = backpack.getInstances(nameOfItemsToFind);
Gets all instances with that itemName
.
const baseSKUOfItemsToFind: string = "5918;6";
const items: ItemInstance[] = backpack.getInstancesByBaseSKU(baseSKUOfItemsToFind);
Gets all instances with that baseSKUOfItemsToFind
.
const specialAssetid: string = "837141231";
const ownsSpecialItem: boolean = backpack.ownsItem(specialAssetid);
Checks if the user owns an item with that assetid
.
FAQs
### π Table of Contents - [π Introduction](#-introduction) - [π Getting Started](#-getting-started) - [ItemInstance](#iteminstance) - [Getting a Backpack](#getting-a-backpack) - [getUsedSlots](#getusedslots) - [getItemByAssetId]
The npm package @automatedtf/sherpa receives a total of 18 weekly downloads. As such, @automatedtf/sherpa popularity was classified as not popular.
We found that @automatedtf/sherpa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Centralβs incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.