Add fallbacks for small collections
This commit is contained in:
parent
1cf0d1c0af
commit
4bbb265342
5 changed files with 264 additions and 192 deletions
|
@ -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)
|
- =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://=
|
- =url=: URL of your site index page including =https://=
|
||||||
- =name=: the name you use in the game
|
- =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 you’re collecting
|
- =highpriority=: a list of high priority decks you’re collecting
|
||||||
- =trademedium=: whether to allow trading medium-priority cards away in exchange for high-priority cards
|
- =trademedium=: whether to allow trading medium-priority cards away in exchange for high-priority cards
|
||||||
- =tradepost=: URL of your trade post on Dreamwidth
|
- =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
|
- =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
|
- =tradestatement=: statement to place on your trading page
|
||||||
- =maxmastered=: maximum number of most recently mastered decks to show on the index 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
|
- =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
|
- =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
|
- =donations= : lists of donated decks and individual scrapbook cards
|
||||||
|
|
28
colors.py
28
colors.py
|
@ -476,18 +476,7 @@ def headerwrite(thefile,pagename):
|
||||||
if len(variables.subfolder) > 0:
|
if len(variables.subfolder) > 0:
|
||||||
header.write("/" + variables.subfolder)
|
header.write("/" + variables.subfolder)
|
||||||
header.write("/mastered\">mastered</a>")
|
header.write("/mastered\">mastered</a>")
|
||||||
header.write("</li>\n")
|
header.write("</li>\n <li>")
|
||||||
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>")
|
|
||||||
if pagename == "trade":
|
if pagename == "trade":
|
||||||
header.write("trading")
|
header.write("trading")
|
||||||
else:
|
else:
|
||||||
|
@ -1138,12 +1127,23 @@ def indexgen():
|
||||||
content.write("/levels\"><img src=\"")
|
content.write("/levels\"><img src=\"")
|
||||||
if len(variables.subfolder) > 0:
|
if len(variables.subfolder) > 0:
|
||||||
content.write("/" + variables.subfolder)
|
content.write("/" + variables.subfolder)
|
||||||
content.write("/assets/levels/" + rankcode + ".gif\"></a><img src=\"")
|
content.write("/assets/levels/" + rankcode + ".gif\"></a>")
|
||||||
|
if variables.sig:
|
||||||
|
content.write("<img src=\"")
|
||||||
if len(variables.subfolder) > 0:
|
if len(variables.subfolder) > 0:
|
||||||
content.write("/" + variables.subfolder)
|
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")
|
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:
|
if len(variables.misclink["text"]) > 0:
|
||||||
content.write("<li><a href=\"" + variables.misclink["link"] + "\">" + variables.misclink["text"] + "</a></li>\n")
|
content.write("<li><a href=\"" + variables.misclink["link"] + "\">" + variables.misclink["text"] + "</a></li>\n")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
content.write("</ul>\n")
|
content.write("</ul>\n")
|
||||||
if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0:
|
if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0:
|
||||||
content.write("<table id=\"crayontable\">\n<tbody>\n<tr>\n")
|
content.write("<table id=\"crayontable\">\n<tbody>\n<tr>\n")
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import variables
|
import variables
|
||||||
|
|
||||||
buildscript = open("build.sh","w")
|
buildscript = open("build.sh","w")
|
||||||
|
|
103
tools.py
103
tools.py
|
@ -1,4 +1,4 @@
|
||||||
import datetime,random
|
import datetime,random,math
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
import colors,log,variables
|
import colors,log,variables
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ def riku():
|
||||||
print(dupes(True,False,True,False))
|
print(dupes(True,False,True,False))
|
||||||
|
|
||||||
def nextportfolio(monochrome=False):
|
def nextportfolio(monochrome=False):
|
||||||
|
goodtogo = True
|
||||||
useddecks = {}
|
useddecks = {}
|
||||||
already = 0
|
already = 0
|
||||||
if monochrome:
|
if monochrome:
|
||||||
|
@ -110,42 +111,68 @@ def nextportfolio(monochrome=False):
|
||||||
nextportcolour = "grey"
|
nextportcolour = "grey"
|
||||||
firstthree = []
|
firstthree = []
|
||||||
if nextportcolour == "red":
|
if nextportcolour == "red":
|
||||||
|
try:
|
||||||
firstthree.append(reddecks[0]["name"])
|
firstthree.append(reddecks[0]["name"])
|
||||||
firstthree.append(reddecks[1]["name"])
|
firstthree.append(reddecks[1]["name"])
|
||||||
firstthree.append(reddecks[2]["name"])
|
firstthree.append(reddecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "orange":
|
elif nextportcolour == "orange":
|
||||||
|
try:
|
||||||
firstthree.append(orangedecks[0]["name"])
|
firstthree.append(orangedecks[0]["name"])
|
||||||
firstthree.append(orangedecks[1]["name"])
|
firstthree.append(orangedecks[1]["name"])
|
||||||
firstthree.append(orangedecks[2]["name"])
|
firstthree.append(orangedecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "yellow":
|
elif nextportcolour == "yellow":
|
||||||
|
try:
|
||||||
firstthree.append(yellowdecks[0]["name"])
|
firstthree.append(yellowdecks[0]["name"])
|
||||||
firstthree.append(yellowdecks[1]["name"])
|
firstthree.append(yellowdecks[1]["name"])
|
||||||
firstthree.append(yellowdecks[2]["name"])
|
firstthree.append(yellowdecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "green":
|
elif nextportcolour == "green":
|
||||||
|
try:
|
||||||
firstthree.append(greendecks[0]["name"])
|
firstthree.append(greendecks[0]["name"])
|
||||||
firstthree.append(greendecks[1]["name"])
|
firstthree.append(greendecks[1]["name"])
|
||||||
firstthree.append(greendecks[2]["name"])
|
firstthree.append(greendecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "blue":
|
elif nextportcolour == "blue":
|
||||||
|
try:
|
||||||
firstthree.append(bluedecks[0]["name"])
|
firstthree.append(bluedecks[0]["name"])
|
||||||
firstthree.append(bluedecks[1]["name"])
|
firstthree.append(bluedecks[1]["name"])
|
||||||
firstthree.append(bluedecks[2]["name"])
|
firstthree.append(bluedecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "purple":
|
elif nextportcolour == "purple":
|
||||||
|
try:
|
||||||
firstthree.append(purpledecks[0]["name"])
|
firstthree.append(purpledecks[0]["name"])
|
||||||
firstthree.append(purpledecks[1]["name"])
|
firstthree.append(purpledecks[1]["name"])
|
||||||
firstthree.append(purpledecks[2]["name"])
|
firstthree.append(purpledecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "brown":
|
elif nextportcolour == "brown":
|
||||||
|
try:
|
||||||
firstthree.append(browndecks[0]["name"])
|
firstthree.append(browndecks[0]["name"])
|
||||||
firstthree.append(browndecks[1]["name"])
|
firstthree.append(browndecks[1]["name"])
|
||||||
firstthree.append(browndecks[2]["name"])
|
firstthree.append(browndecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
elif nextportcolour == "grey":
|
elif nextportcolour == "grey":
|
||||||
|
try:
|
||||||
firstthree.append(greydecks[0]["name"])
|
firstthree.append(greydecks[0]["name"])
|
||||||
firstthree.append(greydecks[1]["name"])
|
firstthree.append(greydecks[1]["name"])
|
||||||
firstthree.append(greydecks[2]["name"])
|
firstthree.append(greydecks[2]["name"])
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
|
if goodtogo:
|
||||||
secondfive = []
|
secondfive = []
|
||||||
nearingdecks = sorted(colors.decklist, key=lambda d: d["count"],reverse=True)
|
nearingdecks = sorted(colors.decklist, key=lambda d: d["count"],reverse=True)
|
||||||
slots = 5
|
slots = 5
|
||||||
for deck in nearingdecks:
|
for deck in nearingdecks:
|
||||||
if slots > 0:
|
if slots > 0:
|
||||||
|
try:
|
||||||
if not deck["mastered"]:
|
if not deck["mastered"]:
|
||||||
if nextportcolour == "grey":
|
if nextportcolour == "grey":
|
||||||
if deck["colour"] == "gray":
|
if deck["colour"] == "gray":
|
||||||
|
@ -155,6 +182,9 @@ def nextportfolio(monochrome=False):
|
||||||
if deck["colour"] == nextportcolour:
|
if deck["colour"] == nextportcolour:
|
||||||
secondfive.append(deck["name"])
|
secondfive.append(deck["name"])
|
||||||
slots -= 1
|
slots -= 1
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
|
if goodtogo:
|
||||||
alleight = sorted(firstthree + secondfive)
|
alleight = sorted(firstthree + secondfive)
|
||||||
else:
|
else:
|
||||||
thereddeck = False
|
thereddeck = False
|
||||||
|
@ -306,6 +336,7 @@ def nextportfolio(monochrome=False):
|
||||||
alleight.append(thepurpledeck)
|
alleight.append(thepurpledeck)
|
||||||
alleight.append(thebrowndeck)
|
alleight.append(thebrowndeck)
|
||||||
alleight.append(thegreydeck)
|
alleight.append(thegreydeck)
|
||||||
|
if goodtogo:
|
||||||
portcomment = "♥ <b>Your Name:</b> " + variables.name + "\n♥ <b>Card post:</b> " + variables.url + "\n♥ <b>"
|
portcomment = "♥ <b>Your Name:</b> " + variables.name + "\n♥ <b>Card post:</b> " + variables.url + "\n♥ <b>"
|
||||||
if monochrome:
|
if monochrome:
|
||||||
portcomment += "Monochrome"
|
portcomment += "Monochrome"
|
||||||
|
@ -346,6 +377,7 @@ def nextportfolio(monochrome=False):
|
||||||
if alleight[7] in firstthree:
|
if alleight[7] in firstthree:
|
||||||
portcomment += " (mastered)"
|
portcomment += " (mastered)"
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
portcomment += "♥ <b>Red deck:</b> " + thereddeck
|
portcomment += "♥ <b>Red deck:</b> " + thereddeck
|
||||||
if redmastered:
|
if redmastered:
|
||||||
portcomment += " (mastered)"
|
portcomment += " (mastered)"
|
||||||
|
@ -370,9 +402,14 @@ def nextportfolio(monochrome=False):
|
||||||
portcomment += "\n♥ <b>Gray deck:</b> " + thegreydeck
|
portcomment += "\n♥ <b>Gray deck:</b> " + thegreydeck
|
||||||
if greymastered:
|
if greymastered:
|
||||||
portcomment += " (mastered)"
|
portcomment += " (mastered)"
|
||||||
|
except:
|
||||||
|
goodtogo = False
|
||||||
|
if goodtogo:
|
||||||
print(portcomment)
|
print(portcomment)
|
||||||
porturl = input("\nPaste the comment URL here: ")
|
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("\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:
|
||||||
|
print("Master some more decks first")
|
||||||
|
|
||||||
def switchit():
|
def switchit():
|
||||||
wantedbypriority = sorted(colors.wantedlist, key=lambda d: d["priority"])
|
wantedbypriority = sorted(colors.wantedlist, key=lambda d: d["priority"])
|
||||||
|
@ -523,6 +560,7 @@ def switchit():
|
||||||
tradechaos = input("Provide " + str(len(wantchaos)) + " cards for the chaos pile (for " + ", ".join(wantchaos) + "): ").split(", ")
|
tradechaos = input("Provide " + str(len(wantchaos)) + " cards for the chaos pile (for " + ", ".join(wantchaos) + "): ").split(", ")
|
||||||
tradeall.extend(tradechaos)
|
tradeall.extend(tradechaos)
|
||||||
print("\n")
|
print("\n")
|
||||||
|
if len(tradeall) > 0:
|
||||||
if len(wantreds) > 0:
|
if len(wantreds) > 0:
|
||||||
print("red: " + ", ".join(tradereds) + " for " + ", ".join(wantreds))
|
print("red: " + ", ".join(tradereds) + " for " + ", ".join(wantreds))
|
||||||
if len(wantoranges) > 0:
|
if len(wantoranges) > 0:
|
||||||
|
@ -551,6 +589,8 @@ def switchit():
|
||||||
switchround = input("Round number: ")
|
switchround = input("Round number: ")
|
||||||
switchcomment = input("Comment URL: ")
|
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) + "\"]}")
|
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():
|
def fish():
|
||||||
fishdecks = input("Paste list of decks here: ").split(", ")
|
fishdecks = input("Paste list of decks here: ").split(", ")
|
||||||
|
@ -615,13 +655,33 @@ def fish():
|
||||||
cardnames = []
|
cardnames = []
|
||||||
for card in fishrefined:
|
for card in fishrefined:
|
||||||
cardnames.append(card["name"])
|
cardnames.append(card["name"])
|
||||||
|
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:")
|
print("\nTrade post: " + variables.url + "\nNumber of matches: " + str(len(fishrefined)) + "\nCard name(s): " + ", ".join(cardnames) + "\nWhere cards are located: " + ", ".join(locations) + "\nCards:")
|
||||||
images = ""
|
images = ""
|
||||||
for card in fishrefined:
|
for card in fishrefined:
|
||||||
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
|
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
|
||||||
print(images)
|
print(images)
|
||||||
|
else:
|
||||||
|
print("No cards found")
|
||||||
|
|
||||||
def studio():
|
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
|
dupeslimit = 10
|
||||||
newlimit = 20
|
newlimit = 20
|
||||||
sigslimit = 10
|
sigslimit = 10
|
||||||
|
@ -650,40 +710,43 @@ def studio():
|
||||||
speciallimit -= event["exchange"]["special"]
|
speciallimit -= event["exchange"]["special"]
|
||||||
except:
|
except:
|
||||||
pass
|
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:
|
if dupeslimit > 0:
|
||||||
dupeswant = int(input("How many randoms for doubles? (" + str(dupeslimit) + " remaining) "))
|
dupeswant = int(input("How many randoms for doubles? (" + str(dupeslimit) + " remaining) "))
|
||||||
else:
|
else:
|
||||||
dupeswant = 0
|
dupeswant = 0
|
||||||
|
if newlimit * 2 > len(tradenormal):
|
||||||
|
newlimit = math.floor(len(tradenormal)/2)
|
||||||
if newlimit > 0:
|
if newlimit > 0:
|
||||||
newwant = int(input("How many new release cards? (" + str(newlimit) + " remaining) "))
|
newwant = int(input("How many new release cards? (" + str(newlimit) + " remaining) "))
|
||||||
else:
|
else:
|
||||||
newwant = 0
|
newwant = 0
|
||||||
|
if sigslimit * 3 + newwant * 2 > len(tradenormal):
|
||||||
|
sigslimit = math.floor((len(tradenormal) - (newwant * 2))/3)
|
||||||
if sigslimit > 0:
|
if sigslimit > 0:
|
||||||
sigswant = int(input("How many signatures? (" + str(sigslimit) + " remaining) "))
|
sigswant = int(input("How many signatures? (" + str(sigslimit) + " remaining) "))
|
||||||
else:
|
else:
|
||||||
sigswant = 0
|
sigswant = 0
|
||||||
|
if choicelimit * 3 + sigswant * 3 + newwant * 2 > len(tradenormal):
|
||||||
|
choicelimit = math.floor((len(tradenormal) - ((newwant * 2) + (sigswant * 3)))/3)
|
||||||
if choicelimit > 0:
|
if choicelimit > 0:
|
||||||
choicewant = int(input("How many choice character cards? (" + str(choicelimit) + " remaining) "))
|
choicewant = int(input("How many choice character cards? (" + str(choicelimit) + " remaining) "))
|
||||||
else:
|
else:
|
||||||
choicewant = 0
|
choicewant = 0
|
||||||
|
if speciallimit * 3 > len(tradespecial):
|
||||||
|
speciallimit = math.floor(len(tradespecial)/3)
|
||||||
if speciallimit > 0:
|
if speciallimit > 0:
|
||||||
specialwant = int(input("How many choice special cards? (" + str(speciallimit) + " remaining) "))
|
specialwant = int(input("How many choice special cards? (" + str(speciallimit) + " remaining) "))
|
||||||
else:
|
else:
|
||||||
specialwant = 0
|
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
|
neededdupes = dupeswant
|
||||||
needednormal = 2 * newwant + 3 * sigswant + 3 * choicewant
|
needednormal = 2 * newwant + 3 * sigswant + 3 * choicewant
|
||||||
neededspecial = 3 * specialwant
|
neededspecial = 3 * specialwant
|
||||||
|
@ -713,7 +776,8 @@ def studio():
|
||||||
allwants.extend(choicelist)
|
allwants.extend(choicelist)
|
||||||
if specialwant > 0:
|
if specialwant > 0:
|
||||||
allwants.extend(speciallist)
|
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")
|
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: ")
|
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) + "\"],"
|
studiostring = "{\"event\":\"art studio\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + studiourl + "\",\"lost\":[\"" + "\",\"".join(give) + "\"],"
|
||||||
allchoice = []
|
allchoice = []
|
||||||
|
@ -729,6 +793,8 @@ def studio():
|
||||||
studiostring += "\"pend\":[\"" + "\",\"".join(allchoice) + "\"],"
|
studiostring += "\"pend\":[\"" + "\",\"".join(allchoice) + "\"],"
|
||||||
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
|
studiostring += "\"exchange\":{\"dupes\":" + str(dupeswant) + ",\"new\":" + str(newwant) + ",\"sigs\":" + str(sigswant) + ",\"choice\":" + str(choicewant) + ",\"special\":" + str(specialwant) + "}}"
|
||||||
print("\n" + studiostring)
|
print("\n" + studiostring)
|
||||||
|
else:
|
||||||
|
print("Nothing requested")
|
||||||
|
|
||||||
def randoms(specials=False):
|
def randoms(specials=False):
|
||||||
totalrandoms = int(input("How many? "))
|
totalrandoms = int(input("How many? "))
|
||||||
|
@ -740,8 +806,11 @@ def randoms(specials=False):
|
||||||
else:
|
else:
|
||||||
if card["colour"] != "special":
|
if card["colour"] != "special":
|
||||||
pool.append(card["name"])
|
pool.append(card["name"])
|
||||||
|
try:
|
||||||
chosen = sorted(random.sample(pool,totalrandoms))
|
chosen = sorted(random.sample(pool,totalrandoms))
|
||||||
print(", ".join(chosen))
|
print(", ".join(chosen))
|
||||||
|
except ValueError:
|
||||||
|
print("Too many cards requested")
|
||||||
|
|
||||||
def artshop():
|
def artshop():
|
||||||
hpred = []
|
hpred = []
|
||||||
|
@ -1415,6 +1484,8 @@ def artshop():
|
||||||
sketch = len(tradecommon)
|
sketch = len(tradecommon)
|
||||||
if sketch > 0:
|
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:
|
if len(requestcards) == 0 and sketchdifference < 1:
|
||||||
print("Nothing to request")
|
print("Nothing to request")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -3,6 +3,7 @@ serverpath = ""
|
||||||
subfolder = ""
|
subfolder = ""
|
||||||
url = ""
|
url = ""
|
||||||
name = "your name"
|
name = "your name"
|
||||||
|
sig = False
|
||||||
highpriority = ["deckname","nameofadeck"]
|
highpriority = ["deckname","nameofadeck"]
|
||||||
trademedium = True
|
trademedium = True
|
||||||
tradepost = "URL"
|
tradepost = "URL"
|
||||||
|
@ -14,10 +15,9 @@ collectthreshold = 2
|
||||||
mediumthreshold = 5
|
mediumthreshold = 5
|
||||||
massmediumthreshold = 1
|
massmediumthreshold = 1
|
||||||
highthreshold = 10
|
highthreshold = 10
|
||||||
keepsig = False
|
keepsig = True
|
||||||
tradestatement = ""
|
tradestatement = ""
|
||||||
maxmastered = 20
|
maxmastered = 20
|
||||||
ownedpage = False
|
|
||||||
firstmasteries = ["deckname","nameofdeck"]
|
firstmasteries = ["deckname","nameofdeck"]
|
||||||
misclink = {"link":"","text":""}
|
misclink = {"link":"","text":""}
|
||||||
donations = {"decks":[],"scrapbook":[]}
|
donations = {"decks":[],"scrapbook":[]}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue