Fix stats issue in script.

This commit is contained in:
Mr_Goldberg 2022-08-16 12:30:52 -04:00
parent 276a9902df
commit bc4262a494
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -11,6 +11,7 @@ STAT_TYPE_BITS = '4'
def generate_stats_achievements(schema, config_directory): def generate_stats_achievements(schema, config_directory):
schema = vdf.binary_loads(schema) schema = vdf.binary_loads(schema)
# print(schema)
achievements_out = [] achievements_out = []
stats_out = [] stats_out = []
@ -61,7 +62,12 @@ def generate_stats_achievements(schema, config_directory):
output_ach = json.dumps(achievements_out, indent=4) output_ach = json.dumps(achievements_out, indent=4)
output_stats = "" output_stats = ""
for s in stats_out: for s in stats_out:
output_stats += "{}={}={}\n".format(s['name'], s['type'], s['default']) default_num = 0
if (s['type'] == 'int'):
default_num = int(s['default'])
else:
default_num = float(s['default'])
output_stats += "{}={}={}\n".format(s['name'], s['type'], default_num)
# print(output_ach) # print(output_ach)
# print(output_stats) # print(output_stats)
@ -72,7 +78,7 @@ def generate_stats_achievements(schema, config_directory):
with open(os.path.join(config_directory, "achievements.json"), 'w') as f: with open(os.path.join(config_directory, "achievements.json"), 'w') as f:
f.write(output_ach) f.write(output_ach)
with open(os.path.join(config_directory, "stats.txt"), 'w') as f: with open(os.path.join(config_directory, "stats.txt"), 'w', encoding='utf-8') as f:
f.write(output_stats) f.write(output_stats)
return (achievements_out, stats_out) return (achievements_out, stats_out)