Add signatures

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

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

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

@ -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,7 +11,8 @@ 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():
content.write(tcgcore.printcard(card)) if card[0:4] != "sig_":
content.write(tcgcore.printcard(card))
content.write("</p>\n") content.write("</p>\n")
content.close() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

@ -12,33 +12,39 @@ def ownedcards():
def cardtext(card): def cardtext(card):
cardtext = "<span class=\"cardname\">" cardtext = "<span class=\"cardname\">"
with open("build/decks/" + card[:-2] + "/type") as thetype: if card[0:4] == "sig_":
cardtype = thetype.read() cardtext += "" + card + "</span>"
if cardtype == "red": else:
cardtext += "🔴" with open("build/decks/" + card[:-2] + "/type") as thetype:
elif cardtype == "orange": cardtype = thetype.read()
cardtext += "🟠" if cardtype == "red":
elif cardtype == "yellow": cardtext += "🔴"
cardtext += "🟡" elif cardtype == "orange":
elif cardtype == "green": cardtext += "🟠"
cardtext += "🟢" elif cardtype == "yellow":
elif cardtype == "blue": cardtext += "🟡"
cardtext += "🔵" elif cardtype == "green":
elif cardtype == "purple": cardtext += "🟢"
cardtext += "🟣" elif cardtype == "blue":
elif cardtype == "brown": cardtext += "🔵"
cardtext += "🟤" elif cardtype == "purple":
elif cardtype == "gray": cardtext += "🟣"
cardtext += "" elif cardtype == "brown":
elif cardtype == "special": cardtext += "🟤"
cardtext += "" elif cardtype == "gray":
cardtext += card + "</span>" cardtext += ""
elif cardtype == "special":
cardtext += ""
cardtext += card + "</span>"
return cardtext return cardtext
def printcard(card): def printcard(card):
deck = card[:-2] if card[0:4] == "sig_":
cardid = card[-2:] return "<img src=\"/decks/sigs/" + card[4:] + ".gif\" title=\"" + card + "\">"
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">" else:
deck = card[:-2]
cardid = card[-2:]
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">"
def printdeck(deck): def printdeck(deck):
deckstring = "<table class=\"decktable " deckstring = "<table class=\"decktable "

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