Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.68 KB | None | 0 0
  1. /*
  2. Defmenow made the flax picker.
  3. I edited alot to get it to an tinderbox buyer.
  4. */
  5. import java.awt.Color;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.util.Map;
  9.  
  10. import org.rsbot.bot.Bot;
  11. import org.rsbot.event.events.ServerMessageEvent;
  12. import org.rsbot.event.listeners.PaintListener;
  13. import org.rsbot.event.listeners.ServerMessageListener;
  14. import org.rsbot.script.Script;
  15. import org.rsbot.script.ScriptManifest;
  16. import org.rsbot.script.wrappers.RSCharacter;
  17. import org.rsbot.script.wrappers.RSNPC;
  18. import org.rsbot.script.wrappers.RSObject;
  19. import org.rsbot.script.wrappers.RSTile;
  20. import org.rsbot.script.wrappers.RSInterface;
  21.  
  22. @ScriptManifest(authors = { "Defmenow, Ikin (AJAX)" }, category = "Money", name = "Da Pyro Buyer", version = 2.0, description = "<html><center><body>Da Pyro Box Buyer<br><Start in Seers bank with about 300k [Minimum 90k] coins <br>Made By: <strong>Defmenow</strong> <br>Edit To other script by:<strong> Ikin</strong></body></html\n")
  23. public class DaPyroBuyer extends Script implements PaintListener, ServerMessageListener {
  24. public boolean startScript = false;
  25.  
  26. public long startTime = System.currentTimeMillis();
  27.  
  28. int tinderboxbougth;
  29. final static int NOOBID = 4946;
  30. public int bankboothid = 25808;
  31. private int RunningEnergy = random(15, 80);
  32. final static int coin = 995;
  33. RSTile[] Walk2Bank = { new RSTile(2720, 3430), new RSTile(2730, 3435), new RSTile(2733, 3443), new RSTile(2729, 3453), new RSTile(2727, 3463), new RSTile(2728, 3474), new RSTile(2725, 3485), new RSTile(2723, 3484), new RSTile(2726, 3491) };
  34. private RSTile[] Walk2Box = reversePath(Walk2Bank);
  35. protected int getMouseSpeed() {
  36. return 6;
  37. }
  38.  
  39. @SuppressWarnings("deprecation")
  40. public boolean onStart(final Map<String, String> args) {
  41. startTime = System.currentTimeMillis();
  42. Bot.getEventManager().addListener(PaintListener.class, this);
  43. return true;
  44. }
  45.  
  46. public boolean needToBank() {
  47. return isInventoryFull();
  48. }
  49.  
  50. public boolean atBank() {
  51. RSObject bank = getNearestObjectByID(bankboothid);
  52. if(bank == null) return false;
  53. return tileOnScreen(bank.getLocation());
  54. }
  55.  
  56. public boolean atShop() {
  57. final RSNPC vulcan = getNearestNPCByID(NOOBID);
  58. if(vulcan == null) return false;
  59. return tileOnScreen(vulcan.getLocation());
  60. }
  61.  
  62. public boolean handleBank() {
  63. RSObject bankbooth = getNearestObjectByID(bankboothid);
  64. if(bank == null)
  65. return false;
  66. if(bank.isOpen()){
  67. bank.depositAllExcept(coin);
  68. }else{
  69. atObject(bankbooth, "uickly");
  70. }
  71. return true;
  72. }
  73.  
  74. public boolean buybox(){
  75.  
  76. final RSNPC vulcan = getNearestNPCByID(NOOBID);
  77. final RSInterface select = RSInterface.getInterface(620);
  78. if (tileOnScreen(vulcan.getLocation())) {
  79. if (!select.isValid() && !isInventoryFull()) {
  80. atNPC(vulcan, "Trade");
  81. waitForIface(select, 3000);
  82. }
  83. }
  84. if (!isInventoryFull()) {
  85. if (select.isValid()) {
  86. clickMouse(52, 69, false);
  87. wait(random(100, 350));
  88. atMenu("Buy 500");
  89. wait(random(800, 1000));
  90. clickMouse(487, 18, true);
  91. }
  92. }
  93. return true;
  94. }
  95.  
  96. public boolean walkToShop(){
  97. if (getEnergy() >= RunningEnergy && !isRunning()) {
  98. setRun(true);
  99. RunningEnergy = random(15, 30);
  100. wait(random(400, 500));
  101. }
  102. if(!getMyPlayer().isMoving() || distanceTo(getDestination()) <= random(6, 8))
  103. {
  104. walkPathMM(randomizePath(Walk2Box, 1, 1), 16);
  105. return false;
  106. }
  107.  
  108. return true;
  109. }
  110.  
  111. public boolean walkToBank(){
  112.  
  113. if (getEnergy() >= RunningEnergy && !isRunning()) {
  114. setRun(true);
  115. RunningEnergy = random(15, 30);
  116. wait(random(400, 500));
  117. }
  118.  
  119. if(!getMyPlayer().isMoving() || distanceTo(getDestination()) <= random(6, 8))
  120. {
  121. walkPathMM(randomizePath(Walk2Bank, 2, 2), 16);
  122. return false;
  123. }
  124.  
  125. return true;
  126. }
  127.  
  128. public boolean flag(int dist){
  129. if(getMyPlayer().getAnimation() != -1) return false;
  130. if(distanceTo(getDestination()) <= dist) return true;
  131. return false;
  132. }
  133.  
  134. public int loop() {
  135. setCameraAltitude(true);
  136. if(needToBank()) {
  137. if(atBank()) {
  138. if(handleBank())
  139. return random(800, 1000);
  140. }else{
  141. if(flag(random(4, 7))){
  142. if(walkToBank())
  143. return random(800, 1000);
  144. }else{
  145. return random(800, 1000);
  146. }
  147. }
  148. }else{
  149. if(atShop()){
  150. buybox();
  151. return random(800, 1000);
  152. }else{
  153. if(flag(random(4, 7))){
  154. if(walkToShop())
  155. return random(800, 1000);
  156. }else{
  157.  
  158. return random(800, 1000);
  159. }
  160. }
  161. }
  162. return random(200, 400);
  163. }
  164.  
  165. public void onFinish() {
  166. Bot.getEventManager().removeListener(PaintListener.class, this);
  167. }
  168. public void serverMessageRecieved(final ServerMessageEvent m) {
  169. final String message = m.getMessage();
  170. if (message.contains("enough inventory")) {
  171. tinderboxbougth ++;
  172.  
  173. }
  174. }
  175. private final Color background = new Color(0,0,0,200),
  176. blue = new Color(51, 204, 255, 200),
  177. black = new Color(0, 0, 0, 200),
  178. white = new Color(255,255,255,200),
  179. green = new Color(30,255,30,200),
  180. red = new Color(235,18,29,200);
  181.  
  182. public void onRepaint(final Graphics g) {
  183. if (isLoggedIn()) {
  184. long millis = System.currentTimeMillis() - startTime;
  185. long profit = tinderboxbougth * 27;
  186. long hours = millis / (1000 * 60 * 60);
  187. millis -= hours * (1000 * 60 * 60);
  188. long minutes = millis / (1000 * 60);
  189. millis -= minutes * (1000 * 60);
  190. long seconds = millis / 1000;
  191.  
  192. int y = 31;
  193. g.setColor(background);
  194. g.fillRoundRect(350,8,140,65,5,5);
  195. g.setColor(white);
  196. g.setFont(new Font("sans serif", Font.PLAIN, 16));
  197. g.drawString("Da Pyro Box Buyer", 353, 26);
  198. g.fillRect(350,28,140,1);
  199. g.setFont(new Font("sans serif", Font.PLAIN, 12));
  200. g.setColor(blue);
  201. g.drawString("Time Running: " + hours + ":" + minutes + ":"
  202. + seconds + "" , 355, y += 14);
  203. g.drawString("Boxes Bougth: "+ profit , 355, y += 14);
  204.  
  205. }
  206. }
  207. }
Add Comment
Please, Sign In to add comment