【问题标题】:Steam Achievements API - How to get achievement unlocking date?Steam 成就 API - 如何获得成就解锁日期?
【发布时间】:2014-06-30 00:16:33
【问题描述】:

这是否可以在 Steam Acheivements API 中获得成就解锁日期?我已经阅读了一堆文档,但没有发现任何提及。

【问题讨论】:

    标签: steam steam-web-api


    【解决方案1】:

    答案是肯定的,但你必须使用旧的 XML API,而不是较新的 Web API,而且它必须是“较新”的成就。

    旧式网址如下所示

    http://steamcommunity.com/id/<profilename>/stats/<appid>/achievements/?xml=1
    

    http://steamcommunity.com/profiles/<profileid>/stats/<appid>/achievements/?xml=1
    

    此时有几点注意事项:

    • &lt;profilename&gt; 是用户选择的唯一 URL 名称。 &lt;profileid&gt; 是 Valve 分配的唯一 64 位数字
    • &lt;appid&gt; 是数字应用程序 ID。我想你知道如何找到这个,对吗?

    如果您从该链接中提取 XML,您最终会得到如下所示的结构:

    playerstats
      game
      player
      stats
      achievements
        achievement
          iconClosed
          iconOpened
          name
          apiname
          description
          unlockTimestamp
    

    重要提示unlockTimestamp 并非始终可用。在没有深入研究的情况下,似乎这是在较晚的游戏(即 TF2)的情况下添加的。因此,您有一些返回类似于以下数据的原始成就:

    <achievement closed="1">
      <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass.jpg</iconClosed>
      <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass_bw.jpg</iconOpen>
      <name>Head of the Class</name>
      <apiname>tf_play_game_everyclass</apiname>
      <description>Play a complete round with every class.</description>
    </achievement>
    

    与如下所示的新成就相比:

    <achievement closed="1">
      <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/bb590c7ca44dfc7eb6a31abb39fae07c47502ac7.jpg</iconClosed>
      <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/4f244b30a76e9de5287a82cc3829c7930baa38c7.jpg</iconOpen>
      <name>Got A Light?</name>
      <apiname>tf_pyro_burn_spy_taunt</apiname>
      <description>Ignite an enemy Spy while he's flicking a cigarette.</description>
      <unlockTimestamp>1301887931</unlockTimestamp>
    </achievement>
    

    如果玩家尚未获得成就,则achievement 节点上的closed 属性将等于0,并且返回的数据将类似于旧成就(没有unlockTimestamp

    <achievement closed="0">
      <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/957daad8f6b9f237620e0326f38cbf941c60a9d1.jpg</iconClosed>
      <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/34b787ce4e47ef0e206ecd52626b053da13e18c4.jpg</iconOpen>
      <name>Krazy Ivan</name>
      <apiname>tf_heavy_kill_underwater</apiname>
      <description>Kill 50 enemies while both you and your victim are underwater.</description>
    </achievement>
    

    在上述 XML 结构中,achievement 节点将针对所选游戏可用的每个成就重复。

    【讨论】:

    • 非常感谢!但是我发现并不是所有的游戏都支持旧的 XML API,我已经通过解析 HTML 页面的成就解决了这个问题。
    • @Andy 你觉得用新界面做这件事有可能吗?目前我通过wiki.teamfortress.com/wiki/WebAPI/GetPlayerAchievements 获得了我的成就。但是没有unlockTimestamp :(
    猜你喜欢
    • 2014-04-12
    • 1970-01-01
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-29
    相关资源
    最近更新 更多