|
|
|
import log,variables
|
|
|
|
|
|
|
|
def ownedcards():
|
|
|
|
ownedcards = []
|
|
|
|
for event in log.log:
|
|
|
|
try:
|
|
|
|
for card in event["received"]:
|
|
|
|
ownedcards.append(card)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
for card in event["lost"]:
|
|
|
|
ownedcards.remove(card)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
return sorted(ownedcards)
|
|
|
|
|
|
|
|
def cardtext(card):
|
|
|
|
cardtext = "<span class=\"cardname\">"
|
|
|
|
if card[0:4] == "sig_":
|
|
|
|
cardtext += "<span title=\"signature\">✍</span>" + card + "</span>"
|
|
|
|
else:
|
|
|
|
with open("build/decks/" + card[:-2] + "/type") as thetype:
|
|
|
|
cardtype = thetype.read()
|
|
|
|
if cardtype == "red":
|
|
|
|
cardtext += "<span title=\"red\">🔴</span>"
|
|
|
|
elif cardtype == "orange":
|
|
|
|
cardtext += "<span title=\"orange\">🟠</span>"
|
|
|
|
elif cardtype == "yellow":
|
|
|
|
cardtext += "<span title=\"yellow\">🟡</span>"
|
|
|
|
elif cardtype == "green":
|
|
|
|
cardtext += "<span title=\"green\">🟢</span>"
|
|
|
|
elif cardtype == "blue":
|
|
|
|
cardtext += "<span title=\"blue\">🔵</span>"
|
|
|
|
elif cardtype == "purple":
|
|
|
|
cardtext += "<span title=\"purple\">🟣</span>"
|
|
|
|
elif cardtype == "brown":
|
|
|
|
cardtext += "<span title=\"brown\">🟤</span>"
|
|
|
|
elif cardtype == "gray":
|
|
|
|
cardtext += "<span title=\""
|
|
|
|
if variables.british:
|
|
|
|
cardtext += "grey"
|
|
|
|
else:
|
|
|
|
cardtext += "gray"
|
|
|
|
cardtext += "\">⚪</span>"
|
|
|
|
elif cardtype == "special":
|
|
|
|
cardtext += "<span title=\"special\">✨</span>"
|
|
|
|
cardtext += card + "</span>"
|
|
|
|
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 + "\">"
|
|
|
|
|
|
|
|
def printdeck(deck):
|
|
|
|
deckstring = "<table class=\"decktable "
|
|
|
|
with open("build/decks/" + deck + "/type") as thetype:
|
|
|
|
decktype = thetype.read()
|
|
|
|
deckstring += decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " ["
|
|
|
|
deckcards = []
|
|
|
|
for card in ownedcards():
|
|
|
|
if card[:-2] == deck:
|
|
|
|
deckcards.append(int(card[-2:]))
|
|
|
|
deckcards = sorted(list(dict.fromkeys(deckcards)))
|
|
|
|
deckstring += str(len(deckcards)) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n"
|
|
|
|
test = 1
|
|
|
|
while test < 21:
|
|
|
|
if test % 5 == 1:
|
|
|
|
deckstring += " <tr>\n"
|
|
|
|
deckstring += " <td><img src=\"/decks/" + deck + "/"
|
|
|
|
if test in deckcards:
|
|
|
|
if test > 9:
|
|
|
|
deckstring += str(test)
|
|
|
|
else:
|
|
|
|
deckstring += "0" + str(test)
|
|
|
|
else:
|
|
|
|
deckstring += "00"
|
|
|
|
deckstring += ".gif\"></td>\n"
|
|
|
|
if test % 5 == 0:
|
|
|
|
deckstring += " </tr>\n"
|
|
|
|
test += 1
|
|
|
|
deckstring += "</tbody>\n</table>\n"
|
|
|
|
return deckstring
|