gt: 								255 - distanceTo(mapPath[paintTile]) * 11));
context: import java.awt.Color;
  import java.awt.Cursor;
  import java.awt.Font;
  import java.awt.Graphics;
  import java.awt.Panel;
  import java.awt.Point;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.KeyEvent;
  import java.awt.event.WindowAdapter;
  import java.awt.event.WindowEvent;
  import java.awt.image.BufferedImage;
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.net.MalformedURLException;
  import java.net.URISyntaxException;
  import java.net.URL;
  import java.util.Map;
  import java.util.Properties;
  import java.util.Random;
  
  import javax.imageio.ImageIO;
  import javax.swing.DefaultComboBoxModel;
  import javax.swing.ImageIcon;
  import javax.swing.JButton;
  import javax.swing.JComboBox;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.JTabbedPane;
  import javax.swing.JTextArea;
  import javax.swing.JTextField;
  import javax.swing.SwingConstants;
  
  import org.rsbot.bot.Bot;
  import org.rsbot.bot.input.Listener;
  import org.rsbot.bot.input.Mouse;
  import org.rsbot.event.events.ServerMessageEvent;
  import org.rsbot.event.listeners.PaintListener;
  import org.rsbot.event.listeners.ServerMessageListener;
  import org.rsbot.script.Calculations;
  import org.rsbot.script.Constants;
  import org.rsbot.script.Script;
  import org.rsbot.script.ScriptManifest;
  import org.rsbot.script.wrappers.RSInterface;
  import org.rsbot.script.wrappers.RSInterfaceChild;
  import org.rsbot.script.wrappers.RSNPC;
  import org.rsbot.script.wrappers.RSObject;
  import org.rsbot.script.wrappers.RSTile;
  import org.rsbot.util.GlobalConfiguration;
  import org.rsbot.util.ScreenshotUtil;
  
  /**
   * @author SpeedWing
   * @version 3.038 (c)2009-2010 SpeedWing, No one except SpeedWing has the right
   *          to modify and/or spread this script without the permission of
   *          SpeedWing.
   */
  @ScriptManifest(authors = { "SpeedWing" }, category = "Runecraft", name = "RuneSpeed AIO Runecrafter", version = 3.038, description = "<html>\n"
  		+ "<body style='font-family: Calibri; color:white; padding: 0px; text-align: center; background-color: black;'>"
  		+ "<img src=\"http://speedwing.ucoz.com/RuneSpeed/RuneSpeed_description.png\" /><br>")
  public class RuneSpeed extends Script implements PaintListener,
  		ServerMessageListener {
  
  	int essence[] = { 1436, 7936 }, Runes[] = { 556, 558, 555, 557, 554, 559 },
  			AllDone, Rune, Tiara, AirTiara = 5527, EarthTiara = 5535,
  			FireTiara = 5537, WaterTiara = 5531, MindTiara = 5529,
  			BodyTiara = 5533, CurBank, CurOutside, CurAltar, ExitPortal,
  			AirBankID = 11402, AirOutsideID = 2452, AirAltarID = 2478,
  			AirExit = 2465, EarthBankID = 11402, EarthOutsideID = 2455,
  			EarthAltarID = 2481, EarthExit = 2468, FireBankID = 35647,
  			FireOutsideID = 2456, FireAltarID = 2482, FireExit = 2469,
  			WaterBankID = 2213, WaterOutsideID = 2454, WaterAltarID = 2480,
  			WaterExit = 2467, MindBankID = 11758, MindOutsideID = 2453,
  			MindAltarID = 2479, MindExit = 2466, BodyBankID = 26972,
  			BodyOutsideID = 2457, BodyAltarID = 2483, BodyExit = 2470,
  			essleft = 0, essInInv = 0, ExtraTimout = 0, essprice = 0,
  			runeprice, runeID = 0, essID, Profit = 0, SamePath = 0,
  			WaitForEnergy = 0, mouseSpeed, clickOrPress = 0;
  	String globalday, globalhour, globalminute, globalsecond;
  	int airRune = 556, mindRune = 558, waterRune = 555, earthRune = 557,
  			fireRune = 554, bodyRune = 559;
  	// STATES//
  	boolean banking, bankwalk, altarwalk, crafting, getessence, grabitems,
  			inbank, exitaltar, walking, run, tiaracheck, tiarabank = false,
  			isTiaraOn = false, openit = false, enterit = false,
  			portalturn = true, gotPrices = false, CameraTurned = false,
  			gotActivity = false, shutDown = false;
  	// special transportation
  	boolean tele = false, varrockTeleport = false, fallyTeleport = false,
  			getTele = false, gotTeleStats = false;
  	int runesInInv = 0, thirdTeleRune, teleports = 0, telePrice = 0;
  	boolean gloryTeleport = false, getGlory = false;
  	int glory4 = 1712, glory3 = 1710, glory2 = 1708, glory1 = 1706,
  			glory0 = 1704;
  	int[] gloryArray = { glory1, glory2, glory3, glory4 };
  	boolean tabTeleport = false, tabClicked = false;
  	int curTab, airTab = 13599, mindTab = 13600, waterTab = 13601,
  			earthTab = 13602, fireTab = 13603, bodyTab = 13604;
  	boolean ringTeleport = false, stileCrossed = false;
  	int explorerRing = 13562, stileID = 7527;
  	boolean duelTeleport = false, getDuel = false, duelArrived = false;
  	int duel1 = 2566, duel2 = 2564, duel3 = 2562, duel4 = 2560, duel5 = 2558,
  			duel6 = 2556, duel7 = 2554, duel8 = 2552;
  	int[] duelArray = { duel2, duel3, duel4, duel5, duel6, duel7, duel8 };
  	int[] duelleaveArray = { duel1, duel2, duel3, duel4, duel5, duel6, duel7,
  			duel8 };
  	boolean antibanstate = true;
  	boolean rest = true;
  	double GlobalChance;
  	RSTile GlobalTile;
  	boolean TurnTheCamera = false;
  	AntiBan antiban;
  	Thread t;
  	boolean RestStat = false;
  	boolean RestCamera = false;
  	// Running
  	char CONTROL = KeyEvent.VK_CONTROL;
  	String TiaraName = "";
  	int MusicianID[] = { 8699, 8700, 8707, 5442 };
  	// stat system
  	long lastUpdateMillis = 0;
  	int lastExp = 0, lastEss = 0, lastCrafted = 0, lastProfit = 0,
  			lastEssUsed = 0;
  	// ///////
  	// PATHS//
  	RSTile[][] path;
  	RSTile[] RealPath;
  	RSTile[] magicTelePath;
  	RSTile[] prevPath = new RSTile[50];
  	int pathar[] = new int[3];
  	RSTile[] AirAltar1 = { new RSTile(3185, 3434), new RSTile(3182, 3430),
  			new RSTile(3176, 3429), new RSTile(3170, 3428),
  			new RSTile(3163, 3422), new RSTile(3158, 3418),
  			new RSTile(3152, 3416), new RSTile(3148, 3415),
  			new RSTile(3143, 3413), new RSTile(3141, 3410),
  			new RSTile(3138, 3406), new RSTile(3135, 3406),
  			new RSTile(3131, 3405) };
  	RSTile[] AirAltar2 = { new RSTile(3185, 3434), new RSTile(3182, 3429),
  			new RSTile(3177, 3429), new RSTile(3172, 3426),
  			new RSTile(3168, 3424), new RSTile(3165, 3420),
  			new RSTile(3163, 3421), new RSTile(3158, 3418),
  			new RSTile(3152, 3416), new RSTile(3148, 3416),
  			new RSTile(3143, 3412), new RSTile(3136, 3406),
  			new RSTile(3131, 3405) };
  	RSTile[] AirAltar3 = { new RSTile(3185, 3434), new RSTile(3172, 3429),
  			new RSTile(3162, 3423), new RSTile(3156, 3422),
  			new RSTile(3148, 3417), new RSTile(3140, 3408),
  			new RSTile(3131, 3405) };
  	RSTile[] AirTelePath = { new RSTile(3185, 3434), new RSTile(3196, 3429),
  			new RSTile(3207, 3429) };
  	RSTile[][] AirPath = { AirAltar1, AirAltar2, AirAltar3 };
  	RSTile[] EarthAltar1 = { new RSTile(3253, 3422), new RSTile(3254, 3428),
  			new RSTile(3260, 3429), new RSTile(3266, 3428),
  			new RSTile(3272, 3428), new RSTile(3277, 3430),
  			new RSTile(3278, 3439), new RSTile(3283, 3446),
  			new RSTile(3286, 3456), new RSTile(3297, 3463),
  			new RSTile(3304, 3472) };
  	RSTile[] EarthAltar2 = { new RSTile(3253, 3422), new RSTile(3254, 3429),
  			new RSTile(3265, 3429), new RSTile(3275, 3430),
  			new RSTile(3274, 3438), new RSTile(3281, 3445),
  			new RSTile(3287, 3453), new RSTile(3293, 3462),
  			new RSTile(3304, 3472) };
  	RSTile[] EarthAltar3 = { new RSTile(3253, 3422), new RSTile(3260, 3429),
  			new RSTile(3270, 3429), new RSTile(3278, 3428),
  			new RSTile(3286, 3435), new RSTile(3286, 3444),
  			new RSTile(3289, 3453), new RSTile(3295, 3462),
  			new RSTile(3297, 3467), new RSTile(3304, 3472) };
  	RSTile[][] EarthPath = { EarthAltar1, EarthAltar2, EarthAltar3 };
  	RSTile[] EarthTelePath = { new RSTile(3253, 3422), new RSTile(3253, 3428),
  			new RSTile(3247, 3430), new RSTile(3237, 3430),
  			new RSTile(3226, 3429) };
  	RSTile[] FireAltar1 = { new RSTile(3271, 3167), new RSTile(3277, 3174),
  			new RSTile(3282, 3182), new RSTile(3283, 3195),
  			new RSTile(3286, 3207), new RSTile(3295, 3218),
  			new RSTile(3300, 3232), new RSTile(3303, 3244),
  			new RSTile(3311, 3252) };
  	RSTile[] FireAltar2 = { new RSTile(3271, 3167), new RSTile(3276, 3176),
  			new RSTile(3281, 3191), new RSTile(3285, 3199),
  			new RSTile(3290, 3213), new RSTile(3296, 3220),
  			new RSTile(3301, 3229), new RSTile(3306, 3239),
  			new RSTile(3311, 3252) };
  	RSTile[] FireAltar3 = { new RSTile(3271, 3167), new RSTile(3277, 3174),
  			new RSTile(3282, 3183), new RSTile(3284, 3195),
  			new RSTile(3286, 3200), new RSTile(3290, 3210),
  			new RSTile(3298, 3217), new RSTile(3300, 3227),
  			new RSTile(3304, 3237), new RSTile(3307, 3241),
  			new RSTile(3311, 3252) };
  	RSTile[][] FirePath = { FireAltar1, FireAltar2, FireAltar3 };
  	RSTile[] FireTelePath = { new RSTile(3271, 3167), new RSTile(3276, 3174),
  			new RSTile(3283, 3183), new RSTile(3292, 3182),
  			new RSTile(3292, 3168) };
  	RSTile[] FireDuelPath = { new RSTile(3307, 3236), new RSTile(3307, 3241),
  			new RSTile(3309, 3251), new RSTile(3311, 3252) };
  	RSTile[] WaterAltar1 = { new RSTile(3094, 3244), new RSTile(3098, 3236),
  			new RSTile(3102, 3225), new RSTile(3110, 3220),
  			new RSTile(3117, 3211), new RSTile(3124, 3207),
  			new RSTile(3135, 3207), new RSTile(3144, 3207),
  			new RSTile(3151, 3194), new RSTile(3159, 3187),
  			new RSTile(3162, 3178), new RSTile(3166, 3169),
  			new RSTile(3174, 3166), new RSTile(3182, 3167) };
  	RSTile[] WaterAltar2 = { new RSTile(3094, 3244), new RSTile(3096, 3234),
  			new RSTile(3102, 3226), new RSTile(3109, 3223),
  			new RSTile(3115, 3218), new RSTile(3127, 3219),
  			new RSTile(3136, 3218), new RSTile(3144, 3209),
  			new RSTile(3151, 3201), new RSTile(3156, 3191),
  			new RSTile(3158, 3184), new RSTile(3164, 3176),
  			new RSTile(3172, 3175), new RSTile(3173, 3167),
  			new RSTile(3182, 3167) };
  	RSTile[] WaterAltar3 = { new RSTile(3094, 3244), new RSTile(3098, 3238),
  			new RSTile(3101, 3229), new RSTile(3113, 3223),
  			new RSTile(3122, 3220), new RSTile(3135, 3219),
  			new RSTile(3143, 3211), new RSTile(3147, 3205),
  			new RSTile(3153, 3196), new RSTile(3157, 3186),
  			new RSTile(3163, 3178), new RSTile(3163, 3172),
  			new RSTile(3170, 3168), new RSTile(3175, 3165),
  			new RSTile(3182, 3167) };
  	RSTile[][] WaterPath = { WaterAltar1, WaterAltar2, WaterAltar3 };
  	RSTile[] WaterTelePath = { new RSTile(3094, 3244), new RSTile(3083, 3248),
  			new RSTile(3080, 3251), new RSTile(3073, 3257),
  			new RSTile(3072, 3265), new RSTile(3073, 3273),
  			new RSTile(3067, 3276), new RSTile(3063, 3280),
  			new RSTile(3063, 3286) };
  	RSTile[] MindAltar1 = { new RSTile(2945, 3370), new RSTile(2955, 3382),
  			new RSTile(2965, 3393), new RSTile(2973, 3405),
  			new RSTile(2982, 3417), new RSTile(2987, 3430),
  			new RSTile(2987, 3442), new RSTile(2982, 3451),
  			new RSTile(2975, 3460), new RSTile(2972, 3471),
  			new RSTile(2974, 3483), new RSTile(2978, 3495),
  			new RSTile(2980, 3504), new RSTile(2980, 3511) };
  	RSTile[] MindAltar2 = { new RSTile(2945, 3370), new RSTile(2952, 3377),
  			new RSTile(2965, 3383), new RSTile(2965, 3390),
  			new RSTile(2971, 3398), new RSTile(2973, 3407),
  			new RSTile(2983, 3417), new RSTile(2989, 3430),
  			new RSTile(2985, 3440), new RSTile(2984, 3450),
  			new RSTile(2979, 3457), new RSTile(2973, 3469),
  			new RSTile(2969, 3480), new RSTile(2973, 3492),
  			new RSTile(2977, 3504), new RSTile(2980, 3511) };
  	RSTile[] MindAltar3 = { new RSTile(2945, 3370), new RSTile(2950, 3375),
  			new RSTile(2963, 3383), new RSTile(2966, 3397),
  			new RSTile(2967, 3406), new RSTile(2975, 3410),
  			new RSTile(2985, 3420), new RSTile(2987, 3430),
  			new RSTile(2983, 3440), new RSTile(2977, 3451),
  			new RSTile(2974, 3461), new RSTile(2972, 3473),
  			new RSTile(2973, 3482), new RSTile(2977, 3494),
  			new RSTile(2979, 3504), new RSTile(2980, 3511) };
  	RSTile[][] MindPath = { MindAltar1, MindAltar2, MindAltar3 };
  	RSTile[] BodyAltar1 = { new RSTile(3092, 3491), new RSTile(3082, 3485),
  			new RSTile(3081, 3477), new RSTile(3084, 3466),
  			new RSTile(3088, 3452), new RSTile(3074, 3451),
  			new RSTile(3068, 3442), new RSTile(3055, 3443) };
  	RSTile[] BodyAltar2 = { new RSTile(3092, 3491), new RSTile(3081, 3485),
  			new RSTile(3081, 3477), new RSTile(3087, 3466),
  			new RSTile(3075, 3460), new RSTile(3071, 3451),
  			new RSTile(3064, 3437), new RSTile(3055, 3443) };
  	RSTile[] BodyAltar3 = { new RSTile(3092, 3491), new RSTile(3087, 3490),
  			new RSTile(3079, 3481), new RSTile(3081, 3476),
  			new RSTile(3087, 3465), new RSTile(3077, 3461),
  			new RSTile(3072, 3455), new RSTile(3067, 3447),
  			new RSTile(3063, 3449), new RSTile(3055, 3443) };
  	RSTile[][] BodyPath = { BodyAltar1, BodyAltar2, BodyAltar3 };
  
  	public double CurrentVersion = getClass().getAnnotation(
  			ScriptManifest.class).version();
  	// ///////
  	// PAINT//
  	int paintX = 294;
  	int paintY = 4;
  	long startTime = 0;
  	long expraise;
  	int startLvl;
  	int startExp;
  	int crafted;
  	int essused;
  	double runexp;
  	long EXPPerHour;
  	String status = "";
  	BufferedImage overlay = null;
  	BufferedImage cursor = null;
  	BufferedImage cursor80 = null;
  	BufferedImage cursor60 = null;
  	BufferedImage cursor40 = null;
  	BufferedImage cursor20 = null;
  	RSTile[] mapPath = new RSTile[200];
  	long totalSeconds = 0;
  
  	// GUI SETTINGS
  	boolean Done = false, ini = false, close = false;
  	public static String SelectedRune;
  	public static String SelectedRest;
  	public static String SelectedTiara;
  	public static String SelectedTab;
  	public static String SelectedCamera;
  	public static String SelectedOverlay;
  	public static String SelectedOverlayColour;
  	public static String SelectedLogout;
  	public static double SelectedRuinsCamera;
  	public static double SelectedAltarCamera;
  	public static double SelectedBankCamera;
  	public static long LevelLogout;
  	public static long EssenceLogout;
  	public static long MinutesLogout;
  	public static String UserName = "NoUserNameEntered";
  	long minutesStop = 0;
  
  	public class GUI extends JFrame {
  		private static final long serialVersionUID = -234234L;
  		private JComboBox RuneCombo;
  		private JComboBox RestCombo;
  		private JComboBox TiaraCombo;
  		private JComboBox OverlayCombo;
  		private JComboBox OverlayColourCombo;
  		private JComboBox RuinsCameraCombo;
  		private JComboBox CameraCombo;
  		private JComboBox BankCameraCombo;
  		private JComboBox AltarCameraCombo;
  		private JTextField HourTextField;
  		private JTextField MinutesTextField;
  		private JTextField LevelTextField;
  		private JTextField EssenceTextField;
  		private JTextArea changeLogTextArea;
  		private JComboBox TabCombo;
  		private JComboBox logoutCombo;
  		private JTextField userNameField;
  		public Properties RSpeedIni = new Properties();
  		private final File changeLogFile = new File(new File(
  				GlobalConfiguration.Paths.getSettingsDirectory()),
  				"RuneSpeedChangeLog.txt");// credits to Taha(SmartSmelter)
  
  		public boolean loadSettings() {
  			try {
  				RSpeedIni.load(new FileInputStream(new File(
  						GlobalConfiguration.Paths.getSettingsDirectory(),
  						"RuneSpeed.ini")));
  			} catch (FileNotFoundException e) {
  				ini = true;
  				return false;
  			} catch (IOException e) {
  				e.printStackTrace();
  				return false;
  			}
  			if (RSpeedIni.getProperty("Rune") != null)
  				RuneCombo.setSelectedIndex(Integer.valueOf(RSpeedIni
  						.getProperty("Rune")));
  			if (RSpeedIni.getProperty("Rest") != null)
  				RestCombo.setSelectedIndex(Integer.valueOf(RSpeedIni
  						.getProperty("Rest")));
  			if (RSpeedIni.getProperty("Tiara") != null)
  				TiaraCombo.setSelectedIndex(Integer.valueOf(RSpeedIni
  						.getProperty("Tiara")));
  			if (RSpeedIni.getProperty("Tab") != null)
  				TabCombo.setSelectedIndex(Integer.valueOf(RSpeedIni
  						.getProperty("Tab")));
  			if (RSpeedIni.getProperty("Username") != null)
  				userNameField.setText(RSpeedIni.getProperty("Username"));
  
  			return true;
  		}
  
  		public void loadChangeLog() {
  			try {
  				changeLogFile.createNewFile();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			BufferedReader in = null;
  			try {
  				in = new BufferedReader(new InputStreamReader(new URL(
  						"http://speedwing.ucoz.com/RuneSpeed/RuneSpeedLog.txt")
  						.openStream()));
  			} catch (MalformedURLException e1) {
  				log("ChangeLog not found.");
  			} catch (IOException e1) {
  				log("Unable to Download ChangeLog");
  			}
  			try {
  				final BufferedWriter out = new BufferedWriter(new FileWriter(
  						changeLogFile));
  				String temp;
  				while ((temp = in.readLine()) != null) {
  					out.append(temp);
  					out.newLine();
  				}
  				out.close();
  				in.close();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  
  			try {
  				changeLogTextArea.read(new BufferedReader(new FileReader(
  						changeLogFile)), changeLogFile);
  			} catch (FileNotFoundException e) {
  				log("ChangeLog not Found.");
  			} catch (IOException e) {
  				log("Unable to open the ChangeLog");
  			}
  		}// credits to Taha(SmartSmelter)
  
  		public void OpenUrl(final String URL) {
  			final java.awt.Desktop browser = java.awt.Desktop.getDesktop();
  			java.net.URI location = null;
  			try {
  				location = new java.net.URI(URL);
  			} catch (final URISyntaxException a) {
  				a.printStackTrace();
  			}
  			try {
  				browser.browse(location);
  			} catch (final IOException c) {
  				c.printStackTrace();
  			}
  		}
  
  		public GUI() {
  			addWindowListener(new WindowAdapter() {
  				@Override
  				public void windowClosed(WindowEvent arg0) {
  					close = true;
  					Done = true;
  				}
  			});
  			setResizable(false);
  			setTitle("RuneSpeed by SpeedWing");
  			setBounds(100, 100, 456, 258);
  			setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  			getContentPane().setLayout(null);
  
  			JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
  			tabbedPane.setBounds(10, 11, 419, 180);
  			tabbedPane.setFont(new Font("Calibri", Font.BOLD, 11));
  			getContentPane().add(tabbedPane);
  
  			Panel panel = new Panel();
  			tabbedPane
  					.addTab(
  							"Main Options",
  							new ImageIcon(
  									GUI.class
  											.getResource("/javax/swing/plaf/metal/icons/ocean/computer.gif")),
  							panel, null);
  			panel.setLayout(null);
  
  			JLabel lblMainOptions = new JLabel("Main Options");
  			lblMainOptions.setBounds(10, 11, 307, 37);
  			lblMainOptions.setHorizontalAlignment(SwingConstants.CENTER);
  			lblMainOptions.setFont(new Font("Calibri", Font.BOLD, 15));
  			panel.add(lblMainOptions);
  
  			JLabel lblRuneToCraft = new JLabel("What to Craft:");
  			lblRuneToCraft.setBounds(56, 52, 101, 22);
  			lblRuneToCraft.setHorizontalAlignment(SwingConstants.CENTER);
  			lblRuneToCraft.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(lblRuneToCraft);
  
  			JLabel lblResting = new JLabel("Resting:");
  			lblResting.setBounds(56, 73, 101, 22);
  			lblResting.setHorizontalAlignment(SwingConstants.CENTER);
  			lblResting.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(lblResting);
  
  			JLabel lblTiaraChecking = new JLabel("Tiara Checking:");
  			lblTiaraChecking.setBounds(56, 95, 101, 22);
  			lblTiaraChecking.setHorizontalAlignment(SwingConstants.CENTER);
  			lblTiaraChecking.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(lblTiaraChecking);
  
  			RuneCombo = new JComboBox();
  			RuneCombo.setToolTipText("");
  			RuneCombo.setBounds(169, 52, 105, 22);
  			RuneCombo.setModel(new DefaultComboBoxModel(new String[] { "Air",
  					"Air(tele)", "Mind", "Mind(tele)", "Earth", "Earth(tele)",
  					"Water", "Water(glory)", "Water(cabbage)", "Fire",
  					"Fire(glory)", "Fire(ring)", "Body", "Body(glory)" }));
  			RuneCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(RuneCombo);
  
  			RestCombo = new JComboBox();
  			RestCombo.setBounds(169, 73, 105, 22);
  			RestCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			RestCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(RestCombo);
  
  			TiaraCombo = new JComboBox();
  			TiaraCombo.setBounds(169, 95, 105, 22);
  			TiaraCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			TiaraCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			panel.add(TiaraCombo);
  
  			TabCombo = new JComboBox();
  			TabCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			TabCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			TabCombo.setBounds(169, 116, 105, 22);
  			panel.add(TabCombo);
  
  			JLabel lblTeleTabs = new JLabel("Altar Tabs:");
  			lblTeleTabs.setHorizontalAlignment(SwingConstants.CENTER);
  			lblTeleTabs.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblTeleTabs.setBounds(56, 116, 101, 22);
  			panel.add(lblTeleTabs);
  
  			JLabel lblSignatureUsername = new JLabel("Signature Username:");
  			lblSignatureUsername
  					.setToolTipText("It automatically creates the signature if the username doesn't exist.");
  			lblSignatureUsername.setHorizontalAlignment(SwingConstants.CENTER);
  			lblSignatureUsername.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblSignatureUsername.setBounds(56, 142, 101, 22);
  			panel.add(lblSignatureUsername);
  
  			userNameField = new JTextField();
  			userNameField
  					.setToolTipText("It automatically creates the username if the username doesn't exist.");
  			userNameField.setHorizontalAlignment(SwingConstants.CENTER);
  			userNameField.setFont(new Font("Calibri", Font.PLAIN, 11));
  			userNameField.setBounds(169, 142, 105, 22);
  			panel.add(userNameField);
  			userNameField.setColumns(10);
  
  			Panel panel_3 = new Panel();
  			tabbedPane.addTab("Camera Anti-Ban", null, panel_3, null);
  			panel_3.setLayout(null);
  
  			JLabel lblCameraBank = new JLabel("Camera Bank Chance:");
  			lblCameraBank.setHorizontalAlignment(SwingConstants.CENTER);
  			lblCameraBank.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblCameraBank.setBounds(12, 75, 152, 22);
  			panel_3.add(lblCameraBank);
  
  			JLabel lblOnlyAdjustThese = new JLabel(
  					"Adjust these only if you know what you are doing else just");
  			lblOnlyAdjustThese.setIcon(null);
  			lblOnlyAdjustThese.setHorizontalAlignment(SwingConstants.CENTER);
  			lblOnlyAdjustThese.setForeground(Color.RED);
  			lblOnlyAdjustThese.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblOnlyAdjustThese.setBounds(12, 49, 297, 14);
  			panel_3.add(lblOnlyAdjustThese);
  
  			BankCameraCombo = new JComboBox();
  			BankCameraCombo
  					.setToolTipText("Will set the chance to turn the camera upon banking");
  			BankCameraCombo.setModel(new DefaultComboBoxModel(new String[] {
  					"100", "95", "90", "85", "80", "75", "70", "65", "60",
  					"55", "50", "45", "40", "35", "30", "25", "20", "15", "10",
  					"5", "0" }));
  			BankCameraCombo.setSelectedIndex(13);
  			BankCameraCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			BankCameraCombo.setBounds(176, 75, 55, 22);
  			panel_3.add(BankCameraCombo);
  
  			RuinsCameraCombo = new JComboBox();
  			RuinsCameraCombo
  					.setToolTipText("Will set the chance to turn the camera upon Entering the Ruins");
  			RuinsCameraCombo.setModel(new DefaultComboBoxModel(new String[] {
  					"100", "95", "90", "85", "80", "75", "70", "65", "60",
  					"55", "50", "45", "40", "35", "30", "25", "20", "15", "10",
  					"5", "0" }));
  			RuinsCameraCombo.setSelectedIndex(14);
  			RuinsCameraCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			RuinsCameraCombo.setBounds(176, 98, 55, 22);
  			panel_3.add(RuinsCameraCombo);
  
  			JLabel lblCameraRuinsChance = new JLabel("Camera Ruins Chance:");
  			lblCameraRuinsChance.setHorizontalAlignment(SwingConstants.CENTER);
  			lblCameraRuinsChance.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblCameraRuinsChance.setBounds(12, 98, 152, 22);
  			panel_3.add(lblCameraRuinsChance);
  
  			JLabel lblCameraAltarLeave = new JLabel(
  					"Camera inside Altar Chance:");
  			lblCameraAltarLeave.setHorizontalAlignment(SwingConstants.CENTER);
  			lblCameraAltarLeave.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblCameraAltarLeave.setBounds(12, 122, 152, 22);
  			panel_3.add(lblCameraAltarLeave);
  
  			JLabel label_1 = new JLabel("Camera Anti-Ban");
  			label_1.setHorizontalAlignment(SwingConstants.CENTER);
  			label_1.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label_1.setBounds(32, 13, 101, 22);
  			panel_3.add(label_1);
  
  			CameraCombo = new JComboBox();
  			CameraCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			CameraCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			CameraCombo.setBounds(174, 11, 55, 22);
  			panel_3.add(CameraCombo);
  
  			JLabel lblElseJustLeave = new JLabel("leave them as they are.");
  			lblElseJustLeave.setHorizontalAlignment(SwingConstants.CENTER);
  			lblElseJustLeave.setForeground(Color.RED);
  			lblElseJustLeave.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblElseJustLeave.setBounds(12, 60, 297, 14);
  			panel_3.add(lblElseJustLeave);
  
  			AltarCameraCombo = new JComboBox();
  			AltarCameraCombo.setModel(new DefaultComboBoxModel(new String[] {
  					"100", "95", "90", "85", "80", "75", "70", "65", "60",
  					"55", "50", "45", "40", "35", "30", "25", "20", "15", "10",
  					"5", "0" }));
  			AltarCameraCombo.setSelectedIndex(13);
  			AltarCameraCombo
  					.setToolTipText("Will set the chance to turn the camera when clicking the altar & leaving the altar");
  			AltarCameraCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			AltarCameraCombo.setBounds(176, 120, 55, 22);
  			panel_3.add(AltarCameraCombo);
  
  			JLabel label_2 = new JLabel("%");
  			label_2.setHorizontalAlignment(SwingConstants.LEFT);
  			label_2.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label_2.setBounds(234, 75, 71, 22);
  			panel_3.add(label_2);
  
  			JLabel label_3 = new JLabel("%");
  			label_3.setHorizontalAlignment(SwingConstants.LEFT);
  			label_3.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label_3.setBounds(234, 98, 71, 22);
  			panel_3.add(label_3);
  
  			JLabel label_4 = new JLabel("%");
  			label_4.setHorizontalAlignment(SwingConstants.LEFT);
  			label_4.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label_4.setBounds(234, 122, 71, 22);
  			panel_3.add(label_4);
  
  			Panel panel_1 = new Panel();
  			tabbedPane
  					.addTab(
  							"Overlay",
  							new ImageIcon(
  									GUI.class
  											.getResource("/javax/swing/plaf/metal/icons/ocean/maximize-pressed.gif")),
  							panel_1, null);
  			panel_1.setLayout(null);
  
  			JLabel lblPaint = new JLabel("Overlay Options");
  			lblPaint.setBounds(10, 11, 297, 37);
  			lblPaint.setFont(new Font("Calibri", Font.BOLD, 15));
  			lblPaint.setHorizontalAlignment(SwingConstants.CENTER);
  			panel_1.add(lblPaint);
  
  			JLabel lblOverlayColour = new JLabel("Overlay:");
  			lblOverlayColour.setHorizontalAlignment(SwingConstants.CENTER);
  			lblOverlayColour.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblOverlayColour.setBounds(58, 81, 101, 22);
  			panel_1.add(lblOverlayColour);
  
  			OverlayCombo = new JComboBox();
  			OverlayCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			OverlayCombo.setSelectedIndex(1);
  			OverlayCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			OverlayCombo.setBounds(169, 81, 55, 22);
  			panel_1.add(OverlayCombo);
  
  			JLabel label = new JLabel("Overlay Colour:");
  			label.setHorizontalAlignment(SwingConstants.CENTER);
  			label.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label.setBounds(58, 104, 101, 22);
  			panel_1.add(label);
  
  			OverlayColourCombo = new JComboBox();
  			OverlayColourCombo.setModel(new DefaultComboBoxModel(new String[] {
  					"Grey", "Blue", "Red", "Green", "Pink" }));
  			OverlayColourCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			OverlayColourCombo.setBounds(169, 104, 55, 22);
  			panel_1.add(OverlayColourCombo);
  
  			JLabel lblUsingTheOverlay = new JLabel(
  					"The overlay decreases the FPS of Runescape!");
  			lblUsingTheOverlay.setForeground(Color.RED);
  			lblUsingTheOverlay.setHorizontalAlignment(SwingConstants.CENTER);
  			lblUsingTheOverlay.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblUsingTheOverlay.setBounds(10, 48, 297, 22);
  			panel_1.add(lblUsingTheOverlay);
  
  			JPanel panel_5 = new JPanel();
  			tabbedPane.addTab("Logout Options", null, panel_5, null);
  			panel_5.setLayout(null);
  
  			JLabel lblLogOut = new JLabel("Logout after Time:");
  			lblLogOut.setHorizontalAlignment(SwingConstants.CENTER);
  			lblLogOut.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblLogOut.setBounds(46, 86, 85, 14);
  			panel_5.add(lblLogOut);
  
  			MinutesTextField = new JTextField();
  			MinutesTextField.setText("0");
  			MinutesTextField.setFont(new Font("Calibri", Font.PLAIN, 12));
  			MinutesTextField.setBounds(211, 82, 30, 22);
  			panel_5.add(MinutesTextField);
  
  			LevelTextField = new JTextField();
  			LevelTextField.setText("0");
  			LevelTextField.setFont(new Font("Calibri", Font.PLAIN, 12));
  			LevelTextField.setBounds(155, 107, 43, 22);
  			panel_5.add(LevelTextField);
  
  			JLabel lblEssenceDoneTill = new JLabel("Logout on level:");
  			lblEssenceDoneTill.setHorizontalAlignment(SwingConstants.CENTER);
  			lblEssenceDoneTill.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblEssenceDoneTill.setBounds(56, 111, 74, 14);
  			panel_5.add(lblEssenceDoneTill);
  
  			EssenceTextField = new JTextField();
  			EssenceTextField.setText("0");
  			EssenceTextField.setFont(new Font("Calibri", Font.PLAIN, 12));
  			EssenceTextField.setBounds(155, 132, 86, 22);
  			panel_5.add(EssenceTextField);
  
  			JLabel label_5 = new JLabel("Essence done till Logout:");
  			label_5.setHorizontalAlignment(SwingConstants.CENTER);
  			label_5.setFont(new Font("Calibri", Font.PLAIN, 11));
  			label_5.setBounds(10, 136, 116, 14);
  			panel_5.add(label_5);
  
  			JLabel lblSetOnOre = new JLabel(
  					"conditions to make the script stop at a condition.");
  			lblSetOnOre.setHorizontalAlignment(SwingConstants.CENTER);
  			lblSetOnOre.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblSetOnOre.setBounds(46, 26, 230, 14);
  			panel_5.add(lblSetOnOre);
  
  			JLabel lblIfYouWant = new JLabel(
  					"If you want to stop at a certain point, then set one or more");
  			lblIfYouWant.setHorizontalAlignment(SwingConstants.CENTER);
  			lblIfYouWant.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblIfYouWant.setBounds(23, 11, 272, 14);
  			panel_5.add(lblIfYouWant);
  
  			JLabel lblItWillLogout = new JLabel(
  					"It will logout on the first condition that takes place.");
  			lblItWillLogout.setHorizontalAlignment(SwingConstants.CENTER);
  			lblItWillLogout.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblItWillLogout.setBounds(37, 41, 239, 14);
  			panel_5.add(lblItWillLogout);
  
  			JLabel lblTurnOffPc = new JLabel("Turn off pc:");
  			lblTurnOffPc.setHorizontalAlignment(SwingConstants.CENTER);
  			lblTurnOffPc.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblTurnOffPc.setBounds(56, 61, 89, 14);
  			panel_5.add(lblTurnOffPc);
  
  			logoutCombo = new JComboBox();
  			logoutCombo.setModel(new DefaultComboBoxModel(new String[] { "On",
  					"Off" }));
  			logoutCombo.setSelectedIndex(1);
  			logoutCombo.setFont(new Font("Calibri", Font.PLAIN, 11));
  			logoutCombo.setBounds(155, 57, 55, 22);
  			panel_5.add(logoutCombo);
  			logoutCombo.setSelectedItem("Off");
  
  			HourTextField = new JTextField();
  			HourTextField.setText("0");
  			HourTextField.setFont(new Font("Calibri", Font.PLAIN, 12));
  			HourTextField.setBounds(155, 82, 30, 22);
  			panel_5.add(HourTextField);
  
  			JLabel lblH = new JLabel("H:");
  			lblH.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblH.setBounds(139, 86, 10, 14);
  			panel_5.add(lblH);
  
  			JLabel lblM = new JLabel("M:");
  			lblM.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblM.setBounds(195, 86, 12, 14);
  			panel_5.add(lblM);
  
  			JPanel panel_4 = new JPanel();
  			tabbedPane.addTab("Change Log", null, panel_4, null);
  			panel_4.setLayout(null);
  
  			JScrollPane scrollPane = new JScrollPane();
  			scrollPane.setBounds(0, 0, 316, 175);
  			panel_4.add(scrollPane);
  
  			changeLogTextArea = new JTextArea();
  			scrollPane.setViewportView(changeLogTextArea);
  			changeLogTextArea.setText("Loading...");
  			changeLogTextArea.setEditable(false);
  			changeLogTextArea.setRows(8);
  			changeLogTextArea.setColumns(8);
  			changeLogTextArea.setCursor(Cursor
  					.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  			changeLogTextArea.setWrapStyleWord(true);
  			changeLogTextArea.setLineWrap(true);
  			changeLogTextArea.setFont(new Font("Calibri", Font.PLAIN, 11));
  
  			Panel panel_2 = new Panel();
  			tabbedPane.addTab("Info", null, panel_2, null);
  			panel_2.setLayout(null);
  
  			JLabel lblRunespeed = new JLabel("RuneSpeed");
  			lblRunespeed.setHorizontalAlignment(SwingConstants.CENTER);
  			lblRunespeed.setFont(new Font("Calibri", Font.BOLD, 15));
  			lblRunespeed.setBounds(10, 11, 297, 37);
  			panel_2.add(lblRunespeed);
  
  			JLabel lblMadeBySpeedwing = new JLabel("Made by: SpeedWing");
  			lblMadeBySpeedwing.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblMadeBySpeedwing.setHorizontalAlignment(SwingConstants.CENTER);
  			lblMadeBySpeedwing.setBounds(10, 48, 297, 23);
  			panel_2.add(lblMadeBySpeedwing);
  
  			JButton btnRunespeedRsbotTopic = new JButton(
  					"Go to RuneSpeed RSBot Topic");
  			btnRunespeedRsbotTopic.setFont(new Font("Calibri", Font.PLAIN, 12));
  			btnRunespeedRsbotTopic.addActionListener(new ActionListener() {
  				public void actionPerformed(ActionEvent arg0) {
  					OpenUrl("http://www.rsbot.org/vb/showthread.php?t=162259");
  				}
  			});
  			btnRunespeedRsbotTopic.setBounds(10, 103, 297, 30);
  			panel_2.add(btnRunespeedRsbotTopic);
  
  			JButton btnDownloadNewestRunespeed = new JButton(
  					"Download Newest RuneSpeed");
  			btnDownloadNewestRunespeed.addActionListener(new ActionListener() {
  				public void actionPerformed(ActionEvent arg0) {
  					OpenUrl("http://speedwing.ucoz.com/RuneSpeed/RuneSpeed.java");
  				}
  			});
  			btnDownloadNewestRunespeed.setFont(new Font("Calibri", Font.PLAIN,
  					12));
  			btnDownloadNewestRunespeed.setBounds(10, 134, 297, 30);
  			panel_2.add(btnDownloadNewestRunespeed);
  
  			JLabel lblThanksToDaevilstat = new JLabel(
  					"Thanks to: DaEvil(stat system)");
  			lblThanksToDaevilstat.setHorizontalAlignment(SwingConstants.CENTER);
  			lblThanksToDaevilstat.setFont(new Font("Calibri", Font.PLAIN, 11));
  			lblThanksToDaevilstat.setBounds(10, 69, 297, 23);
  			panel_2.add(lblThanksToDaevilstat);
  
  			JButton btnStart = new JButton("Start");
  			btnStart.setBounds(340, 196, 89, 23);
  			btnStart.addActionListener(new ActionListener() {
  				public void actionPerformed(ActionEvent arg0) {
  					RuneSpeed.SelectedCamera = (String) CameraCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedTiara = (String) TiaraCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedTab = (String) TabCombo.getSelectedItem();
  					RuneSpeed.SelectedRune = (String) RuneCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedRest = (String) RestCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedOverlay = (String) OverlayCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedOverlayColour = (String) OverlayColourCombo
  							.getSelectedItem();
  					RuneSpeed.SelectedRuinsCamera = Double
  							.valueOf((String) RuinsCameraCombo
  									.getSelectedItem());
  					RuneSpeed.SelectedBankCamera = Double
  							.valueOf((String) BankCameraCombo.getSelectedItem());
  					RuneSpeed.SelectedAltarCamera = Double
  							.valueOf((String) AltarCameraCombo
  									.getSelectedItem());
  					RuneSpeed.LevelLogout = Long.valueOf(LevelTextField
  							.getText());
  					RuneSpeed.EssenceLogout = Long.valueOf(EssenceTextField
  							.getText());
  					RuneSpeed.MinutesLogout = (Long.valueOf(HourTextField
  							.getText()) * 60)
  							+ Long.valueOf(MinutesTextField.getText());
  					RuneSpeed.SelectedLogout = String.valueOf(logoutCombo
  							.getSelectedItem());
  					RuneSpeed.UserName = userNameField.getText();
  					RSpeedIni.setProperty("Rune", String.valueOf(RuneCombo
  							.getSelectedIndex()));
  					RSpeedIni.setProperty("Rest", String.valueOf(RestCombo
  							.getSelectedIndex()));
  					RSpeedIni.setProperty("Tiara", String.valueOf(TiaraCombo
  							.getSelectedIndex()));
  					RSpeedIni.setProperty("Tab", String.valueOf(TabCombo
  							.getSelectedIndex()));
  					RSpeedIni.setProperty("Username", userNameField.getText());
  					try {
  						RSpeedIni.store(new FileWriter(new File(
  								GlobalConfiguration.Paths
  										.getSettingsDirectory(),
  								"RuneSpeed.ini")),
  								"The GUI Settings for RuneSpeed");
  						if (ini)
  							log("Generated settings file!");
  
  					} catch (IOException e) {
  						// TODO Auto-generated catch block
  						e.printStackTrace();
  					}
  
  					Done = true;
  				}
  			});
  			btnStart.setFont(new Font("Calibri", Font.PLAIN, 12));
  			getContentPane().add(btnStart);
  
  			JLabel lblLoadingVersion = new JLabel("Version: " + CurrentVersion);
  			lblLoadingVersion.setBounds(10, 202, 222, 19);
  			lblLoadingVersion.setFont(new Font("Calibri", Font.PLAIN, 11));
  			getContentPane().add(lblLoadingVersion);
  
  			loadSettings();
  			loadChangeLog();
  		}
  	}
  
  	public class AntiBan implements Runnable {
  		private boolean stopThread;
  		Random random = new Random();
  
  		public void run() {
  			while (!stopThread) {
  				if (TurnTheCamera) {
  					final int chance = (int) GlobalChance * 10;
  					if (chance <= random(1, 1001)) {
  						mouseSpeed = random(5, 7);
  						turnToTile(GlobalTile, random(3, 12));
  					} else if (chance == 1000) {
  						turnToTile(GlobalTile, random(3, 12));
  					}
  					TurnTheCamera = false;
  					CameraTurned = true;
  				}
  				if (WaitForEnergy > 0
  						&& (getMyPlayer().getAnimation() == 12108
  								|| getMyPlayer().getAnimation() == 2033
  								|| getMyPlayer().getAnimation() == 2716
  								|| getMyPlayer().getAnimation() == 11786 || getMyPlayer()
  								.getAnimation() == 5713)) {
  					if (RestCamera) {
  						if (random(0, 3) < 2) {
  							final char[] LR = new char[] { KeyEvent.VK_LEFT,
  									KeyEvent.VK_RIGHT };
  							final int rand = random(0, 2);
  							Bot.getInputManager().pressKey(LR[rand]);
  							try {
  								Thread.sleep(random.nextInt(Math
  										.abs(1950 - 550)));
  							} catch (InterruptedException e) {
  								// TODO Auto-generated catch block
  								e.printStackTrace();
  							}
  							Bot.getInputManager().releaseKey(LR[rand]);
  						}
  						moveMouse(tileToMinimap(getMyPlayer().getLocation()).x
  								+ random(-50, 50), tileToMinimap(getMyPlayer()
  								.getLocation()).y
  								+ random(-50, 50));
  
  						RestCamera = false;
  					}
  				}
  				try {
  					Thread.sleep(10);
  				} catch (InterruptedException e) {
  					// TODO Auto-generated catch block
  					e.printStackTrace();
  				}
  			}
  		}
  	}
  
  	public void AntiBanCamera(final RSTile tile, final double ChanceTo) {
  		final int chance = (int) ChanceTo * 10;
  		if (chance <= random(1, 1001))
  			turnToTile(tile, random(3, 12));
  
  	}
  
  	public int arrayBankItemByID(final int array[]) {
  		try {
  			for (int anArray : array) {
  				if (bank.getCount(anArray) > 0)
  					return anArray;
  
  			}
  		} catch (Exception e) {
  			e.printStackTrace();
  		}
  		return 0;
  	}
  
  	public int arrayInvCount(final int array[]) {
  		try {
  			for (int anArray : array) {
  				if (invCount(anArray) > 0)
  					return invCount(anArray);
  
  			}
  		} catch (Exception e) {
  			e.printStackTrace();
  		}
  		return 0;
  	}
  
  	public int arrayInvItemByID(final int array[]) {
  		try {
  			for (int anArray : array) {
  				if (invCount(anArray) > 0)
  					return anArray;
  
  			}
  		} catch (Exception e) {
  			e.printStackTrace();
  		}
  		return 0;
  	}
  
  	public boolean bankSave() {
  		RSTile Loc = getMyPlayer().getLocation();
  		if (Rune == earthRune)
  			if (Loc.equals(new RSTile(3250, 3419))
  					|| Loc.equals(new RSTile(3257, 3419)))
  				if (walkTo(new RSTile(3253 + random(-1, 2),
  						3421 + random(-1, 2))))
  					waitToMove(1000);
  		return false;
  	}
  
  	public void cameraHeight() {
  		if (antibanstate && Bot.getClient().getCameraPitch() < 2750)
  			setCameraAltitude(true);
  
  	}
  
  	public void changePath() {
  		if (RealPath == magicTelePath)
  			RealPath = path[random(0, 3)];
  
  		final RSTile[] curPath = RealPath;
  		int iPath = random(0, 3);
  		RealPath = path[iPath];
  		boolean done = false;
  		if (pathar[0] + pathar[1] > 3 || pathar[0] + pathar[2] > 3
  				|| pathar[1] + pathar[2] > 3) {
  			if (SamePath > 3) {
  				if (curPath == path[0]) {
  					iPath = random(1, 3);
  					RealPath = path[iPath];
  				}
  				if (curPath == path[1]) {
  					iPath = 1;
  					while (iPath == 1) {
  						iPath = random(0, 3);
  					}
  					RealPath = path[iPath];
  				}
  				if (curPath == path[2]) {
  					iPath = random(0, 2);
  					RealPath = path[iPath];
  				}
  				SamePath = 0;
  				done = true;
  			}
  			if (!done) {
  				for (int i = 0; i < pathar.length; i++) {
  					pathar[i] = 0;
  				}
  				if (pathar[0] + pathar[1] > 4)
  					iPath = 2;
  
  				if (pathar[0] + pathar[2] > 4)
  					iPath = 1;
  
  				if (pathar[1] + pathar[2] > 4)
  					iPath = 0;
  
  				RealPath = path[iPath];
  			}
  		}
  		if (curPath == RealPath)
  			SamePath++;
  
  		pathar[iPath]++;
  	}
  
  	public boolean climbStile() {
  		try {
  			if (mapPath[0] == null)
  				mapPath[0] = getMyPlayer().getLocation();
  
  			if (!isInZone(getMyPlayer().getLocation(), 3044, 3068, 3283, 3298)) {
  				stileCrossed = true;
  				return true;
  			}
  			if (getNearestObjectByID(stileID) != null) {
  				if (tileOnScreen(getNearestObjectByID(stileID).getLocation())
  						&& !getMyPlayer().isMoving()
  						&& getDestination() == null) {
  					wait(300);
  					mouseSpeed = random(3, 5);
  					clickMouse(Calculations.tileToScreen(getNearestObjectByID(
  							stileID).getLocation(), 0.5, 0.05, 0), true);
  					if (waitForZone(5000, 3061, 3065, 3275, 3282)) {
  						stileCrossed = true;
  						return true;
  					}
  				} else {
  					if ((distanceTo(getDestination()) < 2 || !getMyPlayer()
  							.isMoving())
  							&& !tileOnScreen(getNearestObjectByID(stileID)
  									.getLocation())) {
  						if (getDestination() != null)
  							if ((distanceBetween(getDestination(),
  									getNearestObjectByID(stileID).getLocation()) < 4))
  								return false;
  
  						walkTo(new RSTile(getNearestObjectByID(stileID)
  								.getLocation().getX(), getNearestObjectByID(
  								stileID).getLocation().getY() + 1), 0, 0);
  						return false;
  					}
  				}
  			}
  		} catch (Exception e) {
  			// e.printStackTrace();
  		}
  
  		return false;
  	}
  
  	public boolean craftRunes() {
  		try {
  			final RSObject InsideAltar = getNearestObjectByID(CurAltar);
  			if (InsideAltar == null)
  				return false;
  
  			final RSTile tile = getNearestObjectByID(CurAltar).getLocation();
  			if (tile == null)
  				return false;
  
  			final Point location = Calculations.tileToScreen(tile);
  			if (location == null)
  				return false;
  
  			// anti-ban
  			if (!pointOnScreen(location) && antibanstate && !CameraTurned) {
  				GlobalTile = tile;
  				GlobalChance = SelectedAltarCamera;
  				TurnTheCamera = true;
  				wait(300, 500);
  				return false;
  			}
  			CameraTurned = true;
  			if (pointOnScreen(location)) {
  				mouseSpeed = random(4, 6);
  				if (atObject(InsideAltar, "Craft-Rune")) {
  					waitForCrafting(3000);
  					altarwalk = false;
  					return false;
  				}
  			}
  			if (!pointOnScreen(location) && distanceTo(InsideAltar) > 3
  					&& getMyPlayer().getAnimation() == -1)
  				if (!getMyPlayer().isMoving()
  						|| distanceTo(getDestination()) < 7) {
  					if (getDestination() != null)
  						if (distanceBetween(tile, getDestination()) < 3)
  							return false;
  
  					walkTo(tile);
  				}
  
  		} catch (Exception e) {
  			/* e.printStackTrace(); */
  		}
  		return true;
  	}
  
  	public int drawLogoutPaint(final boolean Time, final boolean Essence,
  			final boolean Level, final long startT, final long minutes,
  			final int x, int y, final int xl, final Graphics g) {
  		int amount = 0;
  		boolean[] opts = { Time, Essence, Level };
  		for (int i = 0; i < opts.length; i++) {
  			if (opts[i] == true)
  				amount++;
  		}
  		if (amount == 0)
  			return y;
  
  		y += 11;
  		String m = "minutes";
  		String l = " levels";
  		final long curmillis = System.currentTimeMillis() - startTime;
  		final long curminutes = curmillis / (1000 * 60);
  		if ((MinutesLogout - curminutes) == 1)
  			m = "minute";
  		if ((LevelLogout - skills.getCurrentSkillLevel(STAT_RUNECRAFTING)) == 1)
  			l = " level";
  		g.setColor(new Color(0, 0, 0, 147));
  		g.fillRoundRect(x, y, xl, 7 + (amount * 15), 2, 2);
  		g.setColor(new Color(255, 255, 255));
  		g.drawRoundRect(x, y, xl, 7 + (amount * 15), 2, 2);
  		if (Time)
  			drawStringWithShadow(MinutesLogout - curminutes + " " + m
  					+ " until Logout", x + 10, y += 15, g);
  		if (Essence)
  			drawStringWithShadow(EssenceLogout - essused
  					+ " Essence until Logout", x + 10, y += 15, g);
  		if (Level)
  			drawStringWithShadow(LevelLogout
  					- skills.getCurrentSkillLevel(STAT_RUNECRAFTING) + l
  					+ " until Logout", x + 10, y += 15, g);
  		return y;
  	}
  
  	public void drawStringWithShadow(final String text, final int x,
  			final int y, final Graphics g) {
  		final Color col = g.getColor();
  		g.setColor(new Color(0, 0, 0));
  		g.drawString(text, x + 1, y + 1);
  		g.setColor(col);
  		g.drawString(text, x, y);
  	}// credits to Epic_
  
  	public void drawWalkedPath(final Graphics g) {
  		if (bankwalk || altarwalk) {
  			for (int i = 0; i < (mapPath.length - 1); i++) {
  				if (distanceTo(mapPath[i]) > 2 && mapPath[i + 1] == null)
  					mapPath[i + 1] = getMyPlayer().getLocation();
  
  			}
  			// painting the lines between the tiles
  			for (int paintTile = 0; mapPath[paintTile] != null
  					&& paintTile < mapPath.length - 1; paintTile++) {
  				if (mapPath[paintTile] != null
  						&& mapPath[paintTile + 1] != null)
  					if (tileOnMap(mapPath[paintTile])
  							&& tileOnMap(mapPath[paintTile + 1])) {
  
  						g.setColor(new Color(18, 255, 0,
  								255 - distanceTo(mapPath[paintTile + 1]) * 7));
  						g.drawLine(tileToMinimap(mapPath[paintTile]).x + 1,
  								tileToMinimap(mapPath[paintTile]).y + 1,
  								tileToMinimap(mapPath[paintTile + 1]).x + 1,
  								tileToMinimap(mapPath[paintTile + 1]).y + 1);
  					}
  
  			}
  			// painting the tiles
  			for (int paintTile = 0; mapPath[paintTile] != null
  					&& paintTile < mapPath.length - 1; paintTile++) {
  				if (mapPath[paintTile] != null)
  					if (tileOnMap(mapPath[paintTile])) {
  						g.setColor(new Color(0, 0, 0,
  