import log,variables typelist = ["red","orange","yellow","green","blue","purple","brown","gray","special"] 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 deckcards(deck): deckcards = [] for card in ownedcards(): if card[:-2] == deck: deckcards.append(int(card[-2:])) deckcards = sorted(list(dict.fromkeys(deckcards))) return deckcards def deckmastered(deck): if len(deckcards(deck)) == 20: return True else: return False def collecting(deck): if len (deckcards(deck)) < 20: if deck in variables.highpriority: return True else: if deck in variables.medpriority: return True else: if len(deckcards(deck)) < variables.collectthreshold: return False else: return True else: return False def cardtype(card): with open("build/decks/" + card[:-2] + "/type") as thetype: cardtype = thetype.read() return(cardtype) def cardtext(card): cardtext = "" if card[0:4] == "sig_": cardtext += "" + card + "" else: if cardtype(card) == "red": cardtext += "🔴" elif cardtype(card) == "orange": cardtext += "🟠" elif cardtype(card) == "yellow": cardtext += "🟡" elif cardtype(card) == "green": cardtext += "🟢" elif cardtype(card) == "blue": cardtext += "🔵" elif cardtype(card) == "purple": cardtext += "🟣" elif cardtype(card) == "brown": cardtext += "🟤" elif cardtype(card) == "gray": cardtext += "" elif cardtype(card) == "special": cardtext += "" cardtext += card + "" return cardtext def printcard(card): if card[0:4] == "sig_": return "" else: deck = card[:-2] cardid = card[-2:] return "" def printdeck(deck): deckstring = "\n\n \n \n \n\n\n" test = 1 while test < 21: if test % 5 == 1: deckstring += " \n" deckstring += " \n" if test % 5 == 0: deckstring += " \n" test += 1 if deckmastered(deck): deckstring += " \n \n" deckstring += "\n
" + deck + " [" deckstring += str(len(deckcards(deck))) + "/20]
" if test in deckcards(deck): if test > 9: deckstring += printcard(deck + str(test)) else: deckstring += printcard(deck + "0" + str(test)) else: deckstring += "" deckstring += "
\n
\n" return deckstring def filterwrite(page,colour=False,sigs=False): filterstring = "

" if colour: filterstring += "Filtered to " if colour == "gray": if variables.british: filterstring += "grey" else: filterstring += "gray" else: filterstring += colour filterstring += ". Show all" else: filterstring += "Filter: 🔴 🟠 🟡 🟢 🔵 🟣 🟤 " if sigs: filterstring += " " filterstring += "

\n" return filterstring