Compare commits
No commits in common. '65ffda928e4831b40c5827bc3ff0f84890a5728b' and '1e7b29538412d73d3e47eeb453a15287fc501669' have entirely different histories.
65ffda928e
...
1e7b295384
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
python3 new.py
|
python3 generate.py
|
||||||
|
|
||||||
rclone copy build prazevps:/var/www/tcg/public -P -L
|
rclone copy build prazevps:/var/www/tcg/public -P -L
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,variables,skel,tcgcore
|
||||||
|
|
||||||
|
def collectinggen(colour=False):
|
||||||
|
if not os.path.isdir("build/collecting"):
|
||||||
|
os.mkdir("build/collecting")
|
||||||
|
if colour:
|
||||||
|
if not os.path.isdir("build/collecting/" + colour):
|
||||||
|
os.mkdir("build/collecting/" + colour)
|
||||||
|
thefile = "build/collecting/" + colour + "/index.html"
|
||||||
|
else:
|
||||||
|
thefile = "build/collecting/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"collecting")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>decks in progress</h1>\n")
|
||||||
|
decksofinterest = []
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
if colour:
|
||||||
|
if tcgcore.cardtype(card) == colour:
|
||||||
|
decksofinterest.append(card[:-2])
|
||||||
|
else:
|
||||||
|
decksofinterest.append(card[:-2])
|
||||||
|
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
|
||||||
|
highpriority = []
|
||||||
|
medpriority = []
|
||||||
|
lowpriority = []
|
||||||
|
for deck in decksofinterest:
|
||||||
|
if tcgcore.collecting(deck):
|
||||||
|
if tcgcore.priority(deck) == "high":
|
||||||
|
highpriority.append(deck)
|
||||||
|
elif tcgcore.priority(deck) == "medium":
|
||||||
|
medpriority.append(deck)
|
||||||
|
else:
|
||||||
|
lowpriority.append(deck)
|
||||||
|
content.write(tcgcore.filterwrite("collecting",colour))
|
||||||
|
if len(highpriority) > 0:
|
||||||
|
content.write("<div>\n<h2 class=\"collectingheader\">High priority</h2>\n")
|
||||||
|
for deck in highpriority:
|
||||||
|
content.write(tcgcore.printdeck(deck,False))
|
||||||
|
content.write("</div>\n")
|
||||||
|
if len(medpriority) > 0:
|
||||||
|
content.write("<div>\n<h2 class=\"collectingheader\">Medium priority</h2>\n")
|
||||||
|
for deck in medpriority:
|
||||||
|
content.write(tcgcore.printdeck(deck))
|
||||||
|
content.write("</div>\n")
|
||||||
|
if len(lowpriority) > 0:
|
||||||
|
content.write("<div>\n<h2 class=\"collectingheader\">Low priority</h2>\n")
|
||||||
|
for deck in lowpriority:
|
||||||
|
content.write(tcgcore.printdeck(deck))
|
||||||
|
content.write("</div>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def collectingall():
|
||||||
|
collectinggen()
|
||||||
|
for type in tcgcore.typelist:
|
||||||
|
collectinggen(type)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
collectingall()
|
@ -0,0 +1,53 @@
|
|||||||
|
import os,requests
|
||||||
|
import tcgcore,thetypes
|
||||||
|
|
||||||
|
def getimg():
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] == "sig_":
|
||||||
|
if not os.path.exists("build/decks/sigs/" + card[4:] + ".gif"):
|
||||||
|
r = requests.get("https://colors-tcg.eu/cards/" + card + ".gif")
|
||||||
|
open("build/decks/sigs/" + card[4:] + ".gif","wb").write(r.content)
|
||||||
|
else:
|
||||||
|
thepath = "build/decks/" + card[:-2]
|
||||||
|
if not os.path.isdir(thepath):
|
||||||
|
os.mkdir(thepath)
|
||||||
|
if card[:-2] in thetypes.typedict:
|
||||||
|
decktype = thetypes.typedict[card[:-2]]
|
||||||
|
else:
|
||||||
|
index = 0 # adapted from https://stackoverflow.com/a/64536882
|
||||||
|
indexValidList = []
|
||||||
|
print("Deck type for " + card[:-2] + ":")
|
||||||
|
options = tcgcore.typelist
|
||||||
|
for optionName in options:
|
||||||
|
index = index + 1
|
||||||
|
indexValidList.extend([options.index(optionName)])
|
||||||
|
print(str(index) + ") " + optionName)
|
||||||
|
inputValid = False
|
||||||
|
while not inputValid:
|
||||||
|
inputRaw = input("Type: ")
|
||||||
|
inputNo = int(inputRaw) - 1
|
||||||
|
if inputNo > -1 and inputNo < len(indexValidList):
|
||||||
|
selected = indexValidList[inputNo]
|
||||||
|
inputValid = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print("Select a number from the list")
|
||||||
|
decktype = options[selected]
|
||||||
|
typefile = open(thepath + "/type","w")
|
||||||
|
typefile.write(decktype)
|
||||||
|
typefile.close()
|
||||||
|
print("Downloading " + card[:-2])
|
||||||
|
number = 0
|
||||||
|
while number < 21:
|
||||||
|
if number < 10:
|
||||||
|
r = requests.get("https://colors-tcg.eu/cards/" + card[:-2] + "0" + str(number) + ".gif")
|
||||||
|
open(thepath + "/0" + str(number) + ".gif","wb").write(r.content)
|
||||||
|
else:
|
||||||
|
r = requests.get("https://colors-tcg.eu/cards/" + card[:-2] + str(number) + ".gif")
|
||||||
|
open(thepath + "/" + str(number) + ".gif","wb").write(r.content)
|
||||||
|
number += 1
|
||||||
|
master = requests.get("https://colors-tcg.eu/cards/" + card[:-2] + "master.gif")
|
||||||
|
open(thepath + "/master.gif","wb").write(master.content)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
getimg()
|
@ -0,0 +1,43 @@
|
|||||||
|
import sys
|
||||||
|
print("Building tradelist")
|
||||||
|
|
||||||
|
import download,indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen,tradegen,masteredgen,portfoliosgen,searchgen,massgen,variables
|
||||||
|
|
||||||
|
print("Checking for new decks … ",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
download.getimg()
|
||||||
|
print("done\nBuilding index page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
indexgen.indexgen()
|
||||||
|
print(" done\nBuilding collecting page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
massgen.massall()
|
||||||
|
print(" done\nBuilding mass decks pages …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
collectinggen.collectingall()
|
||||||
|
if variables.ownedpage:
|
||||||
|
print(" done\nBuilding owned page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
ownedgen.ownedall()
|
||||||
|
print(" done\nBuilding wanted page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
wantedgen.wantedgen()
|
||||||
|
print(" done\nBuilding log pages …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
loggen.logall()
|
||||||
|
print(" done\nBuilding levels page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
levelsgen.levelsgen()
|
||||||
|
print(" done\nBuilding trading page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
tradegen.tradeall()
|
||||||
|
print(" done\nBuilding mastered page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
masteredgen.masteredall()
|
||||||
|
print(" done\nBuilding portfolios page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
portfoliosgen.portfoliosgen()
|
||||||
|
print(" done\nBuilding search page …",end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
searchgen.searchgen()
|
||||||
|
print(" done")
|
@ -0,0 +1,254 @@
|
|||||||
|
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")
|
||||||
|
dates = []
|
||||||
|
for event in log.log:
|
||||||
|
try:
|
||||||
|
for card in event["received"]:
|
||||||
|
dates.append(event["date"])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
for card in event["lost"]:
|
||||||
|
dates.remove(dates[-1])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
content.write("<table class=\"level\">\n<tbody>\n<tr>\n<td align=\"center\"><img src=\"/assets/levels/red.gif\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[0].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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[4200].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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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\" loading=\"lazy\"></td>\n</tr>\n<tr>\n<td align=\"center\"><code>" + dates[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()
|
@ -0,0 +1,168 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,skel,tcgcore,variables
|
||||||
|
|
||||||
|
def crayonlog(colour,event):
|
||||||
|
crayonno = event["crayons"][colour]
|
||||||
|
if variables.british:
|
||||||
|
if colour == "gray":
|
||||||
|
crayonrend = "grey"
|
||||||
|
else:
|
||||||
|
crayonrend = colour
|
||||||
|
else:
|
||||||
|
crayonrend = colour
|
||||||
|
if crayonno > 0:
|
||||||
|
crayonstring = "+" + str(crayonno) + " " + crayonrend
|
||||||
|
else:
|
||||||
|
crayonstring = str(crayonno) + " " + crayonrend
|
||||||
|
return crayonstring
|
||||||
|
|
||||||
|
def loggen(month=False):
|
||||||
|
if month:
|
||||||
|
if not os.path.isdir("build/log/month"):
|
||||||
|
os.mkdir("build/log/month")
|
||||||
|
if os.path.exists("build/log/month/index.html"):
|
||||||
|
os.remove("build/log/month/index.html")
|
||||||
|
thefile = "build/log/month/index.html"
|
||||||
|
else:
|
||||||
|
if not os.path.isdir("build/log"):
|
||||||
|
os.mkdir("build/log")
|
||||||
|
if os.path.exists("build/log/index.html"):
|
||||||
|
os.remove("build/log/index.html")
|
||||||
|
thefile = "build/log/index.html"
|
||||||
|
skel.headerwrite(thefile,"log")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>log</h1>\n<p class=\"typefilter\">")
|
||||||
|
if month:
|
||||||
|
content.write("<a href=\"/log\">Show all</a>")
|
||||||
|
else:
|
||||||
|
content.write("<a href=\"/log/month\">Show current month only</a>")
|
||||||
|
content.write("</p>\n")
|
||||||
|
if month:
|
||||||
|
thelog = []
|
||||||
|
for event in log.log:
|
||||||
|
if event["date"].month == datetime.datetime.now().month and event["date"].year == datetime.datetime.now().year:
|
||||||
|
thelog.append(event)
|
||||||
|
thelog = thelog[::-1]
|
||||||
|
else:
|
||||||
|
thelog = log.log[::-1]
|
||||||
|
for event in thelog:
|
||||||
|
if event == "portfolio":
|
||||||
|
logit = False
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
if event["received"]:
|
||||||
|
logit = True
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
if event["lost"]:
|
||||||
|
logit = True
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
if event["crayons"]:
|
||||||
|
logit = True
|
||||||
|
except:
|
||||||
|
logit = False
|
||||||
|
if logit == True:
|
||||||
|
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
|
||||||
|
try:
|
||||||
|
if event["received"]:
|
||||||
|
content.write("Received ")
|
||||||
|
receivedlist = sorted(event["received"])
|
||||||
|
position = 1
|
||||||
|
for card in receivedlist:
|
||||||
|
content.write(tcgcore.cardtext(card))
|
||||||
|
if len(receivedlist) != position:
|
||||||
|
content.write(", ")
|
||||||
|
position += 1
|
||||||
|
content.write(".")
|
||||||
|
try:
|
||||||
|
if event["lost"]:
|
||||||
|
content.write(" ")
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
if event["crayons"]:
|
||||||
|
content.write(" ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if event["lost"]:
|
||||||
|
content.write("Lost ")
|
||||||
|
lostlist = sorted(event["lost"])
|
||||||
|
position = 1
|
||||||
|
for card in lostlist:
|
||||||
|
content.write(tcgcore.cardtext(card))
|
||||||
|
if len(lostlist) != position:
|
||||||
|
content.write(", ")
|
||||||
|
position += 1
|
||||||
|
content.write(".")
|
||||||
|
try:
|
||||||
|
if event["crayons"]:
|
||||||
|
content.write(" ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if event["crayons"]:
|
||||||
|
content.write("Crayons: ")
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("red",event))
|
||||||
|
if list(event["crayons"])[-1] != "red":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("orange",event))
|
||||||
|
if list(event["crayons"])[-1] != "orange":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("yellow",event))
|
||||||
|
if list(event["crayons"])[-1] != "yellow":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("green",event))
|
||||||
|
if list(event["crayons"])[-1] != "green":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("blue",event))
|
||||||
|
if list(event["crayons"])[-1] != "blue":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("purple",event))
|
||||||
|
if list(event["crayons"])[-1] != "purple":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("brown",event))
|
||||||
|
if list(event["crayons"])[-1] != "brown":
|
||||||
|
content.write(", ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
content.write(crayonlog("gray",event))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
content.write(".")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
content.write("</p>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def logall():
|
||||||
|
loggen(False)
|
||||||
|
loggen(True)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
logall()
|
@ -0,0 +1,107 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,skel,tcgcore,variables
|
||||||
|
|
||||||
|
massdecks = dict(sorted(variables.masscollect.items()))
|
||||||
|
massowned = {}
|
||||||
|
for series in massdecks:
|
||||||
|
ownedlist = []
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
try:
|
||||||
|
if card[:-2] in massdecks[series]["decks"]:
|
||||||
|
ownedlist.append(card)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if card in massdecks[series]["singles"]:
|
||||||
|
ownedlist.append(card)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if len(ownedlist) > 0:
|
||||||
|
ownedlist = sorted(list(dict.fromkeys(ownedlist)))
|
||||||
|
massowned[series] = ownedlist
|
||||||
|
|
||||||
|
def massindexgen():
|
||||||
|
if not os.path.isdir("build/mass"):
|
||||||
|
os.mkdir("build/mass")
|
||||||
|
thefile = "build/mass/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"mass")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>mass collecting</h1>\n<ul>\n")
|
||||||
|
massindex = 1
|
||||||
|
for series in massowned:
|
||||||
|
content.write("<li><a href=\"/mass/" + str(massindex) + "\">" + series + "</a>")
|
||||||
|
if variables.masscollect[series]["full"] == True:
|
||||||
|
totalno = 0
|
||||||
|
try:
|
||||||
|
totalno += len(variables.masscollect[series]["decks"]) * 20
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
totalno += len(variables.masscollect[series]["singles"])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
content.write(" (")
|
||||||
|
if len(massowned[series]) == totalno:
|
||||||
|
content.write("complete")
|
||||||
|
else:
|
||||||
|
content.write(str(len(massowned[series])) + "/" + str(totalno))
|
||||||
|
content.write(")")
|
||||||
|
content.write("</li>\n")
|
||||||
|
massindex += 1
|
||||||
|
content.write("</ul>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def massseriesgen(series,massindex):
|
||||||
|
if not os.path.isdir("build/mass/" + str(massindex)):
|
||||||
|
os.mkdir("build/mass/" + str(massindex))
|
||||||
|
thefile = "build/mass/" + str(massindex) + "/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"mass")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>" + series + "</h1>\n<p><a href=\"/mass\">back to mass decks page</a></p>\n<p>")
|
||||||
|
themassdecks = []
|
||||||
|
for card in massowned[series]:
|
||||||
|
try:
|
||||||
|
if card[:-2] in variables.masscollect[series]["decks"]:
|
||||||
|
themassdecks.append(card[:-2])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if card[:-2] in variables.masscollect[series]["masters"]:
|
||||||
|
themassdecks.append(card[:-2])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
themassdecks = sorted(list(dict.fromkeys(themassdecks)))
|
||||||
|
massmastered = []
|
||||||
|
for deck in themassdecks:
|
||||||
|
if tcgcore.deckmastered(deck):
|
||||||
|
massmastered.append(deck)
|
||||||
|
if len(massmastered) > 0:
|
||||||
|
for deck in massmastered:
|
||||||
|
content.write("<img src=\"/decks/" + deck + "/master.gif\" title=\"mastered " + deck)
|
||||||
|
try:
|
||||||
|
if deck in variables.firstmasteries:
|
||||||
|
content.write(" (first)\" class=\"first")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
content.write("\">")
|
||||||
|
content.write("</p><p>")
|
||||||
|
for card in massowned[series]:
|
||||||
|
content.write(tcgcore.printcard(card))
|
||||||
|
content.write("</p>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def massall():
|
||||||
|
massindexgen()
|
||||||
|
massindex = 1
|
||||||
|
for series in massowned:
|
||||||
|
massseriesgen(series,massindex)
|
||||||
|
massindex += 1
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
massall()
|
@ -0,0 +1,43 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,variables,skel,tcgcore
|
||||||
|
|
||||||
|
def masteredgen(colour=False):
|
||||||
|
if not os.path.isdir("build/mastered"):
|
||||||
|
os.mkdir("build/mastered")
|
||||||
|
if colour:
|
||||||
|
if not os.path.isdir("build/mastered/" + colour):
|
||||||
|
os.mkdir("build/mastered/" + colour)
|
||||||
|
thefile = "build/mastered/" + colour + "/index.html"
|
||||||
|
else:
|
||||||
|
thefile = "build/mastered/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"mastered")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>mastered decks</h1>\n")
|
||||||
|
decksofinterest = []
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
if colour:
|
||||||
|
if tcgcore.cardtype(card) == colour:
|
||||||
|
decksofinterest.append(card[:-2])
|
||||||
|
else:
|
||||||
|
decksofinterest.append(card[:-2])
|
||||||
|
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
|
||||||
|
mastereddecks = []
|
||||||
|
for deck in decksofinterest:
|
||||||
|
if tcgcore.deckmastered(deck):
|
||||||
|
mastereddecks.append(deck)
|
||||||
|
content.write(tcgcore.filterwrite("mastered",colour))
|
||||||
|
for deck in mastereddecks:
|
||||||
|
content.write(tcgcore.printdeck(deck))
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def masteredall():
|
||||||
|
masteredgen()
|
||||||
|
for type in tcgcore.typelist:
|
||||||
|
masteredgen(type)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
masteredall()
|
@ -0,0 +1,37 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,skel,tcgcore,variables
|
||||||
|
|
||||||
|
def ownedgen(colour=False):
|
||||||
|
if not os.path.isdir("build/owned"):
|
||||||
|
os.mkdir("build/owned")
|
||||||
|
if colour:
|
||||||
|
if not os.path.isdir("build/owned/" + colour):
|
||||||
|
os.mkdir("build/owned/" + colour)
|
||||||
|
thefile = "build/owned/" + colour + "/index.html"
|
||||||
|
else:
|
||||||
|
thefile = "build/owned/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"owned")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>owned cards</h1>\n")
|
||||||
|
content.write(tcgcore.filterwrite("owned",colour))
|
||||||
|
content.write("<p>")
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
if colour:
|
||||||
|
if tcgcore.cardtype(card) == colour:
|
||||||
|
content.write(tcgcore.printcard(card))
|
||||||
|
else:
|
||||||
|
content.write(tcgcore.printcard(card))
|
||||||
|
content.write("</p>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def ownedall():
|
||||||
|
ownedgen()
|
||||||
|
for type in tcgcore.typelist:
|
||||||
|
ownedgen(type)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
ownedall()
|
@ -0,0 +1,37 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,skel,tcgcore,variables
|
||||||
|
|
||||||
|
def portfoliosgen(colour=False):
|
||||||
|
if not os.path.isdir("build/portfolios"):
|
||||||
|
os.mkdir("build/portfolios")
|
||||||
|
if colour:
|
||||||
|
if not os.path.isdir("build/portfolios/" + colour):
|
||||||
|
os.mkdir("build/portfolios/" + colour)
|
||||||
|
thefile = "build/portfolios/" + colour + "/index.html"
|
||||||
|
else:
|
||||||
|
thefile = "build/portfolios/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"portfolios")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>portfolios</h1>\n")
|
||||||
|
if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0:
|
||||||
|
if len(tcgcore.getpalettes()) > 0:
|
||||||
|
content.write("<div class=\"foliocase\">\n")
|
||||||
|
portnumber = 1
|
||||||
|
for portfolio in tcgcore.getpalettes():
|
||||||
|
content.write(tcgcore.portfoliogen(portfolio,"palette",portnumber))
|
||||||
|
portnumber += 1
|
||||||
|
content.write("</div>\n")
|
||||||
|
if len(tcgcore.getmonochrome()) > 0:
|
||||||
|
content.write("<div class=\"foliocase\">\n")
|
||||||
|
portnumber = 1
|
||||||
|
for portfolio in tcgcore.getmonochrome():
|
||||||
|
content.write(tcgcore.portfoliogen(portfolio,"monochrome",portnumber))
|
||||||
|
portnumber += 1
|
||||||
|
content.write("</div>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
portfoliosgen()
|
@ -0,0 +1,119 @@
|
|||||||
|
import os
|
||||||
|
import skel,tcgcore,variables
|
||||||
|
|
||||||
|
def searchgen():
|
||||||
|
decksofinterest = []
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
decksofinterest.append(card[:-2])
|
||||||
|
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
|
||||||
|
wantedcards = []
|
||||||
|
ownedcollecting = []
|
||||||
|
for deck in decksofinterest:
|
||||||
|
if tcgcore.collecting(deck):
|
||||||
|
wantedlist = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
|
||||||
|
for card in wantedlist:
|
||||||
|
combined = deck + card
|
||||||
|
if combined in tcgcore.ownedcards():
|
||||||
|
ownedcollecting.append(combined)
|
||||||
|
else:
|
||||||
|
wantedcards.append(combined)
|
||||||
|
hpw = []
|
||||||
|
mpw = []
|
||||||
|
lpw = []
|
||||||
|
hpt = []
|
||||||
|
mpt = []
|
||||||
|
lpt = []
|
||||||
|
for card in wantedcards:
|
||||||
|
if tcgcore.priority(card[:-2]) == "high":
|
||||||
|
hpw.append(card)
|
||||||
|
elif tcgcore.priority(card[:-2]) == "medium":
|
||||||
|
mpw.append(card)
|
||||||
|
elif tcgcore.priority(card[:-2]) == "low":
|
||||||
|
lpw.append(card)
|
||||||
|
previouscard = ""
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
if card == previouscard:
|
||||||
|
lpt.append(card)
|
||||||
|
else:
|
||||||
|
if not tcgcore.deckmastered(card[:-2]):
|
||||||
|
mass = False
|
||||||
|
for series in variables.masscollect:
|
||||||
|
try:
|
||||||
|
if card in variables.masscollect[series]["singles"]:
|
||||||
|
mass = True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if mass == True:
|
||||||
|
if tcgcore.priority(card[:-2]) != "high":
|
||||||
|
hpt.append(card)
|
||||||
|
else:
|
||||||
|
if card in ownedcollecting:
|
||||||
|
if tcgcore.priority(card[:-2]) == "medium":
|
||||||
|
hpt.append(card)
|
||||||
|
elif tcgcore.priority(card[:-2]) == "low":
|
||||||
|
mpt.append(card)
|
||||||
|
else:
|
||||||
|
lpt.append(card)
|
||||||
|
previouscard = card
|
||||||
|
hpw = sorted(list(dict.fromkeys(hpw)))
|
||||||
|
mpw = sorted(list(dict.fromkeys(mpw)))
|
||||||
|
lpw = sorted(list(dict.fromkeys(lpw)))
|
||||||
|
hpt = sorted(list(dict.fromkeys(hpt)))
|
||||||
|
mpt = sorted(list(dict.fromkeys(mpt)))
|
||||||
|
lpt = sorted(list(dict.fromkeys(lpt)))
|
||||||
|
if not os.path.isdir("build/search"):
|
||||||
|
os.mkdir("build/search")
|
||||||
|
thefile = "build/search/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"search")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>card search</h1>\n<form>\n <label for=\"cardinput\">Enter a list of cards and/or decks here:</label>\n <textarea id=\"cardinput\" name=\"cardinput\"></textarea>\n <input type=\"button\" value=\"Search\" onclick=\"searchcards()\">\n</form>\n<p id=\"hpwfound\"></p>\n<p id=\"mpwfound\"></p>\n<p id=\"lpwfound\"></p>\n<p id=\"hptfound\"></p>\n<p id=\"mptfound\"></p>\n<p id=\"lptfound\"></p>\n<p id=\"nothing\"></p>\n<script>\n function searchcards() {\n const thecards = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20'];\n const hpw = [")
|
||||||
|
precomma = False
|
||||||
|
for card in hpw:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const mpw = [")
|
||||||
|
precomma = False
|
||||||
|
for card in mpw:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const lpw = [")
|
||||||
|
precomma = False
|
||||||
|
for card in lpw:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const hpt = [")
|
||||||
|
precomma = False
|
||||||
|
for card in hpt:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const mpt = [")
|
||||||
|
precomma = False
|
||||||
|
for card in mpt:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const lpt = [")
|
||||||
|
precomma = False
|
||||||
|
for card in lpt:
|
||||||
|
if precomma:
|
||||||
|
content.write(", ")
|
||||||
|
content.write("'" + card + "'")
|
||||||
|
precomma = True
|
||||||
|
content.write("];\n const searchstring = document.getElementById('cardinput').value;\n const searcharray = searchstring.replaceAll(' ','').replaceAll('\\n',',').replaceAll('\\r',',').toLowerCase().split(',');\n const hpwfound = [];\n const mpwfound = [];\n const lpwfound = [];\n const hptfound = [];\n const mptfound = [];\n const lptfound = [];\n for (const element of searcharray) {\n let cardend = element.substring(element.length, element.length - 2);\n if (!(thecards.includes(cardend))) {\n for (const ending of thecards) {\n searcharray.push(element + ending);\n };\n };\n };\n for (const element of searcharray) {\n if (hpw.includes(element)) {\n hpwfound.push(element);\n } else if (mpw.includes(element)) {\n mpwfound.push(element);\n } else if (lpw.includes(element)) {\n lpwfound.push(element);\n } else if (hpt.includes(element)) {\n hptfound.push(element);\n } else if (mpt.includes(element)) {\n mptfound.push(element);\n } else if (lpt.includes(element)) {\n lptfound.push(element);\n };\n };\n if ((hpwfound.length) > 0) {\n document.getElementById('hpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (high priority):</span> <span class=\"searchresults\">' + hpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('hpwfound').innerHTML = '';\n };\n if ((mpwfound.length) > 0) {\n document.getElementById('mpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (medium priority):</span> <span class=\"searchresults\">' + mpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('mpwfound').innerHTML = '';\n };\n if ((lpwfound.length) > 0) {\n document.getElementById('lpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (low priority):</span> <span class=\"searchresults\">' + lpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('lpwfound').innerHTML = '';\n };\n if ((hptfound.length) > 0) {\n document.getElementById('hptfound').innerHTML = '<span class=\"sorttitle\">Will trade out for <a href=\"/wanted\">high priority cards</a> only:</span> <span class=\"searchresults\">' + hptfound.join(', ') + '</span>';\n } else {\n document.getElementById('hptfound').innerHTML = '';\n };\n if ((mptfound.length) > 0) {\n document.getElementById('mptfound').innerHTML = '<span class=\"sorttitle\">Will trade out for <a href=\"/wanted\">high or medium priority cards</a>:</span> <span class=\"searchresults\">' + mptfound.join(', ') + '</span>';\n } else {\n document.getElementById('mptfound').innerHTML = '';\n };\n if ((lptfound.length) > 0) {\n document.getElementById('lptfound').innerHTML = '<span class=\"sorttitle\">Will trade out for <a href=\"/wanted\">any wanted card</a>:</span> <span class=\"searchresults\">' + lptfound.join(', ') + '</span>';\n } else {\n document.getElementById('lptfound').innerHTML = '';\n };\n if ((hpwfound.length) + (mpwfound.length) + (lpwfound.length) + (hptfound.length) + (mptfound.length) + (lptfound.length) == 0) {\n document.getElementById('nothing').innerHTML = 'No results';\n } else {\n document.getElementById('nothing').innerHTML = '';\n }\n }\n</script>\n </main>\n </body>\n</html>")
|
||||||
|
content.close()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
searchgen()
|
@ -0,0 +1,425 @@
|
|||||||
|
import log,variables
|
||||||
|
|
||||||
|
typelist = ["red","orange","yellow","green","blue","purple","brown","gray","special"]
|
||||||
|
|
||||||
|
def ownedcards():
|
||||||
|
ownedcards = []
|
||||||
|
for event in log.log:
|
||||||
|
try:
|
||||||
|
for card in event["received"]:
|
||||||
|
ownedcards.append(card)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
for card in event["lost"]:
|
||||||
|
ownedcards.remove(card)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return sorted(ownedcards)
|
||||||
|
|
||||||
|
def showdupes():
|
||||||
|
dupeslist = []
|
||||||
|
previouscard = ""
|
||||||
|
for card in ownedcards():
|
||||||
|
if card == previouscard:
|
||||||
|
dupeslist.append(card)
|
||||||
|
previouscard = card
|
||||||
|
return dupeslist
|
||||||
|
|
||||||
|
def deckcards(deck):
|
||||||
|
deckcards = []
|
||||||
|
for card in ownedcards():
|
||||||
|
if card[:-2] == deck:
|
||||||
|
deckcards.append(int(card[-2:]))
|
||||||
|
deckcards = sorted(list(dict.fromkeys(deckcards)))
|
||||||
|
return deckcards
|
||||||
|
|
||||||
|
def deckmastered(deck):
|
||||||
|
if len(deckcards(deck)) == 20:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def datemastered(deck):
|
||||||
|
if deckmastered(deck):
|
||||||
|
deckdates = []
|
||||||
|
for event in log.log:
|
||||||
|
try:
|
||||||
|
if event["received"]:
|
||||||
|
for card in event["received"]:
|
||||||
|
if card[:-2] == deck:
|
||||||
|
deckdates.append({"card":card,"date":event["date"],"event":"received"})
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if event["lost"]:
|
||||||
|
for card in event["lost"]:
|
||||||
|
if card[:-2] == deck:
|
||||||
|
deckdates.append({"card":card,"date":event["date"],"event":"lost"})
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
cards = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0}
|
||||||
|
mastered = False
|
||||||
|
for event in deckdates:
|
||||||
|
if not mastered:
|
||||||
|
if event["event"] == "received":
|
||||||
|
cards[int(event["card"][-2:])] += 1
|
||||||
|
if event["event"] == "lost":
|
||||||
|
cards[int(event["card"][-2:])] -= 1
|
||||||
|
if cards[1] > 0 and cards[2] > 0 and cards[3] > 0 and cards[4] > 0 and cards[5] > 0 and cards[6] > 0 and cards[7] > 0 and cards[8] > 0 and cards[9] > 0 and cards[10] > 0 and cards[11] > 0 and cards[12] > 0 and cards[13] > 0 and cards[14] > 0 and cards[15] > 0 and cards[16] > 0 and cards[17] > 0 and cards[18] > 0 and cards[19] > 0 and cards[20] > 0:
|
||||||
|
mastered = event["date"]
|
||||||
|
return mastered
|
||||||
|
|
||||||
|
medium = []
|
||||||
|
for series in variables.masscollect:
|
||||||
|
try:
|
||||||
|
for deck in variables.masscollect[series]["decks"]:
|
||||||
|
medium.append(deck)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
medium = sorted(list(dict.fromkeys(medium)))
|
||||||
|
|
||||||
|
def collecting(deck):
|
||||||
|
if 0 < len (deckcards(deck)) < 20:
|
||||||
|
if deck in variables.highpriority:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
portfoliocollecting = False
|
||||||
|
for event in log.log:
|
||||||
|
if portfoliocollecting == False:
|
||||||
|
if event["event"] == "portfolio":
|
||||||
|
if deck in event["decks"]:
|
||||||
|
portfoliocollecting = True
|
||||||
|
return True
|
||||||
|
if portfoliocollecting == False:
|
||||||
|
if deck in medium:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if len(deckcards(deck)) < variables.collectthreshold:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def priority(deck):
|
||||||
|
if collecting(deck):
|
||||||
|
if deck in variables.highpriority:
|
||||||
|
return "high"
|
||||||
|
elif len(deckcards(deck)) >= variables.highthreshold:
|
||||||
|
return "high"
|
||||||
|
else:
|
||||||
|
portfoliopriority = False
|
||||||
|
for event in log.log:
|
||||||
|
if portfoliopriority == False:
|
||||||
|
if event["event"] == "portfolio":
|
||||||
|
if deck in event["decks"]:
|
||||||
|
portfoliopriority = True
|
||||||
|
return "high"
|
||||||
|
if portfoliopriority == False:
|
||||||
|
if deck in medium:
|
||||||
|
return "medium"
|
||||||
|
elif len(deckcards(deck)) >= variables.mediumthreshold:
|
||||||
|
return "medium"
|
||||||
|
else:
|
||||||
|
return ("low")
|
||||||
|
|
||||||
|
def cardtype(card):
|
||||||
|
with open("build/decks/" + card[:-2] + "/type") as thetype:
|
||||||
|
cardtype = thetype.read()
|
||||||
|
return(cardtype)
|
||||||
|
|
||||||
|
def cardtext(card):
|
||||||
|
cardtext = "<span class=\"cardname\">"
|
||||||
|
if card[0:4] == "sig_":
|
||||||
|
cardtext += "<span title=\"signature\">✍</span>" + card + "</span>"
|
||||||
|
else:
|
||||||
|
if cardtype(card) == "red":
|
||||||
|
cardtext += "<span title=\"red\">🔴</span>"
|
||||||
|
elif cardtype(card) == "orange":
|
||||||
|
cardtext += "<span title=\"orange\">🟠</span>"
|
||||||
|
elif cardtype(card) == "yellow":
|
||||||
|
cardtext += "<span title=\"yellow\">🟡</span>"
|
||||||
|
elif cardtype(card) == "green":
|
||||||
|
cardtext += "<span title=\"green\">🟢</span>"
|
||||||
|
elif cardtype(card) == "blue":
|
||||||
|
cardtext += "<span title=\"blue\">🔵</span>"
|
||||||
|
elif cardtype(card) == "purple":
|
||||||
|
cardtext += "<span title=\"purple\">🟣</span>"
|
||||||
|
elif cardtype(card) == "brown":
|
||||||
|
cardtext += "<span title=\"brown\">🟤</span>"
|
||||||
|
elif cardtype(card) == "gray":
|
||||||
|
cardtext += "<span title=\""
|
||||||
|
if variables.british:
|
||||||
|
cardtext += "grey"
|
||||||
|
else:
|
||||||
|
cardtext += "gray"
|
||||||
|
cardtext += "\">⚪</span>"
|
||||||
|
elif cardtype(card) == "special":
|
||||||
|
cardtext += "<span title=\"special\">✨</span>"
|
||||||
|
cardtext += card + "</span>"
|
||||||
|
return cardtext
|
||||||
|
|
||||||
|
def printcard(card):
|
||||||
|
if card[0:4] == "sig_":
|
||||||
|
return "<img src=\"/decks/sigs/" + card[4:] + ".gif\" title=\"" + card + "\" loading=\"lazy\">"
|
||||||
|
else:
|
||||||
|
deck = card[:-2]
|
||||||
|
cardid = card[-2:]
|
||||||
|
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\" loading=\"lazy\">"
|
||||||
|
|
||||||
|
def printdeck(deck,fold=True):
|
||||||
|
if fold:
|
||||||
|
deckstring = "<details class=\"deckwrap\">\n<summary>" + deck + " ["
|
||||||
|
if deckmastered(deck):
|
||||||
|
deckstring += datemastered(deck).strftime("%Y-%m-%d")
|
||||||
|
else:
|
||||||
|
deckstring += str(len(deckcards(deck))) + "/20"
|
||||||
|
deckstring += "]</summary>\n"
|
||||||
|
else:
|
||||||
|
deckstring = ""
|
||||||
|
deckstring += "<table class=\"decktable "
|
||||||
|
with open("build/decks/" + deck + "/type") as thetype:
|
||||||
|
decktype = thetype.read()
|
||||||
|
deckstring += decktype + "\">\n"
|
||||||
|
if not fold:
|
||||||
|
deckstring += "<thead>\n <tr>\n <th colspan=\"5\">" + deck + " ["
|
||||||
|
if deckmastered(deck):
|
||||||
|
deckstring += datemastered(deck).strftime("%Y-%m-%d")
|
||||||
|
else:
|
||||||
|
deckstring += str(len(deckcards(deck))) + "/20"
|
||||||
|
deckstring += "]</th>\n </tr>\n</thead>\n"
|
||||||
|
deckstring += "<tbody>\n"
|
||||||
|
test = 1
|
||||||
|
while test < 21:
|
||||||
|
if test % 5 == 1:
|
||||||
|
deckstring += " <tr>\n"
|
||||||
|
deckstring += " <td>"
|
||||||
|
if test in deckcards(deck):
|
||||||
|
if test > 9:
|
||||||
|
deckstring += printcard(deck + str(test))
|
||||||
|
else:
|
||||||
|
deckstring += printcard(deck + "0" + str(test))
|
||||||
|
else:
|
||||||
|
deckstring += "<img src=\"/decks/" + deck + "/00.gif\" loading=\"lazy\">"
|
||||||
|
deckstring += "</td>\n"
|
||||||
|
if test % 5 == 0:
|
||||||
|
deckstring += " </tr>\n"
|
||||||
|
test += 1
|
||||||
|
if deckmastered(deck):
|
||||||
|
deckstring += " <tr>\n <td colspan=\"5\" align=\"center\"><img src=\"/decks/" + deck + "/master.gif\" title=\"mastered " + deck
|
||||||
|
try:
|
||||||
|
if deck in variables.firstmasteries:
|
||||||
|
deckstring += " (first)\" class=\"first"
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
deckstring += "\"><td>\n</tr>\n"
|
||||||
|
deckstring += "</tbody>\n</table>\n"
|
||||||
|
if fold:
|
||||||
|
deckstring += "</details>\n"
|
||||||
|
return deckstring
|
||||||
|
|
||||||
|
def filterwrite(page,colour=False,sigs=False):
|
||||||
|
filterstring = "<p class=\"typefilter\">"
|
||||||
|
if colour:
|
||||||
|
filterstring += "Filtered to <span class=\"" + colour + "\"><b>"
|
||||||
|
if colour == "gray":
|
||||||
|
if variables.british:
|
||||||
|
filterstring += "grey"
|
||||||
|
else:
|
||||||
|
filterstring += "gray"
|
||||||
|
else:
|
||||||
|
filterstring += colour
|
||||||
|
filterstring += "</b></span>. <a href=\"/" + page + "\">Show all</a>"
|
||||||
|
else:
|
||||||
|
filterstring += "Filter: <a href=\"/" + page + "/red\" title=\"red\">🔴</a> <a href=\"/" + page + "/orange\" title=\"orange\">🟠</a> <a href=\"/" + page + "/yellow\" title=\"yellow\">🟡</a> <a href=\"/" + page + "/green\" title=\"green\">🟢</a> <a href=\"/" + page + "/blue\" title=\"blue\">🔵</a> <a href=\"/" + page + "/purple\" title=\"purple\">🟣</a> <a href=\"/" + page + "/brown\" title=\"brown\">🟤</a> <a href=\"/" + page + "/gray\" title=\""
|
||||||
|
if variables.british:
|
||||||
|
filterstring += "grey"
|
||||||
|
else:
|
||||||
|
filterstring += "gray"
|
||||||
|
filterstring += "\">⚪</a> <a href=\"/" + page + "/special\" title=\"special\">✨</a>"
|
||||||
|
if sigs:
|
||||||
|
filterstring += " <a href=\"/" + page + "/sig\" title=\"sig\">✍</a>"
|
||||||
|
filterstring += "</p>\n"
|
||||||
|
return filterstring
|
||||||
|
|
||||||
|
def getpalettes():
|
||||||
|
palette = []
|
||||||
|
for event in log.log:
|
||||||
|
if event["event"] == "portfolio":
|
||||||
|
if cardtype(event["decks"][0] + "01") != cardtype(event["decks"][1] + "01"):
|
||||||
|
for deck in event["decks"]:
|
||||||
|
event[cardtype(deck + "01")] = deck
|
||||||
|
palette.append(event)
|
||||||
|
return palette
|
||||||
|
|
||||||
|
def getmonochrome():
|
||||||
|
monochrome = []
|
||||||
|
for event in log.log:
|
||||||
|
if event["event"] == "portfolio":
|
||||||
|
if cardtype(event["decks"][0] + "01") == cardtype(event["decks"][1] + "01"):
|
||||||
|
event["colour"] = cardtype(event["decks"][0] + "01")
|
||||||
|
event["decks"] = sorted(event["decks"])
|
||||||
|
monochrome.append(event)
|
||||||
|
return monochrome
|
||||||
|
|
||||||
|
def portfoliogen(portfolio,thetype,portnumber):
|
||||||
|
if thetype == "palette":
|
||||||
|
portstring = "<table class=\"palette portfolio\">\n<tbody>\n<tr>\n<td colspan=\"2\">" + variables.name.lower() + "</td>\n</tr>\n<tr>\n<td class=\"deck1\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["red"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["red"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n<td class=\"deck5\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["blue"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["blue"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n</tr>\n<tr>\n<td class=\"deck2\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["orange"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["orange"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n<td class=\"deck6\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["purple"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["purple"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n</tr>\n<tr>\n<td class=\"deck3\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["yellow"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["yellow"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n<td class=\"deck7\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["brown"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["brown"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n</tr>\n<tr>\n<td class=\"deck4\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["green"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["green"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n<td class=\"deck8\">"
|
||||||
|
try:
|
||||||
|
if deckmastered(portfolio["gray"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["gray"]
|
||||||
|
except:
|
||||||
|
if deckmastered(portfolio["special"]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["special"]
|
||||||
|
portstring += "</td>\n</tr>\n<tr>\n<td colspan=\"2\"><a href=\"" + portfolio["url"] + "\">palette portfolio "
|
||||||
|
if portnumber < 10:
|
||||||
|
portstring += "0" + str(portnumber)
|
||||||
|
else:
|
||||||
|
portstring += str(portnumber)
|
||||||
|
portstring += "</a></td>\n</tr>\n</tbody>\n</table>\n"
|
||||||
|
elif thetype == "monochrome":
|
||||||
|
portstring = "<table class=\"" + portfolio["colour"] + " portfolio\">\n<tbody>\n<tr>\n<td colspan=\"2\">" + variables.name.lower() + "</td>\n</tr>\n<tr>\n<td class=\"deck1\">"
|
||||||
|
if deckmastered(portfolio["decks"][0]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][0] + "</td>\n<td class=\"deck5\">"
|
||||||
|
if deckmastered(portfolio["decks"][4]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][4] + "</td>\n</tr>\n<tr>\n<td class=\"deck2\">"
|
||||||
|
if deckmastered(portfolio["decks"][1]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][1] + "</td>\n<td class=\"deck6\">"
|
||||||
|
if deckmastered(portfolio["decks"][5]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][5] + "</td>\n</tr>\n<tr>\n<td class=\"deck3\">"
|
||||||
|
if deckmastered(portfolio["decks"][2]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][2] + "</td>\n<td class=\"deck7\">"
|
||||||
|
if deckmastered(portfolio["decks"][6]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][6] + "</td>\n</tr>\n<tr>\n<td class=\"deck4\">"
|
||||||
|
if deckmastered(portfolio["decks"][3]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][3] + "</td>\n<td class=\"deck8\">"
|
||||||
|
if deckmastered(portfolio["decks"][7]):
|
||||||
|
portstring += "■"
|
||||||
|
else:
|
||||||
|
portstring += "□"
|
||||||
|
portstring += " " + portfolio["decks"][7] + "</td>\n</tr>\n<tr>\n<td colspan=\"2\"><a href=\"" + portfolio["url"] + "\">monochrome portfolio "
|
||||||
|
if portnumber < 10:
|
||||||
|
portstring += "0" + str(portnumber)
|
||||||
|
else:
|
||||||
|
portstring += str(portnumber)
|
||||||
|
portstring += "</a></td>\n</tr>\n</tbody>\n</table>\n"
|
||||||
|
return portstring
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,77 @@
|
|||||||
|
import datetime,os
|
||||||
|
import log,skel,tcgcore,variables
|
||||||
|
|
||||||
|
tradelist = []
|
||||||
|
previouscard = ""
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card[0:4] != "sig_":
|
||||||
|
if card == previouscard:
|
||||||
|
tradelist.append(card)
|
||||||
|
else:
|
||||||
|
if not tcgcore.deckmastered(card[:-2]):
|
||||||
|
if not tcgcore.collecting(card[:-2]):
|
||||||
|
mass = False
|
||||||
|
for series in variables.masscollect:
|
||||||
|
try:
|
||||||
|
if card in variables.masscollect[series]["singles"]:
|
||||||
|
mass = True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if mass == False:
|
||||||
|
tradelist.append(card)
|
||||||
|
previouscard = card
|
||||||
|
siglist = []
|
||||||
|
for card in tcgcore.ownedcards():
|
||||||
|
if card == "sig_" + variables.name.lower():
|
||||||
|
siglist.append(card)
|
||||||
|
if variables.keepsig == True:
|
||||||
|
if len(siglist) > 0:
|
||||||
|
siglist.remove(siglist[0])
|
||||||
|
|
||||||
|
def tradegen(colour=False):
|
||||||
|
if not os.path.isdir("build/trade"):
|
||||||
|
os.mkdir("build/trade")
|
||||||
|
if colour:
|
||||||
|
if not os.path.isdir("build/trade/" + colour):
|
||||||
|
os.mkdir("build/trade/" + colour)
|
||||||
|
thefile = "build/trade/" + colour + "/index.html"
|
||||||
|
else:
|
||||||
|
thefile = "build/trade/index.html"
|
||||||
|
if os.path.exists(thefile):
|
||||||
|
os.remove(thefile)
|
||||||
|
skel.headerwrite(thefile,"trade")
|
||||||
|
content = open(thefile,"a")
|
||||||
|
content.write("<h1>available for trade</h1>\n")
|
||||||
|
content.write(tcgcore.filterwrite("trade",colour,True) + "<p class=\"tradeterms\">")
|
||||||
|
if len(variables.tradestatement) > 0:
|
||||||
|
content.write(variables.tradestatement + " ")
|
||||||
|
content.write("Trade cards <a href=\"" + variables.tradepost + "\">here</a></p>\n<p>")
|
||||||
|
thetradelist = []
|
||||||
|
if colour:
|
||||||
|
if colour == "sig":
|
||||||
|
for sig in siglist:
|
||||||
|
thetradelist.append(sig)
|
||||||
|
else:
|
||||||
|
for card in tradelist:
|
||||||
|
if tcgcore.cardtype(card) == colour:
|
||||||
|
thetradelist.append(card)
|
||||||
|
else:
|
||||||
|
for card in tradelist:
|
||||||
|
thetradelist.append(card)
|
||||||
|
for sig in siglist:
|
||||||
|
thetradelist.append(sig)
|
||||||
|
content.write("<textarea readonly>" + ", ".join(thetradelist) + "</textarea>\n<p>")
|
||||||
|
for card in thetradelist:
|
||||||
|
content.write(tcgcore.printcard(card))
|
||||||
|
content.write("</p>\n")
|
||||||
|
content.close()
|
||||||
|
skel.footerwrite(thefile)
|
||||||
|
|
||||||
|
def tradeall():
|
||||||
|
tradegen()
|
||||||
|
for type in tcgcore.typelist:
|
||||||
|
tradegen(type)
|
||||||
|
tradegen("sig")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
tradeall()
|
Loading…
Reference in New Issue