Created
February 22, 2018 20:51
-
-
Save Echocage/27c2f15d040c3620b8429c7e59cfc4a4 to your computer and use it in GitHub Desktop.
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
package com.vencillio.rs2.content.dialogue.impl; | |
import com.vencillio.core.util.Utility; | |
import com.vencillio.rs2.content.dialogue.DialogueManager; | |
import com.vencillio.rs2.content.dialogue.Emotion; | |
import com.vencillio.rs2.entity.item.Item; | |
import com.vencillio.rs2.entity.player.Player; | |
import com.vencillio.rs2.entity.player.net.out.impl.SendMessage; | |
/** | |
* Created by Tanner on 2/21/2018. | |
*/ | |
public class DoubleLottoGame { | |
private static final int CHANCE_OF_LOSING = 55; | |
public static void playGame(Player player, String input) { | |
boolean won = Utility.random(100) >= CHANCE_OF_LOSING; | |
if (player.isPouchPayment()) | |
if (player.getMoneyPouch() < Integer.parseInt(input)) | |
player.send(new SendMessage("You don't have enough money to bet that much")); | |
return; | |
else if(!player.getInventory().hasItemAmount(995, Integer.parseInt(input))) | |
player.send(new SendMessage("You don't have enough money to bet that much")); | |
return; | |
if (won) { | |
if (player.isPouchPayment()) | |
player.setMoneyPouch(player.getMoneyPouch() + (Integer.parseInt(input))); | |
else | |
player.getInventory().add(995, Integer.parseInt(input) ); | |
DialogueManager.sendNpcChat(player, 1011, Emotion.HAPPY, "Congratulations, you have won double your bet"); | |
} else { | |
DialogueManager.sendNpcChat(player, 1011, Emotion.SAD, "Sorry you have lost the money, better luck next time"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment