Add art studio function

master
trémeur 1 day ago
parent ac946bc553
commit 69e16ca5a9

@ -1608,6 +1608,115 @@ def fish():
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
print(images)
def studio():
dupeslimit = 10
newlimit = 20
sigslimit = 10
choicelimit = 16
speciallimit = 10
for event in log.log:
if event["date"].year == datetime.datetime.now().year and event["date"].month == datetime.datetime.now().month:
if event["event"] == "art studio":
try:
dupeslimit -= event["exchange"]["dupes"]
except:
pass
try:
newlimit -= event["exchange"]["new"]
except:
pass
try:
sigslimit -= event["exchange"]["sigs"]
except:
pass
try:
choicelimit -= event["exchange"]["choice"]
except:
pass
try:
speciallimit -= event["exchange"]["special"]
except:
pass
if dupeslimit > 0:
dupeswant = int(input("How many randoms for doubles? (" + str(dupeslimit) + " remaining) "))
else:
dupeswant = 0
if newlimit > 0:
newwant = int(input("How many new release cards? (" + str(newlimit) + " remaining) "))
else:
newwant = 0
if sigslimit > 0:
sigswant = int(input("How many signatures? (" + str(sigslimit) + " remaining) "))
else:
sigswant = 0
if choicelimit > 0:
choicewant = int(input("How many choice character cards? (" + str(choicelimit) + " remaining) "))
else:
choicewant = 0
if speciallimit > 0:
specialwant = int(input("How many choice special cards? (" + str(speciallimit) + " remaining) "))
else:
specialwant = 0
tradedupes = []
tradenormal = []
tradespecial = []
for card in 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
give = []
if neededdupes > 0:
give.extend(random.sample(tradedupes,neededdupes))
if needednormal > 0:
give.extend(random.sample(tradenormal,needednormal))
if neededspecial > 0:
give.extend(random.sample(tradespecial,neededspecial))
if choicewant > 0:
choicelist = input(str(choicewant) + " choice character cards: ").split(", ")
if specialwant > 0:
speciallist = input(str(specialwant) + " choice special cards: ").split(", ")
allwants = []
if dupeswant > 1:
allwants.append(str(dupeswant) + " random cards")
elif dupeswant == 1:
allwants.append(str(dupeswant) + " random card")
if newwant > 1:
allwants.append(str(newwant) + " new release cards")
elif newwant == 1:
allwants.append(str(newwant) + " new release card")
if sigswant > 0:
allwants.append(str(sigswant) + " x sig_" + variables.name.lower())
if choicewant > 0:
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.today().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 __name__ == "__main__":
print("Building index page")

Loading…
Cancel
Save