Remove anniversary decks from wantlist, fix trade function
This commit is contained in:
parent
695146cac1
commit
44b2c1c05e
2 changed files with 96 additions and 63 deletions
15
colors.py
15
colors.py
|
@ -508,13 +508,14 @@ wantedlist = []
|
||||||
|
|
||||||
for deck in decklist:
|
for deck in decklist:
|
||||||
if deck["priority"] < 4:
|
if deck["priority"] < 4:
|
||||||
for number in numbers:
|
if deck["colour"] != "limited":
|
||||||
if deck[number] == None:
|
for number in numbers:
|
||||||
wantedcard = {}
|
if deck[number] == None:
|
||||||
wantedcard["name"] = deck["name"] + number
|
wantedcard = {}
|
||||||
wantedcard["colour"] = deck["colour"]
|
wantedcard["name"] = deck["name"] + number
|
||||||
wantedcard["priority"] = deck["priority"]
|
wantedcard["colour"] = deck["colour"]
|
||||||
wantedlist.append(wantedcard)
|
wantedcard["priority"] = deck["priority"]
|
||||||
|
wantedlist.append(wantedcard)
|
||||||
|
|
||||||
decknames = []
|
decknames = []
|
||||||
for deck in decklist:
|
for deck in decklist:
|
||||||
|
|
144
tools.py
144
tools.py
|
@ -1833,7 +1833,11 @@ def maketrade():
|
||||||
randomsp = []
|
randomsp = []
|
||||||
totalrandomch = 0
|
totalrandomch = 0
|
||||||
totalrandomsp = 0
|
totalrandomsp = 0
|
||||||
randoms = input("Do they take randoms? [y/N] ")
|
ifrandoms = input("Do they take randoms? [y/N] ")
|
||||||
|
if ifrandoms == "y":
|
||||||
|
randoms = True
|
||||||
|
else:
|
||||||
|
randoms = False
|
||||||
for thecard in theirwantlist:
|
for thecard in theirwantlist:
|
||||||
found = False
|
found = False
|
||||||
for card in reversed(colors.cardlist):
|
for card in reversed(colors.cardlist):
|
||||||
|
@ -1873,114 +1877,140 @@ def maketrade():
|
||||||
outc = []
|
outc = []
|
||||||
inc.extend(hpwc)
|
inc.extend(hpwc)
|
||||||
outc.extend(lptc)
|
outc.extend(lptc)
|
||||||
|
medchadded = False
|
||||||
if len(inc) > len(outc):
|
if len(inc) > len(outc):
|
||||||
if randoms:
|
if randoms:
|
||||||
randomch = random.shuffle(randomch)
|
|
||||||
neededrandomch = len(inc) - len(outc)
|
|
||||||
totalrandomch += neededrandomch
|
|
||||||
try:
|
try:
|
||||||
|
random.shuffle(randomch)
|
||||||
|
neededrandomch = len(inc) - len(outc)
|
||||||
|
totalrandomch += neededrandomch
|
||||||
add = randomch[:neededrandomch]
|
add = randomch[:neededrandomch]
|
||||||
randomch = randomch[neededrandomch:]
|
randomch = randomch[neededrandomch:]
|
||||||
outc.extend(add)
|
outc.extend(add)
|
||||||
|
trymediumch = True
|
||||||
except:
|
except:
|
||||||
outc.extend(mptc)
|
outc.extend(mptc)
|
||||||
|
medchadded = True
|
||||||
if len(inc) > len(outc):
|
if len(inc) > len(outc):
|
||||||
|
trymediumch = False
|
||||||
outc.extend(hptc)
|
outc.extend(hptc)
|
||||||
else:
|
else:
|
||||||
inc.extend(mpwc)
|
trymediumch = True
|
||||||
else:
|
else:
|
||||||
outc.extend(mptc)
|
outc.extend(mptc)
|
||||||
|
medchadded = True
|
||||||
if len(inc) > len(outc):
|
if len(inc) > len(outc):
|
||||||
|
trymediumch = False
|
||||||
outc.extend(hptc)
|
outc.extend(hptc)
|
||||||
else:
|
else:
|
||||||
inc.extend(mpwc)
|
trymediumch = True
|
||||||
else:
|
if trymediumch:
|
||||||
inc.extend(mpwc)
|
inc.extend(mpwc)
|
||||||
if len(inc) > len(outc):
|
if len(inc) > len(outc):
|
||||||
if randoms:
|
if randoms:
|
||||||
randomch = random.shuffle(randomch)
|
|
||||||
neededrandomch = len(inc) - len(outc)
|
|
||||||
totalrandomch += neededrandomch
|
|
||||||
try:
|
try:
|
||||||
|
random.shuffle(randomch)
|
||||||
|
neededrandomch = len(inc) - len(outc)
|
||||||
|
totalrandomch += neededrandomch
|
||||||
|
add = randomch[:neededrandomch]
|
||||||
|
randomch = randomch[neededrandomch:]
|
||||||
|
outc.extend(add)
|
||||||
|
trylowch = True
|
||||||
|
except:
|
||||||
|
trylowch = False
|
||||||
|
if not medchadded:
|
||||||
|
outc.extend(mptc)
|
||||||
|
else:
|
||||||
|
trylowch = False
|
||||||
|
if not medchadded:
|
||||||
|
outc.extend(mptc)
|
||||||
|
else:
|
||||||
|
trylowch = True
|
||||||
|
if trylowch:
|
||||||
|
inc.extend(lpwc)
|
||||||
|
if len(inc) > len(outc):
|
||||||
|
if randoms:
|
||||||
|
try:
|
||||||
|
random.shuffle(randomch)
|
||||||
|
neededrandomch = len(inc) - len(outc)
|
||||||
|
totalrandomch += neededrandomch
|
||||||
add = randomch[:neededrandomch]
|
add = randomch[:neededrandomch]
|
||||||
randomch = randomch[neededrandomch:]
|
randomch = randomch[neededrandomch:]
|
||||||
outc.extend(add)
|
outc.extend(add)
|
||||||
except:
|
except:
|
||||||
outc.extend(mptc)
|
pass
|
||||||
else:
|
|
||||||
outc.extend(mptc)
|
|
||||||
else:
|
|
||||||
inc.extend(lpwc)
|
|
||||||
if len(inc) > len(outc):
|
if len(inc) > len(outc):
|
||||||
if randoms:
|
inc = inc[:len(outc)]
|
||||||
randomch = random.shuffle(randomch)
|
|
||||||
neededrandomch = len(inc) - len(outc)
|
|
||||||
totalrandomch += neededrandomch
|
|
||||||
try:
|
|
||||||
add = randomch[:neededrandomch]
|
|
||||||
randomch = randomch[neededrandomch:]
|
|
||||||
outc.extend(add)
|
|
||||||
except:
|
|
||||||
inc = inc[:len(outc)]
|
|
||||||
else:
|
|
||||||
inc = inc[:len(outc)]
|
|
||||||
elif len(outc) > len(inc):
|
elif len(outc) > len(inc):
|
||||||
outc = outc[:len(inc)]
|
outc = outc[:len(inc)]
|
||||||
ins = []
|
ins = []
|
||||||
outs = []
|
outs = []
|
||||||
ins.extend(hpws)
|
ins.extend(hpws)
|
||||||
outs.extend(lpts)
|
outs.extend(lpts)
|
||||||
|
medspadded = False
|
||||||
if len(ins) > len(outs):
|
if len(ins) > len(outs):
|
||||||
if randoms:
|
if randoms:
|
||||||
randomsp = random.shuffle(randomsp)
|
|
||||||
neededrandomsp = len(ins) - len(outs)
|
|
||||||
totalrandomsp += neededrandomsp
|
|
||||||
try:
|
try:
|
||||||
|
random.shuffle(randomsp)
|
||||||
|
neededrandomsp = len(ins) - len(outs)
|
||||||
|
totalrandomsp += neededrandomsp
|
||||||
add = randomsp[:neededrandomsp]
|
add = randomsp[:neededrandomsp]
|
||||||
randomsp = randomsp[neededrandomsp:]
|
randomsp = randomsp[neededrandomsp:]
|
||||||
outs.extend(add)
|
outs.extend(add)
|
||||||
|
trymediumsp = True
|
||||||
except:
|
except:
|
||||||
outs.extend(mpts)
|
outs.extend(mpts)
|
||||||
|
medspadded = True
|
||||||
if len(ins) > len(outs):
|
if len(ins) > len(outs):
|
||||||
|
trymediumsp = False
|
||||||
outs.extend(hpts)
|
outs.extend(hpts)
|
||||||
else:
|
else:
|
||||||
ins.extend(mpws)
|
trymediumsp = True
|
||||||
else:
|
else:
|
||||||
outs.extend(mpts)
|
outs.extend(mpts)
|
||||||
|
medspadded = True
|
||||||
if len(ins) > len(outs):
|
if len(ins) > len(outs):
|
||||||
|
trymediumsp = False
|
||||||
outs.extend(hpts)
|
outs.extend(hpts)
|
||||||
else:
|
else:
|
||||||
ins.extend(mpws)
|
trymediumsp = True
|
||||||
else:
|
if trymediumsp:
|
||||||
ins.extend(mpws)
|
ins.extend(mpws)
|
||||||
if len(ins) > len(outs):
|
if len(ins) > len(outs):
|
||||||
if randoms:
|
if randoms:
|
||||||
randomsp = random.shuffle(randomsp)
|
|
||||||
neededrandomsp = len(ins) - len(outs)
|
|
||||||
totalrandomsp += neededrandomsp
|
|
||||||
try:
|
try:
|
||||||
|
random.shuffle(randomsp)
|
||||||
|
neededrandomsp = len(ins) - len(outs)
|
||||||
|
totalrandomsp += neededrandomsp
|
||||||
|
add = randomsp[:neededrandomsp]
|
||||||
|
randomsp = randomsp[neededrandomsp:]
|
||||||
|
outs.extend(add)
|
||||||
|
trylowsp = True
|
||||||
|
except:
|
||||||
|
trylowsp = False
|
||||||
|
if not medspadded:
|
||||||
|
outs.extend(mpts)
|
||||||
|
else:
|
||||||
|
trylowsp = False
|
||||||
|
if not medspadded:
|
||||||
|
outs.extend(mpts)
|
||||||
|
else:
|
||||||
|
trylowsp = True
|
||||||
|
if trylowsp:
|
||||||
|
ins.extend(lpws)
|
||||||
|
if len(ins) > len(outs):
|
||||||
|
if randoms:
|
||||||
|
try:
|
||||||
|
random.shuffle(randomsp)
|
||||||
|
neededrandomsp = len(ins) - len(outs)
|
||||||
|
totalrandomsp += neededrandomsp
|
||||||
add = randomsp[:neededrandomsp]
|
add = randomsp[:neededrandomsp]
|
||||||
randomsp = randomsp[neededrandomsp:]
|
randomsp = randomsp[neededrandomsp:]
|
||||||
outs.extend(add)
|
outs.extend(add)
|
||||||
except:
|
except:
|
||||||
outs.extend(mpts)
|
pass
|
||||||
else:
|
|
||||||
outs.extend(mpts)
|
|
||||||
else:
|
|
||||||
ins.extend(lpws)
|
|
||||||
if len(ins) > len(outs):
|
if len(ins) > len(outs):
|
||||||
if randoms:
|
ins = ins[:len(outs)]
|
||||||
randomsp = random.shuffle(randomsp)
|
|
||||||
neededrandomsp = len(ins) - len(outs)
|
|
||||||
totalrandomsp += neededrandomsp
|
|
||||||
try:
|
|
||||||
add = randomsp[:neededrandomsp]
|
|
||||||
randomsp = randomsp[neededrandomsp:]
|
|
||||||
outs.extend(add)
|
|
||||||
except:
|
|
||||||
ins = ins[:len(outs)]
|
|
||||||
else:
|
|
||||||
ins = ins[:len(outs)]
|
|
||||||
elif len(outs) > len(ins):
|
elif len(outs) > len(ins):
|
||||||
outs = outs[:len(ins)]
|
outs = outs[:len(ins)]
|
||||||
thein = sorted(inc + ins)
|
thein = sorted(inc + ins)
|
||||||
|
@ -1992,11 +2022,13 @@ def maketrade():
|
||||||
thein.append("sig_" + theirname.lower())
|
thein.append("sig_" + theirname.lower())
|
||||||
theout.append("sig_" + variables.name.lower())
|
theout.append("sig_" + variables.name.lower())
|
||||||
if len(thein) > 0:
|
if len(thein) > 0:
|
||||||
tradestring = "\nmy " + ", ".join(theout) + "\n\nfor your " + ", ".join(thein) + "?\n\n(" + str(len(thein)) + " cards"
|
tradestring = "\nmy " + ", ".join(theout) + "\n\nfor your " + ", ".join(thein) + "?"
|
||||||
if randoms:
|
if randoms:
|
||||||
if randomstotal > 0:
|
if randomstotal > 0:
|
||||||
tradestring += ", including " + str(randomstotal) + " randoms"
|
tradestring += "\n\n(" + str(len(thein)) + " cards, including " + str(randomstotal) + " randoms)"
|
||||||
tradestring += ")\n\n<img src=\"https://colors-tcg.eu/cards/" + ".gif\"><img src=\"https://colors-tcg.eu/cards/".join(theout) + ".gif\">"
|
elif len(thein) > 19:
|
||||||
|
tradestring += "\n\n(" + str(len(thein)) + " cards)"
|
||||||
|
tradestring += "\n\n<img src=\"https://colors-tcg.eu/cards/" + ".gif\"><img src=\"https://colors-tcg.eu/cards/".join(theout) + ".gif\">"
|
||||||
print(tradestring)
|
print(tradestring)
|
||||||
tradeurl = input("\nPaste in comment URL: ")
|
tradeurl = input("\nPaste in comment URL: ")
|
||||||
print("\n{\"event\":\"trade with " + theirname + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + tradeurl + "\",\"lost\":[\"" + "\",\"".join(theout) + "\"],\"pend\":[\"" + "\",\"".join(thein) + "\"]}")
|
print("\n{\"event\":\"trade with " + theirname + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + tradeurl + "\",\"lost\":[\"" + "\",\"".join(theout) + "\"],\"pend\":[\"" + "\",\"".join(thein) + "\"]}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue