Try to read default num as float in script if int doesn't work.

This commit is contained in:
Mr_Goldberg 2022-08-17 20:17:37 -04:00
parent 7f3eb9970e
commit 97a1ff5186
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 4 additions and 1 deletions

View File

@ -64,7 +64,10 @@ def generate_stats_achievements(schema, config_directory):
for s in stats_out:
default_num = 0
if (s['type'] == 'int'):
default_num = int(s['default'])
try:
default_num = int(s['default'])
except ValueError:
default_num = int(float(s['default']))
else:
default_num = float(s['default'])
output_stats += "{}={}={}\n".format(s['name'], s['type'], default_num)