I'll decompile it for you.
package rangeGuild;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.List;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.mouse.RectangleDestination;
import org.osbot.script.rs2.Client;
import org.osbot.script.rs2.map.Position;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.model.Item;
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.skill.Skill;
import org.osbot.script.rs2.skill.Skills;
import org.osbot.script.rs2.ui.Inventory;
import org.osbot.script.rs2.ui.Option;
import org.osbot.script.rs2.ui.RS2Interface;
import org.osbot.script.rs2.ui.RS2InterfaceChild;
import org.osbot.script.rs2.ui.Tab;
import org.osbot.script.rs2.utility.Area;
import rangeGuild.GUI.GUIFrame;
@ScriptManifest(name="YugodsRangeGuild V1.4", author="yugod", version=1.0D, info="Training range in range guild. Very simple.")
public class TrainingRange
extends Script
{
private final Rectangle CLOSE_BUTTON = new Rectangle(480, 35, 10, 13);
private final String CLOSE_ACTION = "Close";
static Timer runTime;
int counterShot = 0;
int minigames = 0;
int shotsFired = 0;
int method = 0;
int bothRunes;
int miss = 0;
int bug = 0;
boolean poisoned = false;
boolean moveCamera;
boolean checkXP;
boolean moveMouse;
private int startXP = 0;
private int startLvl = 0;
final Area SHOOT_AREA = new Area(2668, 3415, 2676, 3421);
public void setMethod(int method)
{
this.method = method;
}
public boolean setCamera(boolean moveCamera)
{
this.moveCamera = moveCamera;
return moveCamera;
}
public boolean setXPcheck(boolean checkXP)
{
this.checkXP = checkXP;
return checkXP;
}
public boolean setMoveMouse(boolean moveMouse)
{
this.moveMouse = moveMouse;
return moveMouse;
}
public void onStart()
{
try
{
runTime = new Timer(0L);
this.startXP = this.client.getSkills().getExperience(Skill.RANGED);
this.startLvl = this.client.getSkills().getLevel(Skill.RANGED);
GUIFrame localGUIFrame = new GUIFrame(this);
}
catch (Exception localException1) {}
}
public int onLoop()
throws InterruptedException
{
try
{
Entity target = closestObjectForName(new String[] { "Target" });
Inventory invent = this.client.getInventory();
Player player = this.client.getMyPlayer();
Item coins = invent.getItemForName("Coins");
RS2Object door = closestObjectForName(new String[] { "Guild door" });
if (!player.isAnimating()) {
this.bug += 1;
}
if (this.bug == 25) {
target.interact("Fire-at");
}
if (player.isAnimating()) {
this.bug = 0;
}
if ((!this.SHOOT_AREA.contains(player)) && (!player.isUnderAttack())) {
walk(new Position(2671 + random(2), 3418 + random(2), 0));
}
if ((this.client.getInterface(241) != null) && (!invent.contains("Bronze arrow")) &&
(this.client.getInterface(241).getChild(2).getMessage().equalsIgnoreCase("I suggest you use the 10 bronze arrows i gave you.")))
{
log("I stopped, because you don't have the arrows he gave you on you. Relog and get those first.");
stop();
}
if (coins == null)
{
log("Ran out of money!");
stop();
}
if (coins.getAmount() < 200)
{
log("Ran out of money!");
stop();
}
if (invent.contains("Bronze arrow"))
{
invent.interactWithName("Bronze arrow", "Wield");
sleep(random(1000, 1200));
}
if (player.isUnderAttack())
{
walk(new Position(2660 + random(2), 3436 + random(2), 0));
sleep(random(7500, 12500));
if (this.poisoned)
{
log("Logged off cause i was poisoned ! ");
stop();
}
}
if (!player.isUnderAttack())
{
if (this.counterShot == 0) {
talking();
}
if (this.counterShot > 0)
{
if ((!target.isVisible()) && (this.method != 2))
{
this.client.rotateCameraPitch(random(22, 29));
this.client.rotateCameraToAngle(random(279, 340));
}
if (((!target.isVisible()) || (this.client.getCameraYawAngle() < 349) || (this.client.getCameraYawAngle() > 354)) && (this.method == 2) && (player.getPosition().getX() == 2670) && (
(player.getPosition().getY() == 3418) || (player.getPosition().getY() == 3419) || (player.getPosition().getY() == 3417))) {
this.client.rotateCameraToAngle(random(349, 354));
}
if (((!target.isVisible()) || (this.client.getCameraPitchAngle() < 22) || (this.client.getCameraPitchAngle() > 26)) && (this.method == 2) && (player.getPosition().getX() == 2670) && (
(player.getPosition().getY() == 3418) || (player.getPosition().getY() == 3419) || (player.getPosition().getY() == 3417))) {
this.client.rotateCameraPitch(random(22, 26));
}
if (((!target.isVisible()) || (this.client.getCameraYawAngle() < 352) || (this.client.getCameraYawAngle() > 356)) && (this.method == 2) && (player.getPosition().getX() == 2671) && (
(player.getPosition().getY() == 3418) || (player.getPosition().getY() == 3419) || (player.getPosition().getY() == 3417))) {
this.client.rotateCameraToAngle(random(352, 356));
}
if (((!target.isVisible()) || (this.client.getCameraPitchAngle() < 22) || (this.client.getCameraPitchAngle() > 26)) && (this.method == 2) && (player.getPosition().getX() == 2671) && (
(player.getPosition().getY() == 3418) || (player.getPosition().getY() == 3419) || (player.getPosition().getY() == 3417))) {
this.client.rotateCameraPitch(random(22, 26));
}
if (((!target.isVisible()) || (this.client.getCameraYawAngle() < 355) || (this.client.getCameraYawAngle() > 360)) && (this.method == 2) && (player.getPosition().getX() == 2672) && (
(player.getPosition().getY() == 3418) || (player.getPosition().getY() == 3419) || (player.getPosition().getY() == 3417))) {
this.client.rotateCameraToAngle(random(355, 360));
}
if (((!this.SHOOT_AREA.contains(player)) && (!target.isVisible()) && (this.method == 2) && (player.getPosition().getX() < 2670)) || (player.getPosition().getX() > 2672) ||
(player.getPosition().getY() < 3417) || (player.getPosition().getY() > 3419))
{
walk(new Position(2671 + random(2), 3418 + random(2), 0));
this.client.moveCameraToEntity(target);
}
if (this.method == 0)
{
log("Please choose a method of shooting and the antiban.");
sleep(random(5000, 7500));
}
if (this.method == 1) {
attacking1();
}
if (this.method == 2) {
attacking2();
}
if (this.method == 3) {
attacking3();
}
}
}
if ((random(900) == 4) && (random(500) < 100) && (this.method != 2) && (this.moveMouse))
{
moveMouseOutsideScreen();
log("ANTIBAN: Moved mouse out of screen.");
sleep(random(4000, 10000));
}
if ((random(900) == 450) && (random(100) < 50) && (this.method != 2) && (this.checkXP))
{
openTab(Tab.SKILLS);
sleep(random(500, 750));
this.client.moveMouse(new RectangleDestination(545, 311, 55, 11), false);
log("ANTIBAN: Checking XP");
sleep(random(3500, 5000));
openTab(Tab.INVENTORY);
}
if ((random(900) == 700) && (random(500) > 400) && (this.method != 2) && (this.moveCamera))
{
this.client.rotateCameraPitch(random(22, 29));
this.client.rotateCameraToAngle(random(279, 340));
log("ANTIBAN: Moved camera around a bit.");
this.miss = 0;
sleep(random(3500, 5000));
}
if ((random(900) == 4) && (this.method == 2) && (random(500) > 450) && (this.moveMouse))
{
moveMouseOutsideScreen();
log("ANTIBAN: Moved mouse out of screen.");
sleep(random(4000, 10000));
}
if ((random(900) == 450) && (this.method == 2) && (random(500) > 450) && (this.checkXP))
{
openTab(Tab.SKILLS);
sleep(random(500, 750));
this.client.moveMouse(new RectangleDestination(545, 311, 55, 11), false);
log("ANTIBAN: Checking XP");
sleep(random(3500, 5000));
openTab(Tab.INVENTORY);
}
if ((random(900) == 700) && (this.method == 2) && (random(500) > 450) && (this.moveCamera))
{
this.client.rotateCameraPitch(random(22, 29));
this.client.rotateCameraToAngle(random(279, 340));
log("ANTIBAN: Moved camera around a bit.");
this.miss = 0;
sleep(random(3500, 5000));
}
sleep(random(50, 100));
}
catch (Exception e)
{
e.printStackTrace();
}
return 1;
}
public void talking()
{
try
{
Player player = this.client.getMyPlayer();
NPC judge = closestNPCForName(new String[] { "Competition Judge" });
Inventory invent = this.client.getInventory();
if (player.getPosition().distance(judge.getPosition()) > 10)
{
walk(judge.getPosition());
sleep(random(750, 1250));
}
if (player.getPosition().distance(judge.getPosition()) <= 10)
{
if ((this.client.getInterface(241) == null) && (this.client.getInterface(242) == null) && (this.client.getInterface(230) == null) && (this.client.getInterface(64) == null)) {
judge.interact("Talk-to");
}
sleep(random(500, 750));
if ((this.client.getInterface(241) != null) &&
(this.client.getInterface(241).getChild(2).getMessage().equalsIgnoreCase("Hello again, do you need reminding of the rules?"))) {
this.counterShot = 10;
}
if (this.client.getInterface(242) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(242).getChild(4).getRectangle());
selectOption(null, destination, "Continue");
}
if (this.client.getInterface(230) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(230).getChild(1).getRectangle());
selectOption(null, destination, "Continue");
}
if (this.client.getInterface(64) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(64).getChild(3).getRectangle());
selectOption(null, destination, "Continue");
}
if ((this.client.getInterface(241) != null) && (!this.client.getInterface(241).getChild(2).getMessage().equalsIgnoreCase("Hello again, do you need reminding of the rules?")))
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(241).getChild(3).getRectangle());
selectOption(null, destination, "Continue");
sleep(random(500, 750));
if (invent.contains("Bronze arrow"))
{
invent.interactWithName("Bronze arrow", "Wield");
sleep(random(1000, 1200));
this.counterShot = random(10, 11);
}
}
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void attacking1()
{
try
{
this.client.setMouseSpeed(random(10, 15));
Player player = this.client.getMyPlayer();
NPC judge = closestNPCForName(new String[] { "Competition Judge" });
Entity target = closestObjectForName(new String[] { "Target" });
if ((target.isVisible()) &&
(!player.isAnimating()))
{
target.interact("Fire-at");
sleep(random(2250, 2700));
if ((this.shotsFired == 1) && (!player.isFacing(judge))) {
selectOption(null, new RectangleDestination(this.CLOSE_BUTTON.x, this.CLOSE_BUTTON.y, this.CLOSE_BUTTON.width, this.CLOSE_BUTTON.height), "Close");
}
}
if (this.client.getInterface(325) != null)
{
this.counterShot -= 1;
RectangleDestination destination = new RectangleDestination(this.client.getInterface(325).getChild(89).getRectangle());
selectOption(null, destination, "Close");
sleep(random(250, 750));
}
if (this.client.getInterface(242) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(242).getChild(4).getRectangle());
selectOption(null, destination, "Continue");
sleep(random(750, 1250));
this.counterShot = 0;
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void attacking2()
{
try
{
Player player = this.client.getMyPlayer();
Entity target = closestObjectForName(new String[] { "Target" });
List<Entity> onCursor = this.client.getEntitiesOnCursor();
Object[] object = { onCursor.toArray() };
if (this.client.getInterface(242) == null)
{
if ((!object[0].equals(target)) && (!onCursor.contains(target))) {
this.client.moveMouse(target.getMouseDestination(), false);
}
if (onCursor.contains(target)) {
this.client.clickMouse(false);
}
}
if (this.client.getInterface(325) != null) {
selectOption(null, new RectangleDestination(this.CLOSE_BUTTON.x, this.CLOSE_BUTTON.y, this.CLOSE_BUTTON.width, this.CLOSE_BUTTON.height), "Close");
}
if (this.client.getInterface(242) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(242).getChild(4).getRectangle());
selectOption(null, destination, "Continue");
sleep(random(750, 1250));
this.counterShot = 0;
}
sleep(random(50, 100));
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void attacking3()
{
boolean hit = false;
try
{
Player player = this.client.getMyPlayer();
Entity target = closestObjectForName(new String[] { "Target" });
if ((target.isVisible()) && (this.SHOOT_AREA.contains(player)))
{
if ((!player.isAnimating()) && (this.client.getInterface(325) == null) && (!this.client.isMenuOpen()) && (this.SHOOT_AREA.contains(player)))
{
target.interact("Fire-at");
sleep(random(500, 750));
}
if ((player.isAnimating()) && (this.counterShot > 0) && (!this.client.isMenuOpen()))
{
if (!this.client.getEntitiesOnCursor().contains(target)) {
this.client.moveMouse(target.getMouseDestination(), false);
}
if (this.client.getEntitiesOnCursor().contains(target)) {
this.client.clickMouse(true);
}
}
if (this.client.getInterface(325) != null) {
if (this.client.isMenuOpen())
{
List<Option> opt = this.client.getMenu();
for (int i = 0; i < opt.size(); i++) {
if ((((Option)opt.get(i)).action.equals("Fire-at")) && (this.client.isMenuOpen()))
{
this.client.moveMouse(new RectangleDestination(this.client.getMenuX() + 5, this.client.getMenuY() + 19 + 14 * i, this.client.getMenuWidth() - 5, 15), false);
sleep(200 + gRandom(100, 100.0D));
this.client.clickMouse(false);
sleep(800 + gRandom(100, 100.0D));
this.counterShot -= 1;
hit = true;
}
}
if (!hit) {
this.miss += 1;
}
if (!hit) {
selectOption(null, new RectangleDestination(this.CLOSE_BUTTON.x, this.CLOSE_BUTTON.y, this.CLOSE_BUTTON.width, this.CLOSE_BUTTON.height), "Close");
}
if (this.miss > 15)
{
this.client.rotateCameraPitch(random(22, 29));
this.client.rotateCameraToAngle(random(279, 340));
log("Changing camera Angle, hard to aim from this angle. ");
sleep(random(1000, 1250));
this.miss = 0;
}
}
}
if ((!this.client.isMenuOpen()) && (this.client.getInterface(325) != null)) {
selectOption(null, new RectangleDestination(this.CLOSE_BUTTON.x, this.CLOSE_BUTTON.y, this.CLOSE_BUTTON.width, this.CLOSE_BUTTON.height), "Close");
}
if (this.client.getInterface(242) != null)
{
RectangleDestination destination = new RectangleDestination(this.client.getInterface(242).getChild(4).getRectangle());
selectOption(null, destination, "Continue");
sleep(random(750, 1250));
this.counterShot = 0;
}
}
if (!target.isVisible()) {
this.client.moveCameraToEntity(target);
}
if (!this.SHOOT_AREA.contains(player)) {
walk(this.SHOOT_AREA);
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void onMessage(String message)
{
Entity target = closestObjectForName(new String[] { "Target" });
if (message.contains("You pay the judge")) {
this.minigames += 1;
}
if (message.contains("You carefully aim")) {
this.shotsFired += 1;
}
if (message.contains("You've fired all your arrows")) {
this.counterShot = 0;
}
if (message.contains("You have been poisoned!")) {
this.poisoned = true;
}
if ((message.contains("I can't reach that!")) && (this.method == 2)) {}
try
{
this.client.moveMouse(target.getMouseDestination(), false);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void onPaint(Graphics g)
{
Graphics2D gr = (Graphics2D)g;
gr.setColor(Color.WHITE);
gr.setFont(new Font("Arial", 1, 12));
if (runTime != null) {
g.drawString("Runtime: " + Timer.format(runTime.getElapsed()),
25, 50);
}
gr.drawString("Minigames: " + this.minigames, 25, 65);
gr.drawString("Shots fired: " + this.shotsFired, 25, 80);
gr.drawString("Exp gained: " + (this.client.getSkills().getExperience(Skill.RANGED) - this.startXP), 25, 95);
gr.drawString("Exp gained/h: " + getPerHour(this.client.getSkills().getExperience(Skill.RANGED) - this.startXP), 25, 110);
gr.drawString("Ranged lvl: " + this.client.getSkills().getLevel(Skill.RANGED) + " gained: (" + (this.client.getSkills().getLevel(Skill.RANGED) - this.startLvl) + ")", 25, 125);
}
public static int getPerHour(int value)
{
if ((runTime != null) && (runTime.getElapsed() > 0L)) {
return (int)(value * 3600000.0D / runTime.getElapsed());
}
return 0;
}
public void onExit()
{
log("Minigames ran: " + this.minigames);
log("Ran for: " + Timer.format(runTime.getElapsed()));
}
}
Timer.java
package rangeGuild;
public class Timer
{
private long period;
private long start;
public Timer(long period)
{
this.period = period;
this.start = System.currentTimeMillis();
}
public long getElapsed()
{
return System.currentTimeMillis() - this.start;
}
public long getRemaining()
{
return this.period - getElapsed();
}
public boolean isRunning()
{
return getElapsed() <= this.period;
}
public void reset()
{
this.start = System.currentTimeMillis();
}
public void stop()
{
this.period = 0L;
}
public static String format(long milliSeconds)
{
long secs = milliSeconds / 1000L;
return String.format("%02d:%02d:%02d", new Object[] {
Long.valueOf(secs / 3600L), Long.valueOf(secs % 3600L / 60L), Long.valueOf(secs % 60L) });
}
}