From 90d75a65a72b28be02ded9cdc116a58d22f27450 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 19 Feb 2014 19:47:08 +0100 Subject: [PATCH] Added Portal Three Kingdoms set to Mage. --- .../client/util/sets/ConstructedFormats.java | 12 ++-- .../plugins/card/dl/sources/GathererSets.java | 7 ++- .../dl/sources/MagicCardsImageSource.java | 1 + .../dl/sources/WizardCardsImageSource.java | 9 +-- .../src/mage/sets/PortalThreeKingdoms.java | 62 +++++++++++++++++++ 5 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/PortalThreeKingdoms.java diff --git a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java index cc3c34e4f7..e4a3cb69af 100644 --- a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java +++ b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java @@ -51,6 +51,7 @@ public class ConstructedFormats { "* Ice Age Block", "Coldsnap", "Alliances", "Ice Age", "Fourth Edition", "Homelands", "Fallen Empires", "The Dark", "Legends", "Antiquities", "Arabian Nights", "Revised Edition", "Unlimited Edition", "Limited Edition Beta", "Limited Edition Alpha", + "Portal Three Kingdoms", "Guru", "Duel Decks: Heroes vs. Monsters", "Duel Decks: Elspeth vs. Tezzeret" @@ -387,6 +388,9 @@ public class ConstructedFormats { if (format.equals("Guru")) { return Arrays.asList("GUR"); } + if (format.equals("Portal Three Kingdoms")) { + return Arrays.asList("PTK"); + } if (format.equals("Duel Decks: Elspeth vs. Tezzeret")) { return Arrays.asList("DDF"); } @@ -422,17 +426,17 @@ public class ConstructedFormats { } } - private static final List standard = new ArrayList(); + private static final List standard = new ArrayList<>(); private static final Date standardDate = new GregorianCalendar(2012, 9, 28).getTime(); - private static final List extended = new ArrayList(); + private static final List extended = new ArrayList<>(); private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime(); - private static final List modern = new ArrayList(); + private static final List modern = new ArrayList<>(); private static final Date modernDate = new GregorianCalendar(2003, 7, 20).getTime(); // for all sets just return empty list - private static final List all = new ArrayList(); + private static final List all = new ArrayList<>(); static { buildLists(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java index 9d5cd0551a..e90e52d27a 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java @@ -30,7 +30,8 @@ public class GathererSets implements Iterable { "RAV", "GPT", "DIS", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", - "SHM", "EVE"}; + "SHM", "EVE", + "PTK"}; private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14", "DDF", "DDL", @@ -42,7 +43,7 @@ public class GathererSets implements Iterable { "RTR", "GTC", "DGM", "MMA", "THS", "BNG"}; - private static final HashMap symbolsReplacements = new HashMap(); + private static final HashMap symbolsReplacements = new HashMap<>(); static { symbolsReplacements.put("ARN", "AN"); @@ -89,7 +90,7 @@ public class GathererSets implements Iterable { @Override public Iterator iterator() { - ArrayList jobs = new ArrayList(); + ArrayList jobs = new ArrayList<>(); for (String symbol : symbols) { jobs.add(generateDownloadJob(symbol, "C")); jobs.add(generateDownloadJob(symbol, "U")); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java index 954c05c640..af205a1994 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java @@ -58,6 +58,7 @@ public class MagicCardsImageSource implements CardImageSource { put("10E", "tenth-edition"); put("CSP", "coldsnap"); put("CHK", "player-rewards-2004"); + put("PTK", "portal-three-kingdoms"); } private static final long serialVersionUID = 1L; }; diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index 0793617d65..98c4e19911 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -17,7 +17,7 @@ public class WizardCardsImageSource implements CardImageSource { private static CardImageSource instance; private static Map setsAliases; - private Map> sets; + private final Map> sets; public static CardImageSource getInstance() { if (instance == null) { @@ -27,8 +27,8 @@ public class WizardCardsImageSource implements CardImageSource { } public WizardCardsImageSource() { - sets = new HashMap>(); - setsAliases = new HashMap(); + sets = new HashMap<>(); + setsAliases = new HashMap<>(); setsAliases.put("BNG", "bornofthegods/cig"); setsAliases.put("C13", "commander2013/cig"); setsAliases.put("THS", "theros/cig"); @@ -55,10 +55,11 @@ public class WizardCardsImageSource implements CardImageSource { setsAliases.put("CON", "conflux/spoiler"); setsAliases.put("ALA", "shardsofalara/spoiler"); setsAliases.put("PC2", "planechase2012edition/cig"); + setsAliases.put("PTK", "portalthreekingdoms/cig"); } private Map getSetLinks(String cardSet) { - Map setLinks = new HashMap(); + Map setLinks = new HashMap<>(); try { Document doc = Jsoup.connect("http://www.wizards.com/magic/tcg/article.aspx?x=mtg/tcg/" + setsAliases.get(cardSet)).get(); Elements cardsImages = doc.select("img[height$=370]"); diff --git a/Mage.Sets/src/mage/sets/PortalThreeKingdoms.java b/Mage.Sets/src/mage/sets/PortalThreeKingdoms.java new file mode 100644 index 0000000000..6c5c90e0f9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/PortalThreeKingdoms.java @@ -0,0 +1,62 @@ +/* + * 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.cards.ExpansionSet; +import mage.constants.SetType; + +/** + * + * @author LevelX2 + */ + +public class PortalThreeKingdoms extends ExpansionSet { + + private static final PortalThreeKingdoms fINSTANCE = new PortalThreeKingdoms(); + + /** + * + * @return + */ + public static PortalThreeKingdoms getInstance() { + return fINSTANCE; + } + + private PortalThreeKingdoms() { + super("Portal Three Kingsdoms", "PTK", "mage.sets.portalthreekingdoms", new GregorianCalendar(1999, 5, 1).getTime(), SetType.REPRINT); + this.hasBasicLands = true; + this.hasBoosters = true; + this.numBoosterLands = 2; + this.numBoosterCommon = 5; + this.numBoosterUncommon = 5; + this.numBoosterRare = 1; + this.ratioBoosterMythic = 0; + } +} \ No newline at end of file