Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. package com.rs.game.player.content;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import com.rs.game.item.Item;
  7. import com.rs.game.player.Player;
  8. import com.rs.utils.Utils;
  9.  
  10. public class Lottery {
  11.  
  12. ArrayList<Item> itemListCommon = new ArrayList<Item>(); //Stores the common items selected
  13. ArrayList<Item> itemListRare = new ArrayList<Item>(); //Stores the rare items selected
  14. ArrayList<Item> itemListSignature = new ArrayList<Item>(); //Stores the signature drops
  15.  
  16.  
  17. private static Item[] rewards = { new Item(995, 100000), new Item(5698, 1), new Item(11695, 2), new Item(1514, 100), new Item(11283, 1),
  18. new Item(10828, 1), new Item(8851, 1), new Item(560, 1000)
  19. };
  20. private static Item[] rareRewards = { new Item(11694, 1), new Item(11696, 1), new Item(7462, 1), new Item(6585, 1) };
  21. private static Item[] signatureRewards = { new Item(13740, 1), new Item(1040, 1) };
  22.  
  23. public static void roll(Player player) {
  24. Item reward = null;
  25. int chance = Utils.random(1, 1000);
  26. if (chance >= 996) { // 1/250
  27. player.getInventory().addItem(reward);
  28. player.sm("Signature");
  29. } else if (chance >= 500 && chance <= 520) { // 1/50
  30. int selection = Utils.random(1);
  31.  
  32. player.sm("Rare");
  33. } else {
  34. int selection = Utils.random(6);
  35.  
  36. player.sm("Common");
  37. }
  38. }
  39.  
  40. public List<Item> getItemListCommon() {
  41. return itemListCommon;
  42. }
  43.  
  44.  
  45. public static void sendNewSOF(Player player) {
  46.  
  47. for (int j = 0; j < 7; j++) {//Loops the rewards array for 7 common Items
  48. getItemListCommon().add(rewards[Utils.random(rewards.length-1)]); //Adds a random item from the rewards list to the ArrayList; Looped 7 times
  49. }
  50. for (int k = 0; k < 2; k++) {//Loops the rewards array for 2 rare items
  51. itemListRare.add(rareRewards[Utils.random(rareRewards.length-1)]); //Adds a random item from the rare rewards list to the ArrayList; Looped 2 times
  52. }
  53. for (int l = 0; l < 1; l++) {//Loops the rewards array for 1 signature item
  54. itemListSignature.add(signatureRewards[Utils.random(signatureRewards.length-1)]); //Adds a random item from the signature rewards list to the ArrayList; Looped 1 time
  55. }
  56.  
  57. player.getInterfaceManager().sendInterface(862);
  58. player.getPackets().sendIComponentText(862, 28, "MBScape Lottery"); //Title
  59. player.getPackets().sendIComponentText(862, 1, "Below are the items that you have a chance of receiving this roll.");
  60. player.getPackets().sendIComponentText(862, 5, "<col=00ff000>" + itemListCommon.get(0).getName()); //Beginning of common items
  61. player.getPackets().sendIComponentText(862, 6, "<col=00ff000>" + itemListCommon.get(1).getName());
  62. player.getPackets().sendIComponentText(862, 7, "<col=00ff000>" + itemListCommon.get(2).getName());
  63. player.getPackets().sendIComponentText(862, 8, "<col=00ff000>" + itemListCommon.get(3).getName());
  64. player.getPackets().sendIComponentText(862, 9, "Each roll will consume one spin from your account.");
  65. player.getPackets().sendIComponentText(862, 57, "<col=00ff000>" + itemListCommon.get(4).getName());
  66. player.getPackets().sendIComponentText(862, 58, "<col=00ff000>" + itemListCommon.get(5).getName());
  67. player.getPackets().sendIComponentText(862, 59, "<col=00ff000>" + itemListCommon.get(6).getName()); //End of common items
  68. player.getPackets().sendIComponentText(862, 60, "<col=ffcc00>" + itemListRare.get(0).getName()); //Start of rare rewards
  69. player.getPackets().sendIComponentText(862, 61, "<col=ffcc00>" + itemListRare.get(1).getName());
  70. player.getPackets().sendIComponentText(862, 62, "Rolls: " + player.spins);
  71. player.getPackets().sendIComponentText(862, 63, "<col=ff0000>" + itemListSignature.get(0).getName()); //Signature reward
  72. player.getPackets().sendIComponentText(862, 64, "<col=ff0000>Signature Reward - Chance: 1/250</col>"); //Signature reward
  73. player.getPackets().sendIComponentText(862, 65, "Roll!"); //Signature reward
  74. }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement