Artifact的接口功能详解

Artifact 正式发售之后,社区热火朝天的开发出各种工具来支持这款游戏。 Value为了支持社区的工作,开放了一些构建工具的公共 API, 由以下两个部分组成:

  • CardSet WebAPI,支持直接获取所有已发行卡牌的所有图片和文本。
  • 可在 GitHub 上查看的牌组代码 API 和源代码,让玩家和社区站点分享牌组代码更为简便。 任何有效牌组代码均可直接粘贴至客户端,或在我们的在线牌组查看器上在线查看。

V社希望这些 API 发布后不仅有助于工具创造者一展身手,也便于所有玩家分享精彩新牌组和钻研新策略。

 

下面是接口的中文说明:

如果你正在开发一个网站需要显示卡片信息,比如名称和卡片文本,卡片图片,则需要向服务器发起2次请求。 第一个请求是请求卡组的信息。 当前支持的设置为00和01.你同时需要两者才能获得所有当前可用的卡。

首先,发起请求获取信息,请求信息和返回信息如下:

https://playartifact.com/cardset/<setid>/

{
  "cdn_root": "https:\/\/<some host>\/",
  "url": "\/<some path>\/somefile.json",
  "expire_time": <unix timestamp>
}

第二步,组装上面获取到的链接发起请求,必须在有效时间内请求,不然url会失效。请求和返回信息如下:

请求URL:https://somehost/some path/somefile.json

返回数据格式:

{
  "card_set": {
    "version": 1,
    "set_info": {
      "set_id": 0,
      "pack_item_def": 0,
      "name": {
        "english": "Base Set"
      }
    },
    "card_list": [{


      "card_id": 4000,
      "base_card_id": 4000,
      "card_type": "Hero",
      "card_name": {
        "english": "Farvhan the Dreamer"
      },
      "card_text": {
        "english": "Pack Leadership<BR>\nFarvhan the Dreamer's allied neighbors have +1 Armor."
      },
      "mini_image": {
        "default": "<url to png>"
      },
      "large_image": {
        "default": "<url to png>"
      },
      "ingame_image": {
        "default": "<url to png>"
      },
      "is_green": true,
      "attack": 4,
      "hit_points": 10,
      "references": [{
          "card_id": 4002,
          "ref_type": "includes",
          "count": 3
        },
        {
          "card_id": 4001,
          "ref_type": "passive_ability"
        }
      ]




    },
    ..... more cards ....


    ]
  }
}

关于数据格式的说明

  1. Text fields (card_name, card_text and the name on set_info) will contain english and additional languages.
  2. Image fields (mini-image, large-image, ingame-image) provide a default image and keys for each supported language.
  3. ref_type indicates a type of card reference:
  4. "includes" - indicates a secondary card which will be automatically included into decks when the card is added. These should NOT be sent to the deck encoder. The ref_type block will include the total count of these cards that will be added.
  5. "references" - indicates that the card text mentions the specified card.
  6. "passive_ability" - a passive ability
  7. "active_ability" - an ability which is activated by clicking on it.

Pingbacks已关闭。

评论已关闭