OverwolfSpire Codex 现已登陆 Overwolf。 了解更多 →

杀戮尖塔2 (STS2) 开发者

用 Spire Codex 的数据构建工具、机器人和内容。一切免费开放。

提示框组件

为任何网站添加 Wowhead 风格的卡牌、遗物和药水悬停提示。一个 script 标签,零依赖。

安装

<script src="https://spire-codex.com/widget/spire-codex-tooltip.js"></script>

语法

[[Strike]]卡牌提示(默认类型)
[[card:Bash]]卡牌(显式)
[[relic:Burning Blood]]遗物
[[potion:Fire Potion]]药水
[[character:Ironclad]]角色
[[monster:Jaw Worm]]怪物
[[power:Strength]]能力
[[event:Neow]]事件
[[encounter:Lagavulin]]遭遇
[[enchantment:Sharp]]附魔
[[keyword:Exhaust]]关键词
[[orb:Lightning]]能量球
[[affliction:Bound]]状态
[[achievement:Minimalist]]成就

JavaScript API

SpireCodex.scan()重新扫描页面中的新 [[...]] 模式(用于 SPA)
SpireCodex.scan(element)扫描指定的 DOM 元素

更新日志组件

嵌入一个紧凑的交互式更新日志查看器,展示 Spire Codex 的更新历史并支持切换版本。

安装

<div id="scx-changelog"></div>
<script src="https://spire-codex.com/widget/spire-codex-changelog.js"></script>
data-version="1.0.4"显示指定版本(默认:最新)

REST API

完整游戏数据库可通过公开 REST API 访问。无需认证:按 IP 的网站配额足以覆盖浏览和零散调用,无密钥的 API 使用适用下方的基础速率。 脚本和工具请创建 API 密钥,并通过 X-API-Key 请求头发送。 在个人资料页创建一个。 密钥按身份而非 IP 归集你的请求(跨网络稳定,绝不与同一 NAT 下的其他用户共享),并提供用量跟踪;其等级上限按端点计算。响应携带 X-RateLimit-Remaining / X-RateLimit-Reset,便于你控制请求节奏。

速率限制

网站流量300/minute每个 IP
无 API 密钥15/minute
注册用户60/minute在个人资料中创建
学术100/minute按申请授予
付费120/minute赞助者

所有上限按端点计算:表格是你在每条路由上的配额,而不是全局池。少数重型端点有自己的预算,无论是否使用密钥都对所有调用者生效(见下方的对局导出;语言 ZIP 为每小时 10 次)。关注 X-RateLimit-Remaining,遇到 429 时退避(会设置 Retry-After)。

批量导出对局

GET /api/exports/runs?limit=1000&start=2026-06-01T00:00:00Z

以 JSONL 流式输出官方对局,每行一局。

limit 限制页面大小;满页会返回指向下一页的 cursor。
start / end 限制为半开区间的提交时间窗口。分页时保持不变;cursor 不包含它们。

该端点有自己的预算,每小时 120 点,带密钥和匿名调用者共享:分页请求消耗 1 点,无限制拉取(不带 limit)消耗 60 点。因此持续同步最好用间隔约 30 秒的分页拉取;遇到 429 时遵守 Retry-After,并用同一个 cursor 继续。

需要完整数据?不带参数的调用会重定向到每天重建一次的静态文件 /exports/runs-latest.jsonl.gz,行格式相同;/api/exports/runs/manifest 给出生成时间和对局数量。每行包含 player_token,即提交账户的稳定化名 ID,匿名对局为 null。

只要某个补丁?/api/exports/runs?version=v0.111.0 会重定向到 manifest 的 versions 表中对应版本的静态文件 /exports/runs-v0.111.0.jsonl.gz;配合 limit 和 cursor 则改为对单个补丁分页拉取。

基础 URL

https://spire-codex.com

Beta 频道(来自 Steam beta 分支的未发布内容):在任意实体端点上加上: ?channel=beta. 当前 beta 版本: /api/beta/version. 与 main 的完整差异: /api/beta/diff.

The community stats pages were reorganized: /community-stats, /leaderboards/metrics, /charts, and the /meta page now live under /stats, /leaderboards/elo is /top-players, and run submission moved to /runs/submit. Old URLs redirect.

端点

完整交互式文档(由后端自动生成,始终最新): /docs

实体

GET/api/cards所有卡牌(筛选:color、type、rarity、keyword、tag、spawns、search)
GET/api/cards/{id}单张卡牌
GET/api/characters所有角色
GET/api/characters/{id}单个角色
GET/api/relics所有遗物(筛选:rarity、pool、ancient、search)
GET/api/relics/{id}单个遗物
GET/api/potions所有药水(筛选:rarity、pool、search)
GET/api/potions/{id}单个药水
GET/api/monsters所有怪物(筛选:type、search)
GET/api/monsters/{id}单个怪物
GET/api/powers所有能力(筛选:type、stack_type、search)
GET/api/powers/{id}单个能力
GET/api/events所有事件(筛选:type、act、search)
GET/api/events/{id}单个事件
GET/api/encounters所有遭遇(筛选:room_type、act、search)
GET/api/encounters/{id}单个遭遇
GET/api/enchantments所有附魔
GET/api/enchantments/{id}单个附魔
GET/api/keywords卡牌关键词
GET/api/keywords/{id}单个关键词
GET/api/intents所有意图类型
GET/api/intents/{id}单个意图
GET/api/orbs所有充能球类型
GET/api/orbs/{id}单个充能球
GET/api/afflictions苦难类型
GET/api/afflictions/{id}单个苦难
GET/api/modifiers自定义模式修正
GET/api/modifiers/{id}单个修正
GET/api/achievements所有成就
GET/api/achievements/{id}单个成就
GET/api/badges所有徽章
GET/api/badges/{id}单个徽章
GET/api/epochs所有纪元
GET/api/epochs/{id}单个纪元
GET/api/stories所有故事
GET/api/stories/{id}单个故事
GET/api/acts全部章节
GET/api/acts/{id}单个章节
GET/api/ascensions所有登塔等级
GET/api/ascensions/{id}单个登塔等级
GET/api/glossary所有术语
GET/api/glossary/{id}单个术语

聚合与查询

GET/api/stats实体数量
GET/api/ancient-pools所有远古者遗物池及其条件
GET/api/ancient-pools/{id}单个远古者的池
GET/api/unlocks按类型分组、附带纪元信息的可解锁实体
GET/api/history/{entity_type}/{entity_id}来自更新日志的单个实体版本历史
GET/api/update-history/{entity_type}/{entity_id}单个实体的游戏补丁更新历史
GET/api/names/{entity_type}/{entity_id}跨语言查询实体名称
GET/api/search覆盖实体、参考条目、机制、攻略、新闻、站点页面和图片文件的统一站内搜索,支持容错拼写(q, lang)
GET/api/search/semanticMeaning-based entity search, same item shape as /api/search (q, limit); empty when the feature is off
GET/api/merchant/configMerchant pricing config extracted from the game
GET/api/mechanics/constantsMechanics constants: room odds, gold ranges, ascension tuning
GET/api/mechanics/sectionsIndex of the mechanics pages
GET/api/mechanics/sections/{slug}One mechanics page as markdown with template tokens resolved
GET/api/changelogs所有更新日志
GET/api/changelogs/recent-additions首页横幅展示的最新实体
GET/api/changelogs/{tag}按标签获取单个更新日志(如 v1.0.20)
GET/api/newsSteam 公告(本地镜像以便长期保存)
GET/api/news/{gid}单篇新闻,正文已净化
GET/api/versions版本选择器可用的 beta 数据版本
GET/api/news/codexSpire Codex site news, newest first
GET/api/news/codex/{slug}One site news entry
GET/api/announcementsActive site banner messages

Languages

GET/api/languagesAvailable languages with display names
GET/api/translationsTranslation maps for filter values and UI strings (lang)
GET/api/localizationsThe game's own localization tables as ICU MessageFormat, all of them or the ones named in ?tables= (max 50; unknown names are 404)
GET/api/localizations/tablesNames of the available localization tables
GET/api/localizations/{table}One localization table

社区与提交

GET/api/guides所有攻略(筛选:category、difficulty、tag、search)
GET/api/guides/{slug}单篇攻略,Markdown 已渲染
POST/api/guides提交攻略(Discord webhook,有速率限制)
POST/api/runsSubmit a run for community stats and leaderboards. The run is attached to an account only with Authorization: Bearer <jwt>; a bare steam_id is kept as a hint
POST/api/runs/claimAttach the signed-in account to previously-submitted anonymous runs by hash
GET/api/runs/list带筛选和分页浏览已提交的对局(包括按提交者胜率的 ascension_min/ascension_max 和 winrate_min/winrate_max,即内容分段) 每行包含 player_token,即提交账户的稳定化名 ID,匿名对局为 null。 total_is_lower_bound is true when the exact count ran out of time and total is a capped lower bound.
GET/api/runs/leaderboardRun leaderboards (fastest, highest_ascension); filter by character, players, game_mode, ascension_min, winrate_min (the content brackets), build_id
GET/api/runs/shared/{run_hash}按哈希获取单个已提交对局(有速率限制)
GET/api/runs/stats社区统计汇总(可按 character、ascension、username 筛选)
GET/api/runs/community-statsThe /stats hub dataset: event decision splits, deadliest encounters, win rates by ascension/character, records. Takes the same bracket keys as the metrics tables; an unknown bracket returns HTTP 400
GET/api/charts/meta/stats/charts 浏览器的图表注册表:可用图表、筛选、拆分和对局统计
GET/api/charts/{chart}One pre-aggregated chart (filter: players, ascension, game_mode, username, split, bracket=a10|wr30|wr50|wr75, build_id, plus per-chart params). A saved chart id from the chart builder returns that saved chart instead
POST/api/chartsSave a chart spec to your profile (bearer token, 100 per account)
PATCH/api/charts/{id}Update the title, visibility or spec of your own saved chart; DELETE removes it
GET/api/charts/mineYour saved charts, newest first (bearer token)
GET/api/charts/publicNewest public saved charts (limit)
GET/api/tierlists/shared/{share_id}Public read-only view of a shared tier list
GET/api/beta/diff当前 beta 按实体类型新增、修改和移除的内容;所有 BETA 标签的数据来源
GET/api/beta/version当前 beta 版本
GET/api/runs/scores/{type}Codex Score + Codex Elo per entity (cards/relics/potions); ?bracket= grades within a run bracket (a10|wr30|wr50|wr75, a game version, or any metrics bracket; unknown is HTTP 400) (the in-game mod sends the same via ?stat_filter=a10|a10_wr30|a10_wr50|a10_wr75); relics accept ?act=1|2|3 to rank by acquisition act; ?character= switches to that character's slice (entries gain a scope field)
GET/api/runs/leaderboard/seed-rank某个种子的种子排名 + 全局排名(?seed=&steam_id=);没有获胜对局时排名字段为 null
POST/api/auth/steam/ticket用 Steamworks 网页认证票据换取站点 JWT(游戏内静默登录);服务器没有 Steam 密钥前返回 503
GET/api/runs/metrics/{type}Dense metrics table for cards/relics/potions, one row per entity: Codex Score, win_rate with a Wilson 95% win_rate_ci, hold_rate, lift and lift_n over the floor-adjusted expectation (null under 20 seats), Codex Elo and pick_rate from free choice screens for cards and relics, a wax block on relics (Toy Box copies split out), and used/use_rate on potions. Counts are per seat, so a 4P run is four seats; the response carries total_runs, total_seats, total_wins and data_through. ?bracket=all|solo|2p|3p|4p|a10|daily|custom|wr30|wr50|wr75 or a composite like solo:standard; ?character= switches to that character's slice (rows gain per-character Elo and Pick%). An unknown bracket returns HTTP 400
GET/api/runs/metrics/shopsShop shelf table, one row per card, relic or potion: seen, bought, buy_rate, and the buyers' win_rate, win_rate_ci and lift. Same bracket keys as the other metrics tables
GET/api/runs/metrics/eventsEvent option table: chosen, share of that event's choices, win_rate, win_rate_ci and lift. Same bracket keys as the other metrics tables
GET/api/runs/metrics/campfiresRest-site choice table (rest, smith, and the rest) with a localized name per ?lang=: chosen, share, low_hp_share, win_rate, win_rate_ci and lift. Same bracket keys as the other metrics tables
GET/api/runs/versions有已提交对局的游戏版本 ID 列表
GET/api/runs/leaderboard/rank/{run_hash}Rank of one winning run within its ladder (category)
GET/api/leaderboards/eloTop players by Codex Elo over solo A10 standard runs, refreshed nightly; powers /top-players (limit, min_runs)
GET/api/runs/stats/{type}/{id}Community stats for one card, relic or potion, with per-bracket and per-character splits
GET/api/runs/stats/{type}/{id}/historyDaily Codex Score and Elo history for one entity (bracket=all|a10|wr30|wr50|wr75)
GET/api/runs/top/{type}/{character}Most-picked entities of a type for one character (limit)
GET/api/runs/encounter-statsPer-encounter appearances, fatal rate, avg damage and turns, per character too (act, room_type, multiplayer, bracket, build_id, encounter, page, limit)
GET/api/runs/encounter-seriesThe given encounters (max 20) rolled up per bracket and per recent game version
GET/api/runs/pulseCommunity run and win totals plus data_through
GET/api/runs/snapshot-statusWhether the stats are loaded or rebuilding
GET/api/runs/{run_hash}/similarNearest winning solo decks to a run and what they took that it didn't
GET/api/runs/archetypesCommunity deck archetypes, clustered nightly
GET/api/runs/encounter-buildsWhich archetypes die to an encounter and which walk past it (encounter)
GET/api/runs/deck-advisorWhat the winning decks nearest a partial deck carry that it doesn't yet (character, cards, relics)
GET/api/runs/pick-coachNearest archetypes for a partial deck and a score per offered card (character, cards, relics, offer, target)
GET/api/pairings/{item_type}/{item_id}Cards, relics and potions that show up in the same runs as this item
GET/api/draft-recs/{item_type}/{item_id}Cards players most often draft when they already hold this item
POST/api/draft-adviceRank the offered cards for the current deck
GET/api/replaysRuns with a replay to watch; same filters and row shape as /api/runs/list plus replay_url
GET/api/replays/summaryHow many replays are watchable, overall and per character
GET/api/runs/{run_hash}/replayThe stored replay journal as gzip; POST uploads one for a run you own, DELETE removes it
GET/api/players/{username}/insightsOne player's public insights with community comparison; 404 for unknown or private profiles
GET/api/players/{username}/stats玩家自己的卡牌、遗物、药水、事件、商店和篝火统计及个人 Lift;筛选和隐私规则与 insights 相同
GET/api/presence/activeLive runs from the in-game mod, deepest first
GET/api/presence/{steam_id}One player's live run; 404 when they aren't in one
GET/api/thanksGitHub contributors, special thanks, and public supporters
GET/api/mod/latestLatest mod build and the game version it was verified against
GET/api/rate-limitsThe public rate-limit tiers
POST/api/feedback提交反馈(Discord webhook)

批量下载

GET/api/exports/runs官方对局的 JSONL 流(limit/start/end/cursor 分页;独立的每小时 120 点预算,见上方批量导出对局)
GET/api/exports/runs/manifestWhen the daily full run dump was generated and how many runs it holds
GET/api/exports/{lang}某一语言全部实体 JSON 的 ZIP(每小时 10 次)
GET/api/images图库分类
GET/api/images/search按文件名搜索图片
GET/api/images/game/{version}/{category}/browse分页浏览完整资源转储的文件夹(path、offset、limit)
GET/api/images/game/{version}/{category}/download某个转储文件夹内文件的 ZIP(path;上限 2000 个文件)

多语言

在任意端点上加上此查询参数: ?lang=jpn. 支持 15 种语言:

eng, deu, esp, fra, ita, jpn, kor, pol, ptb, rus, spa, tha, tur, zhs, zht

快速开始

cURL

curl https://spire-codex.com/api/cards?color=ironclad&rarity=Rare

Python

import requests
cards = requests.get("https://spire-codex.com/api/cards", params={"color": "ironclad"}).json()
for card in cards:
    print(f"{card['name']} - {card['type']} ({card['rarity']})")

JavaScript

const res = await fetch("https://spire-codex.com/api/relics?pool=ironclad");
const relics = await res.json();
console.log(relics.map(r => r.name));

迷你卡牌精灵图

在任何网页项目中复现游戏内的卡牌缩略图(用于对局历史 / 游戏结束界面)。六层 PNG 通过 CSS mask-image 合成,不用 canvas,不用 WebGL,只是上色的精灵图。 颜色直接取自反编译的游戏代码: NTinyCard, CardPoolModel.DeckEntryCardColor.

预览

Ironclad / Attack / Common
Silent / Skill / Uncommon
Defect / Power / Rare
Necrobinder / Skill / Rare
Regent / Attack / Uncommon
Curse
Event
Quest

精灵图资源

全部 10 个 PNG 均启用 CORS,把基础 URL 放在每个文件名前即可。每个精灵图为 128×128、RGBA、透明底白色(用于通过 CSS 上色)。

https://spire-codex.com/static/images/ui/run_history_card/
  card_back.png           ← tinted by pool
  desc_box.png            ← dark description area (render at 25% opacity)
  attack_portrait.png     ← portrait per card type
  attack_portrait_shadow.png
  skill_portrait.png
  skill_portrait_shadow.png
  power_portrait.png
  power_portrait_shadow.png
  banner_shadow.png       ← render at 60% opacity
  banner.png              ← tinted by rarity

卡池(卡背)颜色

来源: CardPoolModel.DeckEntryCardColor. 将它们与 /api/cards 返回的 color 字段对应。

ironclad#D62000
silent#5EBD00
defect#3EB3ED
necrobinder#CD4EED
regent#E36600
colorless#A3A3A3
event#A3A3A3
curse#585B61
quest#24476A
status#FFFFFF
token#FFFFFF

稀有度(横幅)颜色

来源: NTinyCard.GetBannerColor. 与 rarity 字段对应。

Basic#9C9C9C
Starter#9C9C9C
Common#9C9C9C
Uncommon#64FFFF
Rare#FFDA36
Curse#E669FF
Event#13BE1A
Ancient#13BE1A
Quest#F46836
Status#9C9C9C
Token#9C9C9C

最简 HTML + CSS 示例

肖像文件名: attack = 攻击牌, power = 能力牌, skill = 其余所有(技能、状态、诅咒……)

<div class="tiny-card" style="
  --back: #D62000;   /* pool color, Ironclad */
  --banner: #FFDA36; /* rarity color, Rare */
  position: relative;
  width: 64px;
  height: 64px;
">
  <!-- 1. card back, tinted by pool -->
  <div class="layer" style="
    background-color: var(--back);
    mask: url(https://spire-codex.com/static/images/ui/run_history_card/card_back.png) center/contain no-repeat;
    -webkit-mask: url(https://spire-codex.com/static/images/ui/run_history_card/card_back.png) center/contain no-repeat;
  "></div>

  <!-- 2. description box -->
  <img class="layer" src="https://spire-codex.com/static/images/ui/run_history_card/desc_box.png" style="opacity:.25">

  <!-- 3. portrait shadow + portrait (attack/skill/power) -->
  <img class="layer" src="https://spire-codex.com/static/images/ui/run_history_card/attack_portrait_shadow.png">
  <img class="layer" src="https://spire-codex.com/static/images/ui/run_history_card/attack_portrait.png"
       style="filter: brightness(.95) sepia(.15)">

  <!-- 4. banner shadow + banner tinted by rarity -->
  <img class="layer" src="https://spire-codex.com/static/images/ui/run_history_card/banner_shadow.png" style="opacity:.6">
  <div class="layer" style="
    background-color: var(--banner);
    mask: url(https://spire-codex.com/static/images/ui/run_history_card/banner.png) center/contain no-repeat;
    -webkit-mask: url(https://spire-codex.com/static/images/ui/run_history_card/banner.png) center/contain no-repeat;
  "></div>
</div>

<style>
  .tiny-card .layer {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: contain;
  }
</style>

React 组件

开箱即用的 React 版本。源码: TinyCard.tsx

import TinyCard from "./TinyCard";

// Feed in the three fields from /api/cards:
<TinyCard color="ironclad" type="Attack" rarity="Rare" className="w-16 h-16" />

完整卡牌图片

/api/cards 返回的每张卡牌都包含两个可直接使用的 URL,指向游戏渲染的完整卡牌(边框、插画、横幅和文字,与游戏内完全一致)。远古者卡牌为动态 webp。

  • image_url_card — 基础卡。唯一一张没有渲染图的卡(mad_science)为 null;此时请回退到 image_url(肖像插画)。
  • image_url_card_upg — 升级卡。卡牌没有升级时为 null。
// e.g. /api/cards/bash
{
  "id": "BASH",
  "image_url":          "/static/images/cards/bash.webp",  // portrait art
  "image_url_card":     "https://cdn.spire-codex.com/cards-full/stable/bash.webp",
  "image_url_card_upg": "https://cdn.spire-codex.com/cards-full/stable/bash_upg.webp"
}

本地化渲染图位于语言子文件夹下,例如: cards-full/stable/jpn/bash.webp. 全部 15 种语言均可用。

附魔卡牌渲染图

每张卡牌还会与它可合法获得的每种附魔一起渲染,与游戏内附魔预览的绘制完全一致(徽章、数值和新增的卡牌文字)。URL 遵循同一模式:

https://cdn.spire-codex.com/cards-full/stable/ench/{enchantment}/{card}.webp        // English, base
https://cdn.spire-codex.com/cards-full/stable/ench/{enchantment}/{card}_upg.webp    // English, upgraded
https://cdn.spire-codex.com/cards-full/stable/{lang}/ench/{enchantment}/{card}.webp // localized

// e.g. Anger with Corrupted, in Japanese:
https://cdn.spire-codex.com/cards-full/stable/jpn/ench/corrupted/anger.webp
  • {enchantment} / {card}: 来自 /api/enchantments 和 /api/cards 的小写 id(如 sharp、corrupted、sown)。
  • 只存在合法的卡牌与附魔组合(导出使用游戏自身的适用规则),因此无效组合会返回 404。/api/enchantments 中的 card_type / applicable_to 字段说明哪些卡牌符合条件。
  • 每个组合都有基础版和升级版,覆盖全部 14 种语言,附魔文字完全本地化。

数据导出

将全部游戏数据下载为单个 ZIP 压缩包。每个压缩包包含所有实体类型(卡牌、遗物、怪物、能力等)的 JSON 文件。

下载英文数据(ZIP)

提供 15 种语言。下载示例: 日语, 韩语, 中文, 法语, 德语

交互式 API 文档

完整的 Swagger/OpenAPI 文档,支持在线试用。

打开 API 文档 →

开源

Spire Codex 是开源的。数据提取流水线、API 和前端都可以在 GitHub 上获取。

在 GitHub 上查看 →