Created
May 10, 2016 14:05
-
-
Save Marenthyu/78c70ee49e4b19a5b0bc1d4713d43e82 to your computer and use it in GitHub Desktop.
TestYourLuck
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
public void testYourLuck(String sender, String otherargs) { | |
int win = (int) (Math.random() * 201); | |
ProfileManager.getProfileByName(sender).addFunds( | |
channel.replace("#", ""), win); | |
if (win >= 100) { | |
sendMessage( | |
channel, | |
profile.getOption("testyourluckwinmessage") | |
.getValue() | |
.replace("<sender>", sender) | |
.replace("<amount0>", win-100 + "") | |
.replace( | |
"<amount1>", | |
MATH.round(((float) ((float) win-100) / 10), 1) | |
.toString()) | |
.replace( | |
"<amount2>", | |
MATH.round(((float) ((float) win-100) / 100), 2) | |
.toString()) | |
.replace( | |
"<amount3>", | |
MATH.round(((float) ((float) win-100) / 1000), | |
3).toString())); | |
return; | |
} | |
sendMessage( | |
channel, | |
profile.getOption("testyourlucklosemessage") | |
.getValue() | |
.replace("<sender>", sender) | |
.replace("<amount0>", (win-100)*-1 + "") | |
.replace( | |
"<amount1>", | |
MATH.round( | |
((float) ((float) win - 100) / 10) * -1, | |
1).toString()) | |
.replace( | |
"<amount2>", | |
MATH.round( | |
((float) ((float) win - 100) / 100) | |
* -1, 2).toString()) | |
.replace( | |
"<amount3>", | |
MATH.round( | |
((float) ((float) win - 100) / 1000) | |
* -1, 3).toString())); | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment