Advertisement
Floplie

teaGrabber "Floplie"

Jan 12th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. package scripts.teaGrabber;
  2.  
  3. import javax.imageio.ImageIO;
  4.  
  5. import org.tribot.api.General;
  6.  
  7. import java.awt.*;
  8.  
  9. import javax.imageio.ImageIO;
  10.  
  11. import java.io.IOException;
  12. import java.net.URL;
  13. import java.text.DecimalFormat;
  14.  
  15. import org.tribot.api.input.Mouse;
  16. import org.tribot.api2007.Banking;
  17. import org.tribot.api2007.Camera;
  18. import org.tribot.api2007.GroundItems;
  19. import org.tribot.api2007.Inventory;
  20. import org.tribot.api2007.Objects;
  21. import org.tribot.api2007.PathFinding;
  22. import org.tribot.api2007.Player;
  23. import org.tribot.api2007.Skills;
  24. import org.tribot.api2007.Skills.SKILLS;
  25. import org.tribot.api2007.Walking;
  26. import org.tribot.api2007.types.RSGroundItem;
  27. import org.tribot.api2007.types.RSObject;
  28. import org.tribot.api2007.types.RSTile;
  29. import org.tribot.script.Script;
  30. import org.tribot.script.ScriptManifest;
  31. import org.tribot.script.interfaces.Painting;
  32.  
  33. @ScriptManifest(authors = { "Floplie" }, category = "Thieving", name = "teaGrabber", description = "Thank you for using my teaGrabber script, love from Floplie.")
  34. public class TeaGrabber extends Script implements Painting {
  35. private final int[] cupoftea = {1978};
  36. private final RSTile bank = new RSTile(3254, 3420), stall = new RSTile(3268, 3410);
  37. private final int[] cupofteas = {635};
  38. private boolean counted = false;
  39. private int count = 0;
  40. private long startTime = System.currentTimeMillis();
  41. private final Color color1 = new Color(255, 255, 255);
  42. private int startxp = Skills.getXP(SKILLS.THIEVING);
  43.  
  44. private final Font font1 = new Font("Arial", 0, 24);
  45.  
  46. private final Image img1 = getImage("http://i.imgur.com/KMjSNXy.png");
  47.  
  48. public void clickStall() {
  49. RSObject[] stall = Objects.findNearest(20, 635);
  50. if (stall.length > 0) {
  51. if (!Player.getPosition().equals(this.stall)) {
  52. Walking.walkTo(this.stall);
  53. sleep(400, 600);
  54. while (Player.isMoving()) {
  55. sleep(100, 200);
  56. }
  57. }
  58. if (!stall[0].isOnScreen()) {
  59. Camera.turnToTile(stall[0].getPosition());
  60. } else {
  61. stall[0].click("Steal-from");
  62. sleep(500, 800);
  63. }
  64. while (Player.isMoving()) {
  65. sleep(100, 200);
  66. }
  67. }
  68. }
  69.  
  70. public void banking() {
  71. if (counted == false) {
  72. count = count + Inventory.getCount(cupoftea);
  73. counted = true;
  74. }
  75. if (Player.getPosition().distanceTo(bank) > 10) {
  76. Mouse.setSpeed(100);
  77. Walking.blindWalkTo(bank);
  78. Mouse.setSpeed(300);
  79. } else {
  80. if (!Banking.isBankScreenOpen()) {
  81. Banking.openBankBooth();
  82. } else {
  83. Banking.depositAll();
  84. }
  85. }
  86. }
  87.  
  88. public void walkback() {
  89. if (Player.getPosition().distanceTo(stall) > 10) {
  90. Mouse.setSpeed(100);
  91. Walking.blindWalkTo(stall);
  92. Mouse.setSpeed(300);
  93.  
  94. }
  95. }
  96.  
  97. @Override
  98. public void onPaint(Graphics g) {
  99. int currentxp = Skills.getXP(SKILLS.THIEVING);
  100. g.drawImage(img1, 3, 340, null);
  101. g.setFont(font1);
  102. g.setColor(color1);
  103. g.drawString(" " + runTime(startTime), 329, 419);
  104. g.drawString(" " + (currentxp - startxp), 368, 462);
  105.  
  106. }
  107.  
  108. public String runTime(long i) {
  109. DecimalFormat nf = new DecimalFormat("00");
  110. long millis = System.currentTimeMillis() - i;
  111. long hours = millis / (1000 * 60 * 60);
  112. millis -= hours * (1000 * 60 * 60);
  113. long minutes = millis / (1000 * 60);
  114. millis -= minutes * (1000 * 60);
  115. long seconds = millis / 1000;
  116. return nf.format(hours) + ":" + nf.format(minutes) + ":"
  117. + nf.format(seconds);
  118. }
  119.  
  120. private Image getImage(String url) {
  121. try {
  122. return ImageIO.read(new URL(url));
  123. } catch (IOException e) {
  124. return null;
  125. }
  126. }
  127.  
  128. @Override
  129. public void run() {
  130. Mouse.setSpeed(300);
  131. while (true) {
  132. if (Player.getPosition().getPlane() == 0
  133. && Player.getPosition().distanceTo(stall) < 10) {
  134. if (Inventory.isFull()) {
  135. banking();
  136. } else {
  137. clickStall();
  138. }
  139.  
  140. } else {
  141. if (Inventory.isFull()) {
  142. banking();
  143. } else {
  144. walkback();
  145. }
  146. }
  147.  
  148. }
  149. }
  150.  
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement