Add fallbacks for small collections

This commit is contained in:
mez 2025-04-21 12:13:15 +01:00
parent 1cf0d1c0af
commit 4bbb265342
5 changed files with 264 additions and 192 deletions

View file

@ -21,6 +21,7 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =subfolder=: subfolder under your (sub)domain in which the TCG pages will be located (leave as an empty string if they are at the top level)
- =url=: URL of your site index page including =https://=
- =name=: the name you use in the game
- =sig=: set to =True= when you have a signature card
- =highpriority=: a list of high priority decks youre collecting
- =trademedium=: whether to allow trading medium-priority cards away in exchange for high-priority cards
- =tradepost=: URL of your trade post on Dreamwidth
@ -35,7 +36,6 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =keepsig=: =True= if you always want to keep one copy of your signature, =False= if you want to make them all available for trading
- =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page
- =ownedpage=: =True= if you want a page displaying your entire collection, =False= otherwise
- =firstmasteries=: a list of decks you mastered first
- =misclink=: under ="link"=, a link to any page you choose, and under ~"text"~, text to display as the link
- =donations= : lists of donated decks and individual scrapbook cards

View file

@ -476,18 +476,7 @@ def headerwrite(thefile,pagename):
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/mastered\">mastered</a>")
header.write("</li>\n")
if variables.ownedpage:
header.write(" <li>")
if pagename == "owned":
header.write("owned")
else:
header.write("<a href=\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/owned\">owned</a>")
header.write("</li>\n")
header.write(" <li>")
header.write("</li>\n <li>")
if pagename == "trade":
header.write("trading")
else:
@ -1138,12 +1127,23 @@ def indexgen():
content.write("/levels\"><img src=\"")
if len(variables.subfolder) > 0:
content.write("/" + variables.subfolder)
content.write("/assets/levels/" + rankcode + ".gif\"></a><img src=\"")
if len(variables.subfolder) > 0:
content.write("/" + variables.subfolder)
content.write("/decks/sigs/" + variables.name.lower() + ".gif\" loading=\"lazy\">\n<ul>\n<li>player name: <span class=\"name\">" + variables.name + "</span></li>\n<li>" + str(len(cardlist)) + " cards held <span class=\"rank " + rank + "\">(" + rank + ")</span></li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.now().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\" target=\"_blank\">code</a> under construction</li>\n")
if len(variables.misclink["text"]) > 0:
content.write("<li><a href=\"" + variables.misclink["link"] + "\">" + variables.misclink["text"] + "</a></li>\n")
content.write("/assets/levels/" + rankcode + ".gif\"></a>")
if variables.sig:
content.write("<img src=\"")
if len(variables.subfolder) > 0:
content.write("/" + variables.subfolder)
content.write("/decks/sigs/" + variables.name.lower() + ".gif\" loading=\"lazy\">")
content.write("\n<ul>\n<li>player name: <span class=\"name\">" + variables.name + "</span></li>\n<li>" + str(len(cardlist)) + " cards held <span class=\"rank " + rank + "\">(" + rank + ")</span></li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.now().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\" target=\"_blank\">code</a> ")
if variables.name == "Mez":
content.write("under construction")
else:
content.write("by <a href=\https://tcg.praze.net\">mez</a>")
content.write("</li>\n")
try:
if len(variables.misclink["text"]) > 0:
content.write("<li><a href=\"" + variables.misclink["link"] + "\">" + variables.misclink["text"] + "</a></li>\n")
except:
pass
content.write("</ul>\n")
if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0:
content.write("<table id=\"crayontable\">\n<tbody>\n<tr>\n")

View file

@ -1,3 +1,4 @@
import os
import variables
buildscript = open("build.sh","w")

413
tools.py
View file

@ -1,4 +1,4 @@
import datetime,random
import datetime,random,math
from collections import Counter
import colors,log,variables
@ -43,6 +43,7 @@ def riku():
print(dupes(True,False,True,False))
def nextportfolio(monochrome=False):
goodtogo = True
useddecks = {}
already = 0
if monochrome:
@ -110,52 +111,81 @@ def nextportfolio(monochrome=False):
nextportcolour = "grey"
firstthree = []
if nextportcolour == "red":
firstthree.append(reddecks[0]["name"])
firstthree.append(reddecks[1]["name"])
firstthree.append(reddecks[2]["name"])
try:
firstthree.append(reddecks[0]["name"])
firstthree.append(reddecks[1]["name"])
firstthree.append(reddecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "orange":
firstthree.append(orangedecks[0]["name"])
firstthree.append(orangedecks[1]["name"])
firstthree.append(orangedecks[2]["name"])
try:
firstthree.append(orangedecks[0]["name"])
firstthree.append(orangedecks[1]["name"])
firstthree.append(orangedecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "yellow":
firstthree.append(yellowdecks[0]["name"])
firstthree.append(yellowdecks[1]["name"])
firstthree.append(yellowdecks[2]["name"])
try:
firstthree.append(yellowdecks[0]["name"])
firstthree.append(yellowdecks[1]["name"])
firstthree.append(yellowdecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "green":
firstthree.append(greendecks[0]["name"])
firstthree.append(greendecks[1]["name"])
firstthree.append(greendecks[2]["name"])
try:
firstthree.append(greendecks[0]["name"])
firstthree.append(greendecks[1]["name"])
firstthree.append(greendecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "blue":
firstthree.append(bluedecks[0]["name"])
firstthree.append(bluedecks[1]["name"])
firstthree.append(bluedecks[2]["name"])
try:
firstthree.append(bluedecks[0]["name"])
firstthree.append(bluedecks[1]["name"])
firstthree.append(bluedecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "purple":
firstthree.append(purpledecks[0]["name"])
firstthree.append(purpledecks[1]["name"])
firstthree.append(purpledecks[2]["name"])
try:
firstthree.append(purpledecks[0]["name"])
firstthree.append(purpledecks[1]["name"])
firstthree.append(purpledecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "brown":
firstthree.append(browndecks[0]["name"])
firstthree.append(browndecks[1]["name"])
firstthree.append(browndecks[2]["name"])
try:
firstthree.append(browndecks[0]["name"])
firstthree.append(browndecks[1]["name"])
firstthree.append(browndecks[2]["name"])
except:
goodtogo = False
elif nextportcolour == "grey":
firstthree.append(greydecks[0]["name"])
firstthree.append(greydecks[1]["name"])
firstthree.append(greydecks[2]["name"])
secondfive = []
nearingdecks = sorted(colors.decklist, key=lambda d: d["count"],reverse=True)
slots = 5
for deck in nearingdecks:
if slots > 0:
if not deck["mastered"]:
if nextportcolour == "grey":
if deck["colour"] == "gray":
secondfive.append(deck["name"])
slots -= 1
else:
if deck["colour"] == nextportcolour:
secondfive.append(deck["name"])
slots -= 1
alleight = sorted(firstthree + secondfive)
try:
firstthree.append(greydecks[0]["name"])
firstthree.append(greydecks[1]["name"])
firstthree.append(greydecks[2]["name"])
except:
goodtogo = False
if goodtogo:
secondfive = []
nearingdecks = sorted(colors.decklist, key=lambda d: d["count"],reverse=True)
slots = 5
for deck in nearingdecks:
if slots > 0:
try:
if not deck["mastered"]:
if nextportcolour == "grey":
if deck["colour"] == "gray":
secondfive.append(deck["name"])
slots -= 1
else:
if deck["colour"] == nextportcolour:
secondfive.append(deck["name"])
slots -= 1
except:
goodtogo = False
if goodtogo:
alleight = sorted(firstthree + secondfive)
else:
thereddeck = False
redmastered = False
@ -306,73 +336,80 @@ def nextportfolio(monochrome=False):
alleight.append(thepurpledeck)
alleight.append(thebrowndeck)
alleight.append(thegreydeck)
portcomment = "♥ <b>Your Name:</b> " + variables.name + "\n♥ <b>Card post:</b> " + variables.url + "\n♥ <b>"
if monochrome:
portcomment += "Monochrome"
else:
portcomment += "Palette"
portcomment += " Portfolio #:</b> " + str(already + 1) + "\n"
if monochrome:
portcomment += "♥ <b>Monochrome Color:</b> "
if nextportcolour == "grey":
if variables.british:
portcomment += "grey"
else:
portcomment += "gray"
if goodtogo:
portcomment = "♥ <b>Your Name:</b> " + variables.name + "\n♥ <b>Card post:</b> " + variables.url + "\n♥ <b>"
if monochrome:
portcomment += "Monochrome"
else:
portcomment += nextportcolour
portcomment += "\n♥ <b>1st deck:</b> " + alleight[0]
if alleight[0] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>2nd deck:</b> " + alleight[1]
if alleight[1] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>3rd deck:</b> " + alleight[2]
if alleight[2] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>4th deck:</b> " + alleight[3]
if alleight[3] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>5th deck:</b> " + alleight[4]
if alleight[4] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>6th deck:</b> " + alleight[5]
if alleight[5] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>7th deck:</b> " + alleight[6]
if alleight[6] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>8th deck:</b> " + alleight[7]
if alleight[7] in firstthree:
portcomment += " (mastered)"
portcomment += "Palette"
portcomment += " Portfolio #:</b> " + str(already + 1) + "\n"
if monochrome:
portcomment += "♥ <b>Monochrome Color:</b> "
if nextportcolour == "grey":
if variables.british:
portcomment += "grey"
else:
portcomment += "gray"
else:
portcomment += nextportcolour
portcomment += "\n♥ <b>1st deck:</b> " + alleight[0]
if alleight[0] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>2nd deck:</b> " + alleight[1]
if alleight[1] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>3rd deck:</b> " + alleight[2]
if alleight[2] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>4th deck:</b> " + alleight[3]
if alleight[3] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>5th deck:</b> " + alleight[4]
if alleight[4] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>6th deck:</b> " + alleight[5]
if alleight[5] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>7th deck:</b> " + alleight[6]
if alleight[6] in firstthree:
portcomment += " (mastered)"
portcomment += "\n♥ <b>8th deck:</b> " + alleight[7]
if alleight[7] in firstthree:
portcomment += " (mastered)"
else:
try:
portcomment += "♥ <b>Red deck:</b> " + thereddeck
if redmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Orange deck:</b> " + theorangedeck
if orangemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Yellow deck:</b> " + theyellowdeck
if yellowmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Green deck:</b> " + thegreendeck
if greenmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Blue deck:</b> " + thebluedeck
if bluemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Purple deck:</b> " + thepurpledeck
if purplemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Brown deck:</b> " + thebrowndeck
if brownmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Gray deck:</b> " + thegreydeck
if greymastered:
portcomment += " (mastered)"
except:
goodtogo = False
if goodtogo:
print(portcomment)
porturl = input("\nPaste the comment URL here: ")
print("\n{\"event\":\"portfolio\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + porturl + "\",\"decks\":[\"" + alleight[0] + "\",\"" + alleight[1] + "\",\"" + alleight[2] + "\",\"" + alleight[3] + "\",\"" + alleight[4] + "\",\"" + alleight[5] + "\",\"" + alleight[6] + "\",\"" + alleight[7] + "\"]}")
else:
portcomment += "♥ <b>Red deck:</b> " + thereddeck
if redmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Orange deck:</b> " + theorangedeck
if orangemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Yellow deck:</b> " + theyellowdeck
if yellowmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Green deck:</b> " + thegreendeck
if greenmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Blue deck:</b> " + thebluedeck
if bluemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Purple deck:</b> " + thepurpledeck
if purplemastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Brown deck:</b> " + thebrowndeck
if brownmastered:
portcomment += " (mastered)"
portcomment += "\n♥ <b>Gray deck:</b> " + thegreydeck
if greymastered:
portcomment += " (mastered)"
print(portcomment)
porturl = input("\nPaste the comment URL here: ")
print("\n{\"event\":\"portfolio\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + porturl + "\",\"decks\":[\"" + alleight[0] + "\",\"" + alleight[1] + "\",\"" + alleight[2] + "\",\"" + alleight[3] + "\",\"" + alleight[4] + "\",\"" + alleight[5] + "\",\"" + alleight[6] + "\",\"" + alleight[7] + "\"]}")
print("Master some more decks first")
def switchit():
wantedbypriority = sorted(colors.wantedlist, key=lambda d: d["priority"])
@ -523,34 +560,37 @@ def switchit():
tradechaos = input("Provide " + str(len(wantchaos)) + " cards for the chaos pile (for " + ", ".join(wantchaos) + "): ").split(", ")
tradeall.extend(tradechaos)
print("\n")
if len(wantreds) > 0:
print("red: " + ", ".join(tradereds) + " for " + ", ".join(wantreds))
if len(wantoranges) > 0:
print("orange: " + ", ".join(tradeoranges) + " for " + ", ".join(wantoranges))
if len(wantyellows) > 0:
print("yellow: " + ", ".join(tradeyellows) + " for " + ", ".join(wantyellows))
if len(wantgreens) > 0:
print("green: " + ", ".join(tradegreens) + " for " + ", ".join(wantgreens))
if len(wantblues) > 0:
print("blue: " + ", ".join(tradeblues) + " for " + ", ".join(wantblues))
if len(wantpurples) > 0:
print("purple: " + ", ".join(tradepurples) + " for " + ", ".join(wantpurples))
if len(wantbrowns) > 0:
print("brown: " + ", ".join(tradebrowns) + " for " + ", ".join(wantbrowns))
if len(wantgreys) > 0:
if variables.british:
print("grey: " + ", ".join(tradegreys) + " for " + ", ".join(wantgreys))
else:
print("gray: " + ", ".join(tradegreys) + " for " + ", ".join(wantgreys))
if len(wantchaos) > 0:
print("chaos: " + ", ".join(tradechaos) + " for " + ", ".join(wantchaos))
images = ""
for card in tradeall:
images += "<img src=\"https://colors-tcg.eu/cards/" + card + ".gif\">"
print("\n" + images + "\n")
switchround = input("Round number: ")
switchcomment = input("Comment URL: ")
print("\n{\"event\":\"switch it up " + switchround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + switchcomment + "\",\"pend\":[\"" + "\",\"".join(wantall) + "\"],\"lost\":[\"" + "\",\"".join(tradeall) + "\"]}")
if len(tradeall) > 0:
if len(wantreds) > 0:
print("red: " + ", ".join(tradereds) + " for " + ", ".join(wantreds))
if len(wantoranges) > 0:
print("orange: " + ", ".join(tradeoranges) + " for " + ", ".join(wantoranges))
if len(wantyellows) > 0:
print("yellow: " + ", ".join(tradeyellows) + " for " + ", ".join(wantyellows))
if len(wantgreens) > 0:
print("green: " + ", ".join(tradegreens) + " for " + ", ".join(wantgreens))
if len(wantblues) > 0:
print("blue: " + ", ".join(tradeblues) + " for " + ", ".join(wantblues))
if len(wantpurples) > 0:
print("purple: " + ", ".join(tradepurples) + " for " + ", ".join(wantpurples))
if len(wantbrowns) > 0:
print("brown: " + ", ".join(tradebrowns) + " for " + ", ".join(wantbrowns))
if len(wantgreys) > 0:
if variables.british:
print("grey: " + ", ".join(tradegreys) + " for " + ", ".join(wantgreys))
else:
print("gray: " + ", ".join(tradegreys) + " for " + ", ".join(wantgreys))
if len(wantchaos) > 0:
print("chaos: " + ", ".join(tradechaos) + " for " + ", ".join(wantchaos))
images = ""
for card in tradeall:
images += "<img src=\"https://colors-tcg.eu/cards/" + card + ".gif\">"
print("\n" + images + "\n")
switchround = input("Round number: ")
switchcomment = input("Comment URL: ")
print("\n{\"event\":\"switch it up " + switchround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + switchcomment + "\",\"pend\":[\"" + "\",\"".join(wantall) + "\"],\"lost\":[\"" + "\",\"".join(tradeall) + "\"]}")
else:
print("No cards found")
def fish():
fishdecks = input("Paste list of decks here: ").split(", ")
@ -615,13 +655,33 @@ def fish():
cardnames = []
for card in fishrefined:
cardnames.append(card["name"])
print("\nTrade post: " + variables.url + "\nNumber of matches: " + str(len(fishrefined)) + "\nCard name(s): " + ", ".join(cardnames) + "\nWhere cards are located: " + ", ".join(locations) + "\nCards:")
images = ""
for card in fishrefined:
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
print(images)
if len(fishrefined) > 0:
print("\nTrade post: " + variables.url + "\nNumber of matches: " + str(len(fishrefined)) + "\nCard name(s): " + ", ".join(cardnames) + "\nWhere cards are located: " + ", ".join(locations) + "\nCards:")
images = ""
for card in fishrefined:
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
print(images)
else:
print("No cards found")
def studio():
tradedupes = []
tradedupesreserve = []
tradenormal = []
tradespecial = []
for card in colors.cardlist:
if card["priority"] == 4:
if card["colour"] != "sig" and card["colour"] != "limited":
if card["dupe"]:
if len(card["mass"]) == 0:
tradedupes.append(card["name"])
else:
tradedupesreserve.append(card["name"])
else:
if card["colour"] == "special":
tradespecial.append(card["name"])
else:
tradenormal.append(card["name"])
dupeslimit = 10
newlimit = 20
sigslimit = 10
@ -650,40 +710,43 @@ def studio():
speciallimit -= event["exchange"]["special"]
except:
pass
dupesalready = dupeslimit
newalready = newlimit
sigsalready = sigslimit
choicealready = choicelimit
specialalready = speciallimit
if dupeslimit > len(tradedupes):
tradedupes.extend(tradedupesreserve)
if dupeslimit > len(tradedupes):
dupeslimit = len(tradedupes)
if dupeslimit > 0:
dupeswant = int(input("How many randoms for doubles? (" + str(dupeslimit) + " remaining) "))
else:
dupeswant = 0
if newlimit * 2 > len(tradenormal):
newlimit = math.floor(len(tradenormal)/2)
if newlimit > 0:
newwant = int(input("How many new release cards? (" + str(newlimit) + " remaining) "))
else:
newwant = 0
if sigslimit * 3 + newwant * 2 > len(tradenormal):
sigslimit = math.floor((len(tradenormal) - (newwant * 2))/3)
if sigslimit > 0:
sigswant = int(input("How many signatures? (" + str(sigslimit) + " remaining) "))
else:
sigswant = 0
if choicelimit * 3 + sigswant * 3 + newwant * 2 > len(tradenormal):
choicelimit = math.floor((len(tradenormal) - ((newwant * 2) + (sigswant * 3)))/3)
if choicelimit > 0:
choicewant = int(input("How many choice character cards? (" + str(choicelimit) + " remaining) "))
else:
choicewant = 0
if speciallimit * 3 > len(tradespecial):
speciallimit = math.floor(len(tradespecial)/3)
if speciallimit > 0:
specialwant = int(input("How many choice special cards? (" + str(speciallimit) + " remaining) "))
else:
specialwant = 0
tradedupes = []
tradenormal = []
tradespecial = []
for card in colors.cardlist:
if card["priority"] == 4:
if card["colour"] != "sig" and card["colour"] != "limited":
if card["dupe"]:
if len(card["mass"]) == 0:
tradedupes.append(card["name"])
else:
if card["colour"] == "special":
tradespecial.append(card["name"])
else:
tradenormal.append(card["name"])
neededdupes = dupeswant
needednormal = 2 * newwant + 3 * sigswant + 3 * choicewant
neededspecial = 3 * specialwant
@ -713,22 +776,25 @@ def studio():
allwants.extend(choicelist)
if specialwant > 0:
allwants.extend(speciallist)
print("\n<b>What are you exchanging for?</b>: " + ", ".join(allwants) + "\n<b>Cards you are exchanging</b>:\n<img src=\"https://colors-tcg.eu/cards/" + ".gif\"><img src=\"https://colors-tcg.eu/cards/".join(give) + ".gif\">\n<b>Card names</b>: " + ", ".join(give) + "\n<b>Art Studio use for the current month</b>: random cards: " + str(10 - dupeslimit + dupeswant) + "/10; new release cards: " + str(20 - newlimit + newwant) + "/20; signatures: " + str(10 - sigslimit + sigswant) + "/10; character cards: " + str(16 - choicelimit + choicewant) + "/16; special cards: " + str(10 - speciallimit + specialwant) + "/10\n")
studiourl = input("Paste in comment URL: ")
studiostring = "{\"event\":\"art studio\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + studiourl + "\",\"lost\":[\"" + "\",\"".join(give) + "\"],"
allchoice = []
try:
allchoice.extend(choicelist)
except:
pass
try:
allchoice.extend(speciallist)
except:
pass
if len(allchoice) > 0:
studiostring += "\"pend\":[\"" + "\",\"".join(allchoice) + "\"],"
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
print("\n" + studiostring)
if len(allwants) > 0:
print("\n<b>What are you exchanging for?</b>: " + ", ".join(allwants) + "\n<b>Cards you are exchanging</b>:\n<img src=\"https://colors-tcg.eu/cards/" + ".gif\"><img src=\"https://colors-tcg.eu/cards/".join(give) + ".gif\">\n<b>Card names</b>: " + ", ".join(give) + "\n<b>Art Studio use for the current month</b>: random cards: " + str(10 - dupesalready + dupeswant) + "/10; new release cards: " + str(20 - newalready + newwant) + "/20; signatures: " + str(10 - sigsalready + sigswant) + "/10; character cards: " + str(16 - choicealready + choicewant) + "/16; special cards: " + str(10 - specialalready + specialwant) + "/10\n")
studiourl = input("Paste in comment URL: ")
studiostring = "{\"event\":\"art studio\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + studiourl + "\",\"lost\":[\"" + "\",\"".join(give) + "\"],"
allchoice = []
try:
allchoice.extend(choicelist)
except:
pass
try:
allchoice.extend(speciallist)
except:
pass
if len(allchoice) > 0:
studiostring += "\"pend\":[\"" + "\",\"".join(allchoice) + "\"],"
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
print("\n" + studiostring)
else:
print("Nothing requested")
def randoms(specials=False):
totalrandoms = int(input("How many? "))
@ -740,8 +806,11 @@ def randoms(specials=False):
else:
if card["colour"] != "special":
pool.append(card["name"])
chosen = sorted(random.sample(pool,totalrandoms))
print(", ".join(chosen))
try:
chosen = sorted(random.sample(pool,totalrandoms))
print(", ".join(chosen))
except ValueError:
print("Too many cards requested")
def artshop():
hpred = []
@ -1414,7 +1483,9 @@ def artshop():
tradecommon = list((Counter(colors.tradeout) & Counter(colors.tradein)).elements())
sketch = len(tradecommon)
if sketch > 0:
sketchdifference = int(sketch / 20) - colors.redeemedsketch
sketchdifference = int(sketch / 20) - colors.redeemedsketch
else:
sketchdifference = 0
if len(requestcards) == 0 and sketchdifference < 1:
print("Nothing to request")
else:

View file

@ -3,6 +3,7 @@ serverpath = ""
subfolder = ""
url = ""
name = "your name"
sig = False
highpriority = ["deckname","nameofadeck"]
trademedium = True
tradepost = "URL"
@ -14,10 +15,9 @@ collectthreshold = 2
mediumthreshold = 5
massmediumthreshold = 1
highthreshold = 10
keepsig = False
keepsig = True
tradestatement = ""
maxmastered = 20
ownedpage = False
firstmasteries = ["deckname","nameofdeck"]
misclink = {"link":"","text":""}
donations = {"decks":[],"scrapbook":[]}