Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. package com.scripts;
  2. import com.kbot2.scriptable.Script;
  3. import com.kbot2.scriptable.methods.wrappers.Tile;
  4. import com.kbot2.scriptable.methods.data.Walking;
  5. import com.kbot2.scriptable.methods.wrappers.NPC;
  6. import com.kbot2.scriptable.methods.wrappers.Obj;
  7. import com.kbot2.scriptable.methods.wrappers.Interface;
  8. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  9. import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
  10.  
  11.  
  12.  
  13.  
  14. import java.awt.*;
  15. import java.awt.Graphics;
  16. import java.awt.Color;
  17. import java.awt.Font;
  18. import java.awt.Graphics2D;
  19.  
  20. public class FALADORYEWS2 extends Script implements PaintListener, ServerMessageListener {
  21.  
  22. //ID's mang
  23. int BANK_ID = 11758;
  24. int TREE_ID[] = { 1309 };
  25. int YEW_ID = 1515;
  26. int status = 0;
  27. Obj f;
  28. Obj b;
  29.  
  30. //Paint
  31. String minute;
  32. String second;
  33. String hour;
  34. private int YewCount;
  35. long startTime = System.currentTimeMillis();
  36.  
  37. /*Path to shop BANK*/
  38.  
  39.  
  40. Tile[] TO_BANK = new Tile[]{new Tile(2937,3233), new Tile(2942,3235), new Tile(2947,3238), new Tile(2952,3240), new Tile(2955,3244), new Tile(2958,3248), new Tile(2962,3252), new Tile(2967,3255), new Tile(2968,3260), new Tile(2969,3265), new Tile(2973,3268), new Tile(2978,3270), new Tile(2983,3272), new Tile(2987,3275), new Tile(2990,3279), new Tile(2994,3282), new Tile(2997,3286), new Tile(3001,3289), new Tile(3003,3294), new Tile(3005,3299), new Tile(3005,3304), new Tile(3005,3309), new Tile(3005,3314), new Tile(3005,3319), new Tile(3005,3324), new Tile(3005,3329), new Tile(3006,3334), new Tile(3006,3339), new Tile(3006,3344), new Tile(3006,3349), new Tile(3006,3354), new Tile(3008,3359), new Tile(3012,3356), };
  41.  
  42. Tile[] TO_YEW = Walking.reversePath(TO_BANK);
  43.  
  44. public boolean active() {
  45. return true;
  46. }
  47.  
  48. public String getName() {
  49. return "Falador Yews v-2.0";
  50. }
  51.  
  52. public String getAuthor() {
  53. return "Orca";
  54. }
  55.  
  56. public String getDescription() {
  57. return "Start the script at FALADOR YEWS, it chops the yews and then banks.";
  58. }
  59.  
  60. public void onServerMessage(String e) {
  61. if (e.contains("You get some Yew logs.")) {
  62. YewsCut++;
  63. }
  64.  
  65. public int loop() { if(walking.getEnergy() > 50)
  66. walking.setRunning(true);
  67. switch (status) {
  68. case 0:
  69. if (inventory.isFull()) {
  70. status = 3;
  71. } else if (!inventory.isFull()) {
  72. status = 1;
  73. }
  74. return random(300, 500);
  75.  
  76. case 1:
  77. // From Bank To YEW
  78. walking.walkPath(TO_YEW);
  79. if(getMyPlayer().isMoving())
  80. return 100;
  81. status = 2;
  82. return random(150, 300);
  83.  
  84. case 2:
  85. // CHOPPING YEWS
  86. f = getClosestObject(7, TREE_ID);
  87. if (f != null)
  88. f.doAction("Chop down");
  89. sleep(10000);
  90. if (inventory.isFull()) {
  91. status = 3;
  92. }
  93. return random(150, 300);
  94.  
  95. case 3:
  96. // Back To Bank
  97. walking.walkPath(TO_BANK);
  98. if(getMyPlayer().isMoving())
  99. return 100;
  100. status = 4;
  101. return random(150, 300);
  102.  
  103. case 4:
  104. // Check Bank
  105. Obj bankBooth = getClosestObject(7, BANK_ID);
  106. if (bankBooth != null) {
  107. if (distanceTo(bankBooth.getLocation()) > 5)
  108. walking.walkToMM(bankBooth.getLocation());
  109. if (!bank.isOpen()) { // if bank is not open
  110. bankBooth.doAction("quickly");
  111. } else {
  112. sleep(750, 1000);
  113. bank.depositAll(1515);
  114. sleep(350, 500);
  115. if (inventory.getCount(true, 1515) == 0) {
  116. bank.close();
  117. status = 0;
  118. } else {
  119. return random(200, 300);
  120. }
  121. }
  122. }
  123.  
  124.  
  125.  
  126. return random(100, 300);
  127. }
  128. return random(100, 300);
  129. }
  130. public void onRepaint(Graphics g){
  131. long millis = System.currentTimeMillis() - startTime;
  132. long hours = millis / (1000 * 60 * 60);
  133. millis -= hours * (1000 * 60 * 60);
  134. long minutes = millis / (1000 * 60);
  135. millis -= minutes * (1000 * 60);
  136. long seconds = millis / 1000;
  137. hour = Long.toString(hours);
  138. minute = Long.toString(minutes);
  139. second = Long.toString(seconds);
  140. String time1 = "";
  141. String time2 = "";
  142. String time3 = "";
  143. if (hours < 10) {
  144. time1 = "0";
  145. }
  146. if (minutes < 10) {
  147. time2 = "0";
  148. }
  149. if (seconds < 10) {
  150. time3 = "0";
  151. }
  152. Graphics2D g2d = (Graphics2D) g;
  153. g2d.setColor(new Color(250, 250, 250, 110));
  154. g2d.fill3DRect(5, 269, 150, 69, true);
  155. g2d.setColor(Color.green); //Sets text color
  156. g2d.setFont(new Font("Comic Sans", Font.BOLD, 14));
  157. g2d.drawString("FALADORYEWS v" + getVersion(2), 11, 285);
  158. g2d.setColor(Color.red);
  159. g2d.setFont(new Font("Arial", Font.PLAIN, 12));
  160. g2d.drawString("Yews Cut: " + YewCount, 9, 321);
  161. g2d.drawString("Time running: " + time1 + hours + ":" + time2 + minutes + ":" + time3 + seconds, 9, 309);
  162. }
  163. }
Add Comment
Please, Sign In to add comment