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
260 stars 31 forks source link

Remove skin duplicates by transforming paint_index into an array #37

Closed RatzeR closed 1 year ago

RatzeR commented 1 year ago

Example: There are 7 Skins with the Name "Talon Knife | Doppler".

I think it would be cleaner to have all the names just once. For that I suggest to transform the paint_index into an array with all available paint_index values and map the phases to the paint_index. (https://csgoskins.gg/items/talon-knife-doppler)

ByMykel commented 1 year ago

Hi @RatzeR :wave:

They are all different Doppler's (ruby, sapphire, blackpearl, phase 1, phase 2, phase 3, phase 4). So having this in mind I don't know how to structure the data, give me some examples if you have any idea.

image image image image image image image

RatzeR commented 1 year ago

Hi @ByMykel,

maybe like this?

current state:

{
        "id": "skin-34278736",
        "name": "Talon Knife | Doppler",
        "description": "This ivory-handled karambit features brass rivets and saw-tooth ridges, so it cuts on the way in, and tears on the way out.",
        "weapon": "Talon Knife",
        "category": "Knives",
        "pattern": "Doppler",
        "min_float": 0,
        "max_float": 0.08,
        "rarity": "Covert",
        "stattrak": true,
        "paint_index": "852",
        "wears": [
            "Factory New",
            "Minimal Wear"
        ],
        "image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_knife_widowmaker_am_doppler_phase1_widow_light_large.3595e4a1fd5df25a46d17dc4d3a69ba93df2a77a.png"
    }

suggestion

{
        "id": "skin-34278736",
        "name": "Talon Knife | Doppler",
        "description": "This ivory-handled karambit features brass rivets and saw-tooth ridges, so it cuts on the way in, and tears on the way out.",
        "weapon": "Talon Knife",
        "category": "Knives",
        "pattern": "Doppler",
        "min_float": 0,
        "max_float": 0.08,
        "rarity": "Covert",
        "stattrak": true,
        "paint_index": [
             {"Phase 1": 852},
             {"Phase 2": 853},
             {"Phase 3": 854},
             {"Phase 4": 855},
             {"Ruby": 415},
             {"Sapphire": 416},
             {"Black Pearl": 417},             
         ],
        "wears": [
            "Factory New",
            "Minimal Wear"
        ],
        "image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_knife_widowmaker_am_doppler_phase1_widow_light_large.3595e4a1fd5df25a46d17dc4d3a69ba93df2a77a.png"
    },
ByMykel commented 1 year ago

@RatzeR I've adapted your suggestion, the only problem I see is that this change would brake the API as some id's would disappear.

So I'm not sure if I should make these changes. Let me know what you think, maybe be can add a new attribute called phase to difference all the dopplers?

{
    "id": "skin-34278736",
    "name": "Talon Knife | Doppler",
    "description": "This ivory-handled karambit features brass rivets and saw-tooth ridges, so it cuts on the way in, and tears on the way out.",
    "weapon": "Talon Knife",
    "category": "Knives",
    "pattern": "Doppler",
    "min_float": 0,
    "max_float": 0.08,
    "rarity": "Covert",
    "stattrak": true,
    "phases": [
        { "phase": "Phase 1", "paint_index": 852, "image": "phase1_url"  },
        { "phase": "Phase 2"," paint_index": 853, "image": "phase2_url"  },
        { "phase": "Phase 3", "paint_index": 854, "image": "phase3_url" },
    ]
    "wears": [
        "Factory New",
        "Minimal Wear"
    ],
    "image": "any_phase"
}
{
    "id": "skin-34278736",
    "name": "Talon Knife | Doppler",
    "description": "This ivory-handled karambit features brass rivets and saw-tooth ridges, so it cuts on the way in, and tears on the way out.",
    "weapon": "Talon Knife",
    "category": "Knives",
    "pattern": "Doppler",
    "min_float": 0,
    "max_float": 0.08,
    "rarity": "Covert",
    "stattrak": true,
    "paint_index": "852",
    "wears": [
        "Factory New",
        "Minimal Wear"
    ],
    "phase": "Phase 1"
    "image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_knife_widowmaker_am_doppler_phase1_widow_light_large.3595e4a1fd5df25a46d17dc4d3a69ba93df2a77a.png"
    }
RatzeR commented 1 year ago

With the suggestion from #38 I think adding a "phase" attribute here is fine!