From 9471383f973da52f2f486e19869ce9a4a543d1ec Mon Sep 17 00:00:00 2001 From: Julian Marcos Date: Mon, 26 Jun 2023 15:49:40 +0000 Subject: [PATCH] tilde: Also show percentage on brainwash Requested by login --- plugins/tilde.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/tilde.py b/plugins/tilde.py index a9b9338..eea1aed 100755 --- a/plugins/tilde.py +++ b/plugins/tilde.py @@ -111,6 +111,8 @@ def cleanwash_money(msg): #new_balance=((__import__('random').randint(80,110)/100)*balance).split('.')[0] new_balance = Decimal(randint(80,110))/Decimal(100)*Decimal(balance) new_balance = new_balance.quantize(Decimal('1.'), rounding=ROUND_DOWN) + percentage_return = new_balance/balance * Decimal(100) + percentage_return = percentage_return.quantize(Decimal('.00'), rounding=ROUND_DOWN) #jackpot_balance=(0.10*balance).split('.')[0] jackpot_balance = (Decimal(0.10)*Decimal(balance)).quantize(Decimal('1.'), rounding=ROUND_DOWN) with open(util.tilde.JACKPOT_FILE, "r+") as jackpotfile: @@ -119,6 +121,6 @@ def cleanwash_money(msg): jackpotfile.truncate() jackpot_now = str(jackpot + jackpot_balance) jackpotfile.write(jackpot_now) - message = f"Cleanwashed {balance}TCN, and given the user {new_balance}TCN and contributed {jackpot_balance}TCN to the balance, jackpot at {jackpot_now}TCN" + message = f"Cleanwashed {balance}TCN, and given the user {new_balance}TCN ({percentage_return}%) and contributed {jackpot_balance}TCN to the balance, jackpot at {jackpot_now}TCN" util.tilde.admin_update_tilde(nick,amount=new_balance,time=msg.timestamp,comment=message) return pinhook.plugin.message(message)