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;
- @ScriptManifest(name = "Pickpocketing", author = "Murded", version = 1D, info="")
- public class pickpocketing extends Script {
- private int[][] path1 = new int[][] { { 3206, 3209 }, { 3215, 3211 }, { 3217, 3218 }, { 3225, 3218 },
- { 3235, 3220 }, { 3242, 3226 }, { 3252, 3226 }, { 3251, 3235 }, };
- enum State {
- fishing,banking;
- }
- private State state;
- public void onStart(){
- walker = new DicloniusWalking(this);
- }
- public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath, int distanceFromEnd) {
- if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0] : path[0][0],
- AscendThroughPath ? path[path.length - 1][1] : path[0][1]) <= distanceFromEnd)
- return true;
- else {
- WalkAlongPath(path, AscendThroughPath);
- return false;
- }
- }
- public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
- int destination = 0;
- for (int i = 0; i < path.length; i++)
- if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(path[destination][0], path[destination][1]))
- destination = i;
- if (script.client.getMyPlayer().isMoving() && distanceToPoint(path[destination][0], path[destination][1]) > (script.isRunning() ? 3 : 2))
- return;
- if (AscendThroughPath && destination != path.length - 1 || !AscendThroughPath && destination != 0)
- destination += (AscendThroughPath ? 1 : -1);
- try {
- log("Walking to node:" + destination);
- script.walk(new Position(path[destination][0], path[destination][1], 0));
- Thread.sleep(700 + MethodProvider.random(600));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- private int distanceToPoint(int pointX, int pointY) {
- return (int) Math.sqrt(Math.pow(script.client.getMyPlayer().getX() - pointX, 2)
- + Math.pow(script.client.getMyPlayer().getY() - pointY, 2));
- }
- public int onLoop() throws InterruptedException{
- if(client.getInventory().isFull() == false) {
- state = State.fishing;
- } else {
- state = State.banking;
- }
- switch (state){
- case fishing:
- return chopping();
- case banking:
- return banking();
- }
- return random(10, 20);
- }
- int chopping() throws InterruptedException {
- if(client.getMyPlayer().isAnimating() == false) {
- NPC fish = closestNPCForName("Fishing Spot");
- fish.interact("Net");
- }
- return 2000;
- }
- int banking() throws InterruptedException {
- if(client.getInventory().isFull()) {
- }
- WalkAlongPath(path1, true);
- return 2000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment