Add signatures

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

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

@ -130,7 +130,7 @@ def indexgen():
else: else:
rank = "red" rank = "red"
rankcode = re.sub(" ","",rank) 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 crayred = 0
crayorange = 0 crayorange = 0
crayyellow = 0 crayyellow = 0
@ -191,6 +191,15 @@ def indexgen():
if craygrey > 0: if craygrey > 0:
content.write("<td><img src=\"/assets/crayons/crayon8.gif\" class=\"crayon\"> × " + str(craygrey) + "</td>\n") content.write("<td><img src=\"/assets/crayons/crayon8.gif\" class=\"crayon\"> × " + str(craygrey) + "</td>\n")
content.write("</tr>\n</tbody>\n</table>\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: if len(variables.faves) > 0:
content.write("<h2>faves</h2>\n<p>") content.write("<h2>faves</h2>\n<p>")
for card in variables.faves: for card in variables.faves:

@ -32,11 +32,18 @@ def loggen():
if event["received"]: if event["received"]:
content.write("Received ") content.write("Received ")
receivedlist = sorted(event["received"]) receivedlist = sorted(event["received"])
position = 1
for card in receivedlist: for card in receivedlist:
content.write(tcgcore.cardtext(card)) content.write(tcgcore.cardtext(card))
if receivedlist.index(card) != len(receivedlist) - 1: if len(receivedlist) != position:
content.write(", ") content.write(", ")
position += 1
content.write(".") content.write(".")
try:
if event["crayons"]:
content.write(" ")
except:
pass
except: except:
pass pass
try: try:

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

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

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

@ -10,23 +10,21 @@ def wantedgen():
skel.headerwrite(thefile,"wanted") skel.headerwrite(thefile,"wanted")
content = open(thefile,"a") content = open(thefile,"a")
content.write("<h1>wanted cards</h1>\n") content.write("<h1>wanted cards</h1>\n")
ownedcards = []
decksofinterest = [] decksofinterest = []
for event in log.log: for event in log.log:
try: try:
for card in event["received"]: for card in event["received"]:
ownedcards.append(card) if card[0:4] != "sig_":
decksofinterest.append(card[:-2]) decksofinterest.append(card[:-2])
except: except:
pass pass
ownedcards = sorted(ownedcards)
decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
wantedcards = [] wantedcards = []
for deck in decksofinterest: 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"] 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: for card in wantedlist:
combined = deck + card combined = deck + card
if combined not in ownedcards: if combined not in tcgcore.ownedcards():
wantedcards.append(combined) wantedcards.append(combined)
highpriority = [] highpriority = []
medpriority = [] medpriority = []

Loading…
Cancel
Save