Add trade check function
This commit is contained in:
parent
4fe0a8a6d7
commit
aee8f5e122
1 changed files with 100 additions and 2 deletions
102
tools.py
102
tools.py
|
@ -1660,14 +1660,110 @@ def stats():
|
|||
print(" " + key + ": " + str(seriesdict[key]) + "/" + str(totaldict[key]) + " (" + str(int((float(seriesdict[key])/float(totaldict[key])) * 100)) + "%)")
|
||||
else:
|
||||
print(" " + key + ": complete")
|
||||
|
||||
|
||||
def tradecheck():
|
||||
inoffer = input("Paste cards they offered here: ").split(", ")
|
||||
outoffer = input("Paste cards they requested here: ").split(", ")
|
||||
insig = 0
|
||||
inone = 0
|
||||
intwo = 0
|
||||
inthree = 0
|
||||
infour = 0
|
||||
for incard in inoffer:
|
||||
if incard[0:4] == "sig_":
|
||||
insig = 1
|
||||
else:
|
||||
found = False
|
||||
for card in colors.wantedlist:
|
||||
if found == False:
|
||||
if card["name"] == incard:
|
||||
if card["priority"] == 1:
|
||||
inone += 1
|
||||
elif card["priority"] == 2:
|
||||
intwo += 1
|
||||
elif card["priority"] == 3:
|
||||
inthree += 1
|
||||
found = True
|
||||
if found == False:
|
||||
infour += 1
|
||||
print("\n")
|
||||
offerstring = "They are offering "
|
||||
if inone > 0:
|
||||
offerstring += str(inone) + " high priority"
|
||||
if intwo + inthree + infour + insig > 0:
|
||||
offerstring += ", "
|
||||
if intwo > 0:
|
||||
offerstring += str(intwo) + " medium priority"
|
||||
if inthree + infour + insig > 0:
|
||||
offerstring += ", "
|
||||
if inthree > 0:
|
||||
offerstring += str(inthree) + " low priority"
|
||||
if infour + insig > 0:
|
||||
offerstring += ", "
|
||||
if infour > 0:
|
||||
offerstring += str(infour) + " randoms"
|
||||
if insig > 0:
|
||||
offerstring += ", "
|
||||
if insig > 0:
|
||||
offerstring += " sig"
|
||||
offerstring += " = " + str(inone + intwo + inthree + infour + insig) + " cards"
|
||||
print(offerstring)
|
||||
reversecards = colors.cardlist[::-1]
|
||||
outsig = 0
|
||||
outone = 0
|
||||
outtwo = 0
|
||||
outthree = 0
|
||||
outfour = 0
|
||||
notin = []
|
||||
for outcard in outoffer:
|
||||
if outcard[0:4] == "sig_":
|
||||
outsig = 1
|
||||
else:
|
||||
found = False
|
||||
for card in reversecards:
|
||||
if found == False:
|
||||
if card["name"] == outcard:
|
||||
if card["priority"] == 1:
|
||||
outone += 1
|
||||
elif card["priority"] == 2:
|
||||
outtwo += 1
|
||||
elif card["priority"] == 3:
|
||||
outthree += 1
|
||||
elif card["priority"] == 4:
|
||||
outfour += 1
|
||||
found = True
|
||||
if found == False:
|
||||
notin.append(outcard)
|
||||
requeststring = "They are requesting "
|
||||
if outone > 0:
|
||||
requeststring += str(outone) + " high priority"
|
||||
if outtwo + outthree + outfour + outsig > 0:
|
||||
requeststring += ", "
|
||||
if outtwo > 0:
|
||||
requeststring += str(outtwo) + " medium priority"
|
||||
if outthree + outfour + outsig > 0:
|
||||
requeststring += ", "
|
||||
if outthree > 0:
|
||||
requeststring += str(outthree) + " low priority"
|
||||
if outfour + outsig > 0:
|
||||
requeststring += ", "
|
||||
if outfour > 0:
|
||||
requeststring += str(outfour) + " from tradepile"
|
||||
if outsig > 0:
|
||||
requeststring += ", "
|
||||
if outsig > 0:
|
||||
requeststring += " sig"
|
||||
requeststring += " = " + str(outone + outtwo + outthree + outfour + outsig) + " cards"
|
||||
print(requeststring)
|
||||
if len(notin) > 0:
|
||||
print("Requested but not in collection: " + ", ".join(notin))
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
index = 0 # adapted from https://stackoverflow.com/a/64536882
|
||||
indexValidList = []
|
||||
print("Choose from the list:")
|
||||
options = ["Get a list of potential cards to trade in for Riku’s Favors","Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Go Fish comment","Generate art shop request","Generate art studio request","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","See some statistics about the collection"]
|
||||
options = ["Get a list of potential cards to trade in for Riku’s Favors","Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Go Fish comment","Generate art shop request","Generate art studio request","Check a trade offer","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","See some statistics about the collection"]
|
||||
for optionName in options:
|
||||
index = index + 1
|
||||
indexValidList.extend([options.index(optionName)])
|
||||
|
@ -1703,5 +1799,7 @@ if __name__ == "__main__":
|
|||
artshop()
|
||||
elif chosen == "See some statistics about the collection":
|
||||
stats()
|
||||
elif chosen == "Check a trade offer":
|
||||
tradecheck()
|
||||
print("\n")
|
||||
input("Press Enter to continue or Ctrl-C to exit")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue