tilde: Also show percentage on brainwash

Requested by login
master
jmjl 2023-06-26 15:49:40 +00:00
parent 25741faa93
commit 9471383f97
1 changed files with 3 additions and 1 deletions

View File

@ -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)