From 41a2573319315275c391c287b8645ca89ce39acc Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 7 Dec 2018 02:55:27 +0400 Subject: [PATCH] Fixed wrong MtgJsonV4 data format (#5415); --- .../src/main/java/mage/verify/Booster.java | 8 -- .../src/main/java/mage/verify/JsonCard.java | 82 ++++++++----------- ...{ForeignData.java => JsonForeignData.java} | 14 ++-- .../{Legality.java => JsonLegalities.java} | 14 ++-- .../mage/verify/{Meta.java => JsonMeta.java} | 2 +- .../verify/{Ruling.java => JsonRuling.java} | 4 +- .../src/main/java/mage/verify/JsonSet.java | 40 +++------ .../verify/{Token.java => JsonToken.java} | 7 +- 8 files changed, 69 insertions(+), 102 deletions(-) delete mode 100644 Mage.Verify/src/main/java/mage/verify/Booster.java rename Mage.Verify/src/main/java/mage/verify/{ForeignData.java => JsonForeignData.java} (71%) rename Mage.Verify/src/main/java/mage/verify/{Legality.java => JsonLegalities.java} (58%) rename Mage.Verify/src/main/java/mage/verify/{Meta.java => JsonMeta.java} (75%) rename Mage.Verify/src/main/java/mage/verify/{Ruling.java => JsonRuling.java} (73%) rename Mage.Verify/src/main/java/mage/verify/{Token.java => JsonToken.java} (78%) diff --git a/Mage.Verify/src/main/java/mage/verify/Booster.java b/Mage.Verify/src/main/java/mage/verify/Booster.java deleted file mode 100644 index 161dcfff1d..0000000000 --- a/Mage.Verify/src/main/java/mage/verify/Booster.java +++ /dev/null @@ -1,8 +0,0 @@ -package mage.verify; - -public class Booster { - - public Booster(String mythic){ - - } -} diff --git a/Mage.Verify/src/main/java/mage/verify/JsonCard.java b/Mage.Verify/src/main/java/mage/verify/JsonCard.java index ef857d8d75..8a7d1b6916 100644 --- a/Mage.Verify/src/main/java/mage/verify/JsonCard.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonCard.java @@ -3,59 +3,49 @@ package mage.verify; import java.util.List; class JsonCard { + // docs: https://mtgjson.com/v4/docs.html - public String uuid; - public String convertedManaCost; - public List foreignData; - public boolean isReserved; - public String side; - public Legality legalities; - public List printings; - public List rulings; + public String artist; + public String borderColor; + public List colorIdentity; public List colorIndicator; - public String layout; - public String name; - public List names; // flip cards - public String manaCost; + public List colors; + public float convertedManaCost; + public float faceConvertedManaCost; + public String flavorText; + public List foreignData; + public String frameVersion; public boolean hasFoil; public boolean hasNonFoil; - public String multiverseId; - public String frameVersion; - public int cmc; - public List colors; - public List colorIdentity; - public String type; - public List supertypes; - public List types; - public List subtypes; - public String text; - public String power; - public String toughness; + public boolean isOnlineOnly; + public boolean isOversized; + public boolean isReserved; + public boolean isTimeshifted; + public String layout; + public JsonLegalities legalities; public String loyalty; - public String imageName; - public boolean starter; // only available in boxed sets and not in boosters - public int hand; // vanguard - public int life; // vanguard + public String manaCost; + public int multiverseId; + public String name; + public List names; + public String number; public String originalText; public String originalType; - public String flavorText; - public boolean isOnlineOnly; - - // only available in AllSets.json - public String artist; - public String flavor; - public String id; - public int multiverseid; + public List printings; + public String power; public String rarity; - public boolean reserved; - public int[] variations; - public String number; - public String mciNumber; - public String releaseDate; // promos - public String border; + public List rulings; + public List subtypes; + public List supertypes; + public String text; + public String toughness; + public String type; + public List types; + public String uuid; + public List variations; public String watermark; - public boolean timeshifted; - public String borderColor; - public boolean isOversized; - public String faceConvertedManaCost; + + // unknown + public boolean starter; + public String side; } diff --git a/Mage.Verify/src/main/java/mage/verify/ForeignData.java b/Mage.Verify/src/main/java/mage/verify/JsonForeignData.java similarity index 71% rename from Mage.Verify/src/main/java/mage/verify/ForeignData.java rename to Mage.Verify/src/main/java/mage/verify/JsonForeignData.java index e410fb24d7..c6ca9353e4 100644 --- a/Mage.Verify/src/main/java/mage/verify/ForeignData.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonForeignData.java @@ -1,12 +1,10 @@ package mage.verify; -public class ForeignData { - - - public String language; - public String name; - public String type; - public String text; +public class JsonForeignData { public String flavorText; - public String multiverseId; + public String language; + public int multiverseId; + public String name; + public String text; + public String type; } diff --git a/Mage.Verify/src/main/java/mage/verify/Legality.java b/Mage.Verify/src/main/java/mage/verify/JsonLegalities.java similarity index 58% rename from Mage.Verify/src/main/java/mage/verify/Legality.java rename to Mage.Verify/src/main/java/mage/verify/JsonLegalities.java index 925bc2189e..064838754e 100644 --- a/Mage.Verify/src/main/java/mage/verify/Legality.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonLegalities.java @@ -2,18 +2,18 @@ package mage.verify; import com.fasterxml.jackson.annotation.JsonProperty; -public class Legality { +public class JsonLegalities { @JsonProperty("1v1") public String oneVersusOne; + public String brawl; public String commander; public String duel; + public String frontier; + public String future; public String legacy; + public String modern; public String penny; + public String pauper; + public String standard; public String vintage; -public String frontier; -public String modern; -public String pauper; -public String brawl; -public String future; -public String standard; } diff --git a/Mage.Verify/src/main/java/mage/verify/Meta.java b/Mage.Verify/src/main/java/mage/verify/JsonMeta.java similarity index 75% rename from Mage.Verify/src/main/java/mage/verify/Meta.java rename to Mage.Verify/src/main/java/mage/verify/JsonMeta.java index 4a93171da0..4d68703479 100644 --- a/Mage.Verify/src/main/java/mage/verify/Meta.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonMeta.java @@ -1,6 +1,6 @@ package mage.verify; -public class Meta { +public class JsonMeta { public String date; public String version; } diff --git a/Mage.Verify/src/main/java/mage/verify/Ruling.java b/Mage.Verify/src/main/java/mage/verify/JsonRuling.java similarity index 73% rename from Mage.Verify/src/main/java/mage/verify/Ruling.java rename to Mage.Verify/src/main/java/mage/verify/JsonRuling.java index 5bcb036329..1576700d58 100644 --- a/Mage.Verify/src/main/java/mage/verify/Ruling.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonRuling.java @@ -1,6 +1,6 @@ package mage.verify; -public class Ruling { - public String text; +public class JsonRuling { public String date; + public String text; } diff --git a/Mage.Verify/src/main/java/mage/verify/JsonSet.java b/Mage.Verify/src/main/java/mage/verify/JsonSet.java index 466ebbfb63..95bbbfdd5e 100644 --- a/Mage.Verify/src/main/java/mage/verify/JsonSet.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonSet.java @@ -1,36 +1,20 @@ package mage.verify; -import com.fasterxml.jackson.annotation.JsonIgnore; - import java.util.List; -import java.util.Map; class JsonSet { - public String name; - public String code; - public String oldCode; - public String gathererCode; - public String magicCardsInfoCode; - public String[] magicRaritiesCodes; - public String[] alternativeNames; - public String releaseDate; - public String border; - public String type; - public List booster; // [String|[String]] - public List cards; - public String block; - public boolean onlineOnly; - public String mkm_id; - public String mkm_name; - public Map translations; public int baseSetSize; - @JsonIgnore - public List boosterV3; - public String borderColor; - public Meta meta; - public String mtgoCode; - public List tokens; - public int totalSetSize; - public boolean isOnlineOnly; + public String block; + public List boosterV3; // [["rare", "mythic rare"], "uncommon", "uncommon", "uncommon", "common"] + public List cards; + public String code; public boolean isFoilOnly; + public boolean isOnlineOnly; + public JsonMeta meta; + public String mtgoCode; + public String name; + public String releaseDate; + public List tokens; + public int totalSetSize; + public String type; } diff --git a/Mage.Verify/src/main/java/mage/verify/Token.java b/Mage.Verify/src/main/java/mage/verify/JsonToken.java similarity index 78% rename from Mage.Verify/src/main/java/mage/verify/Token.java rename to Mage.Verify/src/main/java/mage/verify/JsonToken.java index c99ed0abc2..98f3881635 100644 --- a/Mage.Verify/src/main/java/mage/verify/Token.java +++ b/Mage.Verify/src/main/java/mage/verify/JsonToken.java @@ -2,17 +2,20 @@ package mage.verify; import java.util.List; -public class Token { +public class JsonToken { public String artist; public String borderColor; public List colorIdentity; + public List colorIndicator; public List colors; + public String loyalty; public String name; public String number; public String power; - public String toughness; public List reverseRelated; + public String side; public String text; + public String toughness; public String type; public String uuid; public String watermark;