Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs.game.player.interfaces.spin;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- import java.util.TimerTask;
- import com.rs.engine.cache.loaders.IComponentDefinitions;
- import com.rs.engine.cores.CoresManager;
- import com.rs.game.item.Item;
- import com.rs.game.item.ItemsContainer;
- import com.rs.game.player.Player;
- public class FloatingCrates {
- public static int[] frost_items = { 4068, // Ice pernix body
- 4069, // ice torva body
- 4070, // ice torva body
- 4071, // ice torva helm
- 4072, // ice pernix cowl
- 4504, // ice virtus
- 4505, // ice virtus top
- 4506, // pernix chaps ice
- 4507, // Ice virtus bottoms
- 18707, // Ice mask
- 18706,// Ice phat
- 30995,
- 30996,
- 30997,
- 30998,
- 30999,
- 14484,//junks start
- 11694,
- 14484,
- 11694,
- 11898,
- 11898,
- 11898,
- 14484,
- 13740,
- 13744,
- 13742,
- 13738,
- 5607,
- 4503,
- 29049,
- };
- public static void sendInterface(Player player, int[] box_items, int keyId) {
- player.getPackets().sendInterSetItemsOptionsScript(1469, 84, 90, 4, 9, "Examine");
- player.getPackets().sendUnlockIComponentOptionSlots(1469, 84, 0, 160, 0);
- player.getInterfaceManager().sendInterface(1469);
- sendPossibleRewards(player, box_items);
- roll(player, keyId, box_items);
- }
- public static void handleButtons(Player player,int cid) {
- switch (cid){
- // case
- }
- }
- public static void sendPossibleRewards(Player player, int[] rewards) {
- ItemsContainer<Item> Rewards = new ItemsContainer<Item>(90, false);
- for (int i : rewards) {
- if (!Rewards.contains((new Item(i, 1))))
- Rewards.add(new Item(i, 1));
- }
- player.getPackets().sendItems(90, false, Rewards);
- }
- public static void roll(Player player, int keyId, int[] rewards) {
- player.getTemporaryAttributtes().put("stopMinimap", Boolean.TRUE);
- player.getPackets().sendBlackOut(5);
- // player.getInventory().deleteItem(MYSTERYBOX_ID, 1);
- player.getTemporaryAttributtes().put("tempFullStop", false);
- player.getTemporaryAttributtes().put("given", false);
- player.setInfiniteStopDelay();
- List<Integer> asList = new ArrayList<Integer>();
- for (int i = 0; i < rewards.length; i++)
- asList.add(rewards[i]);
- Collections.shuffle(asList);
- for (int i = 0; i < 30; i++) {
- player.getPackets().sendItemOnIComponent(1469, 16 + i, asList.get(i), 1);
- IComponentDefinitions def = IComponentDefinitions.getInterfaceComponent(1469, 49 + i);
- IComponentDefinitions items = IComponentDefinitions.getInterfaceComponent(1469, 16 + i);
- CoresManager.fastExecutor.schedule(new TimerTask() {
- int count = 0;
- int x = def.posX;
- int y = def.posY;
- int itx = items.posX;
- int ity = items.posY;
- int ticks = 0;
- @Override
- public void run() {
- if (((boolean) player.getTemporaryAttributtes().get("tempFullStop"))) {
- cancel();
- if (!((boolean) player.getTemporaryAttributtes().get("given"))) {
- Item item = new Item(asList.get(12), 1);
- player.getInventory().addItem(item);
- player.White("You've won x1: " + item.getName());
- player.getTemporaryAttributtes().put("given", true);
- player.getPackets().sendBlackOut(0);
- player.resetStopDelay();
- }
- return;
- }
- int subtract = 15;
- subtract = subtract - (1 * ((int) count / 10));
- if (subtract <= 1)
- subtract = 1;
- x -= subtract;
- itx -= subtract;
- if (x <= -(38 * 20)) {
- x = 380;
- }
- if (itx <= -(38 * 20)) {
- itx = 380;
- }
- player.getPackets().sendIComponentPosition(1469, def.getComponentId(), y, x);
- player.getPackets().sendIComponentPosition(1469, items.getComponentId(), ity, itx);
- // player.getPackets().changeWCPosition(1469, def.getComponentId(), x, y);
- // player.getPackets().changeWCPosition(1469, items.getComponentId(), itx, ity);
- count++;
- // int random = Utils.getRandom(maxValue)
- if (count == (380)) {
- player.getTemporaryAttributtes().put("tempFullStop", true);
- }
- }
- }, 0, 20);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement