ByMykel / CSGO-API

An unofficial JSON API for Counter-Strike 2 in multiples languages. List of skins, cases, stickers, collections, collectibles, agents, graffiti, keys, patches and music kits.
https://bymykel.github.io/CSGO-API/
MIT License
283 stars 34 forks source link

Can we add that to the name of the weapon #21

Closed hackeryutu closed 1 year ago

hackeryutu commented 1 year ago

"SFUI_InvTooltip_Wear_Amount_0" "Factory New" "SFUI_InvTooltip_Wear_Amount_1" "Minimal Wear" "SFUI_InvTooltip_Wear_Amount_2" "Field-Tested" "SFUI_InvTooltip_Wear_Amount_3" "Well-Worn" "SFUI_InvTooltip_Wear_Amount_4" "Battle-Scarred"

P2000 | Amber Fade (${SFUI_InvTooltip_WearAmount?}) P2000 | Chainmail (${SFUI_InvTooltip_WearAmount?}) P250 | Bengal Tiger (${SFUI_InvTooltip_WearAmount?}) P250 | Bone Mask (${SFUI_InvTooltip_WearAmount?})

ByMykel commented 1 year ago

With the current structure I will not add the wear to the name because a lot of data would be repeated. I can add a property named wears with all the wears.

{
    "id": "skin-65604",
    "name": "Desert Eagle | Urban DDPAT",
    "description": "As expensive as it is powerfu...",
    "weapon": "Desert Eagle",
    "pattern": "Urban DDPAT",
    "min_float": 0.06,
    "max_float": 0.8,
    "rarity": "Consumer Grade",
    "stattrak": false,
    "image": "https://steamcdn-a.akamaihd.n..."

    "wears": ["Factory New", "Minimal Wear", "..."]
}
hackeryutu commented 1 year ago

Okay

ByMykel commented 1 year ago

@hackeryutu You can propose me a better structure if you think is better for the general use of this API.

hackeryutu commented 1 year ago

@ByMykel I think your data structure is very good

ErezShahaf commented 1 year ago

With the current structure I will not add the wear to the name because a lot of data would be repeated. I can add a property named wears with all the wears.

{
    "id": "skin-65604",
    "name": "Desert Eagle | Urban DDPAT",
    "description": "As expensive as it is powerfu...",
    "weapon": "Desert Eagle",
    "pattern": "Urban DDPAT",
    "min_float": 0.06,
    "max_float": 0.8,
    "rarity": "Consumer Grade",
    "stattrak": false,
    "image": "https://steamcdn-a.akamaihd.n..."

    "wears": ["Factory New", "Minimal Wear", "..."]
}

Having the min-max values of a specific wear would make the API much better. For example, in buff163 you can look for a specific weapon in a specific wear such as "Factory new" and see the min and max float values for "Factory new" of that specific item.

You can add nested objects which contain the wears and their respective min-max float values.

Would be pretty useful for many developers, although items_game.txt doesn't seem to contain that data so it would have to be scraped from somewhere else.

ByMykel commented 1 year ago

@ErezShahaf If I'm not mistaken the min and max float values for every wear are the same:

image

But one thing I did't notice before, that the images are not the same for all wears: image image

I could do something with nested objects to display the different images for every wear but I can't find all the images.

For example for 'AWP | Corticera' I have 3 different images, but for the most of the skins I only have one.

    "econ/default_generated/weapon_awp_cu_favela_awp_heavy_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_heavy_large.e7e7ee23215e0ccfb22d39500522a0e4128500fa.png",
    "econ/default_generated/weapon_awp_cu_favela_awp_light_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_light_large.4329c047ea1899f3846a1a81539ba2a27665a54e.png",
    "econ/default_generated/weapon_awp_cu_favela_awp_medium_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_medium_large.7578b4d3233ca9d1e47cf51e6fd26fb38048a5ba.png",
ByMykel commented 1 year ago

@hackeryutu Until we find a better structure for the skins I think you can calculate the wears yourself using this image:

image

ErezShahaf commented 1 year ago

@ErezShahaf If I'm not mistaken the min and max float values for every wear are the same:

image

But one thing I did't notice before, that the images are not the same for all wears: image image

I could do something with nested objects to display the different images for every wear but I can't find all the images.

For example for 'AWP | Corticera' I have 3 different images, but for the most of the skins I only have one.

    "econ/default_generated/weapon_awp_cu_favela_awp_heavy_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_heavy_large.e7e7ee23215e0ccfb22d39500522a0e4128500fa.png",
    "econ/default_generated/weapon_awp_cu_favela_awp_light_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_light_large.4329c047ea1899f3846a1a81539ba2a27665a54e.png",
    "econ/default_generated/weapon_awp_cu_favela_awp_medium_large": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_awp_cu_favela_awp_medium_large.7578b4d3233ca9d1e47cf51e6fd26fb38048a5ba.png",

That would have made things easier, unfortunately each weapon has different ranges for their wear names. For example, one factory new could be between 0 to 0.06 and for the other weapon it could be from 0.02 to 0.1.

What you noticed in your image is the spray pattern, which also complicates things if you wanted to do it perfectly. For the floats you could just scrape the data once from somewhere else but if you wanted the accurate image it requires a server and SteamUser/NodeCSGO packages in order to send a request to the game coordinator. Another thing that you could do is scrape each image pattern if you wanted it to be more or less accurate (There are other things which may alter how the weapon looks, the skins are dynamic).

It's up to you if you want to do something about it, I just wanted to let you know that those differences exist. I don't know who this API is intended for but I personally think that the floats are by far more important.

ByMykel commented 1 year ago

That would have made things easier, unfortunately each weapon has different ranges for their wear names. For example, one factory new could be between 0 to 0.06 and for the other weapon it could be from 0.02 to 0.1.

@ErezShahaf Could you give one example?

I definitely want to add nested objects so I can add extra things like market hash name, accurate images for every wear, float values, etc. But I think that woud be some kind of hard to do without scraping some site.

ByMykel commented 1 year ago

@hackeryutu Deployed. Sorry for the delay I should have added this before.