From 69e16ca5a98bf552f04447bb0b58bb44a6e697af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Wed, 2 Apr 2025 20:22:23 +0100 Subject: [PATCH] Add art studio function --- colors.py | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/colors.py b/colors.py index e5b5184..e4e97e4 100644 --- a/colors.py +++ b/colors.py @@ -1608,6 +1608,115 @@ def fish(): images += "" 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("\nWhat are you exchanging for?: " + ", ".join(allwants) + "\nCards you are exchanging:\n\nCard names: " + ", ".join(give) + "\nArt Studio use for the current month: 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")