mtgjson / mtgjson3

MTGJSON repository for Magic Cards
http://mtgjson.com
Other
545 stars 102 forks source link

Add tokens #47

Closed Sembiance closed 6 years ago

Sembiance commented 8 years ago

Add Tokens. One place to get them is magiccards.info Token List: http://magiccards.info/extras.html

Sadly magiccards.info doesn't have all of them and they are very slow to add new ones.

More token info: https://github.com/Psithief/Cockatrice-tokens/blob/master/tokens. http://mtgsalvation.gamepedia.com/Token/Full_List

Should do Issue #46 before this one, as the new tokens will go into the new tokens array.

Note: Afterwards, in addition to updating test_urls.js I also need to look at the tokens folder in DevLab/images/originals/mtg/CCGHQ/full/

ZeldaZach commented 8 years ago

I'd like to tag on to this issue.

We've recently added a "Create Related Card" action to Cockatrice, which allows the flip cards to have their alternate sides created easier then in the past.

We'd like to extend this action to all cards that involve tokens, but the way cards write how to make tokens is not exactly the same in each case. I'm curious if you could add a new field, relatedTokens, that contains a specific ID unique to each token (which could be generated into the tokens.xml file which is hand kept up to date).

What we could add to the tokens.xml:

<card>
    <name>Angel</name>
    **<tokenID>184</tokenID>**
    <set picURL="http://media.wizards.com/2015/images/daily/en_b3znv1aqdq.png">ORI</set>
    <set picURL="http://media.wizards.com/2014/images/daily/0001_MTGC14_TOK_EN_HRR%20copy.png">C14</set>
    <color>W</color>
    <manacost></manacost>
    <type>Token Creature — Angel</type>
    <pt>4/4</pt>
    <tablerow>2</tablerow>
    <text>Flying</text>
    <token>1</token>
</card>

What you could possibly add:

{
    "layout":"normal",
    "type":"Creature — Elf Shaman",
    "types":["Creature"],
    "colors":["White","Green"],
    "multiverseid":369072,
    "name":"Trostani's Summoner",
    "subtypes":["Elf","Shaman"],
    "cmc":7,
    "rarity":"Uncommon",
    "artist":"Howard Lyon",
    "power":"1",
    "toughness":"1",
    "manaCost":"{5}{G}{W}",
    "text":"When Trostani's Summoner enters the battlefield, put a 2/2 white Knight creature token with vigilance, a 3/3 green Centaur creature token, and a 4/4 green Rhino creature token with trample onto the battlefield.",
    "number":"110",
    "watermark":"Selesnya",
    "imageName":"trostani's summoner"
    **"relatedTokens":[104, 991, 1058],**
}

where in this situation, ID 104 is the 2/2 knight, 991 is the 3/3 centaur, and 1058 is the 4/4 Rhino (just an example, noting that these IDs may or may not actually be correct.)

I'd really like your opinion on what you think about this idea.


PS: Psithief's repo is gone and he's merged with us. The new URL is https://github.com/Cockatrice/Magic-Token/blob/master/tokens.xml.

Sembiance commented 8 years ago

Having a 'relatedTokens' field for cards is a great idea and I can see how it would be useful.

This would require an 'id' field on a per card/token level which is documented in Issue #63

Sembiance commented 8 years ago

In regards to adding tokens, sourcing the info for them may be a bit tricky.

Gatherer doesn't have tokens (except for a tiny handful in older sets).

magiccards.info has tokens, but is missing many of them and they don't update their tokens list very often, often not until many months after a set is released.

So when a new set is released in the future with tokens, I need a source of this information. Ideally it could be something I could automate with scraping, however I don't have much hope that this will be the case. I anticipate I'd likely need to add the tokens manually every time a new set is released. Even manually though, does anyone know a good location for token info?

florentdouine commented 8 years ago

@Sembiance Maybe using magiccardmarket.eu or another ecommerce website ?

Sembiance commented 8 years ago

@florentdouine Possibly, however ideally I'd like a source that has token info BEFORE the set is released as I release sets on mtgjson as soon as they hit gatherer which is about a week or so before the prerelease events. My guess is an MTG store site wouldn't have any info on the tokens that early. I'll likely need to manually go to forums/blog posts and add each token manually.

florentdouine commented 8 years ago

Magiccardmarket usually release each cards as soon as it's available but i didn't remember if tokens are included...

ZeldaZach commented 8 years ago

@sembiance You're free to source the information from the XML file we support. @Psithief updates it within hours of the tokens going live on wizard's site for spoiler season each time every time.

Sembiance commented 8 years ago

@ZeldaZach Thanks for the offer! When it comes time to start work on tokens, I'll strongly consider the XML files you create as a potential source!

ZeldaZach commented 8 years ago

@Sembiance You should look into making a gitter.im chat for the MTGJSON projects :smile:

Sembiance commented 8 years ago

@ZeldaZach Looks like a nifty site :) However currently the mtgsalvation thread/my email/github issues is probably enough ways to discuss things/contact me :)

flyingmutant commented 8 years ago

Here is a new site dedicated to tokens: http://tokens.mtg.onl

Psithief commented 8 years ago

Here is a new site dedicated to tokens: http://tokens.mtg.onl

@adam-foster Would you like to submit your dataset for inclusion in this project?

adam-foster commented 8 years ago

Hi all, Yes you're very welcome to use the dataset from my MTG Tokens project. I created following a very similar structure to this project.

The Token ID's are created within the app in the following format: [setCode]_[tokenNumber]-[tokenName], as they're unique, I'm also using this for the token image path. The images are all self hosted. I have a version of the JSON with external image sources if you need it.

Also, I'm working on another couple of dataset's for Proxy tokens & Unofficial tokens. If you're interested I can let you guys know once I have this complete.

Adam

florentdouine commented 8 years ago

This is very interesting @adam-foster, thanks for your help. I think the image url could be useful too, can you add it ?

adam-foster commented 8 years ago

@florentdouine No worries, I've just added a version of the dataset with Token imageSrc's to a Plunker here.

For reference, the format looks like this:

  "ORI": {
    "name": "Magic Origins",
    "code": "ORI",
    "releaseDate": "2015-07-17",
    "type": "core",
    "tokens": [
      {
        "name": "Angel",
        "set": "ORI",
        "color": [
          "W"
        ],
        "type": "Creature — Angel",
        "text": "Flying",
        "power": 4,
        "toughness": 4,
        "subTypes": [
          "Angel"
        ],
        "types": [
          "Creature"
        ],
        "imageSrc": "http://media.wizards.com/2015/images/daily/en_b3znv1aqdq.png",
        "artist": "Cyril Van Der Haegen",
        "number": "001"
      },
florentdouine commented 8 years ago

@adam-foster Would you be able to add translations to this tokens ?

adam-foster commented 8 years ago

@florentdouine Would it just be translations of the card name? I.e:

{
  "name": "Angel",
  "type": "Creature — Angel",
  "foreignNames": [
    {
      "language": "Chinese Simplified",
      "name": "天使"
    },
    {
      "language": "German",
      "name": "Engel"
    }
  ]
  ...

The printed languages seem to differ from set to set. So would the translations need correspond to languages that each card was available in? If so, I'd need to see if there was any reliable resource for this first

florentdouine commented 8 years ago

@adam-foster The simplest solution for you would be the best. If some translations differ from printing, it won't be a big problem. Otherwise, the translations priorities must be :

  1. Name
  2. Text
  3. Type
florentdouine commented 8 years ago

Hey @adam-foster, i'm currently working on your token database. Thanks again for your work. I've found some mistakes on token's number, would you be able to update your database if i give you a list ?

florentdouine commented 8 years ago

Hey @adam-foster Actually i found only 2 mistakes on tokens's number : Plant Token of BFZ should be number 10 instead of 9 Angel Token of M14 should be number 2 instead of 1 !

adam-foster commented 8 years ago

@florentdouine Thanks i'll get them updated :)

florentdouine commented 8 years ago

@adam-foster, just 2 more errors on set Duel Decks: Venser vs. Koth : Koth Emblem should be number E2 instead of E1 Venser Emblem should be number E1 instead of E2 ;)

ZeldaZach commented 8 years ago

@lsmoura Just bumping this post. Many users over at Cockatrice would be very pleased with this feature and I hope you have time in the near future to look into it :)

lsmoura commented 8 years ago

I'll get to it right after the OGW release!

ZeldaZach commented 8 years ago

Thanks for looking into it @lsmoura !! We have an updated xml published with contains a "related" card link back. Example:

        <card>
            <name>Beast </name>
            <set picURL="http://media.wizards.com/2015/c15_9dsm28ccakCDSk2/en_hHSzfAwFwd.png">C15</set>
            <set picURL="http://magiccards.info/extras/token/commander-2014/beast-2.jpg">C14</set>
            <set picURL="http://magiccards.info/extras/token/zendikar/beast.jpg">ZEN</set>
            <set picURL="http://magiccards.info/extras/token/duel-decks-garruk-vs-liliana/beast-2.jpg">DDD</set>
            <set picURL="http://magiccards.info/extras/token/player-rewards-2001/beast.jpg">ODY</set>
            <color>G</color>
            <manacost></manacost>
            <type>Token Creature — Beast</type>
            <pt>4/4</pt>
            <tablerow>2</tablerow>
            <text></text>
            <token>1</token>
            <reverse-related>Baloth Cage Trap</reverse-related>
            <reverse-related>Beast Attack</reverse-related>
            <reverse-related>Ezuri's Predation</reverse-related>
            <reverse-related>Hunting Pack</reverse-related>
            <reverse-related>Rampaging Baloths</reverse-related>
        </card>

So any of those cards can create this specific token

ZeldaZach commented 6 years ago

Addressed in https://github.com/mtgjson/mtgjson-python/commit/cb85db8d368e66cd28720f7704a25e2885b2f0e7