BrownBirdScripts

BBredSalamander

Aug 22nd, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.Image;
  6. import java.io.IOException;
  7. import java.net.URL;
  8.  
  9. import javax.imageio.ImageIO;
  10.  
  11. import org.osbot.script.Script;
  12. import org.osbot.script.ScriptManifest;
  13. import org.osbot.script.rs2.model.Entity;
  14. import org.osbot.script.rs2.model.Player;
  15. import org.osbot.script.rs2.skill.Skill;
  16. import org.osbot.script.rs2.ui.Tab;
  17. import org.osbot.script.rs2.utility.Area;
  18.  
  19. @ScriptManifest(author = "BrownBird", name = "BBredSalamander", version = 1.0, info = "Catches and Releases Red Salamanders for EXP || V1.3")
  20. public class BBredSalamander extends Script {
  21.  
  22. public String RED_SALADMANDER = "Red salamander";
  23. public String ROPE = "Rope";
  24. public String NET = "Small fishing net";
  25. public int TRAP_UNSET = 20811;
  26. public int TRAP_CAUGHT = 20807;
  27. public int dontDrop[] = { 303, 954, 10006 };
  28. private final Area redSalamanderArea = (new Area(2453, 3228, 2447,3223));
  29.  
  30. public long startTime = 0;
  31. public long millis = 0;
  32. public long hours = 0;
  33. public long minutes = 0;
  34. public long seconds = 0;
  35. public long last = 0;
  36. public int startExp;
  37. public int expGained;
  38. public int expGainedPH;
  39. public int startLevel;
  40. public int sala;
  41. public int salaPH;
  42. public int level;
  43. String status = "Starting Script";
  44. public String run = "False";
  45.  
  46. @Override
  47. public void onStart() {
  48. startTime = System.currentTimeMillis();
  49. startExp = client.getSkills().getExperience(Skill.HUNTER);
  50. }
  51.  
  52. @Override
  53. public void onExit() {
  54.  
  55. }
  56.  
  57. @Override
  58. public int onLoop() throws InterruptedException {
  59. Entity trapUnset = closestObject(TRAP_UNSET);
  60. Entity trapCaught = closestObject(TRAP_CAUGHT);
  61. Entity rope = closestGroundItemForName(ROPE);
  62. Entity net = closestGroundItemForName(NET);
  63. Player player = myPlayer();
  64.  
  65. if (currentTab() != Tab.INVENTORY) {
  66. openTab(Tab.INVENTORY);
  67. }
  68.  
  69. if(client.getInventory().contains(RED_SALADMANDER)) {
  70. status = "Releasing salamander";
  71. client.getInventory().interactWithName(RED_SALADMANDER, "Release");
  72. } else if (client.getInventory().isFull() && !client.getInventory().contains(RED_SALADMANDER)) {
  73. status = "Dropping items";
  74. client.getInventory().dropAllExcept(dontDrop);
  75. }
  76.  
  77. if (rope != null) {
  78. if (!player.isAnimating() && !player.isMoving()) {
  79. if (rope.isVisible()) {
  80. status = "Pickup up rope";
  81. rope.interact("Take");
  82. sleep(random(700, 900));
  83. } else {
  84. client.moveCameraToEntity(rope);
  85. }
  86. }
  87. }
  88.  
  89. if (net != null) {
  90. if (!player.isAnimating() && !player.isMoving()) {
  91. if (net.isVisible()) {
  92. status = "Pickup up net";
  93. net.interact("Take");
  94. sleep(random(700, 900));
  95. } else {
  96. client.moveCameraToEntity(net);
  97. }
  98. }
  99. }
  100.  
  101. if(trapUnset != null) {
  102. if(trapUnset.isInArea(redSalamanderArea)) {
  103. if (client.getInventory().getAmount(ROPE) >= 1
  104. && client.getInventory().getAmount(NET) >= 1) {
  105. if (!player.isAnimating() && !player.isMoving()) {
  106. if (trapUnset.isVisible()) {
  107. status = "Setting trap";
  108. trapUnset.interact("Set-Trap");
  109. sleep(random(700, 900));
  110. } else {
  111. client.moveCameraToEntity(trapUnset);
  112. }
  113. }
  114. }
  115. }
  116. }
  117.  
  118. if (trapCaught != null) {
  119. if(trapCaught.isInArea(redSalamanderArea)) {
  120. if (!player.isAnimating() && !player.isMoving()) {
  121. if (trapCaught.isVisible()) {
  122. status = "Checking trap";
  123. trapCaught.interact("Check");
  124. sleep(random(700, 900));
  125. } else {
  126. client.moveCameraToEntity(trapCaught);
  127. }
  128. }
  129. }
  130. }
  131.  
  132. if (client.getRunEnergy() == 100 && run == "False") {
  133. status = "Toggling running";
  134. settingsTab.open();
  135. random(199, 246);
  136. setRunning(true);
  137. run = "True";
  138. }
  139.  
  140. if (run == "True") {
  141. int runInt = random(1, 70);
  142. if (client.getRunEnergy() == runInt) {
  143. run = "False";
  144. }
  145. }
  146.  
  147. AntiBan();
  148.  
  149. return random(500, 650);
  150. }
  151.  
  152. private Image getImage(String url) {
  153. try {
  154. return ImageIO.read(new URL(url));
  155. } catch(IOException e) {
  156. return null;
  157. }
  158. }
  159.  
  160. private final Color color1 = new Color(0, 0, 0);
  161. private final Font font1 = new Font("Arial", 0, 14);
  162. private final Image img1 = getImage("http://i41.tinypic.com/2mq94lu.png");
  163.  
  164.  
  165.  
  166. @Override
  167. public void onPaint(Graphics graphics) {
  168. millis = System.currentTimeMillis() - startTime;
  169. hours = millis / (1000 * 60 * 60);
  170. millis -= hours * (1000 * 60 * 60);
  171. minutes = millis / (1000 * 60);
  172. millis -= minutes * (1000 * 60);
  173. seconds = millis / 1000;
  174. salaPH = (int) ((sala) * 3600000D / (System.currentTimeMillis() - startTime));
  175. expGained = client.getSkills().getExperience(Skill.HUNTER) - startExp;
  176. expGainedPH = (int) ((expGained) * 3600000D / (System
  177. .currentTimeMillis() - startTime));
  178. Graphics2D g = (Graphics2D) graphics;
  179. g.drawImage(img1, -1, 196, null);
  180. g.setFont(font1);
  181. g.setColor(color1);
  182. g.drawString(" " + hours + " hours " + minutes + " minutes "
  183. + seconds + " seconds", 95, 292);
  184. g.drawString(" " + sala, 175, 309);
  185. g.drawString(" " + salaPH, 205, 327);
  186. g.drawString(" " + expGained, 390, 292);
  187. g.drawString(" " + expGainedPH, 421, 311);
  188. g.drawString(" " + status, 362, 335);
  189.  
  190. }
  191.  
  192. public void AntiBan() throws InterruptedException {
  193. switch (random(1, 1135)) {
  194.  
  195. case 14:
  196. status = "Anti-Ban";
  197. client.rotateCameraPitch(50);
  198. case 6:
  199. status = "Anti-Ban";
  200. client.rotateCameraToAngle(350);
  201. case 3:
  202. status = "Anti-Ban";
  203. openTab(Tab.SKILLS);
  204. case 56:
  205. status = "Anti-Ban";
  206. openTab(Tab.ATTACK);
  207. case 106:
  208. status = "Anti-Ban";
  209. openTab(Tab.QUEST);
  210. case 530:
  211. status = "Anti-Ban";
  212. client.rotateCameraPitch(50);
  213. }
  214. random(100, 500);
  215. }
  216.  
  217. public void onMessage(String message) throws InterruptedException {
  218. if (message.contains("You release")) {
  219. sala++;
  220. }
  221. }
  222.  
  223. }
Advertisement
Add Comment
Please, Sign In to add comment