Can now spoof codes when saving *and* loading

This commit is contained in:
Zergling_man 2023-07-01 23:14:38 +10:00
parent 6cb92fd878
commit cd2c4b637b

View File

@ -75,8 +75,11 @@ def update_talent(talent,classes):
lon=len(ranks)//2+len(ranks)%2
return (ranks[-lon],caps[-lon])
def read_code(code,save=True):
data=list(decode.decode(code,active_profile))
def read_code(code,name=None,save=None):
if name is None: name=active_profile; save2=True
else: save2=False # Don't save spoofed codes unless explicitly told
if save is None: save=save2
data=list(decode.decode(code,name))
check,validator=data.pop(-1),data.pop(-1)
talent=data.pop(5)
hero=data[0:6]
@ -111,8 +114,9 @@ def mass_add():
a=input('>')
save_conf()
def generate(officer=None):
def generate(officer=None,name=None):
pro=conf[active_profile]
if name is None: name=active_profile
if officer is None: officer=input('> ')
pieces=officer.split('/')
c=pieces[0].lower()
@ -137,7 +141,7 @@ def generate(officer=None):
muxed=shared.muxhero(out[0],out[3],out[4])
meds=[]
if muxed in pro['medals']: meds=shared.muxmedals(pro['medals'][muxed])
return encode.encode(active_profile,*out,rank,cap,0,*meds)
return encode.encode(name,*out,rank,cap,0,*meds)
def lookup_piece(piece,table,partial=False):
if len(piece)<3: p=piece.upper()