Can now spoof codes when saving *and* loading
This commit is contained in:
parent
6cb92fd878
commit
cd2c4b637b
12
codegen.py
12
codegen.py
|
@ -75,8 +75,11 @@ def update_talent(talent,classes):
|
||||||
lon=len(ranks)//2+len(ranks)%2
|
lon=len(ranks)//2+len(ranks)%2
|
||||||
return (ranks[-lon],caps[-lon])
|
return (ranks[-lon],caps[-lon])
|
||||||
|
|
||||||
def read_code(code,save=True):
|
def read_code(code,name=None,save=None):
|
||||||
data=list(decode.decode(code,active_profile))
|
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)
|
check,validator=data.pop(-1),data.pop(-1)
|
||||||
talent=data.pop(5)
|
talent=data.pop(5)
|
||||||
hero=data[0:6]
|
hero=data[0:6]
|
||||||
|
@ -111,8 +114,9 @@ def mass_add():
|
||||||
a=input('>')
|
a=input('>')
|
||||||
save_conf()
|
save_conf()
|
||||||
|
|
||||||
def generate(officer=None):
|
def generate(officer=None,name=None):
|
||||||
pro=conf[active_profile]
|
pro=conf[active_profile]
|
||||||
|
if name is None: name=active_profile
|
||||||
if officer is None: officer=input('> ')
|
if officer is None: officer=input('> ')
|
||||||
pieces=officer.split('/')
|
pieces=officer.split('/')
|
||||||
c=pieces[0].lower()
|
c=pieces[0].lower()
|
||||||
|
@ -137,7 +141,7 @@ def generate(officer=None):
|
||||||
muxed=shared.muxhero(out[0],out[3],out[4])
|
muxed=shared.muxhero(out[0],out[3],out[4])
|
||||||
meds=[]
|
meds=[]
|
||||||
if muxed in pro['medals']: meds=shared.muxmedals(pro['medals'][muxed])
|
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):
|
def lookup_piece(piece,table,partial=False):
|
||||||
if len(piece)<3: p=piece.upper()
|
if len(piece)<3: p=piece.upper()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user