Skip to content

Instantly share code, notes, and snippets.

@Marenthyu
Created May 10, 2016 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marenthyu/78c70ee49e4b19a5b0bc1d4713d43e82 to your computer and use it in GitHub Desktop.
Save Marenthyu/78c70ee49e4b19a5b0bc1d4713d43e82 to your computer and use it in GitHub Desktop.
TestYourLuck
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