Add go fish function
This commit is contained in:
parent
80a825c344
commit
ac946bc553
1 changed files with 69 additions and 0 deletions
69
colors.py
69
colors.py
|
@ -1539,6 +1539,75 @@ def switchit():
|
||||||
switchcomment = input("Comment URL: ")
|
switchcomment = input("Comment URL: ")
|
||||||
print("\n{\"event\":\"switch it up " + switchround + "\",\"date\":datetime.datetime(" + datetime.datetime.today().strftime("%Y,%-m,%-d") + "),\"url\":\"" + switchcomment + "\",\"pend\":[\"" + "\",\"".join(wantall) + "\"],\"lost\":[\"" + "\",\"".join(tradeall) + "\"]}")
|
print("\n{\"event\":\"switch it up " + switchround + "\",\"date\":datetime.datetime(" + datetime.datetime.today().strftime("%Y,%-m,%-d") + "),\"url\":\"" + switchcomment + "\",\"pend\":[\"" + "\",\"".join(wantall) + "\"],\"lost\":[\"" + "\",\"".join(tradeall) + "\"]}")
|
||||||
|
|
||||||
|
def fish():
|
||||||
|
fishdecks = input("Paste list of decks here: ").split(", ")
|
||||||
|
fishfound = []
|
||||||
|
for card in cardlist:
|
||||||
|
for deck in fishdecks:
|
||||||
|
if card["name"][:-2] == deck:
|
||||||
|
fishfound.append(card)
|
||||||
|
break
|
||||||
|
fishrefined = []
|
||||||
|
previouscard = ""
|
||||||
|
for card in fishfound:
|
||||||
|
try:
|
||||||
|
if card["name"][:-2] != previouscard["name"][:-2]:
|
||||||
|
fishrefined.append(card)
|
||||||
|
except:
|
||||||
|
fishrefined.append(card)
|
||||||
|
previouscard = card
|
||||||
|
fishmastered = []
|
||||||
|
fishhp = []
|
||||||
|
fishmp = []
|
||||||
|
fishlp = []
|
||||||
|
fishmass = []
|
||||||
|
fishtrade = []
|
||||||
|
for card in fishrefined:
|
||||||
|
if card["priority"] == 1:
|
||||||
|
for deck in decklist:
|
||||||
|
if deck["name"] == card["name"][:-2]:
|
||||||
|
if deck["mastered"]:
|
||||||
|
fishmastered.append(card)
|
||||||
|
else:
|
||||||
|
fishhp.append(card)
|
||||||
|
elif card["priority"] == 2:
|
||||||
|
if card["mass"]:
|
||||||
|
for deck in decklist:
|
||||||
|
if deck["name"] == card["name"][:-2]:
|
||||||
|
if deck["mass"]:
|
||||||
|
fishmp.append(card)
|
||||||
|
else:
|
||||||
|
fishmass.append(card)
|
||||||
|
else:
|
||||||
|
fishmp.append(card)
|
||||||
|
elif card["priority"] == 3:
|
||||||
|
fishlp.append(card)
|
||||||
|
else:
|
||||||
|
fishtrade.append(card)
|
||||||
|
locations = []
|
||||||
|
if len(fishmastered) > 0:
|
||||||
|
locations.append("mastered")
|
||||||
|
if len(fishhp) > 0:
|
||||||
|
locations.append("collecting/high priority")
|
||||||
|
if len(fishmp) > 0:
|
||||||
|
locations.append("collecting/medium priority")
|
||||||
|
if len(fishlp) > 0:
|
||||||
|
locations.append("collecting/low priority")
|
||||||
|
if len(fishmass) > 0:
|
||||||
|
for card in fishmass:
|
||||||
|
locations.append("mass collecting/" + card["mass"][0])
|
||||||
|
if len(fishtrade) > 0:
|
||||||
|
locations.append("trading")
|
||||||
|
locations = list(dict.fromkeys(locations))
|
||||||
|
cardnames = []
|
||||||
|
for card in fishrefined:
|
||||||
|
cardnames.append(card["name"])
|
||||||
|
print("\nTrade post: " + variables.url + "\nNumber of matches: " + str(len(fishrefined)) + "\nCard name(s): " + ", ".join(cardnames) + "\nWhere cards are located: " + ", ".join(locations) + "\nCards:")
|
||||||
|
images = ""
|
||||||
|
for card in fishrefined:
|
||||||
|
images += "<img src=\"https://colors-tcg.eu/cards/" + card["name"] + ".gif\">"
|
||||||
|
print(images)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Building index page")
|
print("Building index page")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue