mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Import Moxfield signature spells into the deck [skip ci] (#7751)
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
ada8f399f1
commit
dc4aa19d23
5 changed files with 148 additions and 2 deletions
|
|
@ -54,7 +54,11 @@ public:
|
|||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
outStream.flush();
|
||||
outStream.seek(0);
|
||||
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
|
|
@ -100,7 +104,11 @@ public:
|
|||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
outStream.flush();
|
||||
outStream.seek(0);
|
||||
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||
deckList.setName(deckName);
|
||||
deckList.setComments(deckDescription);
|
||||
|
|
@ -119,6 +127,24 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Moxfield stores Oathbreaker signature spells in their own board,
|
||||
// separate from both mainboard and commanders. They are playable deck
|
||||
// cards, but must not replace the Oathbreaker as the banner card.
|
||||
const QJsonObject signatureSpells = obj.value("signatureSpells").toObject();
|
||||
for (auto it = signatureSpells.begin(); it != signatureSpells.end(); ++it) {
|
||||
const QJsonObject entry = it.value().toObject();
|
||||
const QJsonObject card = entry.value("card").toObject();
|
||||
const QString name = card.value("name").toString();
|
||||
const int quantity = entry.value("quantity").toInt();
|
||||
if (name.isEmpty() || quantity <= 0) {
|
||||
continue;
|
||||
}
|
||||
const QString set = card.value("set").toString().toUpper();
|
||||
const QString collectorNumber = card.value("cn").toString();
|
||||
const QString providerId = card.value("scryfall_id").toString();
|
||||
deckList.addCards(name, quantity, DECK_ZONE_MAIN, -1, set, collectorNumber, providerId);
|
||||
}
|
||||
|
||||
return deckList;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue