mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Merge pull request #634 from Cockatrice/oracle-cmc
Parse cmc from json and store in cards.xml
This commit is contained in:
commit
dd426cbac9
4 changed files with 18 additions and 5 deletions
|
|
@ -365,6 +365,7 @@ CardInfo::CardInfo(CardDatabase *_db,
|
|||
const QString &_name,
|
||||
bool _isToken,
|
||||
const QString &_manacost,
|
||||
const QString &_cmc,
|
||||
const QString &_cardtype,
|
||||
const QString &_powtough,
|
||||
const QString &_text,
|
||||
|
|
@ -381,6 +382,7 @@ CardInfo::CardInfo(CardDatabase *_db,
|
|||
isToken(_isToken),
|
||||
sets(_sets),
|
||||
manacost(_manacost),
|
||||
cmc(_cmc),
|
||||
cardtype(_cardtype),
|
||||
powtough(_powtough),
|
||||
text(_text),
|
||||
|
|
@ -571,6 +573,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
|
|||
xml.writeTextElement("color", colors[i]);
|
||||
|
||||
xml.writeTextElement("manacost", info->getManaCost());
|
||||
xml.writeTextElement("cmc", info->getCmc());
|
||||
xml.writeTextElement("type", info->getCardType());
|
||||
if (!info->getPowTough().isEmpty())
|
||||
xml.writeTextElement("pt", info->getPowTough());
|
||||
|
|
@ -731,7 +734,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
|||
if (xml.readNext() == QXmlStreamReader::EndElement)
|
||||
break;
|
||||
if (xml.name() == "card") {
|
||||
QString name, manacost, type, pt, text;
|
||||
QString name, manacost, cmc, type, pt, text;
|
||||
QStringList colors;
|
||||
QStringMap customPicURLs, customPicURLsHq;
|
||||
MuidMap muids;
|
||||
|
|
@ -747,6 +750,8 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
|||
name = xml.readElementText();
|
||||
else if (xml.name() == "manacost")
|
||||
manacost = xml.readElementText();
|
||||
else if (xml.name() == "cmc")
|
||||
cmc = xml.readElementText().toInt();
|
||||
else if (xml.name() == "type")
|
||||
type = xml.readElementText();
|
||||
else if (xml.name() == "pt")
|
||||
|
|
@ -779,7 +784,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
|
|||
}
|
||||
|
||||
if (isToken == tokens) {
|
||||
addCard(new CardInfo(this, name, isToken, manacost, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
|
||||
addCard(new CardInfo(this, name, isToken, manacost, cmc, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ private:
|
|||
bool isToken;
|
||||
SetList sets;
|
||||
QString manacost;
|
||||
QString cmc;
|
||||
QString cardtype;
|
||||
QString powtough;
|
||||
QString text;
|
||||
|
|
@ -126,6 +127,7 @@ public:
|
|||
const QString &_name = QString(),
|
||||
bool _isToken = false,
|
||||
const QString &_manacost = QString(),
|
||||
const QString &_cmc = QString(),
|
||||
const QString &_cardtype = QString(),
|
||||
const QString &_powtough = QString(),
|
||||
const QString &_text = QString(),
|
||||
|
|
@ -142,12 +144,14 @@ public:
|
|||
bool getIsToken() const { return isToken; }
|
||||
const SetList &getSets() const { return sets; }
|
||||
const QString &getManaCost() const { return manacost; }
|
||||
const QString &getCmc() const { return cmc; }
|
||||
const QString &getCardType() const { return cardtype; }
|
||||
const QString &getPowTough() const { return powtough; }
|
||||
const QString &getText() const { return text; }
|
||||
const int &getLoyalty() const { return loyalty; }
|
||||
bool getCipt() const { return cipt; }
|
||||
void setManaCost(const QString &_manaCost) { manacost = _manaCost; emit cardInfoChanged(this); }
|
||||
void setCmc(const QString &_cmc) { cmc = _cmc; emit cardInfoChanged(this); }
|
||||
void setCardType(const QString &_cardType) { cardtype = _cardType; emit cardInfoChanged(this); }
|
||||
void setPowTough(const QString &_powTough) { powtough = _powTough; emit cardInfoChanged(this); }
|
||||
void setText(const QString &_text) { text = _text; emit cardInfoChanged(this); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue