mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-23 15:13:55 -07:00
feat: set prioritization by set type (#5097)
* feat: prefer 'Core' and 'Expansion' sets for prioritization * rework set prioritization * clean up priority enum * formatting * revert changes to CockatriceXml3Parser * re-add missing null check * remove priority fallback ternary from CardSet model * make defaultSort logic easier to follow * revert changes to v3 card database xsd * remove unused invisible priority col from sets dialog * move draft innovation and duel deck sets to secondary prio * minor fixes * change PriorityFallback to 1 * make priority optional in xml * remove PriorityUndefined and set PriorityFallback to 0 * set priority when not found to PriorityOther in case a new set type is added it's unlikey we want it sorted first, it'll probably be a new product so it's probably best to sort it with the funny things * simplify sort function --------- Co-authored-by: tooomm <tooomm@users.noreply.github.com> Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
5156495b47
commit
b9ed9a6c0b
11 changed files with 128 additions and 36 deletions
|
|
@ -7,11 +7,36 @@
|
|||
#include <utility>
|
||||
|
||||
// many users prefer not to see these sets with non english arts
|
||||
// as a solution we remove the date property on these sets
|
||||
// that way they will be sorted last by default
|
||||
// this will cause their art to not get priority over english cards
|
||||
// users will still be able to find these sets and prioritize them manually
|
||||
// they will given priority PriorityLowest
|
||||
const QStringList nonEnglishSets = {"4BB", "FBB", "PS11", "PSAL", "REN", "RIN"};
|
||||
const QMap<QString, CardSet::Priority> setTypePriorities{
|
||||
{"core", CardSet::PriorityPrimary},
|
||||
{"expansion", CardSet::PriorityPrimary},
|
||||
|
||||
{"commander", CardSet::PrioritySecondary},
|
||||
{"starter", CardSet::PrioritySecondary},
|
||||
{"draft_innovation", CardSet::PrioritySecondary},
|
||||
{"duel_deck", CardSet::PrioritySecondary},
|
||||
|
||||
{"archenemy", CardSet::PriorityReprint},
|
||||
{"arsenal", CardSet::PriorityReprint},
|
||||
{"box", CardSet::PriorityReprint},
|
||||
{"from_the_vault", CardSet::PriorityReprint},
|
||||
{"masterpiece", CardSet::PriorityReprint},
|
||||
{"masters", CardSet::PriorityReprint},
|
||||
{"memorabilia", CardSet::PriorityReprint},
|
||||
{"planechase", CardSet::PriorityReprint},
|
||||
{"premium_deck", CardSet::PriorityReprint},
|
||||
{"promo", CardSet::PriorityReprint},
|
||||
{"spellbook", CardSet::PriorityReprint},
|
||||
{"token", CardSet::PriorityReprint},
|
||||
{"treasure_chest", CardSet::PriorityReprint},
|
||||
|
||||
{"alchemy", CardSet::PriorityOther},
|
||||
{"funny", CardSet::PriorityOther},
|
||||
{"minigame", CardSet::PriorityOther},
|
||||
{"vanguard", CardSet::PriorityOther},
|
||||
};
|
||||
|
||||
class SetToDownload
|
||||
{
|
||||
|
|
@ -20,6 +45,7 @@ private:
|
|||
QList<QVariant> cards;
|
||||
QDate releaseDate;
|
||||
QString setType;
|
||||
CardSet::Priority priority;
|
||||
|
||||
public:
|
||||
const QString &getShortName() const
|
||||
|
|
@ -42,13 +68,18 @@ public:
|
|||
{
|
||||
return releaseDate;
|
||||
}
|
||||
CardSet::Priority getPriority() const
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
SetToDownload(QString _shortName,
|
||||
QString _longName,
|
||||
QList<QVariant> _cards,
|
||||
CardSet::Priority _priority,
|
||||
QString _setType = QString(),
|
||||
const QDate &_releaseDate = QDate())
|
||||
: shortName(std::move(_shortName)), longName(std::move(_longName)), cards(std::move(_cards)),
|
||||
releaseDate(_releaseDate), setType(std::move(_setType))
|
||||
releaseDate(_releaseDate), setType(std::move(_setType)), priority(_priority)
|
||||
{
|
||||
}
|
||||
bool operator<(const SetToDownload &set) const
|
||||
|
|
@ -108,6 +139,7 @@ signals:
|
|||
|
||||
public:
|
||||
explicit OracleImporter(const QString &_dataDir, QObject *parent = nullptr);
|
||||
CardSet::Priority getSetPriority(QString &setType, QString &shortName);
|
||||
bool readSetsFromByteArray(const QByteArray &data);
|
||||
int startImport();
|
||||
bool saveToFile(const QString &fileName, const QString &sourceUrl, const QString &sourceVersion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue