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
|
- =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
|
- =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
|
||||||
- =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:
|
- Run the following:
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
python3 setup.py
|
python3 setup.py
|
||||||
|
|
25
massgen.py
25
massgen.py
|
@ -6,8 +6,16 @@ massowned = {}
|
||||||
for series in massdecks:
|
for series in massdecks:
|
||||||
ownedlist = []
|
ownedlist = []
|
||||||
for card in tcgcore.ownedcards():
|
for card in tcgcore.ownedcards():
|
||||||
if card[:-2] in massdecks[series]:
|
try:
|
||||||
ownedlist.append(card)
|
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:
|
if len(ownedlist) > 0:
|
||||||
ownedlist = sorted(list(dict.fromkeys(ownedlist)))
|
ownedlist = sorted(list(dict.fromkeys(ownedlist)))
|
||||||
massowned[series] = ownedlist
|
massowned[series] = ownedlist
|
||||||
|
@ -23,11 +31,20 @@ def massindexgen():
|
||||||
content.write("<h1>mass collecting</h1>\n<ul>\n")
|
content.write("<h1>mass collecting</h1>\n<ul>\n")
|
||||||
massindex = 1
|
massindex = 1
|
||||||
for series in massowned:
|
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> (")
|
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")
|
content.write("complete")
|
||||||
else:
|
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")
|
content.write(")</li>\n")
|
||||||
massindex += 1
|
massindex += 1
|
||||||
content.write("</ul>\n")
|
content.write("</ul>\n")
|
||||||
|
|
21
searchgen.py
21
searchgen.py
|
@ -38,13 +38,24 @@ def searchgen():
|
||||||
lpt.append(card)
|
lpt.append(card)
|
||||||
else:
|
else:
|
||||||
if not tcgcore.deckmastered(card[:-2]):
|
if not tcgcore.deckmastered(card[:-2]):
|
||||||
if card in ownedcollecting:
|
mass = False
|
||||||
if tcgcore.priority(card[:-2]) == "medium":
|
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)
|
hpt.append(card)
|
||||||
elif tcgcore.priority(card[:-2]) == "low":
|
|
||||||
mpt.append(card)
|
|
||||||
else:
|
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
|
previouscard = card
|
||||||
hpw = sorted(list(dict.fromkeys(hpw)))
|
hpw = sorted(list(dict.fromkeys(hpw)))
|
||||||
mpw = sorted(list(dict.fromkeys(mpw)))
|
mpw = sorted(list(dict.fromkeys(mpw)))
|
||||||
|
|
|
@ -63,8 +63,11 @@ def datemastered(deck):
|
||||||
|
|
||||||
medium = []
|
medium = []
|
||||||
for series in variables.masscollect:
|
for series in variables.masscollect:
|
||||||
for deck in variables.masscollect[series]:
|
try:
|
||||||
medium.append(deck)
|
for deck in variables.masscollect[series]["decks"]:
|
||||||
|
medium.append(deck)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
medium = sorted(list(dict.fromkeys(medium)))
|
medium = sorted(list(dict.fromkeys(medium)))
|
||||||
|
|
||||||
def collecting(deck):
|
def collecting(deck):
|
||||||
|
|
16
tradegen.py
16
tradegen.py
|
@ -32,11 +32,19 @@ def tradegen(colour=False):
|
||||||
else:
|
else:
|
||||||
if not tcgcore.deckmastered(card[:-2]):
|
if not tcgcore.deckmastered(card[:-2]):
|
||||||
if not tcgcore.collecting(card[:-2]):
|
if not tcgcore.collecting(card[:-2]):
|
||||||
if colour:
|
mass = False
|
||||||
if tcgcore.cardtype(card) == colour:
|
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)
|
tradelist.append(card)
|
||||||
else:
|
|
||||||
tradelist.append(card)
|
|
||||||
previouscard = card
|
previouscard = card
|
||||||
siglist = []
|
siglist = []
|
||||||
for card in tcgcore.ownedcards():
|
for card in tcgcore.ownedcards():
|
||||||
|
|
|
@ -14,4 +14,4 @@ tradestatement = ""
|
||||||
maxmastered = 20
|
maxmastered = 20
|
||||||
ownedpage = False
|
ownedpage = False
|
||||||
firstmasteries = ["deckname","nameofdeck"]
|
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