Add signatures

master
trémeur 3 weeks ago
parent 06164ae6cf
commit aaa9504547

@ -14,6 +14,7 @@ def collectinggen():
for event in log.log:
try:
for card in event["received"]:
if card[0:4] != "sig_":
decksofinterest.append(card[:-2])
except:
pass

@ -130,7 +130,7 @@ def indexgen():
else:
rank = "red"
rankcode = re.sub(" ","",rank)
content.write("<a href=\"/levels\"><img src=\"/assets/levels/" + rankcode + ".gif\"></a>\n<ul>\n<li>" + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n")
content.write("<a href=\"/levels\"><img src=\"/assets/levels/" + rankcode + ".gif\"></a>" + tcgcore.printcard("sig_" + variables.name.lower()) + "\n<ul>\n<li>" + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n")
crayred = 0
crayorange = 0
crayyellow = 0
@ -191,6 +191,15 @@ def indexgen():
if craygrey > 0:
content.write("<td><img src=\"/assets/crayons/crayon8.gif\" class=\"crayon\"> × " + str(craygrey) + "</td>\n")
content.write("</tr>\n</tbody>\n</table>\n")
sigs = []
for card in tcgcore.ownedcards():
if card[0:4] == "sig_":
sigs.append(card)
if len(sigs) > 0:
content.write("<h2>signatures</h2>\n<p>")
for card in sigs:
content.write(tcgcore.printcard(card))
content.write("</p>\n")
if len(variables.faves) > 0:
content.write("<h2>faves</h2>\n<p>")
for card in variables.faves:

@ -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:

@ -11,6 +11,7 @@ def ownedgen():
content = open(thefile,"a")
content.write("<h1>owned cards</h1>\n<p>")
for card in tcgcore.ownedcards():
if card[0:4] != "sig_":
content.write(tcgcore.printcard(card))
content.write("</p>\n")
content.close()

@ -12,6 +12,9 @@ def ownedcards():
def cardtext(card):
cardtext = "<span class=\"cardname\">"
if card[0:4] == "sig_":
cardtext += "" + card + "</span>"
else:
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()
if cardtype == "red":
@ -36,6 +39,9 @@ def cardtext(card):
return cardtext
def printcard(card):
if card[0:4] == "sig_":
return "<img src=\"/decks/sigs/" + card[4:] + ".gif\" title=\"" + card + "\">"
else:
deck = card[:-2]
cardid = card[-2:]
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">"

@ -1,3 +1,4 @@
name = "your name"
highpriority = ["deckname","nameofadeck"]
medpriority = ["deckname","nameofdeck"]
tradepost = "URL"

@ -10,23 +10,21 @@ def wantedgen():
skel.headerwrite(thefile,"wanted")
content = open(thefile,"a")
content.write("<h1>wanted cards</h1>\n")
ownedcards = []
decksofinterest = []
for event in log.log:
try:
for card in event["received"]:
ownedcards.append(card)
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 = []

Loading…
Cancel
Save