From b58b85dc0f01ab1ec91650d8d0517d5d7cad4907 Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Sat, 15 Mar 2025 12:13:13 -0700 Subject: [PATCH] Re-add old names for mana value property to oracle (#5711) --- 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 31cf0e9a5..360423394 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -206,8 +206,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 @@ -349,7 +350,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);