Steam API SteamUserStats - 如何获得成就图像

时间:2014-03-09 03:11:06

标签: steam steam-web-api

我目前正在尝试将我的应用程序从Steam Xml Api移至Steam Web Api。

在旧的Xml Api中,我对xml之后的每项成就都有所作为:

<achievement closed="0">
    <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/205830/d21efac1184e37b4b344d18639db18cf40979018.jpg</iconClosed>
    <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/205830/7a4517495fba9f34642efd3983a561f55770f36c.jpg</iconOpen>
    <name>Manic Matcher</name>
    <apiname>st_ach_24</apiname>
    <description>Achieve 5 Consecutive Quick Matches</description>
</achievement>

这是包含成就图片。

在ISteamUserStats界面中,我只得到这个回复:

{
"apiname": "ST_ACH_05",
"achieved": 0,
"name": "Silver Medal",
"description": "50 shot streak"
}

那么,是否有一个接口可以从ST_ACH_05中获取图像?如果不是我该怎么办?可以使用已弃用的XML Api吗?

参考文献:

1 个答案:

答案 0 :(得分:6)

您想使用GetSchemaForGame API调用。

http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v0002/?key=YOURKEY&appid=APPID&l=english&format=json

YOURKEY是您从Valve获得的API密钥。 APPID是您要查找的游戏的应用程序ID。

API具有以下格式(取自上面的Wiki链接)

game

    gameName (string)
        Steam internal (non-localized) name of game. 
    gameVersion (int)
        Steam release version number currently live on Steam. 
    availableGameStats

        achievements (Optional) (array)

            name (string)
                API Name of achievement. 
            defaultvalue (int)
                Always 0 (player's default state is unachieved). 
            displayName (string)
                Display title string of achievement. 
            hidden (int)
                If achievement is hidden to the user before earning achievement, value is 1. 0 if public. 
            description (string)
                Display description string of achievement. 
            icon (string)
                Absolute URL of earned achievement icon art. 
            icongray (string)
                Absolute URL of un-earned achievement icon art. 

        stats (Optional) (array)

            name (string)
                API name of stat. 
            defaultvalue (int)
                Default value of stat. 
            displayName (string)
                Developer provided name of string. 

数据结果(来自TF2,appid 440)看起来像这样:

"achievements": [
                {
                    "name": "TF_PLAY_GAME_EVERYCLASS",
                    "defaultvalue": 0,
                    "displayName": "Head of the Class",
                    "hidden": 0,
                    "description": "Play a complete round with every class.",
                    "icon": "http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass.jpg",
                    "icongray": "http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass_bw.jpg"
                },