Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
oracleimporter.cpp File Reference
#include "oracleimporter.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/format/format_legality_rules.h"
#include "libcockatrice/card/lazy_properties_hash.h"
#include "libcockatrice/card/relation/card_relation_type.h"
#include "libcockatrice/interfaces/noop_card_set_priority_controller.h"
#include "parsehelpers.h"
#include <QChar>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValue>
#include <QJsonValueConstRef>
#include <QJsonValueRef>
#include <QPair>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QSet>
#include <QSharedPointer>
#include <QVariant>
#include <QtGlobal>
#include <algorithm>
#include <climits>
#include <libcockatrice/card/card_localization.h>
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
#include <libcockatrice/card/relation/card_relation.h>
#include <qlogging.h>
Include dependency graph for oracleimporter.cpp:

Functions

static QString mtgjsonLanguageToCode (const QString &language)
 Maps the MTGJSON foreignData language names to the short codes used by Scryfall and stored in cards.xml (e.g. "German" -> "de").
static CardSet::Priority getSetPriority (const QString &setType, const QString &shortName)
static int mainCardTypePriority (const QString &mainCardType)
static QString getMainCardType (const QStringList &typeList)
static void sortAndReduceColors (QString &colors)
static QString getJsonString (const QJsonObject &obj, const QString &key)
static QString normalizeCardName (QString name)
static QString matchingForeignEntryText (const QJsonObject &card, const QString &cardLang)
static FormatRulesNameMap buildDefaultMagicFormats ()

Variables

static const QList< AllowedCount > kConstructedCounts = {{4, "legal"}, {0, "banned"}}
static const QList< AllowedCount > kSingletonCounts = {{1, "legal"}, {0, "banned"}}
static const QStringList MAIN_CARD_TYPE_PRIORITY

Function Documentation

◆ buildDefaultMagicFormats()

FormatRulesNameMap buildDefaultMagicFormats ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJsonString()

QString getJsonString ( const QJsonObject & obj,
const QString & key )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMainCardType()

QString getMainCardType ( const QStringList & typeList)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSetPriority()

CardSet::Priority getSetPriority ( const QString & setType,
const QString & shortName )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mainCardTypePriority()

int mainCardTypePriority ( const QString & mainCardType)
static

Returns the priority (index) of the given main card type. Known types map to their position in mainCardTypePriority(), unknown types map to -1 (lowest priority).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ matchingForeignEntryText()

QString matchingForeignEntryText ( const QJsonObject & card,
const QString & cardLang )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtgjsonLanguageToCode()

QString mtgjsonLanguageToCode ( const QString & language)
static

Maps the MTGJSON foreignData language names to the short codes used by Scryfall and stored in cards.xml (e.g. "German" -> "de").

Parameters
languageThe language name found in the MTGJSON foreignData entries.
Returns
The short language code, or an empty string if unknown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeCardName()

QString normalizeCardName ( QString name)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortAndReduceColors()

void sortAndReduceColors ( QString & colors)
static

Sorts and deduplicates the color chars in the string by WUBRG order.

Parameters
colorsThe string containing the color chars. Will be modified in-place
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kConstructedCounts

const QList<AllowedCount> kConstructedCounts = {{4, "legal"}, {0, "banned"}}
static

◆ kSingletonCounts

const QList<AllowedCount> kSingletonCounts = {{1, "legal"}, {0, "banned"}}
static

◆ MAIN_CARD_TYPE_PRIORITY

const QStringList MAIN_CARD_TYPE_PRIORITY
static
Initial value:
= {"Planeswalker", "Creature", "Land", "Sorcery",
"Instant", "Artifact", "Enchantment"}

The priority order used to pick a card's main type when a card has multiple types (e.g. "Artifact Creature") or multiple faces (e.g. split/adventure cards). A lower index means a higher priority.