Add signatures

master
trémeur 2 months ago
parent 06164ae6cf
commit aaa9504547

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

@ -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,11 +191,20 @@ 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:
content.write(tcgcore.printcard(card))
content.write("</p>\n")
content.write("</p>\n")
content.close()
skel.footerwrite(thefile)

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

@ -12,33 +12,39 @@ def ownedcards():
def cardtext(card):
cardtext = "<span class=\"cardname\">"
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 + "</span>"
if card[0:4] == "sig_":
cardtext += "" + card + "</span>"
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 + "</span>"
return cardtext
def printcard(card):
deck = card[:-2]
cardid = card[-2:]
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + 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 + "\">"
def printdeck(deck):
deckstring = "<table class=\"decktable "

@ -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)
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 = []

Loading…
Cancel
Save