From b3626634e46939decbf4fedde2f27f8f58abe345 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Tue, 11 Mar 2025 19:32:23 -0700 Subject: [PATCH] Re-add old names for mana value property to oracle --- oracle/src/oracleimporter.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index 07aad804d..08108addf 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -207,8 +207,9 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList { // mtgjson name => xml name static const QMap cardProperties{ - {"manaCost", "manacost"}, {"manaValue", "cmc"}, {"type", "type"}, - {"loyalty", "loyalty"}, {"layout", "layout"}, {"side", "side"}, + {"manaCost", "manacost"}, {"manaValue", "cmc"}, {"type", "type"}, + {"loyalty", "loyalty"}, {"layout", "layout"}, {"side", "side"}, + {"convertedManaCost", "cmc"}, // old name for manaValue, for backwards compatibility }; // mtgjson name => xml name @@ -350,7 +351,13 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList // add other face for split cards as card relation if (!getStringPropertyFromMap(card, "side").isEmpty()) { - properties["cmc"] = getStringPropertyFromMap(card, "faceManaValue"); + auto faceManaValue = getStringPropertyFromMap(card, "faceManaValue"); + if (faceManaValue.isEmpty()) { + // check the old name for the property, for backwards compatibility purposes + faceManaValue = getStringPropertyFromMap(card, "faceConvertedManaCost"); + } + properties["cmc"] = faceManaValue; + if (layout == "meld") { // meld cards don't work static const QRegularExpression meldNameRegex{"then meld them into ([^\\.]*)"}; QString additionalName = meldNameRegex.match(text).captured(1);