Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. package com.rs.game.player.interfaces.spin;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Collections;
  5. import java.util.List;
  6. import java.util.TimerTask;
  7.  
  8. import com.rs.engine.cache.loaders.IComponentDefinitions;
  9. import com.rs.engine.cores.CoresManager;
  10. import com.rs.game.item.Item;
  11. import com.rs.game.item.ItemsContainer;
  12. import com.rs.game.player.Player;
  13.  
  14. public class FloatingCrates {
  15.  
  16. public static int[] frost_items = { 4068, // Ice pernix body
  17. 4069, // ice torva body
  18. 4070, // ice torva body
  19. 4071, // ice torva helm
  20. 4072, // ice pernix cowl
  21. 4504, // ice virtus
  22. 4505, // ice virtus top
  23. 4506, // pernix chaps ice
  24. 4507, // Ice virtus bottoms
  25. 18707, // Ice mask
  26. 18706,// Ice phat
  27. 30995,
  28. 30996,
  29. 30997,
  30. 30998,
  31. 30999,
  32.  
  33. 14484,//junks start
  34. 11694,
  35. 14484,
  36. 11694,
  37. 11898,
  38. 11898,
  39. 11898,
  40. 14484,
  41. 13740,
  42. 13744,
  43. 13742,
  44. 13738,
  45. 5607,
  46.  
  47. 4503,
  48. 29049,
  49.  
  50. };
  51.  
  52. public static void sendInterface(Player player, int[] box_items, int keyId) {
  53. player.getPackets().sendInterSetItemsOptionsScript(1469, 84, 90, 4, 9, "Examine");
  54. player.getPackets().sendUnlockIComponentOptionSlots(1469, 84, 0, 160, 0);
  55. player.getInterfaceManager().sendInterface(1469);
  56. sendPossibleRewards(player, box_items);
  57. roll(player, keyId, box_items);
  58. }
  59.  
  60. public static void handleButtons(Player player,int cid) {
  61. switch (cid){
  62. // case
  63. }
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70. public static void sendPossibleRewards(Player player, int[] rewards) {
  71. ItemsContainer<Item> Rewards = new ItemsContainer<Item>(90, false);
  72. for (int i : rewards) {
  73. if (!Rewards.contains((new Item(i, 1))))
  74. Rewards.add(new Item(i, 1));
  75. }
  76. player.getPackets().sendItems(90, false, Rewards);
  77. }
  78.  
  79. public static void roll(Player player, int keyId, int[] rewards) {
  80. player.getTemporaryAttributtes().put("stopMinimap", Boolean.TRUE);
  81. player.getPackets().sendBlackOut(5);
  82. // player.getInventory().deleteItem(MYSTERYBOX_ID, 1);
  83. player.getTemporaryAttributtes().put("tempFullStop", false);
  84. player.getTemporaryAttributtes().put("given", false);
  85. player.setInfiniteStopDelay();
  86. List<Integer> asList = new ArrayList<Integer>();
  87. for (int i = 0; i < rewards.length; i++)
  88. asList.add(rewards[i]);
  89. Collections.shuffle(asList);
  90. for (int i = 0; i < 30; i++) {
  91. player.getPackets().sendItemOnIComponent(1469, 16 + i, asList.get(i), 1);
  92. IComponentDefinitions def = IComponentDefinitions.getInterfaceComponent(1469, 49 + i);
  93. IComponentDefinitions items = IComponentDefinitions.getInterfaceComponent(1469, 16 + i);
  94. CoresManager.fastExecutor.schedule(new TimerTask() {
  95. int count = 0;
  96. int x = def.posX;
  97. int y = def.posY;
  98. int itx = items.posX;
  99. int ity = items.posY;
  100. int ticks = 0;
  101. @Override
  102. public void run() {
  103. if (((boolean) player.getTemporaryAttributtes().get("tempFullStop"))) {
  104. cancel();
  105. if (!((boolean) player.getTemporaryAttributtes().get("given"))) {
  106. Item item = new Item(asList.get(12), 1);
  107. player.getInventory().addItem(item);
  108. player.White("You've won x1: " + item.getName());
  109. player.getTemporaryAttributtes().put("given", true);
  110. player.getPackets().sendBlackOut(0);
  111. player.resetStopDelay();
  112. }
  113. return;
  114. }
  115. int subtract = 15;
  116. subtract = subtract - (1 * ((int) count / 10));
  117. if (subtract <= 1)
  118. subtract = 1;
  119. x -= subtract;
  120. itx -= subtract;
  121. if (x <= -(38 * 20)) {
  122. x = 380;
  123. }
  124. if (itx <= -(38 * 20)) {
  125. itx = 380;
  126. }
  127. player.getPackets().sendIComponentPosition(1469, def.getComponentId(), y, x);
  128. player.getPackets().sendIComponentPosition(1469, items.getComponentId(), ity, itx);
  129. // player.getPackets().changeWCPosition(1469, def.getComponentId(), x, y);
  130. // player.getPackets().changeWCPosition(1469, items.getComponentId(), itx, ity);
  131. count++;
  132. // int random = Utils.getRandom(maxValue)
  133. if (count == (380)) {
  134. player.getTemporaryAttributtes().put("tempFullStop", true);
  135. }
  136. }
  137. }, 0, 20);
  138. }
  139. }
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement