koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
359 stars 65 forks source link

Add DotA2 item GetRarity #237

Closed majidarif closed 6 years ago

majidarif commented 10 years ago

Not as much as an actual issue than a feature request for item schemas.

Here is how to get the item rarity for dota2,

http://api.steampowered.com/IEconItems_570/GetSchema/v0001/?key=XXXX

then

"items_game_url": "http:\/\/media.steampowered.com\/apps\/570\/scripts\/items\/items_game.c702b53c9aa67e73956206bcb9f54cf3be518925.txt",

this fetch the web schema. let say you json-decoded it to $content. the url of the in-game schema is $content->result->items_game_url; that's an url of a txt file which actually a vdf file. and it has info you can't found from web schema, include the rarity of each item.

Sample:

"5100"
        {
            "name"      "Headdress of the Protector"
            "prefab"        "wearable"
            "creation_date"     "2013-07-05"
            "image_inventory"       "econ/items/skywrath_mage/reverent_headdress_ofthe_protector/reverent_headdress_ofthe_protector"
            "item_description"      "#DOTA_Item_Desc_reverent_headdress_ofthe_protector"
            "item_name"     "#DOTA_Item_Headdress_of_the_Protector"
            "item_rarity"       "rare"
            "item_slot"     "head"
            "item_type_name"        "#DOTA_WearableType_Headdress"
            "model_player"      "models/items/skywrath_mage/reverent_headdress_ofthe_protector/reverent_headdress_ofthe_protector.mdl"
            "portraits"
koraktor commented 10 years ago

Really? I can't believe how incomplete and inconsistent Valve's APIs are.

To be honest, I don't think that this will be added any time soon, because it requires a custom parser for Valve's VDF format. Additionally it also adds another request to load that file and like the usual schema it's not that small (currently almost 6 MB).

majidarif commented 10 years ago

Yeah, I agree. I would just temporarily make a class for this and insert it into a db. Just wouldn't be logical to pull this every time we make a request.

koraktor commented 10 years ago

Does the hash on the file name change over time (i.e. when a new schema is released with a game update)? Otherwise you will have the same problem that we currently have with the Web API schema, it's not versioned and the HTTP server doesn't send cache relevant headers.

koraktor commented 6 years ago

Closing this as I don’t see a chance that a VDF parser will make it into Steam Condenser. Sorry.