diff --git a/build/assets/crayons/crayon1.gif b/build/assets/crayons/crayon1.gif new file mode 100644 index 0000000..68595c9 Binary files /dev/null and b/build/assets/crayons/crayon1.gif differ diff --git a/build/assets/crayons/crayon2.gif b/build/assets/crayons/crayon2.gif new file mode 100644 index 0000000..3e45dae Binary files /dev/null and b/build/assets/crayons/crayon2.gif differ diff --git a/build/assets/crayons/crayon3.gif b/build/assets/crayons/crayon3.gif new file mode 100644 index 0000000..8dac1f2 Binary files /dev/null and b/build/assets/crayons/crayon3.gif differ diff --git a/build/assets/crayons/crayon4.gif b/build/assets/crayons/crayon4.gif new file mode 100644 index 0000000..8de65e8 Binary files /dev/null and b/build/assets/crayons/crayon4.gif differ diff --git a/build/assets/crayons/crayon5.gif b/build/assets/crayons/crayon5.gif new file mode 100644 index 0000000..e557d00 Binary files /dev/null and b/build/assets/crayons/crayon5.gif differ diff --git a/build/assets/crayons/crayon6.gif b/build/assets/crayons/crayon6.gif new file mode 100644 index 0000000..93f07e4 Binary files /dev/null and b/build/assets/crayons/crayon6.gif differ diff --git a/build/assets/crayons/crayon7.gif b/build/assets/crayons/crayon7.gif new file mode 100644 index 0000000..22c5335 Binary files /dev/null and b/build/assets/crayons/crayon7.gif differ diff --git a/build/assets/crayons/crayon8.gif b/build/assets/crayons/crayon8.gif new file mode 100644 index 0000000..2fead9a Binary files /dev/null and b/build/assets/crayons/crayon8.gif differ diff --git a/build/style.css b/build/style.css index 17a6ec6..7d690bb 100644 --- a/build/style.css +++ b/build/style.css @@ -122,3 +122,11 @@ span.cardname { font-family: monospace; white-space: nowrap; } + +img.crayon { + vertical-align: middle; +} + +table.level { + display: inline-block; +} diff --git a/collectinggen.py b/collectinggen.py index 6241279..4ee916f 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -1,5 +1,5 @@ import datetime,os -import log,variables,skel +import log,variables,skel,tcgcore def collectinggen(): if not os.path.isdir("build/collecting"): @@ -10,235 +10,36 @@ def collectinggen(): skel.headerwrite(thefile,"collecting") content = open(thefile,"a") content.write("

decks in progress

\n") - ownedcards = [] decksofinterest = [] for event in log.log: - for card in event["received"]: - ownedcards.append(card) - decksofinterest.append(card[:-2]) - ownedcards = sorted(ownedcards) + try: + for card in event["received"]: + decksofinterest.append(card[:-2]) + except: + pass decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) highpriority = [] medpriority = [] + lowpriority = [] for deck in decksofinterest: if deck in variables.highpriority: highpriority.append(deck) - else: + elif deck in variables.medpriority: medpriority.append(deck) + else: + lowpriority.append(deck) if len(highpriority) > 0: content.write("

High priority

\n") for deck in highpriority: - with open("build/decks/" + deck + "/type") as thetype: - decktype = thetype.read() - cardcount = sum(deck in card for card in ownedcards) - content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") + content.write(tcgcore.printdeck(deck)) if len(medpriority) > 0: content.write("

Medium priority

\n") for deck in medpriority: - with open("build/decks/" + deck + "/type") as thetype: - decktype = thetype.read() - cardcount = sum(deck in card for card in ownedcards) - content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") + content.write(tcgcore.printdeck(deck)) + if len(lowpriority) > 0: + content.write("

Low priority

\n") + for deck in lowpriority: + content.write(tcgcore.printdeck(deck)) content.close() skel.footerwrite(thefile) diff --git a/generate.py b/generate.py index 6ec83ff..d458086 100644 --- a/generate.py +++ b/generate.py @@ -1,7 +1,8 @@ -import indexgen,collectinggen,ownedgen,wantedgen,loggen +import indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen indexgen.indexgen() collectinggen.collectinggen() ownedgen.ownedgen() wantedgen.wantedgen() loggen.loggen() +levelsgen.levelsgen() diff --git a/indexgen.py b/indexgen.py index f0daa5a..7125f71 100644 --- a/indexgen.py +++ b/indexgen.py @@ -1,5 +1,5 @@ import datetime,os,re -import log,skel,variables +import log,skel,variables,tcgcore def indexgen(): if os.path.exists("build/index.html"): @@ -7,142 +7,194 @@ def indexgen(): thefile = "build/index.html" skel.headerwrite(thefile,"index") content = open(thefile,"a") - cardstotal = 0 - for event in log.log: - try: - cardstotal += len(event["received"]) - except: - pass firstdate = log.log[0]["date"] - if cardstotal > 14400: + if len(tcgcore.ownedcards()) > 14400: rankcode = "rainbow" - extra = cardstotal - 14400 + extra = len(tcgcore.ownedcards()) - 14400 plusranks = int(extra / 300) if plusranks > 0: rank = "rainbow + " + str(plusranks) else: rank = "rainbow" else: - if cardstotal > 14100: + if len(tcgcore.ownedcards()) > 14100: rank = "himalayan" - elif cardstotal > 13800: + elif len(tcgcore.ownedcards()) > 13800: rank = "puma" - elif cardstotal > 13500: + elif len(tcgcore.ownedcards()) > 13500: rank = "chartreux" - elif cardstotal > 13500: + elif len(tcgcore.ownedcards()) > 13500: rank = "russian blue" - elif cardstotal > 12900: + elif len(tcgcore.ownedcards()) > 12900: rank = "panther" - elif cardstotal > 12600: + elif len(tcgcore.ownedcards()) > 12600: rank = "cheetah" - elif cardstotal > 12300: + elif len(tcgcore.ownedcards()) > 12300: rank = "tiger" - elif cardstotal > 12000: + elif len(tcgcore.ownedcards()) > 12000: rank = "lion" - elif cardstotal > 11700: + elif len(tcgcore.ownedcards()) > 11700: rank = "metal" - elif cardstotal > 11400: + elif len(tcgcore.ownedcards()) > 11400: rank = "ground" - elif cardstotal > 11100: + elif len(tcgcore.ownedcards()) > 11100: rank = "darkness" - elif cardstotal > 10800: + elif len(tcgcore.ownedcards()) > 10800: rank = "water" - elif cardstotal > 10500: + elif len(tcgcore.ownedcards()) > 10500: rank = "nature" - elif cardstotal > 10200: + elif len(tcgcore.ownedcards()) > 10200: rank = "light" - elif cardstotal > 9900: + elif len(tcgcore.ownedcards()) > 9900: rank = "wind" - elif cardstotal > 9600: + elif len(tcgcore.ownedcards()) > 9600: rank = "fire" - elif cardstotal > 9300: + elif len(tcgcore.ownedcards()) > 9300: rank = "mercury" - elif cardstotal > 9000: + elif len(tcgcore.ownedcards()) > 9000: rank = "jupiter" - elif cardstotal > 8700: + elif len(tcgcore.ownedcards()) > 8700: rank = "uranus" - elif cardstotal > 8400: + elif len(tcgcore.ownedcards()) > 8400: rank = "neptune" - elif cardstotal > 8100: + elif len(tcgcore.ownedcards()) > 8100: rank = "earth" - elif cardstotal > 7800: + elif len(tcgcore.ownedcards()) > 7800: rank = "venus" - elif cardstotal > 7500: + elif len(tcgcore.ownedcards()) > 7500: rank = "saturn" - elif cardstotal > 7200: + elif len(tcgcore.ownedcards()) > 7200: rank = "mars" - elif cardstotal > 6900: + elif len(tcgcore.ownedcards()) > 6900: rank = "magnolia" - elif cardstotal > 6600: + elif len(tcgcore.ownedcards()) > 6600: rank = "chocolate cosmos" - elif cardstotal > 6300: + elif len(tcgcore.ownedcards()) > 6300: rank = "lilac" - elif cardstotal > 6000: + elif len(tcgcore.ownedcards()) > 6000: rank = "hydrangea" - elif cardstotal > 5700: + elif len(tcgcore.ownedcards()) > 5700: rank = "clover" - elif cardstotal > 5400: + elif len(tcgcore.ownedcards()) > 5400: rank = "daffodil" - elif cardstotal > 5100: + elif len(tcgcore.ownedcards()) > 5100: rank = "tiger lily" - elif cardstotal > 4800: + elif len(tcgcore.ownedcards()) > 4800: rank = "sakura" - elif cardstotal > 4500: + elif len(tcgcore.ownedcards()) > 4500: rank = "silver" - elif cardstotal > 4200: + elif len(tcgcore.ownedcards()) > 4200: rank = "bronze" - elif cardstotal > 3900: + elif len(tcgcore.ownedcards()) > 3900: rank = "amethyst" - elif cardstotal > 3600: + elif len(tcgcore.ownedcards()) > 3600: rank = "sapphire" - elif cardstotal > 3300: + elif len(tcgcore.ownedcards()) > 3300: rank = "emerald" - elif cardstotal > 3000: + elif len(tcgcore.ownedcards()) > 3000: rank = "gold" - elif cardstotal > 2700: + elif len(tcgcore.ownedcards()) > 2700: rank = "amber" - elif cardstotal > 2400: + elif len(tcgcore.ownedcards()) > 2400: rank = "ruby" - elif cardstotal > 2200: + elif len(tcgcore.ownedcards()) > 2200: rank = "dragon fruit" - elif cardstotal > 2000: + elif len(tcgcore.ownedcards()) > 2000: rank = "apricot" - elif cardstotal > 1800: + elif len(tcgcore.ownedcards()) > 1800: rank = "grape" - elif cardstotal > 1600: + elif len(tcgcore.ownedcards()) > 1600: rank = "blueberry" - elif cardstotal > 1400: + elif len(tcgcore.ownedcards()) > 1400: rank = "lime" - elif cardstotal > 1200: + elif len(tcgcore.ownedcards()) > 1200: rank = "lemon" - elif cardstotal > 1000: + elif len(tcgcore.ownedcards()) > 1000: rank = "tangerine" - elif cardstotal > 800: + elif len(tcgcore.ownedcards()) > 800: rank = "strawberry" - elif cardstotal > 700: + elif len(tcgcore.ownedcards()) > 700: rank = "gray" - elif cardstotal > 600: + elif len(tcgcore.ownedcards()) > 600: rank = "brown" - elif cardstotal > 500: + elif len(tcgcore.ownedcards()) > 500: rank = "purple" - elif cardstotal > 400: + elif len(tcgcore.ownedcards()) > 400: rank = "blue" - elif cardstotal > 300: + elif len(tcgcore.ownedcards()) > 300: rank = "green" - elif cardstotal > 200: + elif len(tcgcore.ownedcards()) > 200: rank = "yellow" - elif cardstotal > 100: + elif len(tcgcore.ownedcards()) > 100: rank = "orange" else: rank = "red" rankcode = re.sub(" ","",rank) - content.write("\n\n") + content.write("\n\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("\n\n\n") + if crayred > 0: + content.write("\n") + if crayorange > 0: + content.write("\n") + if crayyellow > 0: + content.write("\n") + if craygreen > 0: + content.write("\n") + if crayblue > 0: + content.write("\n") + if craypurple > 0: + content.write("\n") + if craybrown > 0: + content.write("\n") + if craygrey > 0: + content.write("\n") + content.write("\n\n
× " + str(crayred) + " × " + str(crayorange) + " × " + str(crayyellow) + " × " + str(craygreen) + " × " + str(crayblue) + " × " + str(craypurple) + " × " + str(craybrown) + " × " + str(craygrey) + "
\n") if len(variables.faves) > 0: content.write("

faves

\n

") for card in variables.faves: - deck = card[:-2] - cardid = card[-2:] - content.write("") + content.write(tcgcore.printcard(card)) content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/levelsgen.py b/levelsgen.py new file mode 100644 index 0000000..3bf34c3 --- /dev/null +++ b/levelsgen.py @@ -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("

levels

\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("\n\n\n\n\n\n\n\n\n
" + firstdate.strftime("%Y-%m-%d") + "
\n") + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[4500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[4800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[14100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[14400].strftime("%Y-%m-%d") + "
\n") + except: + pass + content.close() + skel.footerwrite(thefile) + +if __name__ == "__main__": + levelsgen() diff --git a/loggen.py b/loggen.py index 56d36d8..f08b308 100644 --- a/loggen.py +++ b/loggen.py @@ -1,5 +1,5 @@ import datetime,os -import log,skel +import log,skel,tcgcore def loggen(): if not os.path.isdir("build/log"): @@ -12,36 +12,85 @@ def loggen(): content.write("

log

\n") thelog = log.log[::-1] for event in thelog: - content.write("

" + event["date"].strftime("%Y-%m-%d") + ": Received ") - receivedlist = sorted(event["received"]) - for card in receivedlist: - with open("build/decks/" + card[:-2] + "/type") as thetype: - cardtype = thetype.read() - content.write("") - 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 + "") - if receivedlist.index(card) == len(receivedlist) - 1: - content.write(" ") - else: - content.write(", ") - content.write(" [" + event["event"] + "].

\n") + content.write("

" + event["date"].strftime("%Y-%m-%d") + " [" + event["event"] + "]: ") + try: + if event["received"]: + content.write("Received ") + receivedlist = sorted(event["received"]) + for card in receivedlist: + content.write(tcgcore.cardtext(card)) + if receivedlist.index(card) != len(receivedlist) - 1: + content.write(", ") + content.write(".") + except: + pass + try: + if event["crayons"]: + crayontypes = len(event["crayons"]) + content.write("Gained crayons: ") + try: + redno = event["crayons"]["red"] + content.write(str(redno) + " red") + if list(event["crayons"])[-1] != "red": + content.write(", ") + except: + pass + try: + orangeno = event["crayons"]["orange"] + content.write(str(orangeno) + " orange") + if list(event["crayons"])[-1] != "orange": + content.write(", ") + except: + 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("

\n") content.close() skel.footerwrite(thefile) diff --git a/ownedgen.py b/ownedgen.py index cc0655a..cb9aeb0 100644 --- a/ownedgen.py +++ b/ownedgen.py @@ -1,5 +1,5 @@ import datetime,os -import log,skel +import log,skel,tcgcore def ownedgen(): if not os.path.isdir("build/owned"): @@ -9,16 +9,9 @@ def ownedgen(): thefile = "build/owned/index.html" skel.headerwrite(thefile,"owned") content = open(thefile,"a") - cards = [] - for event in log.log: - for card in event["received"]: - cards.append(card) - cards = sorted(cards) content.write("

owned cards

\n

") - for card in cards: - deck = card[:-2] - cardid = card[-2:] - content.write("") + for card in tcgcore.ownedcards(): + content.write(tcgcore.printcard(card)) content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/skel.py b/skel.py index 201a7c0..78cc0cc 100644 --- a/skel.py +++ b/skel.py @@ -2,7 +2,7 @@ import variables def headerwrite(thefile,pagename): header = open(thefile,"a") - header.write("\n\n \n \n \n \n TCG :: " + pagename + "\n \n \n \n