From aaa95045475cf5cbecd52ae38864beb30cffef98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?tr=C3=A9meur?=
Date: Thu, 31 Oct 2024 23:51:10 +0000
Subject: [PATCH] Add signatures
---
build/decks/sigs/.gitkeep | 0
collectinggen.py | 3 ++-
indexgen.py | 13 ++++++++--
loggen.py | 9 ++++++-
ownedgen.py | 3 ++-
tcgcore.py | 54 ++++++++++++++++++++++-----------------
variables-template.py | 1 +
wantedgen.py | 8 +++---
8 files changed, 57 insertions(+), 34 deletions(-)
create mode 100644 build/decks/sigs/.gitkeep
diff --git a/build/decks/sigs/.gitkeep b/build/decks/sigs/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/collectinggen.py b/collectinggen.py
index 4ee916f..ef64373 100644
--- a/collectinggen.py
+++ b/collectinggen.py
@@ -14,7 +14,8 @@ def collectinggen():
for event in log.log:
try:
for card in event["received"]:
- decksofinterest.append(card[:-2])
+ if card[0:4] != "sig_":
+ decksofinterest.append(card[:-2])
except:
pass
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
diff --git a/indexgen.py b/indexgen.py
index 7125f71..a7eaae8 100644
--- a/indexgen.py
+++ b/indexgen.py
@@ -130,7 +130,7 @@ def indexgen():
else:
rank = "red"
rankcode = re.sub(" ","",rank)
- content.write("\n\n- " + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")
\n- started
" + firstdate.strftime("%Y-%m-%d") + "
\n- last updated
" + datetime.datetime.today().strftime("%Y-%m-%d") + "
\n- code under construction
\n
\n")
+ content.write("" + tcgcore.printcard("sig_" + variables.name.lower()) + "\n\n- " + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")
\n- started
" + firstdate.strftime("%Y-%m-%d") + "
\n- last updated
" + datetime.datetime.today().strftime("%Y-%m-%d") + "
\n- code under construction
\n
\n")
crayred = 0
crayorange = 0
crayyellow = 0
@@ -191,11 +191,20 @@ def indexgen():
if craygrey > 0:
content.write(" × " + str(craygrey) + " | \n")
content.write("\n\n\n")
+ sigs = []
+ for card in tcgcore.ownedcards():
+ if card[0:4] == "sig_":
+ sigs.append(card)
+ if len(sigs) > 0:
+ content.write("signatures
\n")
+ for card in sigs:
+ content.write(tcgcore.printcard(card))
+ content.write("
\n")
if len(variables.faves) > 0:
content.write("faves
\n")
for card in variables.faves:
content.write(tcgcore.printcard(card))
- content.write("
\n")
+ content.write("
\n")
content.close()
skel.footerwrite(thefile)
diff --git a/loggen.py b/loggen.py
index 14b8fc4..84c390c 100644
--- a/loggen.py
+++ b/loggen.py
@@ -32,11 +32,18 @@ def loggen():
if event["received"]:
content.write("Received ")
receivedlist = sorted(event["received"])
+ position = 1
for card in receivedlist:
content.write(tcgcore.cardtext(card))
- if receivedlist.index(card) != len(receivedlist) - 1:
+ if len(receivedlist) != position:
content.write(", ")
+ position += 1
content.write(".")
+ try:
+ if event["crayons"]:
+ content.write(" ")
+ except:
+ pass
except:
pass
try:
diff --git a/ownedgen.py b/ownedgen.py
index cb9aeb0..25109d6 100644
--- a/ownedgen.py
+++ b/ownedgen.py
@@ -11,7 +11,8 @@ def ownedgen():
content = open(thefile,"a")
content.write("owned cards
\n")
for card in tcgcore.ownedcards():
- content.write(tcgcore.printcard(card))
+ if card[0:4] != "sig_":
+ content.write(tcgcore.printcard(card))
content.write("
\n")
content.close()
skel.footerwrite(thefile)
diff --git a/tcgcore.py b/tcgcore.py
index 83f4837..35ad198 100644
--- a/tcgcore.py
+++ b/tcgcore.py
@@ -12,33 +12,39 @@ def ownedcards():
def cardtext(card):
cardtext = ""
- with open("build/decks/" + card[:-2] + "/type") as thetype:
- cardtype = thetype.read()
- if cardtype == "red":
- cardtext += "🔴"
- elif cardtype == "orange":
- cardtext += "🟠"
- elif cardtype == "yellow":
- cardtext += "🟡"
- elif cardtype == "green":
- cardtext += "🟢"
- elif cardtype == "blue":
- cardtext += "🔵"
- elif cardtype == "purple":
- cardtext += "🟣"
- elif cardtype == "brown":
- cardtext += "🟤"
- elif cardtype == "gray":
- cardtext += "⚪"
- elif cardtype == "special":
- cardtext += "✨"
- cardtext += card + ""
+ if card[0:4] == "sig_":
+ cardtext += "✍" + card + ""
+ else:
+ with open("build/decks/" + card[:-2] + "/type") as thetype:
+ cardtype = thetype.read()
+ if cardtype == "red":
+ cardtext += "🔴"
+ elif cardtype == "orange":
+ cardtext += "🟠"
+ elif cardtype == "yellow":
+ cardtext += "🟡"
+ elif cardtype == "green":
+ cardtext += "🟢"
+ elif cardtype == "blue":
+ cardtext += "🔵"
+ elif cardtype == "purple":
+ cardtext += "🟣"
+ elif cardtype == "brown":
+ cardtext += "🟤"
+ elif cardtype == "gray":
+ cardtext += "⚪"
+ elif cardtype == "special":
+ cardtext += "✨"
+ cardtext += card + ""
return cardtext
def printcard(card):
- deck = card[:-2]
- cardid = card[-2:]
- return ""
+ if card[0:4] == "sig_":
+ return ""
+ else:
+ deck = card[:-2]
+ cardid = card[-2:]
+ return ""
def printdeck(deck):
deckstring = "wanted cards\n")
- ownedcards = []
decksofinterest = []
for event in log.log:
try:
for card in event["received"]:
- ownedcards.append(card)
- decksofinterest.append(card[:-2])
+ if card[0:4] != "sig_":
+ decksofinterest.append(card[:-2])
except:
pass
- ownedcards = sorted(ownedcards)
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
wantedcards = []
for deck in decksofinterest:
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 not in ownedcards:
+ if combined not in tcgcore.ownedcards():
wantedcards.append(combined)
highpriority = []
medpriority = []