Oldrs4ever

Old's GreenBodies

May 2nd, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6.  
  7. import com.rarebot.event.events.MessageEvent;
  8. import com.rarebot.event.listeners.MessageListener;
  9. import com.rarebot.event.listeners.PaintListener;
  10. import com.rarebot.script.Script;
  11. import com.rarebot.script.ScriptManifest;
  12. import com.rarebot.script.methods.Skills;
  13. import com.rarebot.script.wrappers.RSItem;
  14. import com.rarebot.script.wrappers.RSObject;
  15.  
  16. @ScriptManifest(name = "OldsGreenBodies", version = 0.3, description = "Makes Green DragonHide Bodies", authors = "Oldrs4ever")
  17. public class OldsGreenBodies extends Script implements PaintListener, MessageListener
  18. {
  19.  
  20. public long startTime = 0;
  21. public long millis = 0;
  22. public long hours = 0;
  23. public long minutes = 0;
  24. public long seconds = 0;
  25. public long last = 0;
  26. public int expGained = 0;
  27. public int expHour = 0;
  28. int startExp;
  29. public int Bodies = 0;
  30.  
  31.  
  32. int greenLeather = 1745;
  33. int bankChest = 42192;
  34. int greenbody = 1135;
  35. int thread = 1734;
  36.  
  37. public void Bank()
  38. {
  39. RSObject Chest = objects.getNearest(bankChest);
  40. if(!inventory.contains(greenLeather))
  41. {
  42. if (Chest != null && getMyPlayer().getAnimation() == -1)
  43. {
  44. camera.turnTo(Chest);
  45. Chest.interact("Use Bank chest");
  46. sleep(random(200,300));
  47. if (bank.isOpen())
  48. {
  49. bank.depositAllExcept(thread);
  50. if (bank.getItem(greenLeather) != null)
  51. {
  52. sleep(random(200,300));
  53. bank.withdraw(greenLeather, 27);
  54. sleep(random(500, 800));
  55. bank.close();
  56. }
  57. }
  58. }
  59. }
  60. }
  61.  
  62.  
  63. public void doCraft()
  64. {
  65. {
  66. final RSItem leather = inventory.getItem(greenLeather);
  67. leather.interact("Craft");
  68. sleep(random(50,100));
  69. {
  70. if (interfaces.getComponent(905, 14).isValid())
  71. {
  72. interfaces.getComponent(905, 14).doClick(true);
  73. sleep(15000,16000);
  74. }
  75.  
  76. }
  77. }
  78. }
  79. public void useNeedle()
  80. {
  81. if (interfaces.getComponent(1179, 11).isValid())
  82. {
  83. interfaces.getComponent(1179, 11).doClick(true);
  84. }
  85. }
  86.  
  87. @Override
  88. public int loop()
  89. {
  90. try
  91. {
  92. Bank();
  93. if (inventory.contains(greenLeather) && getMyPlayer().getAnimation() == -1)
  94. {
  95. doCraft();
  96. }
  97. if(inventory.containsOneOf(24154))
  98. {
  99. inventory.getItem(24154).doClick(true);
  100. }
  101. }catch(NullPointerException np)
  102. {}
  103. return 0;
  104. }
  105.  
  106.  
  107. public void messageReceived(MessageEvent e)
  108. { String x = e.getMessage().toLowerCase();
  109. if (x.contains("you make a green dragonhide body."))
  110. {
  111. Bodies++;
  112. }
  113. }
  114.  
  115.  
  116. public boolean onStart()
  117. {
  118. log(new Color(125,38,205), "Welcome to OldsGreenBodies by Oldrs4ever!");
  119. startTime = System.currentTimeMillis();
  120. mouse.setSpeed(random(4, 6));
  121. startExp = skills.getCurrentExp(Skills.CRAFTING);
  122. return true;
  123. }
  124.  
  125.  
  126.  
  127. //START: Code generated using Enfilade's Easel
  128. private final Color color1 = new Color(0, 0, 0, 204);
  129. private final Color color2 = new Color(32, 32, 32, 229);
  130. private final Color color3 = new Color(24, 79, 20);
  131. private final Color color4 = new Color(34, 224, 21);
  132.  
  133. private final BasicStroke stroke1 = new BasicStroke(1);
  134.  
  135. private final Font font1 = new Font("Arial", 0, 16);
  136. private final Font font2 = new Font("Arial", 0, 9);
  137.  
  138. public void onRepaint(Graphics g1) {
  139. Graphics2D g = (Graphics2D)g1;
  140.  
  141. millis = System.currentTimeMillis() - startTime;
  142. hours = millis / (1000 * 60 * 60);
  143. millis -= hours * (1000 * 60 * 60);
  144. minutes = millis / (1000 * 60);
  145. millis -= minutes * (1000 * 60);
  146. seconds = millis / 1000;
  147. expGained = skills.getCurrentExp(Skills.CRAFTING) - startExp;
  148. expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
  149.  
  150. g.setColor(color1);
  151. g.fillRoundRect(345, 227, 173, 111, 16, 16);
  152. g.setColor(color2);
  153. g.setStroke(stroke1);
  154. g.drawRoundRect(345, 227, 173, 111, 16, 16);
  155. g.setFont(font1);
  156. g.setColor(color3);
  157. g.drawString("OldsGreenBodies", 351, 246);
  158. g.setFont(font2);
  159. g.setColor(color4);
  160. g.drawString("Time Running:" + hours +":"+ minutes + ":" + seconds, 352, 264);
  161. g.drawString("Bodies Crafted:" + Bodies , 351, 285);
  162. g.drawString("Xp Gained:" + expGained , 351, 303);
  163. g.drawString("Xp Per Hour:" + expHour, 351, 325);
  164. }
  165. //END: Code generated using Enfilade's Easel
  166.  
  167. }
Advertisement
Add Comment
Please, Sign In to add comment