mirror of
https://github.com/Apologieze/Monkeycrash.git
synced 2026-01-18 16:27:32 +01:00
Fix balance change and round
This commit is contained in:
@@ -304,7 +304,10 @@ class GUI():
|
||||
def change_balance(n):
|
||||
"""Change the in game balance and the local balance file"""
|
||||
temp = str(gen.balance+n).split('.')
|
||||
gen.balance = round(float(temp[0]) + float("0." + temp[1][:min(2, len(temp[1]))]), 2)
|
||||
gen.balance = round(float(temp[0]) + float(f"0.{temp[1][:min(2, len(temp[1]))]}"), 2)
|
||||
if len(temp[1])>2:
|
||||
if temp[1][2]=='9':
|
||||
gen.balance = round(gen.balance+0.01,2)
|
||||
gen.gui.display_balance.resize()
|
||||
with open('value.json', 'w') as json_file:
|
||||
json.dump({"balance":gen.balance}, json_file)
|
||||
|
||||
7
crash.py
7
crash.py
@@ -452,8 +452,11 @@ def new_round():
|
||||
|
||||
def change_balance(n):
|
||||
"""Change the in game balance and the local balance file"""
|
||||
temp = str(gen.game_state.balance+n).split('.')
|
||||
gen.game_state.balance = round(float(temp[0]) + float("0." + temp[1][:min(2, len(temp[1]))]), 2)
|
||||
temp = str(gen.game_state.balance + n).split('.')
|
||||
gen.game_state.balance = round(float(temp[0]) + float(f"0.{temp[1][:min(2, len(temp[1]))]}"), 2)
|
||||
if len(temp[1]) > 2:
|
||||
if temp[1][2] == '9':
|
||||
gen.game_state.balance = round(gen.game_state.balance + 0.01, 2)
|
||||
with open('value.json', 'w') as json_file:
|
||||
json.dump({"balance":gen.game_state.balance}, json_file)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"balance": 99.6}
|
||||
{"balance": 99.0}
|
||||
Reference in New Issue
Block a user