Compare commits

..

2 commits

Author SHA1 Message Date
Mez
a8783c9574 Add little spell academia function 2025-08-03 22:40:37 +01:00
Mez
63d654bd8a Add natsume function 2025-08-03 22:06:16 +01:00

169
tools.py
View file

@ -1659,12 +1659,175 @@ def roulette():
letteurl = input("Comment URL: ")
print("\n{\"event\":\"release roulette " + theround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + letteurl + "\",\"lost\":[\"" + "\",\"".join(chosen) + "\"]}")
def natsume():
natsudecks = input("Paste in list of decks: ").split(", ")
natsuwant = []
natsugivech = []
natsugivesp = []
for card in colors.cardlist:
for deck in natsudecks:
for number in colors.numbers:
if card["name"] == deck + number:
if card["priority"] > 2:
if card["colour"] == "special":
natsugivesp.append(card)
else:
natsugivech.append(card)
for card in colors.wantedlist:
for deck in natsudecks:
for number in colors.numbers:
if card["name"] == deck + number:
natsuwant.append(card)
for card in natsugivech:
count = 0
for othercard in natsugivech:
if othercard["name"][:-2] == card["name"][:-2]:
count += 1
card["count"] = count
natsugivech = sorted(natsugivech, key=lambda d: d["count"],reverse=True)
natsugivech = sorted(natsugivech, key=lambda d: d["priority"],reverse=True)
for card in natsugivesp:
count = 0
for othercard in natsugivesp:
if othercard["name"][:-2] == card["name"][:-2]:
count += 1
card["count"] = count
natsugivesp = sorted(natsugivesp, key=lambda d: d["count"],reverse=True)
natsugivesp = sorted(natsugivesp, key=lambda d: d["priority"],reverse=True)
natsuwantgrouped = []
natsugivechgrouped = []
natsugivespgrouped = []
index = 0
for card in natsuwant:
if index > 0:
if card["name"][:-2] == natsuwant[index-1]["name"][:-2]:
listone.append(card)
if index + 1 == len(natsuwant):
natsuwantgrouped.append(listone)
else:
natsuwantgrouped.append(listone)
listone = []
listone.append(card)
else:
listone = []
listone.append(card)
index += 1
index = 0
for card in natsugivech:
if index > 0:
if card["name"][:-2] == natsugivech[index-1]["name"][:-2]:
listtwo.append(card["name"])
if index + 1 == len(natsugivech):
natsugivechgrouped.append(listtwo)
else:
natsugivechgrouped.append(listtwo)
listtwo = []
listtwo.append(card["name"])
else:
listtwo = []
listtwo.append(card["name"])
index += 1
index = 0
for card in natsugivesp:
if index > 0:
if card["name"][:-2] == natsugivesp[index-1]["name"][:-2]:
listthree.append(card["name"])
if index + 1 == len(natsugivesp):
natsugivespgrouped.append(listthree)
else:
natsugivespgrouped.append(listthree)
listthree = []
listthree.append(card["name"])
else:
listthree = []
listthree.append(card["name"])
index += 1
natsugivechgrouped = natsugivechgrouped[:5]
natsugivespgrouped = natsugivespgrouped[:5]
finalwant = []
finalgive = []
for group in natsuwantgrouped:
if len(finalwant) < 5:
if group[0]["colour"] == "special":
if len(natsugivespgrouped) > 0:
if natsugivespgrouped[0][0][:-2] == group[0]["name"][:-2]:
if len(natsugivespgrouped) > 1:
group = group[:len(natsugivespgrouped[1])]
natsugivespgrouped[1] = natsugivespgrouped[1][:len(group)]
for givecard in natsugivespgrouped[1]:
finalgive.append(givecard)
natsugivespgrouped.pop(1)
for card in group:
finalwant.append(card["name"])
else:
group = group[:len(natsugivespgrouped[0])]
natsugivespgrouped[0] = natsugivespgrouped[0][:len(group)]
for givecard in natsugivespgrouped[0]:
finalgive.append(givecard)
natsugivespgrouped.pop(0)
for card in group:
finalwant.append(card["name"])
else:
if len(natsugivechgrouped) > 0:
if natsugivechgrouped[0][0][:-2] == group[0]["name"][:-2]:
if len(natsugivechgrouped) > 1:
group = group[:len(natsugivechgrouped[1])]
natsugivechgrouped[1] = natsugivechgrouped[1][:len(group)]
for givecard in natsugivechgrouped[1]:
finalgive.append(givecard)
natsugivechgrouped.pop(1)
for card in group:
finalwant.append(card["name"])
else:
group = group[:len(natsugivechgrouped[0])]
natsugivechgrouped[0] = natsugivechgrouped[0][:len(group)]
for givecard in natsugivechgrouped[0]:
finalgive.append(givecard)
natsugivechgrouped.pop(0)
for card in group:
finalwant.append(card["name"])
finalwant = finalwant[:5]
finalgive = finalgive[:5]
if len(finalwant) > 0:
print("\n<b>Name</b>: " + variables.name + "\n<b>Cards you are turning in (" + str(len(finalwant)) + "/5)</b>:\n<img src=\"https://colors-tcg.eu/cards/" + ".gif\"><img src=\"https://colors-tcg.eu/cards/".join(finalgive) + ".gif\">\n<b>Card names</b>: " + ", ".join(finalgive) + "\n<b>Cards you want</b>: " + ", ".join(finalwant))
theround = input("\nRound number: ")
natsurl = input("Comment URL: ")
print("\n{\"event\":\"natsume’s book of cards " + theround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + natsurl + "\",\"lost\":[\"" + "\",\"".join(finalgive) + "\"],\"received\":[\"" + "\",\"".join(finalwant) + "\"]}")
else:
print("Nothing can be swapped")
def lsa():
thephrase = input("Phrase: ").replace(" ","").lower()
holder = []
slots = len(thephrase)
while slots > 0:
holder.append("")
slots -= 1
nospecials = []
for card in colors.wantedlist:
if card["colour"] != "special":
nospecials.append(card["name"])
for card in nospecials:
index = 0
stop = False
while index < len(thephrase):
if not stop:
if holder[index] == "":
if thephrase[index] in card[:-2]:
holder[index] = card
stop = True
index += 1
print(", ".join(holder))
theround = input("\nRound number: ")
lsaurl = input("Comment URL: ")
print("\n{\"event\":\"little spell academia " + theround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + lsaurl + "\",\"received\":[\"" + "\",\"".join(holder) + "\"]}")
if __name__ == "__main__":
while True:
index = 0 # adapted from https://stackoverflow.com/a/64536882
indexValidList = []
print("Choose from the list:")
options = ["Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Swap Station request","Generate Go Fish comment","Generate Release Roulette comment","Generate Riku’s Favors comment","Generate art shop request","Generate art studio request","Check a trade offer","Propose a trade","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","Check a card in the collection","Check details of a deck","See decks mastered today","See most wanted character cards","See most wanted special cards","See some statistics about the collection"]
options = ["Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Swap Station request","Generate Go Fish comment","Generate Release Roulette comment","Generate Riku’s Favors comment","Generate Natsume’s Book of Cards comment","Generate Little Spell Academia comment","Generate art shop request","Generate art studio request","Check a trade offer","Propose a trade","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","Check a card in the collection","Check details of a deck","See decks mastered today","See most wanted character cards","See most wanted special cards","See some statistics about the collection"]
for optionName in options:
index = index + 1
indexValidList.extend([options.index(optionName)])
@ -1718,5 +1881,9 @@ if __name__ == "__main__":
topwant()
elif chosen == "See most wanted special cards":
topwant(True)
elif chosen == "Generate Natsume’s Book of Cards comment":
natsume()
elif chosen == "Generate Little Spell Academia comment":
lsa()
print("\n")
input("Press Enter to continue or Ctrl-C to exit")