Created
September 15, 2019 17:07
-
-
Save NoelDavies/32d4ebfd784ae871ee14d9f7f7724222 to your computer and use it in GitHub Desktop.
Refactor example - just to see what youthink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balanceAdjustmentTimer() | |
{ | |
this.balanceAdjustmentCounter++; | |
if ( this.balanceAdjustmentCounter <= config.balanceCheckInterval ) return; | |
this.balanceAdjustmentCounter = 0; | |
this.playerBalances.map((currentBalance, username) => { | |
let currentBalance = this.getBalance(username) | |
if (currentBalance >= config.minimumBalance * 100) return currentBalance | |
var newBalance = currentBalance + config.balanceCheckAdjustment * 100; | |
if ( newBalance <= config.minimumBalance * 100 ) return newBalance | |
return config.minimumBalance * 100; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment