|
|
|
@@ -6,7 +6,7 @@ conf={}
|
|
|
|
|
confp=os.path.expanduser('~/.config/swat.cfg') # This won't work on Windows. You'll need to tweak this to run it on Windows. Not my problem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defaults={'classes':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(0,0),(0,0),(1,3),(1,3),(1,3)],'guns':[(1,3),(1,3),(1,3),(1,3),(1,3),(0,0),(0,0),(1,3)],'armour':[(1,3),(1,3),(1,3),(1,3)],'traits':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'specs':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'talents':[(12,12),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'medals':{}}
|
|
|
|
|
defaults={'classes':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(0,0),(0,0),(1,3),(1,3),(1,3)],'guns':[(1,3),(1,3),(1,3),(1,3),(1,3),(0,0),(0,0),(1,3)],'armour':[(1,3),(1,3),(1,3),(1,3)],'traits':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'specs':[(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'talents':[(12,12),(1,3),(1,3),(1,3),(1,3),(1,3),(1,3)],'medals':{},'saves':{}}
|
|
|
|
|
def add_user(name):
|
|
|
|
|
namehash=encode.hash_name(name) # Store the hash so that if they request a different name that happens to have the same hash, it can just be stored together.
|
|
|
|
|
if namehash in conf: conf[namehash]['names'].add(name)
|
|
|
|
@@ -158,7 +158,7 @@ def lookup_piece(piece,table,name,partial=False):
|
|
|
|
|
if not partial:
|
|
|
|
|
try: return table.index(p)
|
|
|
|
|
except ValueError: raise LookupException(f"Couldn't resolve {piece} from {name}")
|
|
|
|
|
res=list(filter(lambda x:p in x,table))
|
|
|
|
|
res=list(filter(lambda x:x.startswith(p),table))
|
|
|
|
|
if len(res)!=1: raise LookupException(f"Couldn't resolve {piece} with partial match from {name} (found {len(res)} possibilities)") # Ambiguous lookups not allowed
|
|
|
|
|
return table.index(res[0])
|
|
|
|
|
class LookupException(Exception): pass
|
|
|
|
@@ -170,6 +170,15 @@ def ranks():
|
|
|
|
|
print(f'{o[0]}: {o[1][0]}/{o[1][1]}',end=', ')
|
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
def savebuild(code,name):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def builds():
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def medals():
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
load_conf()
|
|
|
|
|
|
|
|
|
|
|