殺戮尖塔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.comBeta 頻道(來自 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
實體
彙總與查詢
Languages
社群與提交
批次下載
多語言
在任意端點上加上此查詢參數: ?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=RarePython
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 欄位對應。
稀有度(橫幅)顏色
來源: NTinyCard.GetBannerColor. 與 rarity 欄位對應。
最簡 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 檔案。
互動式 API 文件
完整的 Swagger/OpenAPI 文件,支援線上試用。
打開 API 文件 →開源
Spire Codex 是開源的。資料擷取流水線、API 和前端都可以在 GitHub 上取得。
在 GitHub 上查看 →