D&D: import Open5e SRD bestiary as a raw staging table

fetch|gen bestiary subcommands vendor data/open5e/monsters.json (322
SRD monsters) and generate bestiary_srd_data.go — all 322 as raw SRD
stat blocks (HP/AC/ability scores/CR + per-attack damage dice).

This is a balance-baseline reference, not an engine roster: raw SRD
damage one-shots the solo player, so nothing here feeds combat. It's
what the future tuning pass reads against when deriving dndBestiary /
srdProfiles entries. XP is derived from CR (Open5e has no XP field).
This commit is contained in:
prosolis
2026-05-14 15:28:42 -07:00
parent d6ea08bba6
commit 53be17e6fe
6 changed files with 16522 additions and 5 deletions

View File

@@ -4,11 +4,13 @@
// It is a pull-once / use-many tool — the generated files are committed, so
// the running bot has no runtime dependency on the Open5e API.
//
// open5e-import fetch spells # vendor data/open5e/spells.json from the API
// open5e-import gen spells # classify → internal/plugin/dnd_spells_srd_data.go
// open5e-import fetch spells # vendor data/open5e/spells.json from the API
// open5e-import gen spells # classify → internal/plugin/dnd_spells_srd_data.go
// open5e-import fetch bestiary # vendor data/open5e/monsters.json from the API
// open5e-import gen bestiary # classify → internal/plugin/bestiary_srd_data.go
//
// `bestiary` and `equipment` subcommands are planned; the dispatch below is
// structured to grow into them without reshuffling.
// `equipment` subcommands are planned; the dispatch below is structured to
// grow into them without reshuffling.
package main
import (
@@ -25,6 +27,10 @@ const (
spellsAPIBase = "https://api.open5e.com/v1/spells/?document__slug=wotc-srd&limit=50"
spellsJSON = "data/open5e/spells.json"
spellsGenGo = "internal/plugin/dnd_spells_srd_data.go"
monstersAPIBase = "https://api.open5e.com/v1/monsters/?document__slug=wotc-srd&limit=50"
monstersJSON = "data/open5e/monsters.json"
bestiaryGenGo = "internal/plugin/bestiary_srd_data.go"
)
func main() {
@@ -37,6 +43,8 @@ func main() {
switch noun {
case "spells":
must(fetchSpells())
case "bestiary":
must(fetchMonsters())
default:
usage()
}
@@ -44,6 +52,8 @@ func main() {
switch noun {
case "spells":
must(genSpells())
case "bestiary":
must(genBestiary())
default:
usage()
}
@@ -53,7 +63,7 @@ func main() {
}
func usage() {
fmt.Fprintln(os.Stderr, "usage: open5e-import (fetch|gen) (spells)")
fmt.Fprintln(os.Stderr, "usage: open5e-import (fetch|gen) (spells|bestiary)")
os.Exit(2)
}