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.

This commit is contained in:
Zergling_man 2023-05-15 20:47:24 +10:00
parent 8f3bc473b0
commit 300c4e8315
2 changed files with 2 additions and 1 deletions

View File

@ -90,7 +90,7 @@ def read_code(code,save=True):
print(str(rank)+'/'+str(cap)) print(str(rank)+'/'+str(cap))
print(data) # Extract medals and save them print(data) # Extract medals and save them
medals=data[1:-1] 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') if not check: print('No name given, code validation not performed')
else: else:
if check!=validator: print('code did not validate:',validator,check); return if check!=validator: print('code did not validate:',validator,check); return

View File

@ -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. 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): 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 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 return bool(key&1),bool(key&2),bool(key&4),bool(key&8),bool(key&16),key//32