mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
Added Portal and Portal Second Age set
This commit is contained in:
parent
90f4c2ea05
commit
9d8d1409b2
6 changed files with 747 additions and 613 deletions
|
@ -1,481 +1,487 @@
|
|||
package mage.client.util.sets;
|
||||
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.constants.SetType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Utility class for constructed formats (expansions and other editions).
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ConstructedFormats {
|
||||
|
||||
public static final String ALL = "- All Sets";
|
||||
public static final String STANDARD = "- Standard";
|
||||
public static final String EXTENDED = "- Extended";
|
||||
public static final String MODERN = "- Modern";
|
||||
|
||||
private static final String[] constructedFormats = {
|
||||
ALL, STANDARD, EXTENDED, MODERN,
|
||||
"Commander 2013 Edition",
|
||||
"* Theros Block", "Journey into Nyx", "Born of the Gods", "Theros",
|
||||
"Magic 2014",
|
||||
"Modern Masters",
|
||||
"* Return to Ravnica Block", "Dragon's Maze", "Gatecrash", "Return to Ravnica",
|
||||
"Magic 2013", "Planechase 2012",
|
||||
"* Innistrad Block", "Avacyn Restored", "Dark Ascension", "Innistrad",
|
||||
"Magic 2012", "Commander",
|
||||
"* Scars of Mirrodin Block", "New Phyrexia", "Mirrodin Besieged", "Scars of Mirrodin", "Magic 2011",
|
||||
"* Zendikar Block", "Rise of the Eldrazi", "Worldwake", "Zendikar",
|
||||
"Magic 2010", "Planechase",
|
||||
"* Shards of Alara Block", "Alara Reborn", "Conflux", "Shards of Alara",
|
||||
"* Shadowmoor Block", "Shadowmoor", "Eventide",
|
||||
"* Lorwyn Block", "Lorwyn", "Morningtide",
|
||||
"* Time Spiral Block", "Future Sight", "Planar Chaos", "Time Spiral", "Tenth Edition",
|
||||
"* Ravnica Block", "Dissension", "Guildpact", "Ravnica: City of Guilds",
|
||||
"* Kamigawa Block", "Saviors of Kamigawa", "Betrayers of Kamigawa", "Champions of Kamigawa", "Ninth Edition",
|
||||
"* Mirrodin Block", "Fifth Dawn", "Darksteel", "Mirrodin",
|
||||
"* Onslaught Block", "Scourge", "Legions", "Onslaught", "Eighth Edition",
|
||||
"* Odyssey Block", "Judgment", "Torment", "Odyssey",
|
||||
"* Invasion Block", "Apocalypse", "Planeshift", "Invasion", "Seventh Edition",
|
||||
"* Masquerade Block", "Prophecy", "Nemesis", "Mercadian Masques",
|
||||
"* Urza Block", "Urza's Destiny", "Urza's Legacy", "Urza's Saga", "Sixth Edition",
|
||||
"* Tempest Block", "Exodus", "Stronghold", "Tempest",
|
||||
"* Mirage Block", "Weatherlight", "Visions", "Mirage", "Fifth Edition",
|
||||
"* 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",
|
||||
"Unhinged",
|
||||
"Duel Decks: Elves vs. Goblins",
|
||||
"Duel Decks: Jace vs. Chandra",
|
||||
"Duel Decks: Divine vs. Demonic",
|
||||
"Duel Decks: Garruk vs. Liliana",
|
||||
"Duel Decks: Elspeth vs. Tezzeret",
|
||||
"Duel Decks: Knights vs. Dragons",
|
||||
"Duel Decks: Ajani vs. Nicol Bolas",
|
||||
"Duel Decks: Venser vs. Koth",
|
||||
"Duel Decks: Heroes vs. Monsters",
|
||||
"Duel Decks: Jace vs. Vraska"
|
||||
};
|
||||
|
||||
private ConstructedFormats() {
|
||||
}
|
||||
|
||||
public static String[] getTypes() {
|
||||
return constructedFormats;
|
||||
}
|
||||
|
||||
public static String getDefault() {
|
||||
return constructedFormats[1];
|
||||
}
|
||||
|
||||
public static List<String> getSetsByFormat(String format) {
|
||||
|
||||
if (format.equals("* Theros Block")) {
|
||||
return Arrays.asList("THS", "BNG","JOU");
|
||||
}
|
||||
if (format.equals("Journey into Nyx")) {
|
||||
return Arrays.asList("JOU");
|
||||
}
|
||||
if (format.equals("Born of the Gods")) {
|
||||
return Arrays.asList("BNG");
|
||||
}
|
||||
if (format.equals("Theros")) {
|
||||
return Arrays.asList("THS");
|
||||
}
|
||||
if (format.equals("Arabian Nights")) {
|
||||
return Arrays.asList("ARN");
|
||||
}
|
||||
if (format.equals("Antiquities")) {
|
||||
return Arrays.asList("ATQ");
|
||||
}
|
||||
if (format.equals("Legends")) {
|
||||
return Arrays.asList("LEG");
|
||||
}
|
||||
if (format.equals("The Dark")) {
|
||||
return Arrays.asList("DRK");
|
||||
}
|
||||
if (format.equals("Fallen Empires")) {
|
||||
return Arrays.asList("FEM");
|
||||
}
|
||||
if (format.equals("Homelands")) {
|
||||
return Arrays.asList("HML");
|
||||
}
|
||||
if (format.equals("* Ice Age Block")) {
|
||||
return Arrays.asList("ICE", "ALL", "CSP");
|
||||
}
|
||||
if (format.equals("Ice Age")) {
|
||||
return Arrays.asList("ICE");
|
||||
}
|
||||
if (format.equals("Alliances")) {
|
||||
return Arrays.asList("ALL");
|
||||
}
|
||||
if (format.equals("Coldsnap")) {
|
||||
return Arrays.asList("CSP");
|
||||
}
|
||||
if (format.equals("* Mirage Block")) {
|
||||
return Arrays.asList("MIR", "VIS", "WTH");
|
||||
}
|
||||
if (format.equals("Mirage")) {
|
||||
return Arrays.asList("MIR");
|
||||
}
|
||||
if (format.equals("Visions")) {
|
||||
return Arrays.asList("VIS");
|
||||
}
|
||||
if (format.equals("Weatherlight")) {
|
||||
return Arrays.asList("WTH");
|
||||
}
|
||||
if (format.equals("* Tempest Block")) {
|
||||
return Arrays.asList("TMP", "STH", "EXO");
|
||||
}
|
||||
if (format.equals("Tempest")) {
|
||||
return Arrays.asList("TMP");
|
||||
}
|
||||
if (format.equals("Stronghold")) {
|
||||
return Arrays.asList("STH");
|
||||
}
|
||||
if (format.equals("Exodus")) {
|
||||
return Arrays.asList("EXO");
|
||||
}
|
||||
if (format.equals("* Urza Block")) {
|
||||
return Arrays.asList("USG", "ULG", "UDS");
|
||||
}
|
||||
if (format.equals("Urza's Saga")) {
|
||||
return Arrays.asList("USG");
|
||||
}
|
||||
if (format.equals("Urza's Legacy")) {
|
||||
return Arrays.asList("ULG");
|
||||
}
|
||||
if (format.equals("Urza's Destiny")) {
|
||||
return Arrays.asList("UDS");
|
||||
}
|
||||
if (format.equals("* Masquerade Block")) {
|
||||
return Arrays.asList("MMQ", "NMS", "PCY");
|
||||
}
|
||||
if (format.equals("Mercadian Masques")) {
|
||||
return Arrays.asList("MMQ");
|
||||
}
|
||||
if (format.equals("Nemesis")) {
|
||||
return Arrays.asList("NMS");
|
||||
}
|
||||
if (format.equals("Prophecy")) {
|
||||
return Arrays.asList("PCY");
|
||||
}
|
||||
if (format.equals("* Invasion Block")) {
|
||||
return Arrays.asList("INV", "PLS", "APC");
|
||||
}
|
||||
if (format.equals("Invasion")) {
|
||||
return Arrays.asList("INV");
|
||||
}
|
||||
if (format.equals("Planeshift")) {
|
||||
return Arrays.asList("PLS");
|
||||
}
|
||||
if (format.equals("Apocalypse")) {
|
||||
return Arrays.asList("APC");
|
||||
}
|
||||
if (format.equals("* Odyssey Block")) {
|
||||
return Arrays.asList("ODY", "TOR", "JUD");
|
||||
}
|
||||
if (format.equals("Odyssey")) {
|
||||
return Arrays.asList("ODY");
|
||||
}
|
||||
if (format.equals("Torment")) {
|
||||
return Arrays.asList("TOR");
|
||||
}
|
||||
if (format.equals("Judgment")) {
|
||||
return Arrays.asList("JUD");
|
||||
}
|
||||
if (format.equals("* Onslaught Block")) {
|
||||
return Arrays.asList("ONS", "LGN", "SCG");
|
||||
}
|
||||
if (format.equals("Onslaught")) {
|
||||
return Arrays.asList("ONS");
|
||||
}
|
||||
if (format.equals("Legions")) {
|
||||
return Arrays.asList("LGN");
|
||||
}
|
||||
if (format.equals("Scourge")) {
|
||||
return Arrays.asList("SCG");
|
||||
}
|
||||
if (format.equals("* Mirrodin Block")) {
|
||||
return Arrays.asList("MRD", "DST", "5DN");
|
||||
}
|
||||
if (format.equals("Mirrodin")) {
|
||||
return Arrays.asList("MRD");
|
||||
}
|
||||
if (format.equals("Darksteel")) {
|
||||
return Arrays.asList("DST");
|
||||
}
|
||||
if (format.equals("Fifth Dawn")) {
|
||||
return Arrays.asList("5DN");
|
||||
}
|
||||
if (format.equals("* Kamigawa Block")) {
|
||||
return Arrays.asList("CHK", "BOK", "SOK");
|
||||
}
|
||||
if (format.equals("Champions of Kamigawa")) {
|
||||
return Arrays.asList("CHK");
|
||||
}
|
||||
if (format.equals("Betrayers of Kamigawa")) {
|
||||
return Arrays.asList("BOK");
|
||||
}
|
||||
if (format.equals("Saviors of Kamigawa")) {
|
||||
return Arrays.asList("SOK");
|
||||
}
|
||||
if (format.equals("* Ravnica Block")) {
|
||||
return Arrays.asList("RAV", "GPT", "DIS");
|
||||
}
|
||||
if (format.equals("Ravnica: City of Guilds")) {
|
||||
return Arrays.asList("RAV");
|
||||
}
|
||||
if (format.equals("Guildpact")) {
|
||||
return Arrays.asList("GPT");
|
||||
}
|
||||
if (format.equals("Dissension")) {
|
||||
return Arrays.asList("DIS");
|
||||
}
|
||||
if (format.equals("* Time Spiral Block")) {
|
||||
return Arrays.asList("TSP", "TSB", "PLC", "FUT");
|
||||
}
|
||||
if (format.equals("Time Spiral")) {
|
||||
return Arrays.asList("TSP", "TSB");
|
||||
}
|
||||
if (format.equals("Planar Chaos")) {
|
||||
return Arrays.asList("PLC");
|
||||
}
|
||||
if (format.equals("Future Sight")) {
|
||||
return Arrays.asList("FUT");
|
||||
}
|
||||
if (format.equals("* Lorwyn Block")) {
|
||||
return Arrays.asList("LRW", "MOR");
|
||||
}
|
||||
if (format.equals("Lorwyn")) {
|
||||
return Arrays.asList("LRW");
|
||||
}
|
||||
if (format.equals("Morningtide")) {
|
||||
return Arrays.asList("MOR");
|
||||
}
|
||||
if (format.equals("* Shadowmoor Block")) {
|
||||
return Arrays.asList("SHM", "EVE");
|
||||
}
|
||||
if (format.equals("Shadowmoor")) {
|
||||
return Arrays.asList("SHM");
|
||||
}
|
||||
if (format.equals("Eventide")) {
|
||||
return Arrays.asList("EVE");
|
||||
}
|
||||
if (format.equals("* Shards of Alara Block")) {
|
||||
return Arrays.asList("ALA", "CON", "ARB");
|
||||
}
|
||||
if (format.equals("Alara Reborn")) {
|
||||
return Arrays.asList("ARB");
|
||||
}
|
||||
if (format.equals("Conflux")) {
|
||||
return Arrays.asList("CON");
|
||||
}
|
||||
if (format.equals("Shards of Alara")) {
|
||||
return Arrays.asList("ALA");
|
||||
}
|
||||
if (format.equals("* Zendikar Block")) {
|
||||
return Arrays.asList("ZEN", "WWK", "ROE");
|
||||
}
|
||||
if (format.equals("Zendikar")) {
|
||||
return Arrays.asList("ZEN");
|
||||
}
|
||||
if (format.equals("Worldwake")) {
|
||||
return Arrays.asList("WWK");
|
||||
}
|
||||
if (format.equals("Rise of the Eldrazi")) {
|
||||
return Arrays.asList("ROE");
|
||||
}
|
||||
if (format.equals("* Scars of Mirrodin Block")) {
|
||||
return Arrays.asList("SOM", "MBS", "NPH");
|
||||
}
|
||||
if (format.equals("Scars of Mirrodin")) {
|
||||
return Arrays.asList("SOM");
|
||||
}
|
||||
if (format.equals("Mirrodin Besieged")) {
|
||||
return Arrays.asList("MBS");
|
||||
}
|
||||
if (format.equals("New Phyrexia")) {
|
||||
return Arrays.asList("NPH");
|
||||
}
|
||||
if (format.equals("* Innistrad Block")) {
|
||||
return Arrays.asList("ISD", "DKA", "AVR");
|
||||
}
|
||||
if (format.equals("Innistrad")) {
|
||||
return Arrays.asList("ISD");
|
||||
}
|
||||
if (format.equals("Dark Ascension")) {
|
||||
return Arrays.asList("DKA");
|
||||
}
|
||||
if (format.equals("Avacyn Restored")) {
|
||||
return Arrays.asList("AVR");
|
||||
}
|
||||
if (format.equals("* Return to Ravnica Block")) {
|
||||
return Arrays.asList("RTR", "GTC", "DGM");
|
||||
}
|
||||
if (format.equals("Return to Ravnica")) {
|
||||
return Arrays.asList("RTR");
|
||||
}
|
||||
if (format.equals("Gatecrash")) {
|
||||
return Arrays.asList("GTC");
|
||||
}
|
||||
if (format.equals("Dragon's Maze")) {
|
||||
return Arrays.asList("DGM");
|
||||
}
|
||||
if (format.equals("Limited Edition Alpha")) {
|
||||
return Arrays.asList("LEA");
|
||||
}
|
||||
if (format.equals("Limited Edition Beta")) {
|
||||
return Arrays.asList("LEB");
|
||||
}
|
||||
if (format.equals("Unlimited Edition")) {
|
||||
return Arrays.asList("2ED");
|
||||
}
|
||||
if (format.equals("Revised Edition")) {
|
||||
return Arrays.asList("3ED");
|
||||
}
|
||||
if (format.equals("Fourth Edition")) {
|
||||
return Arrays.asList("4ED");
|
||||
}
|
||||
if (format.equals("Fifth Edition")) {
|
||||
return Arrays.asList("5ED");
|
||||
}
|
||||
if (format.equals("Sixth Edition")) {
|
||||
return Arrays.asList("6ED");
|
||||
}
|
||||
if (format.equals("Seventh Edition")) {
|
||||
return Arrays.asList("7ED");
|
||||
}
|
||||
if (format.equals("Eighth Edition")) {
|
||||
return Arrays.asList("8ED");
|
||||
}
|
||||
|
||||
if (format.equals("Ninth Edition")) {
|
||||
return Arrays.asList("9ED");
|
||||
}
|
||||
if (format.equals("Tenth Edition")) {
|
||||
return Arrays.asList("10E");
|
||||
}
|
||||
|
||||
if (format.equals("Magic 2010")) {
|
||||
return Arrays.asList("M10");
|
||||
}
|
||||
if (format.equals("Magic 2011")) {
|
||||
return Arrays.asList("M11");
|
||||
}
|
||||
if (format.equals("Magic 2012")) {
|
||||
return Arrays.asList("M12");
|
||||
}
|
||||
if (format.equals("Magic 2013")) {
|
||||
return Arrays.asList("M13");
|
||||
}
|
||||
if (format.equals("Magic 2014")) {
|
||||
return Arrays.asList("M14");
|
||||
}
|
||||
if (format.equals("Planechase")) {
|
||||
return Arrays.asList("HOP");
|
||||
}
|
||||
if (format.equals("Commander")) {
|
||||
return Arrays.asList("CMD");
|
||||
}
|
||||
if (format.equals("Commander 2013 Edition")) {
|
||||
return Arrays.asList("C13");
|
||||
}
|
||||
if (format.equals("Planechase 2012")) {
|
||||
return Arrays.asList("PC2");
|
||||
}
|
||||
if (format.equals("Modern Masters")) {
|
||||
return Arrays.asList("MMA");
|
||||
}
|
||||
if (format.equals("Guru")) {
|
||||
return Arrays.asList("GUR");
|
||||
}
|
||||
if (format.equals("Unhinged")) {
|
||||
return Arrays.asList("UNH");
|
||||
}
|
||||
if (format.equals("Portal Three Kingdoms")) {
|
||||
return Arrays.asList("PTK");
|
||||
}
|
||||
if (format.equals("Duel Decks: Elves vs. Goblins")) {
|
||||
return Arrays.asList("EVG");
|
||||
}
|
||||
if (format.equals("Duel Decks: Jace vs. Chandra")) {
|
||||
return Arrays.asList("DD2");
|
||||
}
|
||||
if (format.equals("Duel Decks: Divine vs. Demonic")) {
|
||||
return Arrays.asList("DDC");
|
||||
}
|
||||
if (format.equals("Duel Decks: Garruk vs. Liliana")) {
|
||||
return Arrays.asList("DDD");
|
||||
}
|
||||
if (format.equals("Duel Decks: Elspeth vs. Tezzeret")) {
|
||||
return Arrays.asList("DDF");
|
||||
}
|
||||
if (format.equals("Duel Decks: Knights vs. Dragons")) {
|
||||
return Arrays.asList("DDG");
|
||||
}
|
||||
if (format.equals("Duel Decks: Ajani vs. Nicol Bolas")) {
|
||||
return Arrays.asList("DDH");
|
||||
}
|
||||
if (format.equals("Duel Decks: Venser vs. Koth")) {
|
||||
return Arrays.asList("DDI");
|
||||
}
|
||||
if (format.equals("Duel Decks: Heroes vs. Monsters")) {
|
||||
return Arrays.asList("DDL");
|
||||
}
|
||||
if (format.equals("Duel Decks: Jace vs. Vraska")) {
|
||||
return Arrays.asList("DDM");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (format.equals(STANDARD)) {
|
||||
return standard;
|
||||
}
|
||||
if (format.equals(EXTENDED)) {
|
||||
return extended;
|
||||
}
|
||||
if (format.equals(MODERN)) {
|
||||
return modern;
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
private static void buildLists() {
|
||||
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
|
||||
if (!set.getType().equals(SetType.REPRINT) && !set.getType().equals(SetType.JOKESET)) {
|
||||
if (set.getReleaseDate().after(standardDate)) {
|
||||
standard.add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(extendedDate)) {
|
||||
extended.add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(modernDate)) {
|
||||
modern.add(set.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> standard = new ArrayList<>();
|
||||
private static final Date standardDate = new GregorianCalendar(2012, 9, 28).getTime();
|
||||
|
||||
private static final List<String> extended = new ArrayList<>();
|
||||
private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime();
|
||||
|
||||
private static final List<String> 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<String> all = new ArrayList<>();
|
||||
|
||||
static {
|
||||
buildLists();
|
||||
}
|
||||
}
|
||||
package mage.client.util.sets;
|
||||
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.constants.SetType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Utility class for constructed formats (expansions and other editions).
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ConstructedFormats {
|
||||
|
||||
public static final String ALL = "- All Sets";
|
||||
public static final String STANDARD = "- Standard";
|
||||
public static final String EXTENDED = "- Extended";
|
||||
public static final String MODERN = "- Modern";
|
||||
|
||||
private static final String[] constructedFormats = {
|
||||
ALL, STANDARD, EXTENDED, MODERN,
|
||||
"Commander 2013 Edition",
|
||||
"* Theros Block", "Journey into Nyx", "Born of the Gods", "Theros",
|
||||
"Magic 2014",
|
||||
"Modern Masters",
|
||||
"* Return to Ravnica Block", "Dragon's Maze", "Gatecrash", "Return to Ravnica",
|
||||
"Magic 2013", "Planechase 2012",
|
||||
"* Innistrad Block", "Avacyn Restored", "Dark Ascension", "Innistrad",
|
||||
"Magic 2012", "Commander",
|
||||
"* Scars of Mirrodin Block", "New Phyrexia", "Mirrodin Besieged", "Scars of Mirrodin", "Magic 2011",
|
||||
"* Zendikar Block", "Rise of the Eldrazi", "Worldwake", "Zendikar",
|
||||
"Magic 2010", "Planechase",
|
||||
"* Shards of Alara Block", "Alara Reborn", "Conflux", "Shards of Alara",
|
||||
"* Shadowmoor Block", "Shadowmoor", "Eventide",
|
||||
"* Lorwyn Block", "Lorwyn", "Morningtide",
|
||||
"* Time Spiral Block", "Future Sight", "Planar Chaos", "Time Spiral", "Tenth Edition",
|
||||
"* Ravnica Block", "Dissension", "Guildpact", "Ravnica: City of Guilds",
|
||||
"* Kamigawa Block", "Saviors of Kamigawa", "Betrayers of Kamigawa", "Champions of Kamigawa", "Ninth Edition",
|
||||
"* Mirrodin Block", "Fifth Dawn", "Darksteel", "Mirrodin",
|
||||
"* Onslaught Block", "Scourge", "Legions", "Onslaught", "Eighth Edition",
|
||||
"* Odyssey Block", "Judgment", "Torment", "Odyssey",
|
||||
"* Invasion Block", "Apocalypse", "Planeshift", "Invasion", "Seventh Edition",
|
||||
"* Masquerade Block", "Prophecy", "Nemesis", "Mercadian Masques",
|
||||
"* Urza Block", "Urza's Destiny", "Urza's Legacy", "Urza's Saga", "Sixth Edition",
|
||||
"* Tempest Block", "Exodus", "Stronghold", "Tempest",
|
||||
"* Mirage Block", "Weatherlight", "Visions", "Mirage", "Fifth Edition",
|
||||
"* 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", "Portal Second Age", "Portal Three Kingdoms",
|
||||
"Guru",
|
||||
"Unhinged",
|
||||
"Duel Decks: Elves vs. Goblins",
|
||||
"Duel Decks: Jace vs. Chandra",
|
||||
"Duel Decks: Divine vs. Demonic",
|
||||
"Duel Decks: Garruk vs. Liliana",
|
||||
"Duel Decks: Elspeth vs. Tezzeret",
|
||||
"Duel Decks: Knights vs. Dragons",
|
||||
"Duel Decks: Ajani vs. Nicol Bolas",
|
||||
"Duel Decks: Venser vs. Koth",
|
||||
"Duel Decks: Heroes vs. Monsters",
|
||||
"Duel Decks: Jace vs. Vraska"
|
||||
};
|
||||
|
||||
private ConstructedFormats() {
|
||||
}
|
||||
|
||||
public static String[] getTypes() {
|
||||
return constructedFormats;
|
||||
}
|
||||
|
||||
public static String getDefault() {
|
||||
return constructedFormats[1];
|
||||
}
|
||||
|
||||
public static List<String> getSetsByFormat(String format) {
|
||||
|
||||
if (format.equals("* Theros Block")) {
|
||||
return Arrays.asList("THS", "BNG","JOU");
|
||||
}
|
||||
if (format.equals("Journey into Nyx")) {
|
||||
return Arrays.asList("JOU");
|
||||
}
|
||||
if (format.equals("Born of the Gods")) {
|
||||
return Arrays.asList("BNG");
|
||||
}
|
||||
if (format.equals("Theros")) {
|
||||
return Arrays.asList("THS");
|
||||
}
|
||||
if (format.equals("Arabian Nights")) {
|
||||
return Arrays.asList("ARN");
|
||||
}
|
||||
if (format.equals("Antiquities")) {
|
||||
return Arrays.asList("ATQ");
|
||||
}
|
||||
if (format.equals("Legends")) {
|
||||
return Arrays.asList("LEG");
|
||||
}
|
||||
if (format.equals("The Dark")) {
|
||||
return Arrays.asList("DRK");
|
||||
}
|
||||
if (format.equals("Fallen Empires")) {
|
||||
return Arrays.asList("FEM");
|
||||
}
|
||||
if (format.equals("Homelands")) {
|
||||
return Arrays.asList("HML");
|
||||
}
|
||||
if (format.equals("* Ice Age Block")) {
|
||||
return Arrays.asList("ICE", "ALL", "CSP");
|
||||
}
|
||||
if (format.equals("Ice Age")) {
|
||||
return Arrays.asList("ICE");
|
||||
}
|
||||
if (format.equals("Alliances")) {
|
||||
return Arrays.asList("ALL");
|
||||
}
|
||||
if (format.equals("Coldsnap")) {
|
||||
return Arrays.asList("CSP");
|
||||
}
|
||||
if (format.equals("* Mirage Block")) {
|
||||
return Arrays.asList("MIR", "VIS", "WTH");
|
||||
}
|
||||
if (format.equals("Mirage")) {
|
||||
return Arrays.asList("MIR");
|
||||
}
|
||||
if (format.equals("Visions")) {
|
||||
return Arrays.asList("VIS");
|
||||
}
|
||||
if (format.equals("Weatherlight")) {
|
||||
return Arrays.asList("WTH");
|
||||
}
|
||||
if (format.equals("* Tempest Block")) {
|
||||
return Arrays.asList("TMP", "STH", "EXO");
|
||||
}
|
||||
if (format.equals("Tempest")) {
|
||||
return Arrays.asList("TMP");
|
||||
}
|
||||
if (format.equals("Stronghold")) {
|
||||
return Arrays.asList("STH");
|
||||
}
|
||||
if (format.equals("Exodus")) {
|
||||
return Arrays.asList("EXO");
|
||||
}
|
||||
if (format.equals("* Urza Block")) {
|
||||
return Arrays.asList("USG", "ULG", "UDS");
|
||||
}
|
||||
if (format.equals("Urza's Saga")) {
|
||||
return Arrays.asList("USG");
|
||||
}
|
||||
if (format.equals("Urza's Legacy")) {
|
||||
return Arrays.asList("ULG");
|
||||
}
|
||||
if (format.equals("Urza's Destiny")) {
|
||||
return Arrays.asList("UDS");
|
||||
}
|
||||
if (format.equals("* Masquerade Block")) {
|
||||
return Arrays.asList("MMQ", "NMS", "PCY");
|
||||
}
|
||||
if (format.equals("Mercadian Masques")) {
|
||||
return Arrays.asList("MMQ");
|
||||
}
|
||||
if (format.equals("Nemesis")) {
|
||||
return Arrays.asList("NMS");
|
||||
}
|
||||
if (format.equals("Prophecy")) {
|
||||
return Arrays.asList("PCY");
|
||||
}
|
||||
if (format.equals("* Invasion Block")) {
|
||||
return Arrays.asList("INV", "PLS", "APC");
|
||||
}
|
||||
if (format.equals("Invasion")) {
|
||||
return Arrays.asList("INV");
|
||||
}
|
||||
if (format.equals("Planeshift")) {
|
||||
return Arrays.asList("PLS");
|
||||
}
|
||||
if (format.equals("Apocalypse")) {
|
||||
return Arrays.asList("APC");
|
||||
}
|
||||
if (format.equals("* Odyssey Block")) {
|
||||
return Arrays.asList("ODY", "TOR", "JUD");
|
||||
}
|
||||
if (format.equals("Odyssey")) {
|
||||
return Arrays.asList("ODY");
|
||||
}
|
||||
if (format.equals("Torment")) {
|
||||
return Arrays.asList("TOR");
|
||||
}
|
||||
if (format.equals("Judgment")) {
|
||||
return Arrays.asList("JUD");
|
||||
}
|
||||
if (format.equals("* Onslaught Block")) {
|
||||
return Arrays.asList("ONS", "LGN", "SCG");
|
||||
}
|
||||
if (format.equals("Onslaught")) {
|
||||
return Arrays.asList("ONS");
|
||||
}
|
||||
if (format.equals("Legions")) {
|
||||
return Arrays.asList("LGN");
|
||||
}
|
||||
if (format.equals("Scourge")) {
|
||||
return Arrays.asList("SCG");
|
||||
}
|
||||
if (format.equals("* Mirrodin Block")) {
|
||||
return Arrays.asList("MRD", "DST", "5DN");
|
||||
}
|
||||
if (format.equals("Mirrodin")) {
|
||||
return Arrays.asList("MRD");
|
||||
}
|
||||
if (format.equals("Darksteel")) {
|
||||
return Arrays.asList("DST");
|
||||
}
|
||||
if (format.equals("Fifth Dawn")) {
|
||||
return Arrays.asList("5DN");
|
||||
}
|
||||
if (format.equals("* Kamigawa Block")) {
|
||||
return Arrays.asList("CHK", "BOK", "SOK");
|
||||
}
|
||||
if (format.equals("Champions of Kamigawa")) {
|
||||
return Arrays.asList("CHK");
|
||||
}
|
||||
if (format.equals("Betrayers of Kamigawa")) {
|
||||
return Arrays.asList("BOK");
|
||||
}
|
||||
if (format.equals("Saviors of Kamigawa")) {
|
||||
return Arrays.asList("SOK");
|
||||
}
|
||||
if (format.equals("* Ravnica Block")) {
|
||||
return Arrays.asList("RAV", "GPT", "DIS");
|
||||
}
|
||||
if (format.equals("Ravnica: City of Guilds")) {
|
||||
return Arrays.asList("RAV");
|
||||
}
|
||||
if (format.equals("Guildpact")) {
|
||||
return Arrays.asList("GPT");
|
||||
}
|
||||
if (format.equals("Dissension")) {
|
||||
return Arrays.asList("DIS");
|
||||
}
|
||||
if (format.equals("* Time Spiral Block")) {
|
||||
return Arrays.asList("TSP", "TSB", "PLC", "FUT");
|
||||
}
|
||||
if (format.equals("Time Spiral")) {
|
||||
return Arrays.asList("TSP", "TSB");
|
||||
}
|
||||
if (format.equals("Planar Chaos")) {
|
||||
return Arrays.asList("PLC");
|
||||
}
|
||||
if (format.equals("Future Sight")) {
|
||||
return Arrays.asList("FUT");
|
||||
}
|
||||
if (format.equals("* Lorwyn Block")) {
|
||||
return Arrays.asList("LRW", "MOR");
|
||||
}
|
||||
if (format.equals("Lorwyn")) {
|
||||
return Arrays.asList("LRW");
|
||||
}
|
||||
if (format.equals("Morningtide")) {
|
||||
return Arrays.asList("MOR");
|
||||
}
|
||||
if (format.equals("* Shadowmoor Block")) {
|
||||
return Arrays.asList("SHM", "EVE");
|
||||
}
|
||||
if (format.equals("Shadowmoor")) {
|
||||
return Arrays.asList("SHM");
|
||||
}
|
||||
if (format.equals("Eventide")) {
|
||||
return Arrays.asList("EVE");
|
||||
}
|
||||
if (format.equals("* Shards of Alara Block")) {
|
||||
return Arrays.asList("ALA", "CON", "ARB");
|
||||
}
|
||||
if (format.equals("Alara Reborn")) {
|
||||
return Arrays.asList("ARB");
|
||||
}
|
||||
if (format.equals("Conflux")) {
|
||||
return Arrays.asList("CON");
|
||||
}
|
||||
if (format.equals("Shards of Alara")) {
|
||||
return Arrays.asList("ALA");
|
||||
}
|
||||
if (format.equals("* Zendikar Block")) {
|
||||
return Arrays.asList("ZEN", "WWK", "ROE");
|
||||
}
|
||||
if (format.equals("Zendikar")) {
|
||||
return Arrays.asList("ZEN");
|
||||
}
|
||||
if (format.equals("Worldwake")) {
|
||||
return Arrays.asList("WWK");
|
||||
}
|
||||
if (format.equals("Rise of the Eldrazi")) {
|
||||
return Arrays.asList("ROE");
|
||||
}
|
||||
if (format.equals("* Scars of Mirrodin Block")) {
|
||||
return Arrays.asList("SOM", "MBS", "NPH");
|
||||
}
|
||||
if (format.equals("Scars of Mirrodin")) {
|
||||
return Arrays.asList("SOM");
|
||||
}
|
||||
if (format.equals("Mirrodin Besieged")) {
|
||||
return Arrays.asList("MBS");
|
||||
}
|
||||
if (format.equals("New Phyrexia")) {
|
||||
return Arrays.asList("NPH");
|
||||
}
|
||||
if (format.equals("* Innistrad Block")) {
|
||||
return Arrays.asList("ISD", "DKA", "AVR");
|
||||
}
|
||||
if (format.equals("Innistrad")) {
|
||||
return Arrays.asList("ISD");
|
||||
}
|
||||
if (format.equals("Dark Ascension")) {
|
||||
return Arrays.asList("DKA");
|
||||
}
|
||||
if (format.equals("Avacyn Restored")) {
|
||||
return Arrays.asList("AVR");
|
||||
}
|
||||
if (format.equals("* Return to Ravnica Block")) {
|
||||
return Arrays.asList("RTR", "GTC", "DGM");
|
||||
}
|
||||
if (format.equals("Return to Ravnica")) {
|
||||
return Arrays.asList("RTR");
|
||||
}
|
||||
if (format.equals("Gatecrash")) {
|
||||
return Arrays.asList("GTC");
|
||||
}
|
||||
if (format.equals("Dragon's Maze")) {
|
||||
return Arrays.asList("DGM");
|
||||
}
|
||||
if (format.equals("Limited Edition Alpha")) {
|
||||
return Arrays.asList("LEA");
|
||||
}
|
||||
if (format.equals("Limited Edition Beta")) {
|
||||
return Arrays.asList("LEB");
|
||||
}
|
||||
if (format.equals("Unlimited Edition")) {
|
||||
return Arrays.asList("2ED");
|
||||
}
|
||||
if (format.equals("Revised Edition")) {
|
||||
return Arrays.asList("3ED");
|
||||
}
|
||||
if (format.equals("Fourth Edition")) {
|
||||
return Arrays.asList("4ED");
|
||||
}
|
||||
if (format.equals("Fifth Edition")) {
|
||||
return Arrays.asList("5ED");
|
||||
}
|
||||
if (format.equals("Sixth Edition")) {
|
||||
return Arrays.asList("6ED");
|
||||
}
|
||||
if (format.equals("Seventh Edition")) {
|
||||
return Arrays.asList("7ED");
|
||||
}
|
||||
if (format.equals("Eighth Edition")) {
|
||||
return Arrays.asList("8ED");
|
||||
}
|
||||
|
||||
if (format.equals("Ninth Edition")) {
|
||||
return Arrays.asList("9ED");
|
||||
}
|
||||
if (format.equals("Tenth Edition")) {
|
||||
return Arrays.asList("10E");
|
||||
}
|
||||
|
||||
if (format.equals("Magic 2010")) {
|
||||
return Arrays.asList("M10");
|
||||
}
|
||||
if (format.equals("Magic 2011")) {
|
||||
return Arrays.asList("M11");
|
||||
}
|
||||
if (format.equals("Magic 2012")) {
|
||||
return Arrays.asList("M12");
|
||||
}
|
||||
if (format.equals("Magic 2013")) {
|
||||
return Arrays.asList("M13");
|
||||
}
|
||||
if (format.equals("Magic 2014")) {
|
||||
return Arrays.asList("M14");
|
||||
}
|
||||
if (format.equals("Planechase")) {
|
||||
return Arrays.asList("HOP");
|
||||
}
|
||||
if (format.equals("Commander")) {
|
||||
return Arrays.asList("CMD");
|
||||
}
|
||||
if (format.equals("Commander 2013 Edition")) {
|
||||
return Arrays.asList("C13");
|
||||
}
|
||||
if (format.equals("Planechase 2012")) {
|
||||
return Arrays.asList("PC2");
|
||||
}
|
||||
if (format.equals("Modern Masters")) {
|
||||
return Arrays.asList("MMA");
|
||||
}
|
||||
if (format.equals("Guru")) {
|
||||
return Arrays.asList("GUR");
|
||||
}
|
||||
if (format.equals("Unhinged")) {
|
||||
return Arrays.asList("UNH");
|
||||
}
|
||||
if (format.equals("Portal")) {
|
||||
return Arrays.asList("POR");
|
||||
}
|
||||
if (format.equals("Portal Second Age")) {
|
||||
return Arrays.asList("PO2");
|
||||
}
|
||||
if (format.equals("Portal Three Kingdoms")) {
|
||||
return Arrays.asList("PTK");
|
||||
}
|
||||
if (format.equals("Duel Decks: Elves vs. Goblins")) {
|
||||
return Arrays.asList("EVG");
|
||||
}
|
||||
if (format.equals("Duel Decks: Jace vs. Chandra")) {
|
||||
return Arrays.asList("DD2");
|
||||
}
|
||||
if (format.equals("Duel Decks: Divine vs. Demonic")) {
|
||||
return Arrays.asList("DDC");
|
||||
}
|
||||
if (format.equals("Duel Decks: Garruk vs. Liliana")) {
|
||||
return Arrays.asList("DDD");
|
||||
}
|
||||
if (format.equals("Duel Decks: Elspeth vs. Tezzeret")) {
|
||||
return Arrays.asList("DDF");
|
||||
}
|
||||
if (format.equals("Duel Decks: Knights vs. Dragons")) {
|
||||
return Arrays.asList("DDG");
|
||||
}
|
||||
if (format.equals("Duel Decks: Ajani vs. Nicol Bolas")) {
|
||||
return Arrays.asList("DDH");
|
||||
}
|
||||
if (format.equals("Duel Decks: Venser vs. Koth")) {
|
||||
return Arrays.asList("DDI");
|
||||
}
|
||||
if (format.equals("Duel Decks: Heroes vs. Monsters")) {
|
||||
return Arrays.asList("DDL");
|
||||
}
|
||||
if (format.equals("Duel Decks: Jace vs. Vraska")) {
|
||||
return Arrays.asList("DDM");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (format.equals(STANDARD)) {
|
||||
return standard;
|
||||
}
|
||||
if (format.equals(EXTENDED)) {
|
||||
return extended;
|
||||
}
|
||||
if (format.equals(MODERN)) {
|
||||
return modern;
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
private static void buildLists() {
|
||||
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
|
||||
if (!set.getType().equals(SetType.REPRINT) && !set.getType().equals(SetType.JOKESET)) {
|
||||
if (set.getReleaseDate().after(standardDate)) {
|
||||
standard.add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(extendedDate)) {
|
||||
extended.add(set.getCode());
|
||||
}
|
||||
if (set.getReleaseDate().after(modernDate)) {
|
||||
modern.add(set.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> standard = new ArrayList<>();
|
||||
private static final Date standardDate = new GregorianCalendar(2012, 9, 28).getTime();
|
||||
|
||||
private static final List<String> extended = new ArrayList<>();
|
||||
private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime();
|
||||
|
||||
private static final List<String> 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<String> all = new ArrayList<>();
|
||||
|
||||
static {
|
||||
buildLists();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,132 +1,132 @@
|
|||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
||||
public class GathererSets implements Iterable<DownloadJob> {
|
||||
|
||||
private static final String SETS_PATH = File.separator + "sets";
|
||||
private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SETS_PATH);
|
||||
private static File outDir = DEFAULT_OUT_DIR;
|
||||
|
||||
private static final String[] symbols = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA",
|
||||
"HOP",
|
||||
"ARN", "ATQ", "LEG", "DRK", "FEM", "HML",
|
||||
"ICE", "ALL", "CSP",
|
||||
"MIR", "VIS", "WTH",
|
||||
"TMP", "STH", "EXO",
|
||||
"USG", "ULG", "UDS",
|
||||
"MMQ", "NMS", "PCY",
|
||||
"INV", "PLS", "APC",
|
||||
"ODY", "TOR", "JUD",
|
||||
"ONS", "LGN", "SCG",
|
||||
"MRD", "DST", "5DN",
|
||||
"CHK", "BOK", "SOK",
|
||||
"RAV", "GPT", "DIS",
|
||||
"TSP", "TSB", "PLC", "FUT",
|
||||
"LRW", "MOR",
|
||||
"SHM", "EVE",
|
||||
"PTK"};
|
||||
|
||||
private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14",
|
||||
"DDF", "DDL",
|
||||
"ALA", "CON", "ARB",
|
||||
"ZEN", "WWK", "ROE",
|
||||
"SOM", "MBS", "NPH",
|
||||
"CMD", "PC2",
|
||||
"ISD", "DKA", "AVR",
|
||||
"RTR", "GTC", "DGM",
|
||||
"MMA",
|
||||
"THS", "BNG", "JOU"};
|
||||
private static final HashMap<String, String> symbolsReplacements = new HashMap<>();
|
||||
|
||||
static {
|
||||
symbolsReplacements.put("ARN", "AN");
|
||||
symbolsReplacements.put("ATQ", "AQ");
|
||||
symbolsReplacements.put("LEG", "LE");
|
||||
symbolsReplacements.put("DRK", "DK");
|
||||
symbolsReplacements.put("FEM", "FE");
|
||||
symbolsReplacements.put("HML", "HM");
|
||||
symbolsReplacements.put("ICE", "IA");
|
||||
symbolsReplacements.put("ALL", "AL");
|
||||
symbolsReplacements.put("APC", "AP");
|
||||
symbolsReplacements.put("TMP", "TE");
|
||||
symbolsReplacements.put("INV", "IN");
|
||||
symbolsReplacements.put("PLS", "PS");
|
||||
symbolsReplacements.put("WTH", "WL");
|
||||
symbolsReplacements.put("ULG", "GU");
|
||||
symbolsReplacements.put("USG", "UZ");
|
||||
symbolsReplacements.put("UDS", "CG");
|
||||
symbolsReplacements.put("ODY", "OD");
|
||||
symbolsReplacements.put("MMQ", "MM");
|
||||
symbolsReplacements.put("NMS", "NE");
|
||||
symbolsReplacements.put("PCY", "PR");
|
||||
symbolsReplacements.put("STH", "ST");
|
||||
symbolsReplacements.put("EXO", "EX");
|
||||
symbolsReplacements.put("VIS", "VI");
|
||||
symbolsReplacements.put("MIR", "MI");
|
||||
symbolsReplacements.put("7ED", "7E");
|
||||
symbolsReplacements.put("6ED", "6E");
|
||||
symbolsReplacements.put("5ED", "5E");
|
||||
symbolsReplacements.put("4ED", "4E");
|
||||
symbolsReplacements.put("3ED", "3E");
|
||||
symbolsReplacements.put("2ED", "2U");
|
||||
symbolsReplacements.put("LEB", "2E");
|
||||
symbolsReplacements.put("LEA", "1E");
|
||||
}
|
||||
|
||||
public GathererSets(String path) {
|
||||
if (path == null) {
|
||||
useDefaultDir();
|
||||
} else {
|
||||
changeOutDir(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
for (String symbol : symbols) {
|
||||
jobs.add(generateDownloadJob(symbol, "C"));
|
||||
jobs.add(generateDownloadJob(symbol, "U"));
|
||||
jobs.add(generateDownloadJob(symbol, "R"));
|
||||
}
|
||||
for (String symbol : withMythics) {
|
||||
jobs.add(generateDownloadJob(symbol, "C"));
|
||||
jobs.add(generateDownloadJob(symbol, "U"));
|
||||
jobs.add(generateDownloadJob(symbol, "R"));
|
||||
jobs.add(generateDownloadJob(symbol, "M"));
|
||||
}
|
||||
return jobs.iterator();
|
||||
}
|
||||
|
||||
private DownloadJob generateDownloadJob(String set, String rarity) {
|
||||
File dst = new File(outDir, set + "-" + rarity + ".jpg");
|
||||
if (symbolsReplacements.containsKey(set)) {
|
||||
set = symbolsReplacements.get(set);
|
||||
}
|
||||
String url = "http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=small&rarity=" + rarity;
|
||||
return new DownloadJob(set + "-" + rarity, fromURL(url), toFile(dst));
|
||||
}
|
||||
|
||||
private void changeOutDir(String path) {
|
||||
File file = new File(path + SETS_PATH);
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
} else {
|
||||
file.mkdirs();
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefaultDir() {
|
||||
outDir = DEFAULT_OUT_DIR;
|
||||
}
|
||||
}
|
||||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
||||
public class GathererSets implements Iterable<DownloadJob> {
|
||||
|
||||
private static final String SETS_PATH = File.separator + "sets";
|
||||
private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SETS_PATH);
|
||||
private static File outDir = DEFAULT_OUT_DIR;
|
||||
|
||||
private static final String[] symbols = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA",
|
||||
"HOP",
|
||||
"ARN", "ATQ", "LEG", "DRK", "FEM", "HML",
|
||||
"ICE", "ALL", "CSP",
|
||||
"MIR", "VIS", "WTH",
|
||||
"TMP", "STH", "EXO",
|
||||
"USG", "ULG", "UDS",
|
||||
"MMQ", "NMS", "PCY",
|
||||
"INV", "PLS", "APC",
|
||||
"ODY", "TOR", "JUD",
|
||||
"ONS", "LGN", "SCG",
|
||||
"MRD", "DST", "5DN",
|
||||
"CHK", "BOK", "SOK",
|
||||
"RAV", "GPT", "DIS",
|
||||
"TSP", "TSB", "PLC", "FUT",
|
||||
"LRW", "MOR",
|
||||
"SHM", "EVE",
|
||||
"POR", "PO2", "PTK"};
|
||||
|
||||
private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14",
|
||||
"DDF", "DDL",
|
||||
"ALA", "CON", "ARB",
|
||||
"ZEN", "WWK", "ROE",
|
||||
"SOM", "MBS", "NPH",
|
||||
"CMD", "PC2",
|
||||
"ISD", "DKA", "AVR",
|
||||
"RTR", "GTC", "DGM",
|
||||
"MMA",
|
||||
"THS", "BNG", "JOU"};
|
||||
private static final HashMap<String, String> symbolsReplacements = new HashMap<>();
|
||||
|
||||
static {
|
||||
symbolsReplacements.put("ARN", "AN");
|
||||
symbolsReplacements.put("ATQ", "AQ");
|
||||
symbolsReplacements.put("LEG", "LE");
|
||||
symbolsReplacements.put("DRK", "DK");
|
||||
symbolsReplacements.put("FEM", "FE");
|
||||
symbolsReplacements.put("HML", "HM");
|
||||
symbolsReplacements.put("ICE", "IA");
|
||||
symbolsReplacements.put("ALL", "AL");
|
||||
symbolsReplacements.put("APC", "AP");
|
||||
symbolsReplacements.put("TMP", "TE");
|
||||
symbolsReplacements.put("INV", "IN");
|
||||
symbolsReplacements.put("PLS", "PS");
|
||||
symbolsReplacements.put("WTH", "WL");
|
||||
symbolsReplacements.put("ULG", "GU");
|
||||
symbolsReplacements.put("USG", "UZ");
|
||||
symbolsReplacements.put("UDS", "CG");
|
||||
symbolsReplacements.put("ODY", "OD");
|
||||
symbolsReplacements.put("MMQ", "MM");
|
||||
symbolsReplacements.put("NMS", "NE");
|
||||
symbolsReplacements.put("PCY", "PR");
|
||||
symbolsReplacements.put("STH", "ST");
|
||||
symbolsReplacements.put("EXO", "EX");
|
||||
symbolsReplacements.put("VIS", "VI");
|
||||
symbolsReplacements.put("MIR", "MI");
|
||||
symbolsReplacements.put("7ED", "7E");
|
||||
symbolsReplacements.put("6ED", "6E");
|
||||
symbolsReplacements.put("5ED", "5E");
|
||||
symbolsReplacements.put("4ED", "4E");
|
||||
symbolsReplacements.put("3ED", "3E");
|
||||
symbolsReplacements.put("2ED", "2U");
|
||||
symbolsReplacements.put("LEB", "2E");
|
||||
symbolsReplacements.put("LEA", "1E");
|
||||
}
|
||||
|
||||
public GathererSets(String path) {
|
||||
if (path == null) {
|
||||
useDefaultDir();
|
||||
} else {
|
||||
changeOutDir(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
for (String symbol : symbols) {
|
||||
jobs.add(generateDownloadJob(symbol, "C"));
|
||||
jobs.add(generateDownloadJob(symbol, "U"));
|
||||
jobs.add(generateDownloadJob(symbol, "R"));
|
||||
}
|
||||
for (String symbol : withMythics) {
|
||||
jobs.add(generateDownloadJob(symbol, "C"));
|
||||
jobs.add(generateDownloadJob(symbol, "U"));
|
||||
jobs.add(generateDownloadJob(symbol, "R"));
|
||||
jobs.add(generateDownloadJob(symbol, "M"));
|
||||
}
|
||||
return jobs.iterator();
|
||||
}
|
||||
|
||||
private DownloadJob generateDownloadJob(String set, String rarity) {
|
||||
File dst = new File(outDir, set + "-" + rarity + ".jpg");
|
||||
if (symbolsReplacements.containsKey(set)) {
|
||||
set = symbolsReplacements.get(set);
|
||||
}
|
||||
String url = "http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=small&rarity=" + rarity;
|
||||
return new DownloadJob(set + "-" + rarity, fromURL(url), toFile(dst));
|
||||
}
|
||||
|
||||
private void changeOutDir(String path) {
|
||||
File file = new File(path + SETS_PATH);
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
} else {
|
||||
file.mkdirs();
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefaultDir() {
|
||||
outDir = DEFAULT_OUT_DIR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
put("10E", "tenth-edition");
|
||||
put("CSP", "coldsnap");
|
||||
put("CHK", "player-rewards-2004");
|
||||
put("POR", "portal");
|
||||
put("PO2", "portal-second-age");
|
||||
put("PTK", "portal-three-kingdoms");
|
||||
put("M14", "magic-2014");
|
||||
put("M13", "magic-2013");
|
||||
|
|
62
Mage.Sets/src/mage/sets/Portal.java
Normal file
62
Mage.Sets/src/mage/sets/Portal.java
Normal file
|
@ -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 Plopman
|
||||
*/
|
||||
|
||||
public class Portal extends ExpansionSet {
|
||||
|
||||
private static final Portal fINSTANCE = new Portal();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Portal getInstance() {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
private Portal() {
|
||||
super("Portal", "POR", "mage.sets.portal", new GregorianCalendar(1997, 5, 1).getTime(), SetType.REPRINT);
|
||||
this.hasBasicLands = true;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 0;
|
||||
}
|
||||
}
|
62
Mage.Sets/src/mage/sets/PortalSecondAge.java
Normal file
62
Mage.Sets/src/mage/sets/PortalSecondAge.java
Normal file
|
@ -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 Plopman
|
||||
*/
|
||||
|
||||
public class PortalSecondAge extends ExpansionSet {
|
||||
|
||||
private static final PortalSecondAge fINSTANCE = new PortalSecondAge();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static PortalSecondAge getInstance() {
|
||||
return fINSTANCE;
|
||||
}
|
||||
|
||||
private PortalSecondAge() {
|
||||
super("Portal Second Age", "PO2", "mage.sets.portalsecondage", new GregorianCalendar(1998, 6, 24).getTime(), SetType.REPRINT);
|
||||
this.hasBasicLands = true;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 0;
|
||||
}
|
||||
}
|
|
@ -94,4 +94,6 @@ Modern Masters|modernmasters|
|
|||
Theros|theros|
|
||||
Born of the Gods|bornofthegods|
|
||||
Journey into Nyx|journeyintonyx|
|
||||
Portal|portal|
|
||||
Portal Second Age|portalsecondage|
|
||||
Portal Three Kingdoms|portalthreekingdoms
|
Loading…
Reference in a new issue