Filter Strings for Deck Editor search (#3582)

* Add MagicCards.info like fitler parser.

* Use FilterString whenever one of [:=<>] is in the edit box.

* Opts

* Opt

* - Capture errors
- Allow querying any property by full name

* clang format

* Update cockatrice/src/filter_string.cpp

Co-Authored-By: basicer <basicer@basicer.com>

* - Some refactoring for clarity
- More filters
- Add filter help

* Clangify

* Add icon

* Fix test name

* Remove stay debug

* - Add Rarity filter
- Make " trigger filter string mode

* You have to pass both filter types

* clangify

* - Allow filtering by legality
- Import legality into card.xml

* Add format filter to filtertree

* More color search options

* RIP extended

* More fixes

* Fix c:m

* set syntax help parent

* Fix warning

* add additional explanations to syntax help

* Allow multiple ands/ors to be chained

* Cleanup and refactor

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Move utility into guards

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* I heard you like refactors so I put a refactor inside your refactor (#3594)

* I heard you like refactors so I put a refactor inside your refactor

so you can refactor while you refactor

* clangify

* Update tab_deck_editor.h
This commit is contained in:
Rob Blanckaert 2019-03-01 11:30:32 -08:00 committed by Zach H
parent 4427ad1451
commit eb60fec8e2
24 changed files with 780 additions and 122 deletions

View file

@ -98,6 +98,11 @@ CardInfoPtr OracleImporter::addCard(QString name,
sortAndReduceColors(allColors);
properties.insert("colors", allColors);
}
QString allColorIdent = properties.value("colorIdenity").toString();
if (allColorIdent.size() > 1) {
sortAndReduceColors(allColorIdent);
properties.insert("coloridentity", allColorIdent);
}
// DETECT CARD POSITIONING INFO
@ -178,7 +183,7 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
QMap<QString, SplitCardPart> splitCards;
QString ptSeparator("/");
QVariantMap card;
QString layout, name, text, colors, maintype, power, toughness;
QString layout, name, text, colors, colorIdentity, maintype, power, toughness;
bool isToken;
QStringList additionalNames;
QVariantHash properties;
@ -232,6 +237,11 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
if (!colors.isEmpty())
properties.insert("colors", colors);
// special handling properties
colorIdentity = card.value("colorIdentity").toStringList().join("");
if (!colorIdentity.isEmpty())
properties.insert("coloridentity", colorIdentity);
maintype = card.value("types").toStringList().first();
if (!maintype.isEmpty())
properties.insert("maintype", maintype);
@ -242,6 +252,12 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
properties.insert("pt", power + ptSeparator + toughness);
additionalNames = card.value("names").toStringList();
auto legalities = card.value("legalities").toMap();
for (const QString &fmtName : legalities.keys()) {
properties.insert(QString("format-%1").arg(fmtName), legalities.value(fmtName).toString().toLower());
}
// split cards are considered a single card, enqueue for later merging
if (layout == "split") {
// get the position of this card part