magarena / magarena-scripts-builder

Generate card templates from JSON card description
3 stars 1 forks source link

Fix parsing for MTGJSON v4 #8

Closed bilbo2 closed 5 years ago

bilbo2 commented 6 years ago

This fixes loading of MTGJson v4, as there are some differences in the format, partially due to bugs in MTGJson 4, partly due to version difference: "releaseDate" is null in some sets (bug in JSON, but as the field is not critical, fix the handling so we do not die on exception if it is null) fields "supertypes" and "subtypes" are present, but empty in some cards (i.e. card does not have sub/super types). Handle this correctly. Rarity is lowercased in the new JSON.

In the end, in MTGJson 4 field "number" is not same as "mciNumber", so many images were wrong/not working

I had to use older MTGJson v3 - in it just one planeswalker had "loaylty": null instead of "loyalty": "X" (fixed manually in the input JSON)

Now it can handle both v3 and v4.

I've added script scripts/images-from-scryfall that downloads list of available images from scryfall and creates CardImages.txt with the list. This helped with images for newer sets not working with neither v3 or v4 json and current image-url-generation heuristics

melvinzhang commented 5 years ago

Thanks for adding the v4 support and images from scryfall.