import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
/**
* BigBotsOnly - This script is ready to run, however- you should not.
*/
@ScriptManifest(author = "BigBotsOnly", info = "Completes selected Agility rooftop course.", name = "RooftopAgility", version = 1.0, logo = "url")
public class Main extends Script{
private int maxSleep = 1297; //make this random
private int minSleep = 489; //make this random
private int idleCycle = 0;
private int lapsCompleted = 0;
private int obsticlesFailed = 0;
private int currentObsticle = 0;
private int markOfGrace = 0;
private Area[] failedObsticle;
private Area[] targetArea;
private int[] objectIDS;
private Position[] landingPosition;
private String[] getInteractionLable;
private Position startLocation;
private String foodItem = "Trout"; //change this with GUI or manually
@Override
public void onStart() {
log("Setting up..");
skills.getExperienceTracker().start(Skill.AGILITY);
this.startTime = System.currentTimeMillis();
//edit this for GUI to change course
log("Reading SeersVillage variables..");
failedObsticle = SeersVillage.failedObsticle;
targetArea = SeersVillage.targetArea;
objectIDS = SeersVillage.objectIDS;
landingPosition = SeersVillage.landingPosition;
getInteractionLable = SeersVillage.getInteractionLable;
startLocation = SeersVillage.startLocation;
log("Setup complete, starting script..");
}
public Main(){
this.font1 = new Font("Lao UI", 0, 13);
this.color2 = new Color(255, 255, 255);
}
@Override
public int onLoop() throws InterruptedException {
if(myPlayer().isAnimating()){
//setStatus("Running..");
idleCycle = 0;
return random(minSleep, minSleep+random(maxSleep));
}
if(!myPlayer().isAnimating()){
//we have come to a standstill
if(idleCycle > 20)
{
log("Something has happened, terminating script for account safety.");
this.stop(true);
return 200;
}
if(idleCycle > 2 && !myPlayer().isAnimating()){
// log("Getting new action");
if(myPlayer().getHealthPercent() < 50) {
//check if player has food
if(inventory.contains(foodItem)) {
setStatus("Eating..");
inventory.interact(foodItem, "Eat");
return random(minSleep, minSleep+random(maxSleep));
} else {
if(getSkills().getDynamic(Skill.HITPOINTS) < 8){
log("We have ran out of food and have no hp left. Terminating script for account safety.");
this.stop();
return random(minSleep, minSleep+random(maxSleep));
}
log("We have ran out of food, continuing till we have less than 8 hp.");
}
}
currentObsticle = getCurrentStep();
GroundItem item = getGroundItems().closest("Mark of Grace");
if(getMap().canReach(item)) {
setStatus("Picking Mark of Grace");
if(item != null)
if(item.interact("take")) {
markOfGrace++;
}
new BotTimer(5000, 100) {
public boolean breakCondition() {
return item == null;
}
}.sleep();
}
if(currentObsticle == -1) {
//failed obsticle.
obsticlesFailed++;
setStatus("Walking to start");
walking.walk(startLocation);
//return random(minSleep, minSleep+random(maxSleep));
}
if(currentObsticle == -2) {
//unknown location
log("Unknown location..");
if(idleCycle > 20) {
log("Something has happened, terminating script for account safety.");
this.stop(true);
return 200;
}
return random(minSleep, minSleep+random(maxSleep));
}
if(currentObsticle == landingPosition.length-1) {
//finished course
lapsCompleted++;
setStatus("Walking to start");
walking.walk(startLocation);
return 20+random(minSleep);
}
Entity nextObsticle = objects.closest(objectIDS[currentObsticle]);
if(nextObsticle == null) {
log("Can't find next obsticle.");
return 500;
}
log("Current step: "+currentObsticle+ "Next obsticle: "+nextObsticle.getId());
if(nextObsticle.interact(getInteractionLable[currentObsticle])) {
setStatus("Performing "+getInteractionLable[currentObsticle]);
new BotTimer(5000, 100) {
public boolean breakCondition() {
return landingPosition[currentObsticle].distance(myPlayer().getPosition()) <= 1;
}
}.sleep();
//return 10+random(maxSleep);
} else {
log("Can't click next obsticle.");
}
return random(minSleep, minSleep+random(maxSleep));
}
//log("idleCycle++ : "+idleCycle);
idleCycle++;
}
return random(minSleep, minSleep+random(maxSleep));
}
private int getCurrentStep() {
for(int i = 0; i < failedObsticle.length; i++) {
if(failedObsticle[i].contains(myPlayer().getPosition())){
// Player has failed an obsticle.. Resetting course.
return -1;
}
}
if(landingPosition[landingPosition.length-1].distance(myPlayer().getPosition()) <= 1) {
return landingPosition.length-1;
}
//TODO load this into seersvillage class or load only on seers village.
if(SeersVillage.inSpecialLocation(myPlayer())) {
//this is the step that prolly will ban your account, fix it dawg
return 4;
}
//end TODO
for(int i = 0; i < landingPosition.length; i++) {
if(landingPosition[i].distance(myPlayer().getPosition()) <= 1) {
//log("In landing position..");
return i;
}
}
for(int i = 0; i < targetArea.length; i++) {
targetArea[i].setPlane(myPlayer().getZ());
if(targetArea[i].contains(myPlayer())){
//log("In target area..");
return i;
}
}
return -2;
}
@Override
public void onExit() {
log("Reading debug..");
log("Starting lvl: "+(skills.getStatic(Skill.AGILITY) - skills.getExperienceTracker().getGainedLevels(Skill.AGILITY))+", Level now: "+skills.getStatic(Skill.AGILITY)+", Total xp gained: "+skills.getExperienceTracker().getGainedXP(Skill.AGILITY));
log("Time ran: "+skills.getExperienceTracker().getElapsed(Skill.AGILITY) +" Gained: "+skills.getExperienceTracker().getGainedLevels(Skill.AGILITY) + " levels.");
log("Script has been terminated. ");
}
private final Font font1;
private final Color color2;
private long startTime;
private final Image backpaint = getImage("https://i.imgur.com/wDpknA6.png");//https://i.imgur.com/DOQPPs5.png //https://i.imgur.com/S6wqJnK.png
public boolean showRandomWarning(){
return getClosestNPC() != null;
}
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
}
catch (IOException e) {}
return null;
}
private NPC getClosestNPC() {
NPC closest = null;
double lowest = Double.MAX_VALUE;
for(NPC npc : getNpcs().getAll()) {
final double distance = npc.getPosition().distance(myPosition());
if(npc.isInteracting(myPlayer()) && distance < lowest) {
closest = npc;
lowest = distance;
}
}
return closest;
}
private int getHourly(int amount) {
return (int)((double)amount * 3600000.0 / (double)(System.currentTimeMillis() - startTime));
}
@Override
public void onPaint(Graphics2D g) {
millis = System.currentTimeMillis() - startTime;
hours = millis / 3600000;
millis -= hours * 3600000;
minutes = millis / 60000;
millis -= minutes * 60000;
seconds = millis / 1000;
//g.setFont(font3);
//g.setColor(color3);
g.drawImage(backpaint, 0, 229, null);
if(showRandomWarning()){
// g.drawImage(warning, 1, 100, null);
}
g.setFont(font1);
g.setColor(color2);
int x = 15;
int y = 250;
g.drawString("Time: " + (hours < 10 ? "0"+hours : hours) + " : " + (minutes < 10 ? "0"+minutes : minutes) + " : " + (seconds < 10 ? "0"+seconds : seconds), x, y); y+=13;
g.drawString("Laps: "+lapsCompleted+", ("+getHourly(lapsCompleted)+"/h), Fails: "+obsticlesFailed+" ("+getHourly(obsticlesFailed)+"/h), Marks: "+markOfGrace+" ("+getHourly(markOfGrace)+"/h)", x, y); y+=14;
g.drawString("Experience: "+getSkills().getExperienceTracker().getGainedXP(Skill.AGILITY)+", ("+(getSkills().getExperienceTracker().getGainedXPPerHour(Skill.AGILITY))+" /h)", x, y); y+=13;
g.drawString("Status: "+getStatus()+"", x, y); y+=13;
}
private String getStatus() {
return status;
}
private String status = "Loading..";
private String setStatus(String status) {
return this.status = status;
}
private long millis;
private long hours;
private long minutes;
private long seconds;
}
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
public class SeersVillage {
public static Position startLocation = new Position(2729, 3488, 0);
public static Area[] failedObsticle = {
new Area(2715, 3491, 2718, 3496),
new Area(2706, 3483, 2715, 3486),
};
public static Area[] targetArea = {
new Area(2727, 3487, 2731, 3489),
new Area(2722, 3490, 2730, 3497),
new Area(2705, 3487, 2715, 3496),
new Area(2709, 3476, 2716, 3482),
new Area(2700, 3470, 2716, 3474),
new Area(2698, 3459, 2702, 3465),
};
public static int[] objectIDS = {
11373, 11374, 11378, 11375, 11376, 11377
};
public static Position[] landingPosition = {
new Position(1111, 1111, 1), //spoof
new Position(2729, 3491, 3), //0
new Position(2713, 3494, 2), //1
new Position(2710, 3480, 2), //2
new Position(2712, 3472, 3), //3
new Position(2702, 3465, 2), //4
new Position(2704, 3464, 0) //5
};
public static String[] getInteractionLable = {
"Climb-up",
"Jump",
"Cross",
"Jump",
"Jump",
"Jump"
};
public static boolean inSpecialLocation(Entity player) {
return (player.getPosition().getX() == 2709 || player.getPosition().getX() == 2710 || player.getPosition().getX() == 2711 || player.getPosition().getX() == 2712 || player.getPosition().getX() == 2713 || player.getPosition().getX() == 2714) && player.getPosition().getY() == 3472;
}
}
I think you're probably better off without botting agility. This script is just a basic shell that I made up quickly, unless you modify this script you're gonna have a bad time.