You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.6 KiB
Python
79 lines
2.6 KiB
Python
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():
|
|
if card[:-2] in massdecks[series]:
|
|
ownedlist.append(card)
|
|
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 len(massowned[series]) == len(variables.masscollect[series]) * 20:
|
|
content.write("complete")
|
|
else:
|
|
content.write(str(len(massowned[series])) + "/" + str(len(variables.masscollect[series]) * 20))
|
|
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]:
|
|
themassdecks.append(card[:-2])
|
|
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()
|