mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
Fixed mtgjson data;
This commit is contained in:
parent
1986b01bf6
commit
a4d797e473
3 changed files with 43 additions and 21 deletions
|
@ -34,6 +34,8 @@ class JsonCard {
|
||||||
public List<String> printings;
|
public List<String> printings;
|
||||||
public String power;
|
public String power;
|
||||||
public String rarity;
|
public String rarity;
|
||||||
|
public boolean starter;
|
||||||
|
public String side;
|
||||||
public List<JsonRuling> rulings;
|
public List<JsonRuling> rulings;
|
||||||
public List<String> subtypes;
|
public List<String> subtypes;
|
||||||
public List<String> supertypes;
|
public List<String> supertypes;
|
||||||
|
@ -44,8 +46,4 @@ class JsonCard {
|
||||||
public String uuid;
|
public String uuid;
|
||||||
public List<String> variations;
|
public List<String> variations;
|
||||||
public String watermark;
|
public String watermark;
|
||||||
|
|
||||||
// unknown
|
|
||||||
public boolean starter;
|
|
||||||
public String side;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,10 @@ import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
public final class MtgJson {
|
public final class MtgJson {
|
||||||
|
@ -60,16 +63,29 @@ public final class MtgJson {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
cards = loadAllCards();
|
cards = loadAllCards();
|
||||||
List<String> oldKeys = new ArrayList<>();
|
|
||||||
|
List<String> keysToDelete = new ArrayList<>();
|
||||||
|
|
||||||
|
// fix names
|
||||||
Map<String, JsonCard> newKeys = new HashMap<>();
|
Map<String, JsonCard> newKeys = new HashMap<>();
|
||||||
for (String key : cards.keySet()) {
|
for (String key : cards.keySet()) {
|
||||||
if (key.contains("(")) {
|
if (key.contains("(")) {
|
||||||
newKeys.put(key.replaceAll("\\(.*\\)", "").trim(), cards.get(key));
|
newKeys.put(key.replaceAll("\\(.*\\)", "").trim(), cards.get(key));
|
||||||
oldKeys.add(key);
|
keysToDelete.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cards.putAll(newKeys);
|
cards.putAll(newKeys);
|
||||||
cards.keySet().removeAll(oldKeys);
|
cards.keySet().removeAll(keysToDelete);
|
||||||
|
|
||||||
|
// remove wrong data (tokens)
|
||||||
|
keysToDelete.clear();
|
||||||
|
for (Map.Entry<String, JsonCard> record : cards.entrySet()) {
|
||||||
|
if (record.getValue().layout.equals("token") || record.getValue().layout.equals("double_faced_token")) {
|
||||||
|
keysToDelete.add(record.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cards.keySet().removeAll(keysToDelete);
|
||||||
|
|
||||||
addAliases(cards);
|
addAliases(cards);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
package mage.verify;
|
package mage.verify;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.NoSuchFileException;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.keyword.MultikickerAbility;
|
import mage.abilities.keyword.MultikickerAbility;
|
||||||
import mage.cards.*;
|
import mage.cards.*;
|
||||||
|
@ -29,6 +17,19 @@ import org.mage.plugins.card.images.CardDownloadData;
|
||||||
import org.mage.plugins.card.images.DownloadPictures;
|
import org.mage.plugins.card.images.DownloadPictures;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.NoSuchFileException;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author JayDi85
|
* @author JayDi85
|
||||||
*/
|
*/
|
||||||
|
@ -58,18 +59,25 @@ public class VerifyCardDataTest {
|
||||||
skipListCreate("PT");
|
skipListCreate("PT");
|
||||||
skipListAddName("PT", "UST", "Garbage Elemental");
|
skipListAddName("PT", "UST", "Garbage Elemental");
|
||||||
skipListAddName("PT", "UST", "Infinity Elemental");
|
skipListAddName("PT", "UST", "Infinity Elemental");
|
||||||
|
skipListAddName("PT", "UNH", "Old Fogey");
|
||||||
|
|
||||||
// color
|
// color
|
||||||
skipListCreate("COLOR");
|
skipListCreate("COLOR");
|
||||||
|
|
||||||
// cost
|
// cost
|
||||||
skipListCreate("COST");
|
skipListCreate("COST");
|
||||||
|
skipListAddName("COST", "KTK", "Erase");
|
||||||
|
skipListAddName("COST", "M13", "Erase");
|
||||||
|
skipListAddName("COST", "ULG", "Erase");
|
||||||
|
skipListAddName("COST", "H17", "Grimlock, Dinobot Leader");
|
||||||
|
|
||||||
// supertype
|
// supertype
|
||||||
skipListCreate("SUPERTYPE");
|
skipListCreate("SUPERTYPE");
|
||||||
|
|
||||||
// type
|
// type
|
||||||
skipListCreate("TYPE");
|
skipListCreate("TYPE");
|
||||||
|
skipListAddName("TYPE", "UNH", "Old Fogey");
|
||||||
|
skipListAddName("TYPE", "UST", "capital offense");
|
||||||
|
|
||||||
// subtype
|
// subtype
|
||||||
skipListCreate("SUBTYPE");
|
skipListCreate("SUBTYPE");
|
||||||
|
|
Loading…
Reference in a new issue