Code Monkey home page Code Monkey logo

mtg-list's Introduction

image

mtg-list

A node extension for listing out existing Magic the Gathering™ (© WotC) expansions and cards.

This is backed by magiccards.info. If you're looking for specific card info / stats / ruling / type / text search, this won't do what you want - try tutor instead (that's backed by the official Gatherer. The only advantage this has over it is that this includes promo sets and alternate art (and potentially later, tokens).

Installing

npm install mtg-list

API

var mtg = require("mtg-list");

Each of these methods takes an optional language parameter, defaulting to "en". The full set of options are "en", "de", "fr", "it", "es", "pt", "jp", "cn", "ru", and "tw" (theoretically all of those work, but the tests for this only cover English).

expansions([language], callback)

Expects a callback in the form function(error, result). The result passed back is an object with set abbreviations (e.g. "ths" = Theros) as keys and the full set name as values.

   { jou: 'Journey into Nyx',
     bng: 'Born of the Gods',
     ths: 'Theros',
     dgm: 'Dragon\'s Maze',
     gtc: 'Gatecrash',
     rtr: 'Return to Ravnica',
     avr: 'Avacyn Restored',
     dka: 'Dark Ascension',
     isd: 'Innistrad',
     ...

cardsInExpansion(expansion, [language,] callback)

Expects a callback in the form function(error, results). The results passed back is an array containing all cards found in that set.

Each card contains the following properties:

  • number - The number of the card within the set.
  • name - The full name.
  • type - The card's type, as printed.
  • mana - The mana cost, or null if it doesn't have one.
  • rarity - The rarity, fully spelled out. The possible values are "Common", "Uncommon", "Rare", "Mythic Rare", "Land", and "Special".
  • artist - The artist's name.
   [ { number: '1',
       name: 'Cao Cao, Lord of Wei',
       type: 'Legendary Creature — Human Soldier 3/3',
       mana: '3BB',
       rarity: 'Mythic Rare',
       artist: 'Gao Jianzhang' },
     { number: '2',
       name: 'Captain Sisay',
       type: 'Legendary Creature — Human Soldier 2/2',
       mana: '2WG',
       rarity: 'Mythic Rare',
       artist: 'Ray Lago' },
     { number: '3',
       name: 'Doran, the Siege Tower',
       type: 'Legendary Creature — Treefolk Shaman 0/5',
       mana: 'WBG',
       rarity: 'Mythic Rare',
       artist: 'Mark Zug' },
     { number: '4',
       name: 'Kiki-Jiki, Mirror Breaker',
       type: 'Legendary Creature — Goblin Shaman 2/2',
       mana: '2RRR',
       rarity: 'Mythic Rare',
       artist: 'Steven Belledin' },
     ...

cardImageURL(expansion, number[, language])

Returns a URL that (hopefully*) points to a scan of that card, hosted by magiccards.info. As this is hosted by them, please cache it locally if you need it more than once to avoid putting undue strain on their servers.

(* Hopefully = They have some dead links)

License

MIT

mtg-list's People

Contributors

forana avatar

Stargazers

Alex Solo avatar

Watchers

 avatar James Cloos avatar Alex Solo avatar

mtg-list's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.