All Projects → danocmx → node-tf2-item-format

danocmx / node-tf2-item-format

Licence: MIT license
Fully typed battle-tested library that helps you format TF2 items to the community standards.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to node-tf2-item-format

TF2-Item-Plugins
Manage your cosmetic and weapons freely! Set Unusual Effects, Australiums, Festives, War Paints (w/ Wear), Spells and Paints at will!
Stars: ✭ 22 (+29.41%)
Mutual labels:  tf2, tf2-items
Yolov3 Tf2
YoloV3 Implemented in Tensorflow 2.0
Stars: ✭ 2,327 (+13588.24%)
Mutual labels:  tf2
tf-faster-rcnn
Tensorflow 2 Faster-RCNN implementation from scratch supporting to the batch processing with MobileNetV2 and VGG16 backbones
Stars: ✭ 88 (+417.65%)
Mutual labels:  tf2
GameTracking-TF2
📥 Game Tracker: Team Fortress 2
Stars: ✭ 59 (+247.06%)
Mutual labels:  tf2
keras cv attention models
Keras/Tensorflow attention models including beit,botnet,CMT,CoaT,CoAtNet,convnext,cotnet,davit,efficientdet,efficientnet,fbnet,gmlp,halonet,lcnet,levit,mlp-mixer,mobilevit,nfnets,regnet,resmlp,resnest,resnext,resnetd,swin,tinynet,uniformer,volo,wavemlp,yolor,yolox
Stars: ✭ 159 (+835.29%)
Mutual labels:  tf2
tf2-rich-presence
Discord Rich Presence for Team Fortress 2
Stars: ✭ 30 (+76.47%)
Mutual labels:  tf2
CRNN.tf2
Convolutional Recurrent Neural Network(CRNN) for End-to-End Text Recognition - TensorFlow 2
Stars: ✭ 131 (+670.59%)
Mutual labels:  tf2
Kervolution
Kervolution implementation using TF2.0
Stars: ✭ 20 (+17.65%)
Mutual labels:  tf2
Tensorflow Yolov4 Tflite
YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
Stars: ✭ 1,881 (+10964.71%)
Mutual labels:  tf2
keras efficientnet v2
self defined efficientnetV2 according to official version. Including converted ImageNet/21K/21k-ft1k weights.
Stars: ✭ 56 (+229.41%)
Mutual labels:  tf2
vehicles-counting-yolov4-deepsort
A project for counting vehicles using YOLOv4 + DeepSORT + Flask + Ngrok + TF2
Stars: ✭ 23 (+35.29%)
Mutual labels:  tf2
Creators.TF-Community-Launcher
The Creators.TF Community Launcher is a launcher created to help install and update mod content for TF2.
Stars: ✭ 49 (+188.24%)
Mutual labels:  tf2
Swin-Transformer-Tensorflow
Unofficial implementation of "Swin Transformer: Hierarchical Vision Transformer using Shifted Windows" (https://arxiv.org/abs/2103.14030)
Stars: ✭ 45 (+164.71%)
Mutual labels:  tf2
map-compiling-toolkit
Tools for map compiling in Source Engine, tailored for Garry's Mod (and metastruct, sorry)
Stars: ✭ 17 (+0%)
Mutual labels:  tf2
manning tf2 in action
The official code repository for "TensorFlow in Action" by Manning.
Stars: ✭ 61 (+258.82%)
Mutual labels:  tf2
tf2attributes
TF2Attributes SourceMod plugin
Stars: ✭ 19 (+11.76%)
Mutual labels:  tf2
SSD-Tensorflow2.0
A Tensorflow2.0 implementation of Single Shot Detector
Stars: ✭ 25 (+47.06%)
Mutual labels:  tf2
RequestifyTF2
Client side commands for mic spamming and more!
Stars: ✭ 13 (-23.53%)
Mutual labels:  tf2
server
A server for tf2pickup.org
Stars: ✭ 16 (-5.88%)
Mutual labels:  tf2
sku-algorithm
商品多规格选择-sku算法
Stars: ✭ 108 (+535.29%)
Mutual labels:  sku

TF2 Item Format

Formatting for TF2 items.

Use v5 branch for current version. Install it via npm install tf2-item-format

Features

  • Parses item name into attribute object
  • Stringifies attribute object into item name same as backpack.tf
  • Parses ECON item into attributes
  • Parses SKU into attributes
  • Makes SKU out of attributes
  • Creates backpack.tf compatible format for listing creation

Support the project

tf2-item-format is now used in number of production grade projects for handling item data, help support the project by donating items here.

Migrating from v4 to v5

To keep your application working like before with version 5 you have to:

import { parseString } from 'tf2-item-format/static' // -> from 'tf2-item-format'

const { parseString } = require('tf2-item-format/static') // -> from 'tf2-item-format'

New

To inject your own schema use this interface:

export type ISchema = {
    getDefindex(search: number | string): number|null;
    getName(search: number | string): string;
    getEffectName(effect: number | string): string;
    getWearName(wear: number | string): string;
    getKillstreakName(killstreak: number | string): string;
    getTextureName(texture: number | string): string;
    getQualityName(quality: number | string): string;
    getEffectEnum(effect: number | string): number;
    getWearEnum(wear: number | string): number;
    getKillstreakEnum(killstreak: number | string): number;
    getTextureEnum(texture: number | string): number;
    getQualityEnum(quality: number | string): number;
    getTextures(): SchemaEnum;
    getEffects(): SchemaEnum;
    isUniqueHat(defindexOrName: string | number): boolean;
}

// Extra types you might need:
export type NameToDefindex = { [name: string]: number };
export type DefindexToName = { [defindex: number]: string };
export type SchemaEnum = NameToDefindex & DefindexToName;

// Import these like:
// import { ISchema, NameToDefindex, DefindexToName, SchemaEnum } from 'tf2-item-format'

Then you just have to:

import { createFormat } from 'tf2-item-format';

const format = createFormat(schema);

Every method is then export same as before.

You can use parseSKU and toSKU without schema:

import { parseSKU, toSKU } from 'tf2-item-format';

Please note that static schema has implemented a lot of overwrites for defindexes that simply cannot be obtained by the limited data we have, so when you are implementing it yourself you should use the current Schema as your guide.

Instalation

Via NPM: npm install tf2-item-format Or Yarn: yarn add tf2-item-format

Documentation

Currently there is no full documentation.

We export these methods:

  • parseString
  • stringify
  • parseEconItem
  • toSKU
  • parseSKU
  • createBPListing
  • fixName

And static schema:

  • under property schema

Everything is fully typed so you should be able to get this working on your own, until I make a documentation. Some of the types are a bit confusing which will get fixed in next major version.

parseEconItem

parseEconItem(econ: EconItem, inNumbers: boolean, useDefindexes: boolean, options?: { useTrueDefindex: boolean }): ParsedEconItem;
  • econ is raw item you receive from the api
  • inNumbers - changes return type of certain attributes to numbers instead of pure strings, eg. quality, texture, wear, ...
  • useDefindexes - appends item defindex to the object, adds target & output aswell
  • options
    • useTrueDefindex - returns true defindex item has on this econ, doesn't ask schema.
  • Returns ParsedEconItem which is an object of all attributes the econ gives us

createBPListing

createBPListing(attributes: ItemAttributes | StringifySKUAttributes, options?: CreateBPListingOptions): BackpackTFListing
  • attributes - these you get from parseString, parseSKU or parseEconItem, all are compatible
  • options
    • unuSkinsToDecorated - defaults unusual skins to decorated weapon quality, default value is true
  • Returns BackpackTFListing object compatible with item object in backpack.tf listing creation api

stringify

stringify(attributes: StrigifySKUAttributes | ItemAttributes, options?: StringifyOptions): string
  • attributes - these you get from parseString, parseSKU or parseEconItem, all are compatible
  • options
    • determineUniqueHat - if set it checks in schema if given item should use The in name, defaults to false
  • Returns the item name

Note for stringify

If you are using sku format to store your items and want to use The in your names, you have to turn determineUniqueHat to true.

Compability usage

// Have a name, want a sku
const attributes = parseString(name, true, true); // To get defindexes and enums
const sku = toSKU(attributes);

// Have a sku, want a name
const attributes = parseSKU(sku);
const name = stringify(attributes);

// Have a sku, want a bp listing
const attributes = parseSKU(sku);
const listing = createBPListing(attributes);

Every method should be interchangable in similar ways.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].