danocmx / node-tf2-item-format Goto Github PK
View Code? Open in Web Editor NEWFully typed battle-tested library that helps you format TF2 items to the community standards.
License: MIT License
Fully typed battle-tested library that helps you format TF2 items to the community standards.
License: MIT License
The gettradehistory api descriptions are a bit more condensed and the quality type defaults as Unique.
Demonstration item: The Bitter Taste of Defeat and Lime
Expected response: { name: 'The Bitter Taste of Defeat and Lime', quality: 6 }
Current response: { name: 'Bitter Taste of Defeat and Lime', quality: 6 }
Procedure:
parseString
does not parse output quality and output defindex for killstreak fabricators
name: Specialized Killstreak Atomizer Kit Fabricator
output:
{
"name": "Specialized Killstreak Kit Fabricator",
"craftable": true,
"quality": 6,
"killstreak": 2,
"defindex": 20002,
"target": "Atomizer",
"targetDefindex": 450
}
Don't force tf2-static-schema and leave the choice onto the user.
Refers to effect exceptions and other problems caused by overlaying names. These could easily be generated when item format receives a list of effects.
Example item: Haunted Ghosts Battle Boonie
TASKS:
Non-Craftable Killstreak Eyelander Kit
defindex returned: 5726
expected: 6527
Genuine Marxman
defindex returned: 816
expected: 837
Any warpaint - you return 9536
- which is generic warpaint, instead of returning the specific warpaint defindex
Cool Candy Coated War Paint (Battle Scarred)
defindex returned: 9536
expected: 17258
This is just a diference between your library and autobot library, I'm not 100% sure problem is in your library
Hot Blitzkrieg SMG (Battle Scarred)
defindex returned: 203
expected: 15153
Certain items in Tf2, such as "The Blutsauger", "The Anger", etc. have a "The" prefixed when in Unique form.
When stringifying the SKUs of such items, the "The" is omitted.
Example:
const { stringify, parseSKU } = require("tf2-item-format/static");
console.log(stringify(parseSKU("36;6"))); //returns "Blutsauger", should be "The Blutsauger"
This bug currently affects over 1,200 items
Sites such as Backpack.tf respect the "The" prefix, and this module is currently incompatible with their more correct schema system.
This bug originates within a dependency, node-tf2-static-schema. Specifically, the item-names.json file. tf2-item-format
blindly trusts this file to resolve SKUs to item names. However, this bug cannot be blamed on tf2-static-schema, as they are providing the correct base name of the item, which is correct in most contexts
Luckily, the method to find which item names have this prefix is quite simple. Items with the proper_name
property set to true
within the raw tf2 schema should have the "The" prefix when unique.
However, the
name
property does not always include the "The" prefix when the prefix is still required. For example, the "The Sun-on-a-Stick" has thename
property set to "Sun-on-a-Stick".
In order to keep backwards compatibilty with existing systems, I propose that this fix should be implemented as a separate function, or as an option to the stringify
function.
Add an overload to stringify
to directly get the item name from the SKU. In my opinion, this would make the api simpler and it's a common operation (at least for my use case).
Example:
const name = stringify("211;11;australium;kt-3;festive");
console.log(name); // "Strange Festivized Professional Killstreak Australium Medi Gun"
const attributes = parseSKU("211;11;australium;kt-3;festive");
const name = stringify(attributes);
If you're happy with that, I can open a PR.
proper_name
does -> (either it says if name
is accurate or if The
is supposed to be in name)item-names.json
with this knowledgeA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.