From 300c4e8315c0d3c0be234fd006f712fa54b6e3ae Mon Sep 17 00:00:00 2001 From: Zergling_man Date: Mon, 15 May 2023 20:47:24 +1000 Subject: [PATCH] inputting codes with medals no longer crashes, medals now actually save! But medals on the same build from different codes probably don't save correctly yet. --- codegen.py | 2 +- shared.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/codegen.py b/codegen.py index 3ea7b6e..15c8437 100644 --- a/codegen.py +++ b/codegen.py @@ -90,7 +90,7 @@ def read_code(code,save=True): print(str(rank)+'/'+str(cap)) print(data) # Extract medals and save them medals=data[1:-1] - if any(medals): conf[active_profile]['medals'][shared.muxhero(hero[0],hero[3],hero[4])]=shared.muxmedals(medals) + if any(medals): conf[active_profile]['medals'][shared.muxhero(hero[0],hero[3],hero[4])]=shared.muxmedals(*medals) if not check: print('No name given, code validation not performed') else: if check!=validator: print('code did not validate:',validator,check); return diff --git a/shared.py b/shared.py index 70b7db4..21fb9ad 100644 --- a/shared.py +++ b/shared.py @@ -32,5 +32,6 @@ def muxhero(clas,trait,spec): return clas+trait*12+spec*12*16 # It's actually stored backwards like this, spec is in the most significant bits. Whatever, it doesn't need to be reversable. def muxmedals(key,moh=-1,pcc=-1,cob=-1,lsa=-1,rem=-1): + print(key,moh,pcc,cob,lsa,rem) if moh!=-1: return key+moh*2+pcc*4+cob*8+lsa*16+rem*32 return bool(key&1),bool(key&2),bool(key&4),bool(key&8),bool(key&16),key//32 \ No newline at end of file