Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1.  
  2. import java.awt.BasicStroke;
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.util.ArrayList;
  8. import java.util.Arrays;
  9.  
  10. import xobot.client.callback.listeners.PaintListener;
  11. import xobot.script.ActiveScript;
  12. import xobot.script.Manifest;
  13. import xobot.script.methods.Bank;
  14. import xobot.script.methods.GameObjects;
  15. import xobot.script.methods.NPCs;
  16. import xobot.script.methods.Packets;
  17. import xobot.script.methods.Players;
  18. import xobot.script.methods.Walking;
  19. import xobot.script.methods.tabs.Inventory;
  20. import xobot.script.methods.tabs.Skills;
  21. import xobot.script.util.Timer;
  22. import xobot.script.wrappers.Tile;
  23. import xobot.script.wrappers.WidgetChild;
  24. import xobot.script.wrappers.interactive.GameObject;
  25. import xobot.script.wrappers.interactive.Item;
  26. import xobot.script.wrappers.interactive.NPC;
  27. import xobot.script.methods.Widgets;
  28. import xobot.script.methods.input.KeyBoard;
  29. import xobot.script.util.Time;
  30.  
  31.  
  32. @Manifest(authors = { "Casual" }, name = "fThiever 0.1")
  33. public final class fThieve extends ActiveScript implements PaintListener{
  34.  
  35. private Timer t;
  36. private int startxp = 0;
  37.  
  38. public static void teleport(String location) {
  39. final NPC wizard = NPCs.getNearest(4397);
  40. if(wizard != null) {
  41. final WidgetChild prev = Widgets.getWidgetChild(42860954);
  42. if(prev != null && prev.getText().toLowerCase().startsWith(location.toLowerCase())) {
  43. wizard.interact("prev");
  44. return;
  45. }else {
  46. if(Widgets.isVisible(654)) {
  47. WidgetChild[] options = Widgets.get(654).getChildren();
  48. for(WidgetChild option : options) {
  49. final String text = option.getText();
  50. if(text != null && !text.isEmpty() && text.toLowerCase().trim().startsWith(location.toLowerCase())) {
  51. Packets.sendAction(0, option.getId(), 8, 0, "", "Ok");
  52. Time.sleep(150);
  53. Packets.sendAction(0, 42860643, 28, 0, "", "Close");
  54. }
  55. }
  56. }else {
  57. wizard.interact("talk-to");
  58. Time.sleep(() -> Widgets.isVisible(654), 750);
  59. Time.sleep(150);
  60. teleport(location);
  61. }
  62. }
  63. }
  64.  
  65. }
  66.  
  67. public void bank() {
  68. GameObject obj = GameObjects.getNearest(6943);
  69. if (!Players.getMyPlayer().isMoving() && !Bank.isOpen() && obj != null && Inventory.isFull()) {
  70. obj.interact("Bank");
  71. Time.sleep(5000);
  72. } else {
  73. Tile t = new Tile(3086, 3250);
  74. while (!Players.getMyPlayer().isMoving()) {
  75. Walking.walkTo(t);
  76. Time.sleep(1000);
  77. }
  78. }
  79. if (Bank.isOpen()) {
  80. if(Inventory.isFull()) {
  81. Bank.depositAll();
  82. Time.sleep(150);
  83. }
  84. } else {
  85. return;
  86. }
  87. }
  88.  
  89. public boolean onStart() {
  90. t = new Timer(System.currentTimeMillis());
  91. startxp = Skills.getCurrentExp(Skills.THIEVING);
  92. KeyBoard.typeWord("::home", true);
  93. Time.sleep(3500);
  94. teleport("draynor village");
  95. Time.sleep(5000);
  96. Walking.walkTo(new Tile(3086, 3250));
  97. return true;
  98. }
  99.  
  100.  
  101. @Override
  102. public int loop() {
  103. final int npc;
  104. npc = 3257;
  105. NPC farmer = NPCs.getNearest(npc);
  106. if (Inventory.isFull()) {
  107. bank(); }
  108. if(farmer != null) {
  109. farmer.interact("pickpocket");
  110. return 2700;
  111. }
  112. return 1000;
  113. }
  114.  
  115.  
  116.  
  117. private final Color color1 = new Color(255, 255, 255, 84);
  118. private final Color color2 = new Color(0, 0, 0);
  119. private final BasicStroke stroke1 = new BasicStroke(1);
  120. private final Font font1 = new Font("Arial", 0, 23);
  121. private final Font font2 = new Font("Arial", 0, 16);
  122.  
  123.  
  124. @Override
  125. public void repaint(Graphics g1) {
  126. int xp = Skills.getCurrentExp(Skills.THIEVING) - startxp;
  127. int ph = (int) ((xp) * 3600000D / (t.getElapsed()));
  128.  
  129. Graphics2D g = (Graphics2D)g1;
  130. g.setColor(color1);
  131. g.fillRect(343, 155, 171, 183);
  132. g.setColor(color2);
  133. g.setStroke(stroke1);
  134. g.drawRect(343, 155, 171, 183);
  135. g.setFont(font1);
  136. g.drawString("fThiever 0.1", 367, 184);
  137. g.setFont(font2);
  138. g.drawString("Time: " + t.toElapsedString(), 352, 219);
  139. g.drawString("XP: " + format(xp), 352, 249);
  140. g.drawString("XP(h): " + format(ph), 352, 277);
  141. }
  142.  
  143. public String format(int i) {
  144. if(i > 1000000) {
  145. return (i / 1000000) + "M";
  146. }else if(i > 1000) {
  147. return (i / 1000) + "K";
  148. }
  149. return String.valueOf(i);
  150. }
  151.  
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement