Added M12 Set.

Added Wizards M12 and Commander source.
This commit is contained in:
North 2011-07-11 23:24:49 +03:00
parent 125a605471
commit 4337e9fb3c
5 changed files with 73 additions and 16 deletions

View file

@ -14,7 +14,6 @@ import org.mage.plugins.card.constants.Constants;
import org.mage.plugins.card.images.ImageCache;
import org.mage.plugins.card.utils.BufferedImageBuilder;
import javax.imageio.ImageIO;
public class ManaSymbols {
private static final Logger log = Logger.getLogger(ManaSymbols.class);
@ -24,7 +23,7 @@ public class ManaSymbols {
static private Pattern replaceSymbolsPattern = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
private static final String[] sets = {"DIS", "GPT", "RAV", "MRD",
"10E", "HOP", "ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11",
"10E", "HOP", "ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11", "M12",
"MBS", "DDF", "DST", "EVE", "APC", "NPH", "TMP", "CHK"};

View file

@ -17,7 +17,7 @@ public class GathererSets implements Iterable<DownloadJob> {
private static File outDir = DEFAULT_OUT_DIR;
private static final String[] symbols = {"DIS", "DST", "GPT", "RAV", "MRD", "10E", "HOP", "EVE", "APC", "TMP", "CHK"};
private static final String[] withMythics = {"ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11", "DDF", "MBS", "NPH"};
private static final String[] withMythics = {"ALA", "CFX", "ARB", "ZEN", "WWK", "ROE", "SOM", "M10", "M11", "M12", "DDF", "MBS", "NPH"};
private static final HashMap<String, String> symbolsReplacements = new HashMap<String, String>();
static {

View file

@ -29,23 +29,25 @@ public class WizardCardsImageSource implements CardImageSource {
public WizardCardsImageSource() {
sets = new HashMap();
setsAliases = new HashMap();
setsAliases.put("NPH", "newphyrexia");
setsAliases.put("MBS", "mirrodinbesieged");
setsAliases.put("SOM", "scarsofmirrodin");
setsAliases.put("M11", "magic2011");
setsAliases.put("ROE", "riseoftheeldrazi");
setsAliases.put("WWK", "worldwake");
setsAliases.put("ZEN", "zendikar");
setsAliases.put("M10", "magic2010");
setsAliases.put("ARB", "alarareborn");
setsAliases.put("CON", "conflux");
setsAliases.put("ALA", "shardsofalara");
setsAliases.put("M12", "magic2012/cig");
setsAliases.put("CMD", "commander/cig");
setsAliases.put("NPH", "newphyrexia/spoiler");
setsAliases.put("MBS", "mirrodinbesieged/spoiler");
setsAliases.put("SOM", "scarsofmirrodin/spoiler");
setsAliases.put("M11", "magic2011/spoiler");
setsAliases.put("ROE", "riseoftheeldrazi/spoiler");
setsAliases.put("WWK", "worldwake/spoiler");
setsAliases.put("ZEN", "zendikar/spoiler");
setsAliases.put("M10", "magic2010/spoiler");
setsAliases.put("ARB", "alarareborn/spoiler");
setsAliases.put("CON", "conflux/spoiler");
setsAliases.put("ALA", "shardsofalara/spoiler");
}
private List<String> getSetLinks(String cardSet) {
List<String> setLinks = new ArrayList<String>();
try {
Document doc = Jsoup.connect("http://www.wizards.com/magic/tcg/article.aspx?x=mtg/tcg/" + cardSet + "/spoiler").get();
Document doc = Jsoup.connect("http://www.wizards.com/magic/tcg/article.aspx?x=mtg/tcg/" + (String) setsAliases.get(cardSet)).get();
Elements cardsImages = doc.select("img[height$=370]");
for (int i = 0; i < cardsImages.size(); i++) {
setLinks.add(cardsImages.get(i).attr("src"));
@ -64,7 +66,7 @@ public class WizardCardsImageSource implements CardImageSource {
if (setsAliases.get(cardSet) != null) {
List<String> setLinks = (List<String>) sets.get(cardSet);
if (setLinks == null) {
setLinks = getSetLinks((String) setsAliases.get(cardSet));
setLinks = getSetLinks(cardSet);
sets.put(cardSet, setLinks);
}
String link;

View file

@ -0,0 +1,55 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets;
import java.util.GregorianCalendar;
import mage.Constants.SetType;
import mage.cards.ExpansionSet;
/**
*
* @author North
*/
public class Magic2012 extends ExpansionSet {
private static final Magic2012 fINSTANCE = new Magic2012();
public static Magic2012 getInstance() {
return fINSTANCE;
}
private Magic2012() {
super("Magic 2012", "M12", "seticon_M12", "mage.sets.magic2012", new GregorianCalendar(2011, 6, 9).getTime(), SetType.CORE);
this.hasBoosters = true;
this.numBoosterLands = 1;
this.numBoosterCommon = 10;
this.numBoosterUncommon = 3;
this.numBoosterRare = 1;
this.ratioBoosterMythic = 8;
}
}

View file

@ -78,6 +78,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
this.addSet(Guru.getInstance());
this.addSet(Magic2010.getInstance());
this.addSet(Magic2011.getInstance());
this.addSet(Magic2012.getInstance());
this.addSet(Mirrodin.getInstance());
this.addSet(MirrodinBesieged.getInstance());
this.addSet(NewPhyrexia.getInstance());