Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.io.IOException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import org.osbot.script.Script;
- import org.osbot.script.ScriptManifest;
- import org.osbot.script.rs2.model.Entity;
- import org.osbot.script.rs2.model.Player;
- import org.osbot.script.rs2.skill.Skill;
- import org.osbot.script.rs2.ui.Tab;
- import org.osbot.script.rs2.utility.Area;
- @ScriptManifest(author = "BrownBird", name = "BBredSalamander", version = 1.0, info = "Catches and Releases Red Salamanders for EXP || V1.3")
- public class BBredSalamander extends Script {
- public String RED_SALADMANDER = "Red salamander";
- public String ROPE = "Rope";
- public String NET = "Small fishing net";
- public int TRAP_UNSET = 20811;
- public int TRAP_CAUGHT = 20807;
- public int dontDrop[] = { 303, 954, 10006 };
- private final Area redSalamanderArea = (new Area(2453, 3228, 2447,3223));
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public int startExp;
- public int expGained;
- public int expGainedPH;
- public int startLevel;
- public int sala;
- public int salaPH;
- public int level;
- String status = "Starting Script";
- public String run = "False";
- @Override
- public void onStart() {
- startTime = System.currentTimeMillis();
- startExp = client.getSkills().getExperience(Skill.HUNTER);
- }
- @Override
- public void onExit() {
- }
- @Override
- public int onLoop() throws InterruptedException {
- Entity trapUnset = closestObject(TRAP_UNSET);
- Entity trapCaught = closestObject(TRAP_CAUGHT);
- Entity rope = closestGroundItemForName(ROPE);
- Entity net = closestGroundItemForName(NET);
- Player player = myPlayer();
- if (currentTab() != Tab.INVENTORY) {
- openTab(Tab.INVENTORY);
- }
- if(client.getInventory().contains(RED_SALADMANDER)) {
- status = "Releasing salamander";
- client.getInventory().interactWithName(RED_SALADMANDER, "Release");
- } else if (client.getInventory().isFull() && !client.getInventory().contains(RED_SALADMANDER)) {
- status = "Dropping items";
- client.getInventory().dropAllExcept(dontDrop);
- }
- if (rope != null) {
- if (!player.isAnimating() && !player.isMoving()) {
- if (rope.isVisible()) {
- status = "Pickup up rope";
- rope.interact("Take");
- sleep(random(700, 900));
- } else {
- client.moveCameraToEntity(rope);
- }
- }
- }
- if (net != null) {
- if (!player.isAnimating() && !player.isMoving()) {
- if (net.isVisible()) {
- status = "Pickup up net";
- net.interact("Take");
- sleep(random(700, 900));
- } else {
- client.moveCameraToEntity(net);
- }
- }
- }
- if(trapUnset != null) {
- if(trapUnset.isInArea(redSalamanderArea)) {
- if (client.getInventory().getAmount(ROPE) >= 1
- && client.getInventory().getAmount(NET) >= 1) {
- if (!player.isAnimating() && !player.isMoving()) {
- if (trapUnset.isVisible()) {
- status = "Setting trap";
- trapUnset.interact("Set-Trap");
- sleep(random(700, 900));
- } else {
- client.moveCameraToEntity(trapUnset);
- }
- }
- }
- }
- }
- if (trapCaught != null) {
- if(trapCaught.isInArea(redSalamanderArea)) {
- if (!player.isAnimating() && !player.isMoving()) {
- if (trapCaught.isVisible()) {
- status = "Checking trap";
- trapCaught.interact("Check");
- sleep(random(700, 900));
- } else {
- client.moveCameraToEntity(trapCaught);
- }
- }
- }
- }
- if (client.getRunEnergy() == 100 && run == "False") {
- status = "Toggling running";
- settingsTab.open();
- random(199, 246);
- setRunning(true);
- run = "True";
- }
- if (run == "True") {
- int runInt = random(1, 70);
- if (client.getRunEnergy() == runInt) {
- run = "False";
- }
- }
- AntiBan();
- return random(500, 650);
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(0, 0, 0);
- private final Font font1 = new Font("Arial", 0, 14);
- private final Image img1 = getImage("http://i41.tinypic.com/2mq94lu.png");
- @Override
- public void onPaint(Graphics graphics) {
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- salaPH = (int) ((sala) * 3600000D / (System.currentTimeMillis() - startTime));
- expGained = client.getSkills().getExperience(Skill.HUNTER) - startExp;
- expGainedPH = (int) ((expGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- Graphics2D g = (Graphics2D) graphics;
- g.drawImage(img1, -1, 196, null);
- g.setFont(font1);
- g.setColor(color1);
- g.drawString(" " + hours + " hours " + minutes + " minutes "
- + seconds + " seconds", 95, 292);
- g.drawString(" " + sala, 175, 309);
- g.drawString(" " + salaPH, 205, 327);
- g.drawString(" " + expGained, 390, 292);
- g.drawString(" " + expGainedPH, 421, 311);
- g.drawString(" " + status, 362, 335);
- }
- public void AntiBan() throws InterruptedException {
- switch (random(1, 1135)) {
- case 14:
- status = "Anti-Ban";
- client.rotateCameraPitch(50);
- case 6:
- status = "Anti-Ban";
- client.rotateCameraToAngle(350);
- case 3:
- status = "Anti-Ban";
- openTab(Tab.SKILLS);
- case 56:
- status = "Anti-Ban";
- openTab(Tab.ATTACK);
- case 106:
- status = "Anti-Ban";
- openTab(Tab.QUEST);
- case 530:
- status = "Anti-Ban";
- client.rotateCameraPitch(50);
- }
- random(100, 500);
- }
- public void onMessage(String message) throws InterruptedException {
- if (message.contains("You release")) {
- sala++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment