Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs.game.player.content;
- import java.util.ArrayList;
- import java.util.List;
- import com.rs.game.item.Item;
- import com.rs.game.player.Player;
- import com.rs.utils.Utils;
- public class Lottery {
- ArrayList<Item> itemListCommon = new ArrayList<Item>(); //Stores the common items selected
- ArrayList<Item> itemListRare = new ArrayList<Item>(); //Stores the rare items selected
- ArrayList<Item> itemListSignature = new ArrayList<Item>(); //Stores the signature drops
- private static Item[] rewards = { new Item(995, 100000), new Item(5698, 1), new Item(11695, 2), new Item(1514, 100), new Item(11283, 1),
- new Item(10828, 1), new Item(8851, 1), new Item(560, 1000)
- };
- private static Item[] rareRewards = { new Item(11694, 1), new Item(11696, 1), new Item(7462, 1), new Item(6585, 1) };
- private static Item[] signatureRewards = { new Item(13740, 1), new Item(1040, 1) };
- public static void roll(Player player) {
- Item reward = null;
- int chance = Utils.random(1, 1000);
- if (chance >= 996) { // 1/250
- player.getInventory().addItem(reward);
- player.sm("Signature");
- } else if (chance >= 500 && chance <= 520) { // 1/50
- int selection = Utils.random(1);
- player.sm("Rare");
- } else {
- int selection = Utils.random(6);
- player.sm("Common");
- }
- }
- public List<Item> getItemListCommon() {
- return itemListCommon;
- }
- public static void sendNewSOF(Player player) {
- for (int j = 0; j < 7; j++) {//Loops the rewards array for 7 common Items
- getItemListCommon().add(rewards[Utils.random(rewards.length-1)]); //Adds a random item from the rewards list to the ArrayList; Looped 7 times
- }
- for (int k = 0; k < 2; k++) {//Loops the rewards array for 2 rare items
- itemListRare.add(rareRewards[Utils.random(rareRewards.length-1)]); //Adds a random item from the rare rewards list to the ArrayList; Looped 2 times
- }
- for (int l = 0; l < 1; l++) {//Loops the rewards array for 1 signature item
- itemListSignature.add(signatureRewards[Utils.random(signatureRewards.length-1)]); //Adds a random item from the signature rewards list to the ArrayList; Looped 1 time
- }
- player.getInterfaceManager().sendInterface(862);
- player.getPackets().sendIComponentText(862, 28, "MBScape Lottery"); //Title
- player.getPackets().sendIComponentText(862, 1, "Below are the items that you have a chance of receiving this roll.");
- player.getPackets().sendIComponentText(862, 5, "<col=00ff000>" + itemListCommon.get(0).getName()); //Beginning of common items
- player.getPackets().sendIComponentText(862, 6, "<col=00ff000>" + itemListCommon.get(1).getName());
- player.getPackets().sendIComponentText(862, 7, "<col=00ff000>" + itemListCommon.get(2).getName());
- player.getPackets().sendIComponentText(862, 8, "<col=00ff000>" + itemListCommon.get(3).getName());
- player.getPackets().sendIComponentText(862, 9, "Each roll will consume one spin from your account.");
- player.getPackets().sendIComponentText(862, 57, "<col=00ff000>" + itemListCommon.get(4).getName());
- player.getPackets().sendIComponentText(862, 58, "<col=00ff000>" + itemListCommon.get(5).getName());
- player.getPackets().sendIComponentText(862, 59, "<col=00ff000>" + itemListCommon.get(6).getName()); //End of common items
- player.getPackets().sendIComponentText(862, 60, "<col=ffcc00>" + itemListRare.get(0).getName()); //Start of rare rewards
- player.getPackets().sendIComponentText(862, 61, "<col=ffcc00>" + itemListRare.get(1).getName());
- player.getPackets().sendIComponentText(862, 62, "Rolls: " + player.spins);
- player.getPackets().sendIComponentText(862, 63, "<col=ff0000>" + itemListSignature.get(0).getName()); //Signature reward
- player.getPackets().sendIComponentText(862, 64, "<col=ff0000>Signature Reward - Chance: 1/250</col>"); //Signature reward
- player.getPackets().sendIComponentText(862, 65, "Roll!"); //Signature reward
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement