diff --git a/codegen.py b/codegen.py index 4be4d96..86d7370 100644 --- a/codegen.py +++ b/codegen.py @@ -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() @@ -158,4 +162,4 @@ def ranks(): load_conf() -if __name__=="__main__": print("Please open an interpreter and use 'import codegen', this script doesn't serve as an entrypoint on its own yet.") \ No newline at end of file +if __name__=="__main__": print("Please open an interpreter and use 'import codegen', this script doesn't serve as an entrypoint on its own yet.")