From 4337e9fb3cb60187eb3765eb444945c1921aac1d Mon Sep 17 00:00:00 2001 From: North Date: Mon, 11 Jul 2011 23:24:49 +0300 Subject: [PATCH] Added M12 Set. Added Wizards M12 and Commander source. --- .../org/mage/card/arcane/ManaSymbols.java | 3 +- .../plugins/card/dl/sources/GathererSets.java | 2 +- .../dl/sources/WizardCardsImageSource.java | 28 +++++----- Mage.Sets/src/mage/sets/Magic2012.java | 55 +++++++++++++++++++ Mage.Sets/src/mage/sets/Sets.java | 1 + 5 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/Magic2012.java diff --git a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/card/arcane/ManaSymbols.java index 5958a79bc6..15f98b5fa1 100644 --- a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -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"}; diff --git a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java index faacadaba3..5a47f2942a 100644 --- a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java +++ b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java @@ -17,7 +17,7 @@ public class GathererSets implements Iterable { 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 symbolsReplacements = new HashMap(); static { diff --git a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index 0b8e303986..a897d4bfae 100644 --- a/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Plugins/Mage.Card.Plugin/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -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 getSetLinks(String cardSet) { List setLinks = new ArrayList(); 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 setLinks = (List) sets.get(cardSet); if (setLinks == null) { - setLinks = getSetLinks((String) setsAliases.get(cardSet)); + setLinks = getSetLinks(cardSet); sets.put(cardSet, setLinks); } String link; diff --git a/Mage.Sets/src/mage/sets/Magic2012.java b/Mage.Sets/src/mage/sets/Magic2012.java new file mode 100644 index 0000000000..545b9a0346 --- /dev/null +++ b/Mage.Sets/src/mage/sets/Magic2012.java @@ -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; + } +} diff --git a/Mage.Sets/src/mage/sets/Sets.java b/Mage.Sets/src/mage/sets/Sets.java index 8b80ce2f1a..dd8dd97829 100644 --- a/Mage.Sets/src/mage/sets/Sets.java +++ b/Mage.Sets/src/mage/sets/Sets.java @@ -78,6 +78,7 @@ public class Sets extends HashMap { 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());