Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.osbot.script.Script;
- import org.osbot.script.ScriptManifest;
- import org.osbot.script.rs2.map.Position;
- import org.osbot.script.rs2.model.NPC;
- import org.osbot.script.rs2.model.Player;
- import org.osbot.script.rs2.model.RS2Object;
- import org.osbot.script.rs2.ui.Tab;
- import org.osbot.script.rs2.utility.Area;
- @ScriptManifest(name = "Shrimp Fisher", author = "Merccy", version = 1D, info = "Fishes in Draynor")
- public class ShrimpFisher extends Script {
- private NPC fish;
- private final Position[] bankToFish = { new Position(3092, 3248, 0),
- new Position(3084, 3245, 0), new Position(3085, 3240, 0),
- new Position(3088, 3244, 0), new Position(3087, 3228, 0) };
- private final Position[] fishToBank = { new Position(3088, 3244, 0),
- new Position(3085, 3240, 0), new Position(3084, 3245, 0),
- new Position(3092, 3248, 0), new Position(3093, 3242, 0) };
- private final Area fishArea = new Area(3082, 3233, 3089, 3225);
- private final Area bankArea = new Area(3095, 3246, 3092, 3240);
- // Ids
- public final int fishingNet = 303;
- public void onStart() {
- log("ShrimpFisher 1.0 Started");
- }
- public int onLoop() {
- try {
- this.antiBan();
- BotStates s = getState();
- handleState(s);
- } catch (InterruptedException e) {
- }
- return 50;
- }
- public void handleState(BotStates state) throws InterruptedException {
- switch (state) {
- case shouldWalkToFish:
- this.walkPath(this.bankToFish);
- break;
- case shouldWalkToBank:
- this.walkPath(this.fishToBank);
- break;
- case getFish:
- this.getFish();
- sleep(random(500, 1000));
- this.goFish();
- break;
- case Banking:
- this.bank();
- break;
- }
- }
- public BotStates getState() {
- Player player = this.client.getMyPlayer();
- if (this.client.getInventory().isFull()
- && this.bankArea.contains(player)) {
- return BotStates.Banking;
- }
- if (this.client.getInventory().isFull()
- && !this.bankArea.contains(player)) {
- return BotStates.shouldWalkToBank;
- }
- if (player.isAnimating() || player.isMoving()) {
- return BotStates.Fishing;
- }
- if (!this.client.getInventory().isFull()
- && this.fishArea.contains(player)) {
- return BotStates.getFish;
- }
- return BotStates.shouldWalkToFish;
- }
- public void bank() throws InterruptedException {
- RS2Object booth = closestObjectForName("Bank Booth");
- if (booth != null) {
- booth.interact("Bank");
- if (this.client.getBank().isOpen()) {
- this.client.getBank().depositAllExcept(this.fishingNet);
- }
- }
- }
- public void antiBan() throws InterruptedException {
- int rnd = random(1000);
- if (rnd == 0) {
- log("Antiban");
- int rnd2 = random(16);
- switch (rnd2) {
- case 0:
- if (currentTab() != Tab.SKILLS) {
- openTab(Tab.SKILLS);
- sleep(random(2500, 5000));
- openTab(Tab.INVENTORY);
- }
- break;
- case 1:
- this.client.getInterface(548).getChild(47).hover();
- sleep(random(1000, 2000));
- break;
- case 2:
- this.client.getInterface(548).getChild(48).hover();
- sleep(random(1000, 2000));
- break;
- case 3:
- this.client.getInterface(548).getChild(49).hover();
- sleep(random(1000, 2000));
- break;
- case 4:
- this.client.getInterface(548).getChild(50).hover();
- sleep(random(1000, 2000));
- break;
- case 5:
- this.client.getInterface(548).getChild(51).hover();
- sleep(random(1000, 2000));
- break;
- case 6:
- this.client.getInterface(548).getChild(52).hover();
- sleep(random(1000, 2000));
- break;
- case 7:
- this.client.getInterface(548).getChild(53).hover();
- sleep(random(1000, 2000));
- break;
- case 8:
- this.client.getInterface(548).getChild(30).hover();
- sleep(random(1000, 2000));
- break;
- case 9:
- this.client.getInterface(548).getChild(31).hover();
- sleep(random(1000, 2000));
- break;
- case 10:
- this.client.getInterface(548).getChild(32).hover();
- sleep(random(1000, 2000));
- break;
- case 11:
- this.client.getInterface(548).getChild(33).hover();
- sleep(random(1000, 2000));
- break;
- case 12:
- this.client.getInterface(548).getChild(34).hover();
- sleep(random(1000, 2000));
- break;
- case 13:
- this.client.getInterface(548).getChild(35).hover();
- sleep(random(1000, 2000));
- break;
- case 14:
- this.client.getInterface(548).getChild(36).hover();
- sleep(random(1000, 2000));
- break;
- case 15:
- this.client.setMouseSpeed(random(3, 7));
- break;
- }
- }
- }
- public void getFish() throws InterruptedException {
- NPC f = closestNPCForName("Fishing spot");
- if (f != null) {
- if (!f.isVisible()) {
- this.client.moveCameraToEntity(f);
- sleep(random(250, 500));
- }
- this.fish = f;
- }
- }
- public void goFish() throws InterruptedException {
- if (this.fish != null) {
- this.fish.interact("Net");
- sleep(random(500, 1000));
- }
- }
- public Position randomize(Position p, int min, int max) {
- int rnd = random(6);
- Position p1 = p;
- if (rnd == 0) {
- p1 = new Position((p.getX() + random(min, max)),
- (p.getY() + random(min, max)), p.getZ());
- if (!canReach(p1)) {
- rnd = 1;
- }
- }
- if (rnd == 1) {
- p1 = new Position((p.getX() - random(min, max)),
- (p.getY() + random(min, max)), p.getZ());
- if (!canReach(p1)) {
- rnd = 2;
- }
- }
- if (rnd == 2) {
- p1 = new Position((p.getX() + random(min, max)),
- (p.getY() - random(min, max)), p.getZ());
- if (!canReach(p1)) {
- rnd = 3;
- }
- }
- if (rnd == 3) {
- p1 = new Position((p.getX() - random(min, max)),
- (p.getY() - random(min, max)), p.getZ());
- if (!canReach(p1)) {
- p1 = p;
- }
- }
- return p1;
- }
- public void walkPath(Position[] ps) throws InterruptedException {
- for (Position p : ps) {
- if (p == ps[ps.length - 1] || p == ps[0]) {
- p = this.randomize(p, 0, 2);
- } else {
- p = this.randomize(p, 1, 3);
- }
- walkMiniMap(p);
- sleep(random(250, 750));
- while (this.client.getMyPlayer().isMoving()) {
- sleep(100);
- }
- }
- }
- public enum BotStates {
- shouldWalkToFish, shouldWalkToBank, Banking, Fishing, getFish
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement