From 457cf368b70483f28f8ccac0f19a79a20f08f86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Fri, 1 Nov 2024 08:29:52 +0000 Subject: [PATCH] Account for card losses, add more tooltips, add player name --- collectinggen.py | 10 ++-- indexgen.py | 23 +++++---- levelsgen.py | 126 ++++++++++++++++++++++++----------------------- loggen.py | 22 +++++++++ skel.py | 2 +- tcgcore.py | 32 +++++++----- wantedgen.py | 10 ++-- 7 files changed, 128 insertions(+), 97 deletions(-) diff --git a/collectinggen.py b/collectinggen.py index ef64373..057dad4 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -11,13 +11,9 @@ def collectinggen(): content = open(thefile,"a") content.write("

decks in progress

\n") decksofinterest = [] - for event in log.log: - try: - for card in event["received"]: - if card[0:4] != "sig_": - decksofinterest.append(card[:-2]) - except: - pass + for card in tcgcore.ownedcards(): + if card[0:4] != "sig_": + decksofinterest.append(card[:-2]) decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) highpriority = [] medpriority = [] diff --git a/indexgen.py b/indexgen.py index a7eaae8..bcac4e0 100644 --- a/indexgen.py +++ b/indexgen.py @@ -130,7 +130,7 @@ def indexgen(): else: rank = "red" rankcode = re.sub(" ","",rank) - content.write("" + tcgcore.printcard("sig_" + variables.name.lower()) + "\n\n") + content.write("" + tcgcore.printcard("sig_" + variables.name.lower()) + "\n\n") crayred = 0 crayorange = 0 crayyellow = 0 @@ -175,21 +175,26 @@ def indexgen(): if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0: content.write("\n\n\n") if crayred > 0: - content.write("\n") + content.write("\n") if crayorange > 0: - content.write("\n") + content.write("\n") if crayyellow > 0: - content.write("\n") + content.write("\n") if craygreen > 0: - content.write("\n") + content.write("\n") if crayblue > 0: - content.write("\n") + content.write("\n") if craypurple > 0: - content.write("\n") + content.write("\n") if craybrown > 0: - content.write("\n") + content.write("\n") if craygrey > 0: - content.write("\n") + content.write("\n") content.write("\n\n
× " + str(crayred) + " × " + str(crayred) + " × " + str(crayorange) + " × " + str(crayorange) + " × " + str(crayyellow) + " × " + str(crayyellow) + " × " + str(craygreen) + " × " + str(craygreen) + " × " + str(crayblue) + " × " + str(crayblue) + " × " + str(craypurple) + " × " + str(craypurple) + " × " + str(craybrown) + " × " + str(craybrown) + " × " + str(craygrey) + " × " + str(craygrey) + "
\n") sigs = [] for card in tcgcore.ownedcards(): diff --git a/levelsgen.py b/levelsgen.py index 3bf34c3..85df0ed 100644 --- a/levelsgen.py +++ b/levelsgen.py @@ -10,239 +10,241 @@ def levelsgen(): skel.headerwrite(thefile,"levels") content = open(thefile,"a") content.write("

levels

\n") - datecard = {} - cardno = -1 + dates = [] for event in log.log: try: for card in event["received"]: - cardno += 1 - datecard[cardno] = event["date"] + dates.append(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: + for card in event["lost"]: + dates.remove(dates[-1]) + except: + pass + content.write("\n\n\n\n\n\n\n\n\n
" + dates[0].strftime("%Y-%m-%d") + "
\n") try: - content.write("\n\n\n\n\n\n\n\n\n
" + datecard[100].strftime("%Y-%m-%d") + "
\n") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[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") + content.write("\n\n\n\n\n\n\n\n\n
" + dates[14400].strftime("%Y-%m-%d") + "
\n") except: pass content.close() diff --git a/loggen.py b/loggen.py index 84c390c..a4c3bcb 100644 --- a/loggen.py +++ b/loggen.py @@ -39,6 +39,28 @@ def loggen(): 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(" ") diff --git a/skel.py b/skel.py index 78cc0cc..57eb4f7 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 \n TCG :: " + pagename + "\n \n \n \n