Steam Achievements API - 如何获得成就解锁日期?

时间:2014-05-12 14:55:00

标签: steam steam-web-api

这可以在Steam Achievements API中获得成就解锁日期吗?我已经阅读了大量文档,但没有提到这一点。

1 个答案:

答案 0 :(得分:7)

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

旧样式网址如下所示

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

OR

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

此时有几点说明:

  • <profilename>是用户选择的唯一网址名称。 <profileid>是Valve分配的唯一64位数
  • <appid>是数字应用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>

如果玩家尚未获得成就,则closed节点上的achievement属性将等于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节点将针对所选游戏可用的每个成就重复。