Change default priority to low, add crayons, general refactoring

master
trémeur 3 weeks ago
parent df32c9558e
commit 45e1425e01

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

@ -122,3 +122,11 @@ span.cardname {
font-family: monospace; font-family: monospace;
white-space: nowrap; white-space: nowrap;
} }
img.crayon {
vertical-align: middle;
}
table.level {
display: inline-block;
}

@ -1,5 +1,5 @@
import datetime,os import datetime,os
import log,variables,skel import log,variables,skel,tcgcore
def collectinggen(): def collectinggen():
if not os.path.isdir("build/collecting"): if not os.path.isdir("build/collecting"):
@ -10,235 +10,36 @@ def collectinggen():
skel.headerwrite(thefile,"collecting") skel.headerwrite(thefile,"collecting")
content = open(thefile,"a") content = open(thefile,"a")
content.write("<h1>decks in progress</h1>\n") content.write("<h1>decks in progress</h1>\n")
ownedcards = []
decksofinterest = [] decksofinterest = []
for event in log.log: for event in log.log:
for card in event["received"]: try:
ownedcards.append(card) for card in event["received"]:
decksofinterest.append(card[:-2]) decksofinterest.append(card[:-2])
ownedcards = sorted(ownedcards) except:
pass
decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
highpriority = [] highpriority = []
medpriority = [] medpriority = []
lowpriority = []
for deck in decksofinterest: for deck in decksofinterest:
if deck in variables.highpriority: if deck in variables.highpriority:
highpriority.append(deck) highpriority.append(deck)
else: elif deck in variables.medpriority:
medpriority.append(deck) medpriority.append(deck)
else:
lowpriority.append(deck)
if len(highpriority) > 0: if len(highpriority) > 0:
content.write("<h2>High priority</h2>\n") content.write("<h2>High priority</h2>\n")
for deck in highpriority: for deck in highpriority:
with open("build/decks/" + deck + "/type") as thetype: content.write(tcgcore.printdeck(deck))
decktype = thetype.read()
cardcount = sum(deck in card for card in ownedcards)
content.write("<table class=\"decktable " + decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " [" + str(cardcount) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "01" in ownedcards:
content.write("01")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "02" in ownedcards:
content.write("02")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "03" in ownedcards:
content.write("03")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "04" in ownedcards:
content.write("04")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "05" in ownedcards:
content.write("05")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "06" in ownedcards:
content.write("06")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "07" in ownedcards:
content.write("07")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "08" in ownedcards:
content.write("08")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "09" in ownedcards:
content.write("09")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "10" in ownedcards:
content.write("10")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "11" in ownedcards:
content.write("11")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "12" in ownedcards:
content.write("12")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "13" in ownedcards:
content.write("13")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "14" in ownedcards:
content.write("14")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "15" in ownedcards:
content.write("15")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "16" in ownedcards:
content.write("16")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "17" in ownedcards:
content.write("17")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "18" in ownedcards:
content.write("18")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "19" in ownedcards:
content.write("19")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "20" in ownedcards:
content.write("20")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n</tbody>\n</table>\n")
if len(medpriority) > 0: if len(medpriority) > 0:
content.write("<h2>Medium priority</h2>\n") content.write("<h2>Medium priority</h2>\n")
for deck in medpriority: for deck in medpriority:
with open("build/decks/" + deck + "/type") as thetype: content.write(tcgcore.printdeck(deck))
decktype = thetype.read() if len(lowpriority) > 0:
cardcount = sum(deck in card for card in ownedcards) content.write("<h2>Low priority</h2>\n")
content.write("<table class=\"decktable " + decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " [" + str(cardcount) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/") for deck in lowpriority:
if deck + "01" in ownedcards: content.write(tcgcore.printdeck(deck))
content.write("01")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "02" in ownedcards:
content.write("02")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "03" in ownedcards:
content.write("03")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "04" in ownedcards:
content.write("04")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "05" in ownedcards:
content.write("05")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "06" in ownedcards:
content.write("06")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "07" in ownedcards:
content.write("07")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "08" in ownedcards:
content.write("08")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "09" in ownedcards:
content.write("09")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "10" in ownedcards:
content.write("10")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "11" in ownedcards:
content.write("11")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "12" in ownedcards:
content.write("12")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "13" in ownedcards:
content.write("13")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "14" in ownedcards:
content.write("14")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "15" in ownedcards:
content.write("15")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "16" in ownedcards:
content.write("16")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "17" in ownedcards:
content.write("17")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "18" in ownedcards:
content.write("18")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "19" in ownedcards:
content.write("19")
else:
content.write("00")
content.write(".gif\"></td>\n <td><img src=\"/decks/" + deck + "/")
if deck + "20" in ownedcards:
content.write("20")
else:
content.write("00")
content.write(".gif\"></td>\n </tr>\n</tbody>\n</table>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -1,7 +1,8 @@
import indexgen,collectinggen,ownedgen,wantedgen,loggen import indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen
indexgen.indexgen() indexgen.indexgen()
collectinggen.collectinggen() collectinggen.collectinggen()
ownedgen.ownedgen() ownedgen.ownedgen()
wantedgen.wantedgen() wantedgen.wantedgen()
loggen.loggen() loggen.loggen()
levelsgen.levelsgen()

@ -1,5 +1,5 @@
import datetime,os,re import datetime,os,re
import log,skel,variables import log,skel,variables,tcgcore
def indexgen(): def indexgen():
if os.path.exists("build/index.html"): if os.path.exists("build/index.html"):
@ -7,142 +7,194 @@ def indexgen():
thefile = "build/index.html" thefile = "build/index.html"
skel.headerwrite(thefile,"index") skel.headerwrite(thefile,"index")
content = open(thefile,"a") content = open(thefile,"a")
cardstotal = 0
for event in log.log:
try:
cardstotal += len(event["received"])
except:
pass
firstdate = log.log[0]["date"] firstdate = log.log[0]["date"]
if cardstotal > 14400: if len(tcgcore.ownedcards()) > 14400:
rankcode = "rainbow" rankcode = "rainbow"
extra = cardstotal - 14400 extra = len(tcgcore.ownedcards()) - 14400
plusranks = int(extra / 300) plusranks = int(extra / 300)
if plusranks > 0: if plusranks > 0:
rank = "rainbow + " + str(plusranks) rank = "rainbow + " + str(plusranks)
else: else:
rank = "rainbow" rank = "rainbow"
else: else:
if cardstotal > 14100: if len(tcgcore.ownedcards()) > 14100:
rank = "himalayan" rank = "himalayan"
elif cardstotal > 13800: elif len(tcgcore.ownedcards()) > 13800:
rank = "puma" rank = "puma"
elif cardstotal > 13500: elif len(tcgcore.ownedcards()) > 13500:
rank = "chartreux" rank = "chartreux"
elif cardstotal > 13500: elif len(tcgcore.ownedcards()) > 13500:
rank = "russian blue" rank = "russian blue"
elif cardstotal > 12900: elif len(tcgcore.ownedcards()) > 12900:
rank = "panther" rank = "panther"
elif cardstotal > 12600: elif len(tcgcore.ownedcards()) > 12600:
rank = "cheetah" rank = "cheetah"
elif cardstotal > 12300: elif len(tcgcore.ownedcards()) > 12300:
rank = "tiger" rank = "tiger"
elif cardstotal > 12000: elif len(tcgcore.ownedcards()) > 12000:
rank = "lion" rank = "lion"
elif cardstotal > 11700: elif len(tcgcore.ownedcards()) > 11700:
rank = "metal" rank = "metal"
elif cardstotal > 11400: elif len(tcgcore.ownedcards()) > 11400:
rank = "ground" rank = "ground"
elif cardstotal > 11100: elif len(tcgcore.ownedcards()) > 11100:
rank = "darkness" rank = "darkness"
elif cardstotal > 10800: elif len(tcgcore.ownedcards()) > 10800:
rank = "water" rank = "water"
elif cardstotal > 10500: elif len(tcgcore.ownedcards()) > 10500:
rank = "nature" rank = "nature"
elif cardstotal > 10200: elif len(tcgcore.ownedcards()) > 10200:
rank = "light" rank = "light"
elif cardstotal > 9900: elif len(tcgcore.ownedcards()) > 9900:
rank = "wind" rank = "wind"
elif cardstotal > 9600: elif len(tcgcore.ownedcards()) > 9600:
rank = "fire" rank = "fire"
elif cardstotal > 9300: elif len(tcgcore.ownedcards()) > 9300:
rank = "mercury" rank = "mercury"
elif cardstotal > 9000: elif len(tcgcore.ownedcards()) > 9000:
rank = "jupiter" rank = "jupiter"
elif cardstotal > 8700: elif len(tcgcore.ownedcards()) > 8700:
rank = "uranus" rank = "uranus"
elif cardstotal > 8400: elif len(tcgcore.ownedcards()) > 8400:
rank = "neptune" rank = "neptune"
elif cardstotal > 8100: elif len(tcgcore.ownedcards()) > 8100:
rank = "earth" rank = "earth"
elif cardstotal > 7800: elif len(tcgcore.ownedcards()) > 7800:
rank = "venus" rank = "venus"
elif cardstotal > 7500: elif len(tcgcore.ownedcards()) > 7500:
rank = "saturn" rank = "saturn"
elif cardstotal > 7200: elif len(tcgcore.ownedcards()) > 7200:
rank = "mars" rank = "mars"
elif cardstotal > 6900: elif len(tcgcore.ownedcards()) > 6900:
rank = "magnolia" rank = "magnolia"
elif cardstotal > 6600: elif len(tcgcore.ownedcards()) > 6600:
rank = "chocolate cosmos" rank = "chocolate cosmos"
elif cardstotal > 6300: elif len(tcgcore.ownedcards()) > 6300:
rank = "lilac" rank = "lilac"
elif cardstotal > 6000: elif len(tcgcore.ownedcards()) > 6000:
rank = "hydrangea" rank = "hydrangea"
elif cardstotal > 5700: elif len(tcgcore.ownedcards()) > 5700:
rank = "clover" rank = "clover"
elif cardstotal > 5400: elif len(tcgcore.ownedcards()) > 5400:
rank = "daffodil" rank = "daffodil"
elif cardstotal > 5100: elif len(tcgcore.ownedcards()) > 5100:
rank = "tiger lily" rank = "tiger lily"
elif cardstotal > 4800: elif len(tcgcore.ownedcards()) > 4800:
rank = "sakura" rank = "sakura"
elif cardstotal > 4500: elif len(tcgcore.ownedcards()) > 4500:
rank = "silver" rank = "silver"
elif cardstotal > 4200: elif len(tcgcore.ownedcards()) > 4200:
rank = "bronze" rank = "bronze"
elif cardstotal > 3900: elif len(tcgcore.ownedcards()) > 3900:
rank = "amethyst" rank = "amethyst"
elif cardstotal > 3600: elif len(tcgcore.ownedcards()) > 3600:
rank = "sapphire" rank = "sapphire"
elif cardstotal > 3300: elif len(tcgcore.ownedcards()) > 3300:
rank = "emerald" rank = "emerald"
elif cardstotal > 3000: elif len(tcgcore.ownedcards()) > 3000:
rank = "gold" rank = "gold"
elif cardstotal > 2700: elif len(tcgcore.ownedcards()) > 2700:
rank = "amber" rank = "amber"
elif cardstotal > 2400: elif len(tcgcore.ownedcards()) > 2400:
rank = "ruby" rank = "ruby"
elif cardstotal > 2200: elif len(tcgcore.ownedcards()) > 2200:
rank = "dragon fruit" rank = "dragon fruit"
elif cardstotal > 2000: elif len(tcgcore.ownedcards()) > 2000:
rank = "apricot" rank = "apricot"
elif cardstotal > 1800: elif len(tcgcore.ownedcards()) > 1800:
rank = "grape" rank = "grape"
elif cardstotal > 1600: elif len(tcgcore.ownedcards()) > 1600:
rank = "blueberry" rank = "blueberry"
elif cardstotal > 1400: elif len(tcgcore.ownedcards()) > 1400:
rank = "lime" rank = "lime"
elif cardstotal > 1200: elif len(tcgcore.ownedcards()) > 1200:
rank = "lemon" rank = "lemon"
elif cardstotal > 1000: elif len(tcgcore.ownedcards()) > 1000:
rank = "tangerine" rank = "tangerine"
elif cardstotal > 800: elif len(tcgcore.ownedcards()) > 800:
rank = "strawberry" rank = "strawberry"
elif cardstotal > 700: elif len(tcgcore.ownedcards()) > 700:
rank = "gray" rank = "gray"
elif cardstotal > 600: elif len(tcgcore.ownedcards()) > 600:
rank = "brown" rank = "brown"
elif cardstotal > 500: elif len(tcgcore.ownedcards()) > 500:
rank = "purple" rank = "purple"
elif cardstotal > 400: elif len(tcgcore.ownedcards()) > 400:
rank = "blue" rank = "blue"
elif cardstotal > 300: elif len(tcgcore.ownedcards()) > 300:
rank = "green" rank = "green"
elif cardstotal > 200: elif len(tcgcore.ownedcards()) > 200:
rank = "yellow" rank = "yellow"
elif cardstotal > 100: elif len(tcgcore.ownedcards()) > 100:
rank = "orange" rank = "orange"
else: else:
rank = "red" rank = "red"
rankcode = re.sub(" ","",rank) rankcode = re.sub(" ","",rank)
content.write("<img src=\"/assets/levels/" + rankcode + ".gif\">\n<ul>\n<li>" + str(cardstotal) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n") content.write("<a href=\"/levels\"><img src=\"/assets/levels/" + rankcode + ".gif\"></a>\n<ul>\n<li>" + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n")
crayred = 0
crayorange = 0
crayyellow = 0
craygreen = 0
crayblue = 0
craypurple = 0
craybrown = 0
craygrey = 0
for event in log.log:
try:
crayred += event["crayons"]["red"]
except:
pass
try:
crayorange += event["crayons"]["orange"]
except:
pass
try:
crayyellow += event["crayons"]["yellow"]
except:
pass
try:
craygreen += event["crayons"]["green"]
except:
pass
try:
crayblue += event["crayons"]["blue"]
except:
pass
try:
craypurple += event["crayons"]["purple"]
except:
pass
try:
craybrown += event["crayons"]["brown"]
except:
pass
try:
craygrey += event["crayons"]["gray"]
except:
pass
if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0:
content.write("<table id=\"crayontable\">\n<tbody>\n<tr>\n")
if crayred > 0:
content.write("<td><img src=\"/assets/crayons/crayon1.gif\" class=\"crayon\"> × " + str(crayred) + "</td>\n")
if crayorange > 0:
content.write("<td><img src=\"/assets/crayons/crayon2.gif\" class=\"crayon\"> × " + str(crayorange) + "</td>\n")
if crayyellow > 0:
content.write("<td><img src=\"/assets/crayons/crayon3.gif\" class=\"crayon\"> × " + str(crayyellow) + "</td>\n")
if craygreen > 0:
content.write("<td><img src=\"/assets/crayons/crayon4.gif\" class=\"crayon\"> × " + str(craygreen) + "</td>\n")
if crayblue > 0:
content.write("<td><img src=\"/assets/crayons/crayon5.gif\" class=\"crayon\"> × " + str(crayblue) + "</td>\n")
if craypurple > 0:
content.write("<td><img src=\"/assets/crayons/crayon6.gif\" class=\"crayon\"> × " + str(craypurple) + "</td>\n")
if craybrown > 0:
content.write("<td><img src=\"/assets/crayons/crayon7.gif\" class=\"crayon\"> × " + str(craybrown) + "</td>\n")
if craygrey > 0:
content.write("<td><img src=\"/assets/crayons/crayon8.gif\" class=\"crayon\"> × " + str(craygrey) + "</td>\n")
content.write("</tr>\n</tbody>\n</table>\n")
if len(variables.faves) > 0: if len(variables.faves) > 0:
content.write("<h2>faves</h2>\n<p>") content.write("<h2>faves</h2>\n<p>")
for card in variables.faves: for card in variables.faves:
deck = card[:-2] content.write(tcgcore.printcard(card))
cardid = card[-2:]
content.write("<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">")
content.write("</p>\n") content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -0,0 +1,252 @@
import datetime,os,re
import log,skel
def levelsgen():
if not os.path.isdir("build/levels"):
os.mkdir("build/levels")
if os.path.exists("build/levels/index.html"):
os.remove("build/levels/index.html")
thefile = "build/levels/index.html"
skel.headerwrite(thefile,"levels")
content = open(thefile,"a")
content.write("<h1>levels</h1>\n")
datecard = {}
cardno = -1
for event in log.log:
try:
for card in event["received"]:
cardno += 1
datecard[cardno] = event["date"]
except:
pass
firstdate = log.log[0]["date"]
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/red.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + firstdate.strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/orange.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[100].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/yellow.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/green.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[300].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/blue.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/purple.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[500].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/brown.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/gray.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[700].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/strawberry.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/tangerine.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[1000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/lemon.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[1200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/lime.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[1400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/blueberry.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[1600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/grape.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[1800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/apricot.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[2000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/dragonfruit.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[2200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/ruby.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[2400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/amber.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[2700].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/gold.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[3000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/emerald.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[3300].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/sapphire.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[3600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/amethyst.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[3900].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/bronze.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[5200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/silver.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[4500].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/sakura.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[4800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/tigerlily.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[5100].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/daffodil.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[5400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/clover.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[5700].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/hydrangea.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[6000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/lilac.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[6300].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/chocolatecosmos.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[6600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/magnolia.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[6900].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/mars.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[7200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/saturn.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[7500].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/venus.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[7800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/earth.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[8100].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/neptune.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[8400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/uranus.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[8700].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/jupiter.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[9000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/mercury.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[9300].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/fire.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[9600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/wind.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[9900].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/light.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[10200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/nature.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[10500].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/water.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[10800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/darkness.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[11100].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/ground.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[11400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/metal.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[11700].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/lion.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[12000].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/tiger.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[12300].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/cheetah.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[12600].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/panther.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[12900].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/russianblue.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[13200].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/chartreux.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[13500].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/puma.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[13800].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/himalayan.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[14100].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
try:
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/rainbow.gif\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + datecard[14400].strftime("%Y-%m-%d") + "</code></td>\n</tr>\n</tbody>\n</table>\n")
except:
pass
content.close()
skel.footerwrite(thefile)
if __name__ == "__main__":
levelsgen()

@ -1,5 +1,5 @@
import datetime,os import datetime,os
import log,skel import log,skel,tcgcore
def loggen(): def loggen():
if not os.path.isdir("build/log"): if not os.path.isdir("build/log"):
@ -12,36 +12,85 @@ def loggen():
content.write("<h1>log</h1>\n") content.write("<h1>log</h1>\n")
thelog = log.log[::-1] thelog = log.log[::-1]
for event in thelog: for event in thelog:
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code>: Received ") content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
receivedlist = sorted(event["received"]) try:
for card in receivedlist: if event["received"]:
with open("build/decks/" + card[:-2] + "/type") as thetype: content.write("Received ")
cardtype = thetype.read() receivedlist = sorted(event["received"])
content.write("<span class=\"cardname\">") for card in receivedlist:
if cardtype == "red": content.write(tcgcore.cardtext(card))
content.write("🔴") if receivedlist.index(card) != len(receivedlist) - 1:
elif cardtype == "orange": content.write(", ")
content.write("🟠") content.write(".")
elif cardtype == "yellow": except:
content.write("🟡") pass
elif cardtype == "green": try:
content.write("🟢") if event["crayons"]:
elif cardtype == "blue": crayontypes = len(event["crayons"])
content.write("🔵") content.write("Gained crayons: ")
elif cardtype == "purple": try:
content.write("🟣") redno = event["crayons"]["red"]
elif cardtype == "brown": content.write(str(redno) + " red")
content.write("🟤") if list(event["crayons"])[-1] != "red":
elif cardtype == "gray": content.write(", ")
content.write("") except:
elif cardtype == "special": pass
content.write("") try:
content.write(card + "</span>") orangeno = event["crayons"]["orange"]
if receivedlist.index(card) == len(receivedlist) - 1: content.write(str(orangeno) + " orange")
content.write(" ") if list(event["crayons"])[-1] != "orange":
else: content.write(", ")
content.write(", ") except:
content.write(" <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>.</p>\n") pass
try:
yellowno = event["crayons"]["yellow"]
content.write(str(yellowno) + " yellow")
if list(event["crayons"])[-1] != "yellow":
content.write(", ")
except:
pass
try:
greenno = event["crayons"]["green"]
content.write(str(greenno) + " green")
if list(event["crayons"])[-1] != "green":
content.write(", ")
except:
pass
try:
blueno = event["crayons"]["blue"]
content.write(str(blueno) + " blue")
if list(event["crayons"])[-1] != "blue":
content.write(", ")
except:
pass
try:
purpleno = event["crayons"]["purple"]
content.write(str(purpleno) + " purple")
if list(event["crayons"])[-1] != "purple":
content.write(", ")
except:
pass
try:
brownno = event["crayons"]["brown"]
content.write(str(brownno) + " brown")
if list(event["crayons"])[-1] != "brown":
content.write(", ")
except:
pass
try:
grayno = event["crayons"]["gray"]
if variables.british:
content.write(str(grayno) + " grey")
else:
content.write(str(grayno) + " gray")
if list(event["crayons"])[-1] != "gray":
content.write(", ")
except:
pass
content.write(".")
except:
pass
content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -1,5 +1,5 @@
import datetime,os import datetime,os
import log,skel import log,skel,tcgcore
def ownedgen(): def ownedgen():
if not os.path.isdir("build/owned"): if not os.path.isdir("build/owned"):
@ -9,16 +9,9 @@ def ownedgen():
thefile = "build/owned/index.html" thefile = "build/owned/index.html"
skel.headerwrite(thefile,"owned") skel.headerwrite(thefile,"owned")
content = open(thefile,"a") content = open(thefile,"a")
cards = []
for event in log.log:
for card in event["received"]:
cards.append(card)
cards = sorted(cards)
content.write("<h1>owned cards</h1>\n<p>") content.write("<h1>owned cards</h1>\n<p>")
for card in cards: for card in tcgcore.ownedcards():
deck = card[:-2] content.write(tcgcore.printcard(card))
cardid = card[-2:]
content.write("<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">")
content.write("</p>\n") content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -2,7 +2,7 @@ import variables
def headerwrite(thefile,pagename): def headerwrite(thefile,pagename):
header = open(thefile,"a") header = open(thefile,"a")
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--headbg:" + variables.headerbackground + ";\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"/style.css\"> <!-- temporary -->\n <title>TCG :: " + pagename + "</title>\n </head>\n <body>\n <aside>\n \n </aside>\n <nav>\n <ul>\n <li>") header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--headbg:" + variables.headerbackground + ";\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"/style.css\">\n <meta name=\"theme-color\" content=\"" + variables.headerbackground + "\">\n <title>TCG :: " + pagename + "</title>\n </head>\n <body>\n <aside>\n \n </aside>\n <nav>\n <ul>\n <li>")
if pagename == "index": if pagename == "index":
header.write("home") header.write("home")
else: else:

@ -0,0 +1,71 @@
import log
def ownedcards():
ownedcards = []
for event in log.log:
try:
for card in event["received"]:
ownedcards.append(card)
except:
pass
return sorted(ownedcards)
def cardtext(card):
cardtext = "<span class=\"cardname\">"
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()
if cardtype == "red":
cardtext += "🔴"
elif cardtype == "orange":
cardtext += "🟠"
elif cardtype == "yellow":
cardtext += "🟡"
elif cardtype == "green":
cardtext += "🟢"
elif cardtype == "blue":
cardtext += "🔵"
elif cardtype == "purple":
cardtext += "🟣"
elif cardtype == "brown":
cardtext += "🟤"
elif cardtype == "gray":
cardtext += ""
elif cardtype == "special":
cardtext += ""
cardtext += card + "</span>"
return cardtext
def printcard(card):
deck = card[:-2]
cardid = card[-2:]
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">"
def printdeck(deck):
deckstring = "<table class=\"decktable "
with open("build/decks/" + deck + "/type") as thetype:
decktype = thetype.read()
deckstring += decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " ["
deckcards = []
for card in ownedcards():
if card[:-2] == deck:
deckcards.append(int(card[-2:]))
deckcards = sorted(list(dict.fromkeys(deckcards)))
deckstring += str(len(deckcards)) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n"
test = 1
while test < 21:
if test % 5 == 1:
deckstring += " <tr>\n"
deckstring += " <td><img src=\"/decks/" + deck + "/"
if test in deckcards:
if test > 9:
deckstring += str(test)
else:
deckstring += "0" + str(test)
else:
deckstring += "00"
deckstring += ".gif\"></td>\n"
if test % 5 == 0:
deckstring += " </tr>\n"
test += 1
deckstring += "</tbody>\n</table>\n"
return deckstring

@ -1,4 +1,6 @@
highpriority = ["deckname","nameofadeck"] highpriority = ["deckname","nameofadeck"]
medpriority = ["deckname","nameofdeck"]
tradepost = "URL" tradepost = "URL"
faves = ["favecard01","favecard02"] faves = ["favecard01","favecard02"]
headerbackground = "#000000" headerbackground = "#000000"
british = True

@ -1,5 +1,5 @@
import datetime,os import datetime,os
import log,variables,skel import log,variables,skel,tcgcore
def wantedgen(): def wantedgen():
if not os.path.isdir("build/wanted"): if not os.path.isdir("build/wanted"):
@ -13,9 +13,12 @@ def wantedgen():
ownedcards = [] ownedcards = []
decksofinterest = [] decksofinterest = []
for event in log.log: for event in log.log:
for card in event["received"]: try:
ownedcards.append(card) for card in event["received"]:
decksofinterest.append(card[:-2]) ownedcards.append(card)
decksofinterest.append(card[:-2])
except:
pass
ownedcards = sorted(ownedcards) ownedcards = sorted(ownedcards)
decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
wantedcards = [] wantedcards = []
@ -27,36 +30,18 @@ def wantedgen():
wantedcards.append(combined) wantedcards.append(combined)
highpriority = [] highpriority = []
medpriority = [] medpriority = []
lowpriority = []
for card in wantedcards: for card in wantedcards:
if card[:-2] in variables.highpriority: if card[:-2] in variables.highpriority:
highpriority.append(card) highpriority.append(card)
else: elif card[:-2] in variables.medpriority:
medpriority.append(card) medpriority.append(card)
else:
lowpriority.append(card)
if len(highpriority) > 0: if len(highpriority) > 0:
content.write("<p><b>High priority:</b> ") content.write("<p><b>High priority:</b> ")
for card in highpriority: for card in highpriority:
with open("build/decks/" + card[:-2] + "/type") as thetype: content.write(tcgcore.cardtext(card))
cardtype = thetype.read()
content.write("<span class=\"cardname\">")
if cardtype == "red":
content.write("🔴")
elif cardtype == "orange":
content.write("🟠")
elif cardtype == "yellow":
content.write("🟡")
elif cardtype == "green":
content.write("🟢")
elif cardtype == "blue":
content.write("🔵")
elif cardtype == "purple":
content.write("🟣")
elif cardtype == "brown":
content.write("🟤")
elif cardtype == "gray":
content.write("")
elif cardtype == "special":
content.write("")
content.write(card + "</span>")
if highpriority.index(card) == len(highpriority) - 1: if highpriority.index(card) == len(highpriority) - 1:
content.write(" ") content.write(" ")
else: else:
@ -65,33 +50,21 @@ def wantedgen():
if len(medpriority) > 0: if len(medpriority) > 0:
content.write("<p><b>Medium priority:</b> ") content.write("<p><b>Medium priority:</b> ")
for card in medpriority: for card in medpriority:
with open("build/decks/" + card[:-2] + "/type") as thetype: content.write(tcgcore.cardtext(card))
cardtype = thetype.read()
content.write("<span class=\"cardname\">")
if cardtype == "red":
content.write("🔴")
elif cardtype == "orange":
content.write("🟠")
elif cardtype == "yellow":
content.write("🟡")
elif cardtype == "green":
content.write("🟢")
elif cardtype == "blue":
content.write("🔵")
elif cardtype == "purple":
content.write("🟣")
elif cardtype == "brown":
content.write("🟤")
elif cardtype == "gray":
content.write("")
elif cardtype == "special":
content.write("")
content.write(card + "</span>")
if medpriority.index(card) == len(medpriority) - 1: if medpriority.index(card) == len(medpriority) - 1:
content.write(" ") content.write(" ")
else: else:
content.write(", ") content.write(", ")
content.write("</p>\n") content.write("</p>\n")
if len(lowpriority) > 0:
content.write("<p><b>Low priority:</b> ")
for card in lowpriority:
content.write(tcgcore.cardtext(card))
if lowpriority.index(card) == len(lowpriority) - 1:
content.write(" ")
else:
content.write(", ")
content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

Loading…
Cancel
Save