Make it possible to include single cards in mass collects
This commit is contained in:
parent
f9961bf6d4
commit
bb33cc084d
6 changed files with 56 additions and 17 deletions
|
@ -32,7 +32,7 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
|
|||
- =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
|
||||
- =masscollect=: list (python dict) of series/themes being mass collected and which decks to include in each one
|
||||
- =masscollect=: list (python dict) of series/themes being mass collected, each containing a dict which contains at least one of ="decks"= specifying a list of decks, or ="singles"= specifying a list of individual cards
|
||||
- Run the following:
|
||||
#+BEGIN_SRC bash
|
||||
python3 setup.py
|
||||
|
|
25
massgen.py
25
massgen.py
|
@ -6,8 +6,16 @@ massowned = {}
|
|||
for series in massdecks:
|
||||
ownedlist = []
|
||||
for card in tcgcore.ownedcards():
|
||||
if card[:-2] in massdecks[series]:
|
||||
ownedlist.append(card)
|
||||
try:
|
||||
if card[:-2] in massdecks[series]["decks"]:
|
||||
ownedlist.append(card)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if card in massdecks[series]["singles"]:
|
||||
ownedlist.append(card)
|
||||
except:
|
||||
pass
|
||||
if len(ownedlist) > 0:
|
||||
ownedlist = sorted(list(dict.fromkeys(ownedlist)))
|
||||
massowned[series] = ownedlist
|
||||
|
@ -23,11 +31,20 @@ def massindexgen():
|
|||
content.write("<h1>mass collecting</h1>\n<ul>\n")
|
||||
massindex = 1
|
||||
for series in massowned:
|
||||
totalno = 0
|
||||
try:
|
||||
totalno += len(variables.masscollect[series]["decks"]) * 20
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
totalno += len(variables.masscollect[series]["singles"])
|
||||
except:
|
||||
pass
|
||||
content.write("<li><a href=\"/mass/" + str(massindex) + "\">" + series + "</a> (")
|
||||
if len(massowned[series]) == len(variables.masscollect[series]) * 20:
|
||||
if len(massowned[series]) == totalno:
|
||||
content.write("complete")
|
||||
else:
|
||||
content.write(str(len(massowned[series])) + "/" + str(len(variables.masscollect[series]) * 20))
|
||||
content.write(str(len(massowned[series])) + "/" + str(totalno))
|
||||
content.write(")</li>\n")
|
||||
massindex += 1
|
||||
content.write("</ul>\n")
|
||||
|
|
21
searchgen.py
21
searchgen.py
|
@ -38,13 +38,24 @@ def searchgen():
|
|||
lpt.append(card)
|
||||
else:
|
||||
if not tcgcore.deckmastered(card[:-2]):
|
||||
if card in ownedcollecting:
|
||||
if tcgcore.priority(card[:-2]) == "medium":
|
||||
mass = False
|
||||
for series in variables.masscollect:
|
||||
try:
|
||||
if card in variables.masscollect[series]["singles"]:
|
||||
mass = True
|
||||
except:
|
||||
pass
|
||||
if mass == True:
|
||||
if tcgcore.priority(card[:-2]) != "high":
|
||||
hpt.append(card)
|
||||
elif tcgcore.priority(card[:-2]) == "low":
|
||||
mpt.append(card)
|
||||
else:
|
||||
lpt.append(card)
|
||||
if card in ownedcollecting:
|
||||
if tcgcore.priority(card[:-2]) == "medium":
|
||||
hpt.append(card)
|
||||
elif tcgcore.priority(card[:-2]) == "low":
|
||||
mpt.append(card)
|
||||
else:
|
||||
lpt.append(card)
|
||||
previouscard = card
|
||||
hpw = sorted(list(dict.fromkeys(hpw)))
|
||||
mpw = sorted(list(dict.fromkeys(mpw)))
|
||||
|
|
|
@ -63,8 +63,11 @@ def datemastered(deck):
|
|||
|
||||
medium = []
|
||||
for series in variables.masscollect:
|
||||
for deck in variables.masscollect[series]:
|
||||
medium.append(deck)
|
||||
try:
|
||||
for deck in variables.masscollect[series]["decks"]:
|
||||
medium.append(deck)
|
||||
except:
|
||||
pass
|
||||
medium = sorted(list(dict.fromkeys(medium)))
|
||||
|
||||
def collecting(deck):
|
||||
|
|
16
tradegen.py
16
tradegen.py
|
@ -32,11 +32,19 @@ def tradegen(colour=False):
|
|||
else:
|
||||
if not tcgcore.deckmastered(card[:-2]):
|
||||
if not tcgcore.collecting(card[:-2]):
|
||||
if colour:
|
||||
if tcgcore.cardtype(card) == colour:
|
||||
mass = False
|
||||
for series in variables.masscollect:
|
||||
try:
|
||||
if card in variables.masscollect[series]["singles"]:
|
||||
mass = True
|
||||
except:
|
||||
pass
|
||||
if mass == False:
|
||||
if colour:
|
||||
if tcgcore.cardtype(card) == colour:
|
||||
tradelist.append(card)
|
||||
else:
|
||||
tradelist.append(card)
|
||||
else:
|
||||
tradelist.append(card)
|
||||
previouscard = card
|
||||
siglist = []
|
||||
for card in tcgcore.ownedcards():
|
||||
|
|
|
@ -14,4 +14,4 @@ tradestatement = ""
|
|||
maxmastered = 20
|
||||
ownedpage = False
|
||||
firstmasteries = ["deckname","nameofdeck"]
|
||||
masscollect = {"series":["firstdeck","seconddeck"]}
|
||||
masscollect = {"series":{"decks":["firstdeck","seconddeck"],"singles":["card01","card02"]}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue