Page 1 of 2
Templates for cards, all of them

Posted:
06 Oct 2013, 20:05
by ember hauler
Hi guys,
As far as I know, Magic has more than 13 500 unique cards (if you count planes, avatars, characters and the rest).
Magarena v.1.42 has 3735. Huge difference.
Adding new cards is a hard work, and I'm really glad there are some cool guys doing scripting and programming and everything.
I was thinking about my contribution, about some way to make this scripting work a bit easier for you.
So I managed to create a template for every card up to M14, which is 13 431 cards in total. These templates could be a starting point for scripting new card, saving some time with boring stuff like types, subtypes, manacost, url, image, PT, etc.
See the attachment.
Let me know if this is helpful.
Regards.
UPDATE:
Attached file was updated so now it's easier to find it in this thread.
Re: Templates for cards, all of them

Posted:
06 Oct 2013, 23:41
by Huggybaby
I'm not capable of judging how helpful your contribution is, but I sure like the way you think.

Re: Templates for cards, all of them

Posted:
07 Oct 2013, 08:14
by jerichopumpkin

Holy cow! That is amazing, it will save me an awful lot of time!
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 08:55
by melvin
Thanks, ember hauler. This is a very useful resource that will reduce the work needed to create a card.
Some suggestions for improvements to better match current conventions:
File names should be card name with non alpha numeric characters changed to _, eg Lu_Su,_Wu_Advisor.txt should be Lu_Su__Wu_Advisor.txt
Currently I'm checking for conformance against Arch's cards.xml for name, type, subtype, cost, pt in that order. It would help if in the template, the cost property appears after subtype property.
Could you share the scripts for generating these templates so that we can include them in the project? This will allow us to generate templates for future sets.
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 10:16
by ember hauler
melvin wrote:Thanks, ember hauler. This is a very useful resource that will reduce the work needed to create a card.
I truly hope so.
melvin wrote:Some suggestions for improvements to better match current conventions:
File names should be card name with non alpha numeric characters changed to _, eg Lu_Su,_Wu_Advisor.txt should be Lu_Su__Wu_Advisor.txt
Currently I'm checking for conformance against Arch's cards.xml for name, type, subtype, cost, pt in that order. It would help if in the template, the cost property appears after subtype property.
Sure thing! Will do in a couple of days. I've noticed some things to improve as well, so I'll put updated files here.
melvin wrote:Could you share the scripts for generating these templates so that we can include them in the project? This will allow us to generate templates for future sets.
It was just several hours in MS Excel, I'm not sure if it counts as "programming environment"

Re: Templates for cards, all of them

Posted:
07 Oct 2013, 10:19
by ember hauler
jerichopumpkin wrote::D Holy cow! That is amazing, it will save me an awful lot of time!
Good to hear

There are no Theros cards at the moment, but I'm planning to deal with them as well, as soon as I'll find more recent database.
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 10:23
by ember hauler
Another thing I keep thinking about is the "value" property of the card.
Is there any way to fetch community rating from Gatherer for every card?
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 12:05
by melvin
ember hauler wrote:It was just several hours in MS Excel, I'm not sure if it counts as "programming environment"


that's incredible, never knew Excel could do something like this. I'll see if I can whip up something to detect vanilla creatures that are not yet in the game, then those could be added directly from your templates as they don't need anything else.
ember hauler wrote:Another thing I keep thinking about is the "value" property of the card.
Is there any way to fetch community rating from Gatherer for every card?
Before a release, I'll run a script that update every card in the game. I just grab the Gatherer page for the card and scrap the rating. So the value property is not that important as we can update it automatically, perhaps you can default it to 2.5 first.
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 12:29
by ember hauler
melvin wrote:I'll see if I can whip up something to detect vanilla creatures that are not yet in the game, then those could be added directly from your templates as they don't need anything else.
Well, now that you mentioned Arch's xml I guess I will redo my templates. My source was Deckbuilder's csv, which is not as accurate as Arch's, I guess. For example we could fetch simple abilities and put them into templates. I think I can do that.
melvin wrote:Before a release, I'll run a script that update every card in the game. I just grab the Gatherer page for the card and scrap the rating. So the value property is not that important as we can update it automatically, perhaps you can default it to 2.5 first.
Great, let's do it this way.
Re: Templates for cards, all of them

Posted:
07 Oct 2013, 12:41
by mike
I have a relatively up to date copy of the gatherer database for Project Firemind. If you need an easy to use API (json/xml) for generating the templates let me know, I'll set one up.
Would it be helpful to anyone if I hosted those templates on firemind.ch linked to the specific cards? So people could search for a card and directly download the template (or even edit and submit it directly in the browser).
Re: Templates for cards, all of them

Posted:
11 Oct 2013, 08:00
by ember hauler
Well, I did all the work again, completely from scratch. This time I used Arch's XML, the most recent one. I've corrected requested things and did some other small improvements.
The result is in the attachment:
- 13 648 card templates
- Theros included (so I guess now it's really ALL the cards)
- file names follow conventions
- name, type, subtype, cost, pt are in correct order
- value is 2.500 by default
I hope it will help.
UPDATE:
Now you can find the latest templates at the first post in this thread.
Re: Templates for cards, all of them

Posted:
11 Oct 2013, 08:06
by ember hauler
mike wrote:Would it be helpful to anyone if I hosted those templates on firemind.ch linked to the specific cards? So people could search for a card and directly download the template (or even edit and submit it directly in the browser).
I think it's a great idea.
The more ways we have for people to participate and find the information/templates, the more card scripts we will get.
Most of the card submitting traffic, I believe, is now goes thru firemind.ch, so it's quite natural to host templates there as well.
Re: Templates for cards, all of them

Posted:
13 Oct 2013, 03:38
by melvin
ember hauler wrote:Well, I did all the work again, completely from scratch. This time I used Arch's XML, the most recent one. I've corrected requested things and did some other small improvements.
Great to have the Theros cards available now. Btw, how did you get the URLs for the image and text propert of the cards? That was my stumbling block when I tried to so something similar.
I was merging the 35 cards you submitted when I noticed that the order of types and subtypes do not follow from Arch's cards.xml.
For example,
Triton Shorethief is printed as Merfolk Rogue but in the template it is given as "subtype=Rogue,Merfolk", similarly
Bronze Sable is printed as Artifact Creature but given as "type=Creature,Artifact". All things being equal, it would be better if the order of subtypes follow from cards.xml as well.
Re: Templates for cards, all of them

Posted:
13 Oct 2013, 13:15
by ember hauler
melvin wrote: Btw, how did you get the URLs for the image and text propert of the cards? That was my stumbling block when I tried to so something similar.
Arch's XML pack has setinfo.xml, from that I took set codes and release dates. In meta.xml there is a set for every card, so I calculated the code for most recently released set for every card. Then I added number of the card inside the release (this info is also from meta.xml). This way I was able to construct URL and Image for 88.5% of all cards. Sometimes these URLs lead to 404 (sorry), but most of the time they are accurate.
melvin wrote:I was merging the 35 cards you submitted when I noticed that the order of types and subtypes do not follow from Arch's cards.xml.
True. Unfortunately, once XML is imported to Excel there is no way of telling the right order - there is no attribute for this, only for supertypes.
But I managed to put all of the types and some of the subtypes in the right order by working with keywords. I hope it's not crucial.
Updated ZIP is now in the first post of the thread.
Re: Templates for cards, all of them

Posted:
08 Nov 2013, 12:08
by ember hauler
The file in the first post was updated, now with Commander 2013 cards.
13699 card templates in total.