Guest User

Untitled

a guest
Jun 21st, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import java.awt.*;
  4. import com.kbot2.scriptable.Script;
  5. import com.kbot2.scriptable.methods.wrappers.*;
  6. import com.kbot2.scriptable.methods.data.*;
  7. import com.kbot2.scriptable.methods.Calculations;
  8.  
  9.  
  10.  
  11. public class Planks extends Script {
  12. /*Path*/
  13. Rectangle plankTiles = new Rectangle(3209, 3666, 37, 34);
  14. Tile[] fromBanktoPlanks = new Tile[] {new Tile(3187,3692), new Tile(3190,3682), new Tile(3190,3672), new Tile(3196,3670), new Tile(3203,3673), new Tile(3206,3681), new Tile(3211,3681)};
  15. Tile[] fromPlankstoBank = walking.reversePath(fromBanktoPlanks);
  16.  
  17.  
  18.  
  19.  
  20. /*Define*/
  21. NPC b;
  22. GroundItem PLANK;
  23. Tile PLANK_TILE;
  24. Point Point_c;
  25. Tile myLocat;
  26.  
  27.  
  28.  
  29. /*ID's*/
  30. int PLANK_ID = 454;
  31. int BANK_ID = 3217;
  32. int status = 0;
  33. int LOW_HEALTH = 21;
  34. int FOOD_ID = 333;
  35.  
  36. public void eatFood() {
  37. if (inventory.contains(FOOD_ID)) {
  38. gameScreen.openTab(gameScreen.TAB_INVENTORY);
  39. inventory.atItem("Eat", FOOD_ID);
  40. }
  41. }
  42. @Override
  43. public boolean active() {
  44. return true;
  45. }
  46.  
  47. public String getName() {
  48. return "Planks";
  49. }
  50.  
  51. @Override
  52. public String getAuthor() {
  53. return "SuperTaranta";
  54. }
  55.  
  56. @Override
  57. public String getDescription() {
  58. return "Planks";
  59. }
  60. @Override
  61. public boolean onStart() {
  62. log("Starting SuperTaranta's GayClub");
  63. return true;
  64. }
  65.  
  66.  
  67. public int loop() {
  68. if (!isLoggedIn()) {
  69. return random(1000, 1100);
  70. }
  71. camera.setAltitude(true);
  72. if(walking.getEnergy() > 30)
  73. walking.setRunning(true);
  74. switch (status) {
  75.  
  76.  
  77.  
  78. case 0:
  79. if (inventory.isFull()) {
  80. sleep(500);
  81. status = 3;
  82. } else {
  83. status = 1;
  84. sleep(500);
  85. }
  86. return random(300, 500);
  87. case 1:
  88. // From Bank To Planks
  89. log("Walking from Bank to Planks");
  90. walking.walkPath(fromBanktoPlanks);
  91. while(getMyPlayer().isMoving())
  92. sleep(3000);
  93.  
  94. status = 2;
  95. return random(150, 300);
  96.  
  97. case 2:
  98. // Around Planks
  99. PLANK = groundItems.getClosestItem(20, PLANK_ID);
  100. if (PLANK != null) {
  101. PLANK_TILE = PLANK.getLocation();
  102. myLocat = getMyPlayer().getLocation();
  103. Point_c = new Point(myLocat.getX(), myLocat.getY());
  104. log("Around Planks");
  105. if (!getCalculations().onScreen(getCalculations().tileToScreen(PLANK.getLocation()))) {
  106. walking.walkToMM(PLANK_TILE);
  107. }
  108. if (getCalculations().onScreen(getCalculations().tileToScreen(PLANK.getLocation()))) {
  109. PLANK.doAction("Take");
  110. } else { plankTiles.contains(Point_c);
  111. }
  112. }
  113.  
  114. if(inventory.getCount() == 28)
  115. status = 3;
  116. return random(150, 300);
  117.  
  118. case 3:
  119. // From Planks to Bank
  120. log("Walking from Planks to Bank");
  121. if(inventory.isFull()){
  122. walking.walkPath(fromPlankstoBank);
  123. while(getMyPlayer().isMoving())
  124. sleep(3000);
  125. status = 4;
  126. } else {
  127. status = 2;
  128. return random(150, 300);
  129. }
  130. case 4:
  131.  
  132. //Banking
  133. b = npcs.getClosest(20, BANK_ID);
  134. log("Checking/Opening Bank");
  135. while (!bank.isOpen()) {
  136. if (b != null)
  137. b.doAction("Bank");
  138. sleep(750, 1000);
  139. }
  140. status = 5;
  141. return random(150, 300);
  142.  
  143. case 5:
  144. // Banking
  145. log("Banking");
  146. if (!bank.isOpen()) {
  147. status = 4;
  148. return 100;
  149. }
  150. while (inventory.getCount() > 1) {
  151. bank.depositAll(960);
  152.  
  153. }
  154. if (skills.getLevel(Skills.SKILL_HITPOINTS) == LOW_HEALTH){
  155. bank.withdrawItem(FOOD_ID, 1);
  156. sleep(500);
  157. eatFood();
  158. }
  159. status = 0;
  160. return random(150, 300);
  161. }
  162.  
  163. return random(100, 300);
  164. }
  165.  
  166.  
  167. }
Add Comment
Please, Sign In to add comment