Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cockadecks

Converts MTGJSON's AllDeckFiles archive into Cockatrice .cod deck files.

Every preconstructed deck Wizards has ever published — Commander, Brawl, Theme, Intro, Archenemy, Planechase, … — downloaded once, converted to native Cockatrice format, organized by deck type.

Requirements

  • fnm — picks up .nvmrc to install the right Node LTS.
  • pnpm — auto-managed by Corepack via the packageManager field in package.json.

Usage

fnm use --install-if-missing
pnpm install
pnpm start

The first run downloads ~245 MB. Subsequent runs reuse the cached archive at output/AllDeckFiles.tar.gz and revalidate it with If-Modified-Since — only re-downloading when the upstream file has actually changed.

Output layout

output/
├── AllDeckFiles.tar.gz             # cached upstream archive (keep to skip re-downloads)
├── cod/<type>/<deck>.cod           # Cockatrice deck files
├── json/<type>/<deck>.json         # raw MTGJSON deck JSON
└── json-pretty/<type>/<deck>.json  # MTGJSON deck JSON, 2-space indented

<type> is data.type from the MTGJSON deck (e.g. Commander Deck, Theme Deck, Archenemy Deck). The cod/, json/, and json-pretty/ subfolders are wiped on every run; the cached archive is not.

What ends up in each .cod

Beyond the obvious <deckname> and zone/card lists:

  • <format> — Cockatrice's lowercase format key when data.type matches (Commander Deckcommander, Brawl Deckbrawl); empty otherwise. Cockatrice's format dropdown is built from MTGJSON legality keys, so other product types (Theme/Intro/Archenemy/…) intentionally don't get a format.
  • <bannerCard>displayCommander[0] if present (the alt-art printing meant for box display), else first commander, else first mainboard card. providerId is the MTGJSON per-printing uuid.
  • <comments> — type, set code, release date, source sets, color identity, commander name(s), card counts. Followed by a Generated by Cockadecks… paragraph.
  • <tags>type:<type>, setCode:<code>, releaseDate:<YYYY-MM-DD>, one sourceSetCode:<set> per set referenced by cards, one color:<X> per color in the deck identity (B/G/R/U/W), one commander:<name> per commander.
  • <card> — emits every attribute Cockatrice's loader recognizes: setShortName, collectorNumber, uuid. Cards are aggregated by uuid (with a name|setCode|number fallback), so distinct printings of the same card stay distinct.

See docs/cod.md for the full Cockatrice .cod format reference annotated against the latest Cockatrice master, and docs/deck.xsd for the upstream — slightly stale — XML schema.

License

AGPL-3.0-only.

About

Converts MTGJSON's AllDeckFiles archive into Cockatrice .cod deck files.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages