From 5b843a15378a02d2ca926b6b0745228d15da2eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Sat, 29 Mar 2025 12:19:41 +0000 Subject: [PATCH] Allow pasting card type symbols into search, show subsets of dupes list --- colors.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/colors.py b/colors.py index 4395f42..fb0281c 100644 --- a/colors.py +++ b/colors.py @@ -989,18 +989,46 @@ def crayonlog(colour,event): crayonstring = str(crayonno) + " " + crayonrend return crayonstring -def dupes(): +def dupes(mass=True,nonmass=True,characters=True,specials=True): dupeslist = [] previouscard = "" for card in cardlist: try: - if card["name"] == previouscard["name"]: - dupeslist.append(card["name"]) + if card["colour"] != "sig" and card ["colour"] != "limited": + if card["name"] == previouscard["name"]: + dupe = {} + dupe["name"] = card["name"] + if len(card["mass"]) > 0: + if mass: + dupe["mass"] = card["mass"] + if card["colour"] == "special": + if specials: + dupeslist.append(dupe) + else: + if characters: + dupeslist.append(dupe) + else: + if nonmass: + if card["colour"] == "special": + if specials: + dupeslist.append(dupe) + else: + if characters: + dupeslist.append(dupe) except: pass previouscard = card return dupeslist +def activitydupes(): + print(dupes(False,True,True,False)) + +def riku(): + print("Specials") + print(dupes(True,False,False,True)) + print("Characters") + print(dupes(True,False,True,False)) + if __name__ == "__main__": print("Building index page") @@ -2009,7 +2037,7 @@ def searchgen(): content.write(", ") content.write("'" + card["name"] + "'") precomma = True - content.write("];\n const searchstring = document.getElementById('cardinput').value;\n const dupesarray = searchstring.replaceAll(' ','').replaceAll('\\n',',').replaceAll('\\r',',').toLowerCase().split(',');\n const searcharray = [ ...new Set(dupesarray) ];\n const hpwfound = [];\n const mpwfound = [];\n const lpwfound = [];\n const hptfound = [];\n const mptfound = [];\n const lptfound = [];\n for (const element of searcharray) {\n let cardend = element.substring(element.length, element.length - 2);\n if (!(thecards.includes(cardend))) {\n for (const ending of thecards) {\n searcharray.push(element + ending);\n };\n };\n };\n for (const element of searcharray) {\n if (hpw.includes(element)) {\n hpwfound.push(element);\n };\n if (mpw.includes(element)) {\n mpwfound.push(element);\n };\n if (lpw.includes(element)) {\n lpwfound.push(element);\n };\n if (hpt.includes(element)) {\n hptfound.push(element);\n };\n if (mpt.includes(element)) {\n mptfound.push(element);\n };\n if (lpt.includes(element)) {\n lptfound.push(element);\n };\n };\n if ((hpwfound.length) > 0) {\n document.getElementById('hpwfound').innerHTML = 'Wanted (high priority): ' + hpwfound.join(', ') + '';\n } else {\n document.getElementById('hpwfound').innerHTML = '';\n };\n if ((mpwfound.length) > 0) {\n document.getElementById('mpwfound').innerHTML = 'Wanted (medium priority): ' + mpwfound.join(', ') + '';\n } else {\n document.getElementById('mpwfound').innerHTML = '';\n };\n if ((lpwfound.length) > 0) {\n document.getElementById('lpwfound').innerHTML = 'Wanted (low priority): ' + lpwfound.join(', ') + '';\n } else {\n document.getElementById('lpwfound').innerHTML = '';\n };") + content.write("];\n const searchstring = document.getElementById('cardinput').value;\n const dupesarray = searchstring.replaceAll(' ','').replaceAll('\\n',',').replaceAll('\\r',',').replaceAll('🔴','').replaceAll('🟠','').replaceAll('🟡','').replaceAll('🟢','').replaceAll('🔵','').replaceAll('🟣','').replaceAll('🟤','').replaceAll('⚪','').replaceAll('✨','').replaceAll('🌈','').replaceAll('✍','').toLowerCase().split(',');\n const searcharray = [ ...new Set(dupesarray) ];\n const hpwfound = [];\n const mpwfound = [];\n const lpwfound = [];\n const hptfound = [];\n const mptfound = [];\n const lptfound = [];\n for (const element of searcharray) {\n let cardend = element.substring(element.length, element.length - 2);\n if (!(thecards.includes(cardend))) {\n for (const ending of thecards) {\n searcharray.push(element + ending);\n };\n };\n };\n for (const element of searcharray) {\n if (hpw.includes(element)) {\n hpwfound.push(element);\n };\n if (mpw.includes(element)) {\n mpwfound.push(element);\n };\n if (lpw.includes(element)) {\n lpwfound.push(element);\n };\n if (hpt.includes(element)) {\n hptfound.push(element);\n };\n if (mpt.includes(element)) {\n mptfound.push(element);\n };\n if (lpt.includes(element)) {\n lptfound.push(element);\n };\n };\n if ((hpwfound.length) > 0) {\n document.getElementById('hpwfound').innerHTML = 'Wanted (high priority): ' + hpwfound.join(', ') + '';\n } else {\n document.getElementById('hpwfound').innerHTML = '';\n };\n if ((mpwfound.length) > 0) {\n document.getElementById('mpwfound').innerHTML = 'Wanted (medium priority): ' + mpwfound.join(', ') + '';\n } else {\n document.getElementById('mpwfound').innerHTML = '';\n };\n if ((lpwfound.length) > 0) {\n document.getElementById('lpwfound').innerHTML = 'Wanted (low priority): ' + lpwfound.join(', ') + '';\n } else {\n document.getElementById('lpwfound').innerHTML = '';\n };") if variables.trademedium: content.write("\n if ((hptfound.length) > 0) {\n document.getElementById('hptfound').innerHTML = 'Will trade out for 0: