Jump to content

Alternative to Area's


Articron

Recommended Posts

import org.osbot.script.MethodProvider;
import org.osbot.script.Script;
import org.osbot.script.rs2.Client;
import org.osbot.script.rs2.map.Position;

public class Area {


    private int z;
    private int maxX;
    private int maxY;
    private int minX;
    private int minY;
    Script script;

    public Area(int x1, int y1, int x2, int y2,int z) {
        this.z = z;
        maxX = (x1 > x2? x1 : x2);
        maxY = (y2 > y1? y2 : y2);
        minX = (x1 < x2? x1 : x2);
        minY = (y2 < y1? y2 : y1);
    }

    public boolean isInArea(Client c) {
        if (c.getMyPlayer().getX() >= minX
                && c.getMyPlayer().getX() <= maxX
                && c.getMyPlayer().getY() <= maxY
                && c.getMyPlayer().getY() >= minY)
            return true;
        else
            return false;
    }
    
    public void walktoZone() throws InterruptedException {
        int xDeficit = maxX - minX;
        int yDeficit = maxY - minX;
        Position toWalk = new Position(maxX - (MethodProvider.random(0,xDeficit)), maxY - (MethodProvider.random(0,yDeficit)), z);
        script.walkMiniMap(toWalk);
    }
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...