Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Incorrect names of items with proper_name property #177

Closed
piman51277 opened this issue Jun 9, 2022 · 2 comments
Closed

[Bug] Incorrect names of items with proper_name property #177

piman51277 opened this issue Jun 9, 2022 · 2 comments

Comments

@piman51277
Copy link
Contributor

Bug description

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"

Examples of affected items

This bug currently affects over 1,200 items

Why this matters

Sites such as Backpack.tf respect the "The" prefix, and this module is currently incompatible with their more correct schema system.

Origin of the Bug

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

Proposed solution

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 the name 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.

@piman51277
Copy link
Contributor Author

I have made a rudimentary fix via this module on npm.

@danocmx
Copy link
Owner

danocmx commented Jun 18, 2022

This issue has already been solved by enabling flag in stringify. Example stringify(parseSKU("36;6", { determineUniqueHat: true })). It's not a default option because it would break existing apps.

@danocmx danocmx closed this as completed Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants