-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoraclecard.cpp
86 lines (75 loc) · 3.47 KB
/
oraclecard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "oraclecard.h"
#include <QDir>
QString OracleCard::sImagePath = "/tmp/";
QString OracleSet::sImagePath = "/tmp/";
QString OracleCard::getImagePath() const
{
if(mySet)
{
QDir path(QString("%1/%2").arg(sImagePath).arg(mySet->sSetCode));
path.mkpath(".");
return QString("%3/%1/%2.jpg").arg(mySet->sSetCode).arg(sSequenceNumber).arg(sImagePath);
}
else
{
return "";
}
}
QString OracleCard::getImageURL() const
{
return QString("https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=%1&type=card").arg(iMultiverseID);
}
QString OracleSet::getLogoPath(char cRarity) const
{
QDir path(QString("%1/%2").arg(sImagePath).arg(sSetCode));
path.mkpath(".");
return QString("%3/%1/%2.jpg").arg(sSetCode).arg(cRarity).arg(sImagePath); //path makes sense because it will also have all the card images in that folder, not just the few rarities
}
//QString OracleSet::getLogoURL(char cRarity) const
//{
// return QString("http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=%1&size=large&rarity=%2").arg(sGSID).arg(cRarity);
//}
QString OracleCard::PucaHeader("Count,Name,Expansion,Condition,Language\n");
QString OracleCard::pucaInventoryLine(bool Foil) const
{
QString sInventory("1,\"%1\",\"%2\",Near Mint,English,%3\n");
sInventory = sInventory.arg(sNameEn).arg(mySet->sMySet);
sInventory = sInventory.arg(Foil ? "Foil" : "");
return sInventory;
}
QString OracleCard::DeckBoxHeader("Count,Tradelist Count,Name,Edition,Card Number,Condition,Language,Foil,Signed,Artist Proof,Altered Art,Misprint,Promo,Textless,My Price,\n");
QString OracleCard::deckBoxInventoryLine(bool Foil) const
{
QString sInventory("1,0,%1,%2,%3,Near Mint,English,%4,,,,,,,,\n");
QString sName = sNameEn;
if(sName.at(0) != '\"') //only if it doesn't start with a " already
sName = sName.replace(QRegExp("\""), "\"\""); //some names include " in them, deckbox wants those replaced with a pair of ""
//sName = sName.replace(QRegExp("[\?\!]"), "");
if(sName == "Kill! Destroy!")
sName = "Kill Destroy"; //deckbox stripped the ! from this name, but not others
if(sName.at(0) != '\"') //only if it doesn't start with a " already
sName = QString("\"") + sName + "\"";
QString sSetLocal = this->mySet->sMySet;
if(sSetLocal == QString("Planechase 2012 Edition"))
sSetLocal = "Planechase 2012";
if(sSetLocal == QString("Magic: The Gathering-Commander"))
sSetLocal = "Commander";
if(sSetLocal == QString("Commander 2013 Edition"))
sSetLocal = "Commander 2013";
if(sSetLocal == QString("Magic: The Gathering—Conspiracy"))
sSetLocal = "Conspiracy";
if(sSetLocal == QString("Modern Masters Edition"))
sSetLocal = "Modern Masters";
if(sSetLocal.contains("Masterpiece Series"))
sSetLocal = sSetLocal.replace("Masterpiece Series: ", "");
sSetLocal == sSetLocal.replace(QRegExp(" \\([0-9][0-9][0-9][0-9]\\)"), "");
if(sSetLocal.at(0) != '\"') //only if it doesn't start with a " already
sSetLocal = sSetLocal.replace(QRegExp("\""), "\"\""); //some names include " in them, deckbox wants those replaced with a pair of ""
sSetLocal = QString("\"") + sSetLocal + "\"";
sInventory = sInventory.arg(sName).arg(sSetLocal).arg(this->sSequenceNumber).arg(Foil ? "Foil" : ""); //arg 4 is Foil or blank
return sInventory;
}
bool OracleCard::operator==(const OracleCard& rhs) const
{
return this->iMultiverseID == rhs.iMultiverseID;
}