Add native Essence card database properties with legacy XML fallback

This commit is contained in:
Christian Daniel Jensen 2026-11-02 05:49:22 -07:00
parent 02c8f33d18
commit bba44e4b97

View file

@ -16,6 +16,14 @@
* Note: Mtg = "Maybe that game" * Note: Mtg = "Maybe that game"
*/ */
// These remain only for reading older Cockatrice XML. New cards use Essence.
namespace EssenceProperties
{
inline const QString Cost = QStringLiteral("essencecost");
inline const QString Types = QStringLiteral("essence");
inline const QString Value = QStringLiteral("essencevalue");
}
namespace Mtg namespace Mtg
{ {
QString const CardType("type"); QString const CardType("type");
@ -31,24 +39,24 @@ QString const ColorIdentity("coloridentity");
inline static const QString getNicePropertyName(QString key) inline static const QString getNicePropertyName(QString key)
{ {
if (key == EssenceProperties::Cost || key == ManaCost) {
return QCoreApplication::translate("Essence", "Essence Cost");
}
if (key == EssenceProperties::Types || key == Colors || key == ColorIdentity) {
return QCoreApplication::translate("Essence", "Essence");
}
if (key == EssenceProperties::Value || key == ConvertedManaCost) {
return QCoreApplication::translate("Essence", "Essence Value");
}
if (key == CardType) { if (key == CardType) {
return QCoreApplication::translate("Mtg", "Card Type"); return QCoreApplication::translate("Mtg", "Card Type");
} }
if (key == ConvertedManaCost) {
return QCoreApplication::translate("Mtg", "Mana Value");
}
if (key == Colors) {
return QCoreApplication::translate("Mtg", "Color(s)");
}
if (key == Loyalty) { if (key == Loyalty) {
return QCoreApplication::translate("Mtg", "Loyalty"); return QCoreApplication::translate("Mtg", "Loyalty");
} }
if (key == MainCardType) { if (key == MainCardType) {
return QCoreApplication::translate("Mtg", "Main Card Type"); return QCoreApplication::translate("Mtg", "Main Card Type");
} }
if (key == ManaCost) {
return QCoreApplication::translate("Mtg", "Mana Cost");
}
if (key == PowTough) { if (key == PowTough) {
return QCoreApplication::translate("Mtg", "P/T"); return QCoreApplication::translate("Mtg", "P/T");
} }
@ -58,9 +66,6 @@ inline static const QString getNicePropertyName(QString key)
if (key == Layout) { if (key == Layout) {
return QCoreApplication::translate("Mtg", "Layout"); return QCoreApplication::translate("Mtg", "Layout");
} }
if (key == ColorIdentity) {
return QCoreApplication::translate("Mtg", "Color Identity");
}
return key; return key;
} }
} // namespace Mtg } // namespace Mtg