- import java.awt.*;
- import java.awt.Color;
- import java.awt.Desktop;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.Point;
- import java.awt.Polygon;
- import java.awt.RenderingHints;
- import java.awt.Rectangle;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import java.awt.event.MouseListener;
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.DataInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URI;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.LinkedHashSet;
- import java.util.Set;
- import javax.imageio.ImageIO;
- //import com.rarebot.Configuration;
- import com.rarebot.event.events.MessageEvent;
- import com.rarebot.event.listeners.MessageListener;
- import com.rarebot.event.listeners.PaintListener;
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.methods.Environment;
- import com.rarebot.script.methods.Equipment;
- import com.rarebot.script.methods.Game;
- import com.rarebot.script.methods.Prayer.Book;
- import com.rarebot.script.methods.Prayer.Curses;
- import com.rarebot.script.methods.Prayer.Normal;
- import com.rarebot.script.methods.Skills;
- import com.rarebot.script.util.Filter;
- import com.rarebot.script.util.Timer;
- import com.rarebot.script.wrappers.RSArea;
- import com.rarebot.script.wrappers.RSCharacter;
- import com.rarebot.script.wrappers.RSComponent;
- import com.rarebot.script.wrappers.RSGroundItem;
- import com.rarebot.script.wrappers.RSInterface;
- import com.rarebot.script.wrappers.RSItem;
- import com.rarebot.script.wrappers.RSModel;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSObject;
- import com.rarebot.script.wrappers.RSObject.Type;
- import com.rarebot.script.wrappers.RSObjectDef;
- import com.rarebot.script.wrappers.RSPlayer;
- import com.rarebot.script.wrappers.RSTile;
- @ScriptManifest(name = "iDungeon Pro",
- authors = "Kiko",
- description = "C6, 30 Bosses, 39 Puzzles, 60 Floors, Flawless Dungeoneering!",
- version = 1.0)
- public class iDungeonPro extends Script implements KeyListener, MouseListener, MouseMotionListener, MessageListener, PaintListener {
- private static final String VERSION = "1.44";
- private final int SMUGGLER = 11226, SKINWEAVER = 10058, HEIM_CRAB = 18159, RED_EYE = 18161, DUSK_EEL = 18163, FLAT_FISH =
- 18165, SHORT_FIN = 18167, WEB_SNIPPER = 18169, BOULDABASS = 18171, SALVE_EEL = 18173, BLUE_CRAB = 18175, CAVE_MORAY = 18177;
- private final int ANTIPOISON = 17566, GATESTONE = 17489, GGS = 18829, TOOLKIT = 19650, COINS = 18201, CHISEL = 17444, PICKAXE
- = 16295, TINDERBOX = 17678, GUARD_KEY = 17363, END_STAIRS = 50552, ENTRANCE = 48496;
- private final int[] BLOCK_ANIMS = { 733, 7660, 13085, 13573, 13711 };
- private final int[] BONES = { 17670, 17672, 17674, 17676, 17671, 18830, 18831, 18833, 18834 }, RINGS = { 15707, 18817, 18818,
- 18819, 18820, 18821, 18822, 18823, 18824, 18825, 18826, 18827, 18828 };
- private final int[] EQUIP_SLOTS = { Equipment.HELMET, Equipment.BODY, Equipment.SHIELD, Equipment.LEGS, Equipment.HANDS,
- Equipment.FEET };
- private final int[] EXIT_LADDERS = { 50604, 51156, 51704, 54675, 56149 }, FINISHED_LADDERS = { 49696, 49698, 49700, 53748,
- 55484 };
- private final int[] FOOD_ARRAY = { HEIM_CRAB, RED_EYE, DUSK_EEL, FLAT_FISH, SHORT_FIN, WEB_SNIPPER, BOULDABASS, SALVE_EEL,
- BLUE_CRAB, CAVE_MORAY };
- private final int[] FIRES = { 49940, 49941, 49942, 49943, 49944, 49945, 49946, 49947, 49948, 49949 };
- private final int[] FRIENDLIES = { SKINWEAVER, 11086, 11087, 11088, 11089, 11090, 11091, 11092, 11093, 11094, 11095, SMUGGLER,
- 11002, 11003, 11004 };
- private final int[] GROUP_PORTAL = { 53124, 53125, 53126, 7528, 56146 };
- private final int[] TOOLS = { PICKAXE, 16361, 17490, TINDERBOX, 17754, 17794, 17796, 17883 };
- private final int[] COSMIC_RUNES = { 16100, 17789 };
- private final int[] LAW_RUNES = { 16103, 17792 };
- private final int[] FIRE_RUNES = { 16094, 17783 };
- private final int[] NATURE_RUNES = { 16102, 17791 };
- private final int[] UNLIT = { 17682, 17684, 17686, 17688, 17690, 17692, 17694, 17696, 17698, 17700 };
- private final int[] CHAIN_WARRIORS = { 10250, 10251, 10252, 10256, 10258, 10259, 10262, 10263, 10265, 10266, 10270, 10271,
- 10272, 10273, 10277, 10284, 10286, 10292, 10293, 10298, 10299, 10300, 10307, 10402, 10403, 10409, 10416, 10417, 10430, 10445, 10450,
- 10451, 10452, 10457, 10458, 10517, 10526, 10546, 10548, 10847, 10848, 10849, 10854, 10855, 10856, 10860, 10861, 10868, 10877, 10881,
- 10883, 10884, 10888, 10889, 10897 };
- private final int[] PLATE_WARRIORS = { 10246, 10247, 10248, 10253, 10254, 10255, 10260, 10261, 10267, 10274, 10289, 10295,
- 10296, 10297, 10302, 10303, 10397, 10398, 10399, 10401, 10404, 10405, 10411, 10412, 10413, 10419, 10426, 10439, 10448, 10455, 10509,
- 10542, 10845, 10851, 10858, 10866, 10873, 10885, 10886, 10899, 10893 };
- private final int[] BASIC_DOORS = { 50342, 50343, 50344, 53948, 55762 }, GUARDIAN_DOORS = { 50346, 50347, 50348, 53949, 55763
- }, STANDARD_DOORS = { 50342, 50343, 50344, 53948, 55762, 50346, 50347, 50348, 53949, 55763 };
- private final int[] BACK_DOORS = { 49462, 50342, 50343, 50344, 53948, 55762, 50350, 50351, 50352, 53950, 55764 }, BOSS_DOORS =
- { 50350, 50351, 50352, 53950, 55764 };
- private final int[] FREE_BLOCK_DOORS = { 50278, 50279, 50280, 50305, 50306, 50307, 50314, 50315, 50316, 50329, 50330, 50331,
- 53953, 53962, 53965, 53970 };
- private final int[] FREE_SKILL_DOORS = { 50272, 50273, 50274, 50287, 50288, 50289, 50299, 50300, 50301, 50308, 50309, 50310,
- 50317, 50318, 50319, 53951, 53960, 53963, 53966 };
- private final int[] MEMBER_BLOCK_DOORS = { 50323, 50324, 50325, 53968, 55741, 55750, 55753, 55756, 55757, 55758 };
- private final int[] MEMBER_SKILL_DOORS = { 50281, 50282, 50283, 50293, 50294, 50295, 50335, 50336, 50337, 53954, 53956, 53958,
- 53972, 55739, 55742, 55744, 55745, 55746, 55748, 55751, 55754, 55760 };
- private final int[] PRAYER_DOORS = { 50332, 50333, 50334, 53971, 55759 };
- private final int[] SUMMON_DOORS = { 50326, 50327, 50328, 53969, 55757 };
- private final int[] PUZZLE_DOORS = { 49306, 49335, 49336, 49337, 49338, 49375, 49376, 49377, 49378, 49379, 49380, 49387,
- 49388, 49389, 49462, 49463, 49464, 49504, 49505, 49506, 49516, 49517, 49518, 49564, 49565, 49566, 49574, 49575, 49576, 49577, 49578,
- 49579, 49603, 49604, 49605, 49606, 49607, 49608, 49625, 49626, 49627, 49644, 49645, 49646, 49650, 49651, 49652, 49677, 49678, 49679,
- 53987, 53988, 53989, 53990, 53992, 54000, 54001, 54006, 54067, 54070, 54071, 54072, 54073, 54106, 54107, 54108, 54109, 54236, 54274,
- 54284, 54299, 54300, 54315, 54316, 54317, 54318, 54319, 54320, 54335, 54360, 54361, 54362, 54363, 54404, 54417, 54418, 54620, 55478,
- 55479, 55480, 55481, 56079, 56081, 56526, 56527, 56528, 56529 };
- private final int[] WARPED_PUZZLE_DOORS = { 32370, 32406, 33607, 33634, 33637, 33654, 33712, 34269, 34865, 35273, 35348,
- 35863, 35907, 37199, 37201, 39522, 39854, 39856, 39863, 39901, 39965, 55482, 56082, 56530 };
- private final int[] ORANGE_KEYS = { 18202, 18204, 18206, 18208, 18210, 18212, 18214, 18216 };
- private final int[] SILVER_KEYS = { 18218, 18220, 18222, 18224, 18226, 18228, 18230, 18232 };
- private final int[] YELLOW_KEYS = { 18234, 18236, 18238, 18240, 18242, 18244, 18246, 18248 };
- private final int[] GREEN_KEYS = { 18250, 18252, 18254, 18256, 18258, 18260, 18262, 18264 };
- private final int[] BLUE_KEYS = { 18266, 18268, 18270, 18272, 18274, 18276, 18278, 18280 };
- private final int[] PURPLE_KEYS = { 18282, 18284, 18286, 18288, 18290, 18292, 18294, 18296 };
- private final int[] CRIMSON_KEYS = { 18298, 18300, 18302, 18304, 18306, 18308, 18310, 18312 };
- private final int[] GOLD_KEYS = { 18314, 18316, 18318, 18320, 18322, 18324, 18326, 18328 };
- private final int[][] KEYS = { ORANGE_KEYS, SILVER_KEYS, YELLOW_KEYS, GREEN_KEYS, BLUE_KEYS, PURPLE_KEYS, CRIMSON_KEYS,
- GOLD_KEYS };
- private final int[] ORANGE_DOORS = { 50208, 50209, 50210, 50211, 50212, 50213, 50214, 50215 };
- private final int[] SILVER_DOORS = { 50216, 50217, 50218, 50219, 50220, 50221, 50222, 50223 };
- private final int[] YELLOW_DOORS = { 50224, 50225, 50226, 50227, 50228, 50229, 50230, 50231 };
- private final int[] GREEN_DOORS = { 50232, 50233, 50234, 50235, 50236, 50237, 50238, 50239 };
- private final int[] BLUE_DOORS = { 50240, 50241, 50242, 50243, 50244, 50245, 50246, 50247 };
- private final int[] PURPLE_DOORS = { 50248, 50249, 50250, 50251, 50252, 50253, 50254, 50255 };
- private final int[] CRIMSON_DOORS = { 50256, 50257, 50258, 50259, 50260, 50261, 50262, 50263 };
- private final int[] GOLD_DOORS = { 50264, 50265, 50266, 50267, 50268, 50269, 50270, 50271 };
- private final int[][] KEY_DOORS = { ORANGE_DOORS, SILVER_DOORS, YELLOW_DOORS, GREEN_DOORS, BLUE_DOORS, PURPLE_DOORS,
- CRIMSON_DOORS, GOLD_DOORS };
- private final Monster[] HOODED_MONSTERS = { Monster.FORGOTTEN_WARRIOR, Monster.FORGOTTEN_WARRIOR0CHAIN,
- Monster.FORGOTTEN_WARRIOR0PLATE, Monster.FORGOTTEN_RANGER, Monster.ZOMBIE0MELEE, Monster.ZOMBIE0RANGE, Monster.SKELETON0MELEE,
- Monster.SKELETON0RANGE, Monster.HILL_GIANT };
- private final String[] PRIORITY_MONSTERS = { "Necromancer", "Reborn mage", "dragon" };
- private final String[] SECONDARY_MONSTERS = { "shade", "mage" };
- private final String[] DISTANCE_MONSTER = { "Forgotten ranger", "Forgotten mage", "Mysterious shade", "Zombie", "Hydra",
- "Icefiend", "Animated book", "Skeleton", "Thrower troll", "Ice elemental", "Lesser demon", "Greater demon", "Necromancer", "Ghost" };
- private final String[] POISON_MONSTER = { "Dungeon spider", "Cave crawler", "Night spider" };
- private final String[] METAL_TIERS = { "Novite", "Bathus", "Marmaros", "Kratonite", "Fractite", "Zephyrium", "Argonite",
- "Katagon", "Gorgonite", "Promethium", "Primal" };
- private final String[] LEATHER_TIERS = { "Protoleather", "Subleather", "Paraleather", "Archleather", "Dromoleather",
- "Spinoleather", "Gallileather", "Stegoleather", "Megaleather", "Tyrannoleather", "Sagittarian" };
- private final String[] CLOTH_TIERS = { "Salve", "Wildercress", "Blightleaf", "Roseblood", "Bryll", "Duskweed", "Soulbell",
- "Ectograss", "Runic", "Spiritbloom", "Celestial" };
- private final String[] WOOD_TIERS = { "Tangle gum", "Seeping elm", "Blood spindle", "Utuku", "Spinebeam", "Bovistrangler",
- "Thigat", "Corpsethorn", "Entgallow", "Grave creeper", "Sagittarian" };
- private final String[] FREE_WORLDS = { "1", "3", "4", "5", "7", "8", "10", "11", "13", "14", "16", "17", "19", "20", "25",
- "29", "30", "33", "34", "35", "37", "38", "41", "43", "47", "49", "50", "55", "57", "61", "62", "73", "74", "75", "80", "81", "87",
- "90", "93", "102", "105", "106", "108", "113", "118", "120", "123", "134", "135", "136", "141", "149", "152", "153", "154", "155",
- "161", "167", "169" };
- private final String[] MELEE_SLOTS = { "full helm", "body", "kiteshield", "plate", "gauntlets", "boots" };
- private final String[] RANGE_SLOTS = { "coif", "body", "", "chaps", "vambraces", "boots" };
- private final String[] MAGIC_SLOTS = { "hood", "robe top", "", "robe bottom", "gloves", "boots" };
- private final String LOGO = "";//"http://img526.imageshack.us/img526/6892/iconacv.png";
- private final String HIDE = "";//"http://img807.imageshack.us/img807/5183/hide.png";
- private final String HIDE_S = "";//"http://img807.imageshack.us/img807/5183/hide.png";
- private final String UPARROW = "";//"http://www2.hawaii.edu/~mbutler/ButlerLab.data/SmartObjects/up_arrow_green_sm.gif";
- private final String UPARROW_S = "";//"http://www2.hawaii.edu/~mbutler/ButlerLab.data/SmartObjects/up_arrow_green_sm.gif";
- private final String DOWNARROW = "";//"http://www2.hawaii.edu/~mbutler/ButlerLab.data/SmartObjects/down_arrow_green_sm.gif";
- private final String DOWNARROW_S = "";//"http://www2.hawaii.edu/~mbutler/ButlerLab.data/SmartObjects/down_arrow_green_sm.gif";
- private final String PLAY = "";//"http://files.softicons.com/download/toolbar-icons/gaming-toolbar-icons-by-natalie-nash/png/32x32/Play%20Symbol.png";
- private final String PLAY_S = "";//"http://img42.imageshack.us/img42/9383/playsi.png";
- private final String PAUSE = "";//"https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/Gnome-media-playback-pause.svg/48px-Gnome-media-playback-pause.svg.png";
- private final String PAUSE_S = "";//"https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/Gnome-media-playback-pause.svg/48px-Gnome-media-playback-pause.svg.png";
- private final String INFO = "";//"http://cdn1.iconfinder.com/data/icons/lullacons/large-info.png";
- private final String INFO_S = "";//"http://cdn1.iconfinder.com/data/icons/lullacons/large-info.png";
- private final String HELP = "";//"http://www.webhelpdesk.com/images/icon_question-mark.png";
- private final String HELP_S = "";//"http://www.webhelpdesk.com/images/icon_question-mark.png";
- private final String STOP = "";//"http://fedoraproject.org/w/uploads/thumb/6/61/Stop_(medium_size).png/35px-Stop_(medium_size).png";
- private final String STOP_S = "";//"http://fedoraproject.org/w/uploads/thumb/6/61/Stop_(medium_size).png/35px-Stop_(medium_size).png";
- private final String MINIS = "";//"http://images4.wikia.nocookie.net/__cb20111118163341/runescape/images/f/f6/Bronze_arrow_5.png";
- private final String MINIS_S = "";//"http://www.go-runescape.com/img/woodcutting_fletching_firemaking/arrow_bronze1.gif";
- private static final int[] SLAYER_MONSTERS = { 10694, 10695, 10696, 10697, 10698, 10699, 10700, 10701, 10702, 10704, 10705 };
- private static final String CACHE = "C:/Documents and Settings/Daniel/My Documents/RareBot";
- private static final String DIRECTORY = CACHE + File.separator + "iDungeonLoader" + File.separator;
- private static final RSTile ORIGIN = new RSTile(0, 0), DAEMONHEIM = new RSTile(3450, 3720);
- private static final String LOGIN_FILE = DIRECTORY + File.separator + "iDPLogin.ini";
- private static final String EMPTY_TIMER = "00:00:00";
- private static Floor floor = Floor.OUTSIDE;
- private static int dungLevel, prayerLevel, slayerLevel = 85;
- private static Point mp = new Point(0, 0), cp = new Point(0, 0);
- private int[] foods = FOOD_ARRAY, goodFoods, topFoods;
- private int[] equipmentTiers = { 0, 0, 0, 0, 0, 0 }, initialEquipmentTiers = { 0, 0, 0, 0, 0, 0 }, tempTiers = { 0, 0, 0, 0,
- 0, 0 };
- private String[] improvements, armorTiers = METAL_TIERS, weaponTiers, slotNames = MELEE_SLOTS;
- private ArrayList<Integer> bounds = new ArrayList<Integer>(), lockIDs = new ArrayList<Integer>();
- private ArrayList<RSArea> rooms = new ArrayList<RSArea>(), clearedRooms = new ArrayList<RSArea>(), finishedRooms = new
- ArrayList<RSArea>(), skipRooms = new ArrayList<RSArea>();
- private ArrayList<RSArea> unBacktrackable = new ArrayList<RSArea>();
- private ArrayList<RSArea> puzzleRooms = new ArrayList<RSArea>(), finishedPuzzles = new ArrayList<RSArea>(), chasmRooms = new
- ArrayList<RSArea>();
- private ArrayList<RSObject> newObjects = new ArrayList<RSObject>();
- private ArrayList<RSTile> allDoors = new ArrayList<RSTile>(), goodDoors = new ArrayList<RSTile>(), openedDoors = new
- ArrayList<RSTile>();
- private ArrayList<RSTile> newDoors = new ArrayList<RSTile>(), backDoors = new ArrayList<RSTile>(), drawDoors = new
- ArrayList<RSTile>();
- private ArrayList<RSTile> guardianDoors = new ArrayList<RSTile>(), lockedDoors = new ArrayList<RSTile>(), blockedDoors = new
- ArrayList<RSTile>(), skillDoors = new ArrayList<RSTile>(), finishedDoors = new ArrayList<RSTile>();
- private ArrayList<RSTile> bossPath = new ArrayList<RSTile>(), deathPath = new ArrayList<RSTile>();
- private ArrayList<RSTile> badTiles = new ArrayList<RSTile>();
- private ArrayList<RSTile> oldObjectTiles = new ArrayList<RSTile>(), newObjectTiles = new ArrayList<RSTile>();
- private ArrayList<RSTile> roomFlags = new ArrayList<RSTile>();
- private ArrayList<RSTile> puzzlePoints = new ArrayList<RSTile>();
- private boolean authCheck, verified, developer, memberWorld = true, newDungeon = true, inDungeon, levelRequirement = true,
- temporarySecondary, welcomeBack;
- private boolean isDead, isCursing, unreachable, outOfAmmo, lockDown, skipRoom, isRushing, shadowHooded, roomHooded,
- itemReceived, skipDoorFound, showSecondary = true;
- private boolean explore, open, bossFight, retrace, finish, exit, settingsFinished, forcePrestige, aborted, twoHanded,
- disrobed, cookReady, spawnRoom;
- private boolean puzzleSolved, puzzleRepeat, roomSwitch, disableBossPath;
- private double tpf = 0, fph = 0;
- private int degrees, pitch;
- private int attackMode = -1, defaultMode = -1, defenseMode = 3, weaponTier = 11, attackTier, defenseTier, newWeapon,
- startArmor, armorSlot = -1, attempts;
- private int roomNumber, primaryWep, secondaryWep, arrows, blastBox, complexity = 6, rushTo = 18, aComplexity = 6, rComplexity
- = 1, fNumber = 0, maxFloor = 47, dungStartLevel;
- private int abortedCount, dungeonCount = 0, prestigeCount, puzzleCount, reportedPrestige, userCount = 0, userOffset = 114,
- userRank = 0, rankOffset = 144;
- private int dungStart, dungGain, strStart, strGain, attStart, attGain, defStart, defGain, rngStart, rngGain, mgcStart,
- mgcGain, hitStart, hitGain, prayStart, prayGain;
- private int runeStart, runeGain, mineStart, mineGain, fireStart, fireGain, woodStart, woodGain, smthStart, smthGain,
- crftStart, crftGain, agilStart, agilGain, thevStart, thevGain, summStart, summGain, herbStart, herbGain, cnstStart, cnstGain,
- cookStart, cookGain, fishStart, fishGain, slayStart, slayGain;
- private int tokens, restarts, restartCount, deaths, bossStage, bossID, cProg, ceph, deph, seph, bossHp = 100, levelGoal;
- private long fastestMillis = 999999, slowestMillis = 0;
- private Combat tempMode = Melee.NONE;
- private Food fish;
- private Logs logs;
- private RSArea newRoom, currentRoom, oldRoom, startRoom, groupRoom, bossRoom, targetRoom, gateRoom;
- private RSGroundItem nearItem;
- private RSNPC nearMonster;
- private RSTile nearDoor, nearDoor2, bossDoor, destDoor, entryDoor, oldDoor, safeTile;
- private Spell combatSpell;
- private String controlStatus = "", fastestTime = EMPTY_TIMER, secondaryStatus = "", slowestTime = EMPTY_TIMER, status =
- "Loading images...", statusSettings = "Hover over an option to find out more";
- private String armorType, bossName = "", failReason = "", lastMessage = "", strongestMonster = "", userSettings, weaponType =
- "Unknown";
- private Style combatStyle = Style.MELEE, primaryStyle = Style.MELEE, protection;
- private Timer bossTimer, doorTimer, dungTimer, failTimer = new Timer(random(360000, 480000)), idleTimer = new Timer(0),
- itemTimer = new Timer(random(800, 1100)), logoutTimer = new Timer(0), prayTimer, puzzleTimer, runTimer = new Timer(0);
- @Override
- public boolean onStart() {
- userSettings = DIRECTORY + "iDPSettings141-" + account.getName() + ".ini";
- //loadSettings();
- dungStartLevel = skills.getRealLevel(Skills.DUNGEONEERING);
- dungLevel = skills.getRealLevel(Skills.DUNGEONEERING);
- levelGoal = dungLevel + 1;
- return retrieveCredentials();
- }
- public boolean retrieveCredentials() {
- /*try {
- FileInputStream fstream = new FileInputStream(LOGIN_FILE);
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- username = br.readLine().replaceAll("_", "");
- password = br.readLine().replaceAll("_", "");
- in.close();
- try {
- String[] tmp = { username, "" };
- BufferedWriter out = new BufferedWriter(new FileWriter(LOGIN_FILE));
- for (String s : tmp) {
- out.write(s);
- out.newLine();
- }
- if (out != null)
- out.close();
- } catch (Exception e) {
- log(RED, "Unable to clear the password data");
- return false;
- }
- authCheck = true;
- } catch (Exception e) {
- log.severe("Error checking credentials!");
- }*/
- authCheck = true;
- verified = false;
- return authCheck;
- }
- @Override
- public void onFinish() {
- authCheck = false;
- hidePaint = false;
- Option.DEBUG.set(true);
- if (dungeonCount > 1 && verified) {
- verified = false;
- log(PRP, "Thanks for using iDungeon Pro v" + VERSION + " by kiko & ShadowMoose");
- env.saveScreenshot(true);
- log("We completed " + dungeonCount + " dungeons for " + tokens + " tokens!");
- env.enableRandoms();
- }
- }
- private void enterDungeon() {
- int selComplexity = valueOf(complexity);
- RSObject entrance;
- aborted = false;
- exit = false;
- lastMessage = "";
- status = "Entering Daemonheim...";
- while ((entrance = objects.getNearest(ENTRANCE)) != null) {
- if (failSafe())
- return;
- updateProgress();
- selComplexity = valueOf(Option.RUSH.enabled() && cProg < rushTo ? rComplexity : complexity);
- if (lastMessage.contains("carrying items")) {
- log.severe("Please bank all items besides your Ring and restart the script!");
- authCheck = false;
- return;
- }
- RSInterface floorWindow = interfaces.get(947);
- RSInterface cWindow = interfaces.get(938);
- if (interfaces.getComponent(210, 2).isValid()) {
- interfaces.getComponent(210, 2).doClick();
- } else if (interfaces.get(236).isValid()) {
- interfaces.getComponent(236, !isRushing && Option.MEDIUM.enabled() && interfaces.getComponent(236,
- 0).containsText("size") && (!Option.RUSH.enabled() || fNumber > rushTo) ? 2 : 1).doClick();
- } else if (floorWindow.getComponent(608).isValid()) {
- if (updateProgress() && fNumber > 1 && maxFloor > 0 && (fNumber + (forcePrestige ? 1 : 0) > maxFloor
- || (username.isEmpty() && dungeonCount > 6))) {
- if (!resetPrestige())
- return;
- }
- boolean skipScrolling = fNumber == maxFloor;
- if (skipScrolling || scrollToFloor()) {
- for (int d = 0; d < 10; d++) {
- if (!floorWindow.getComponent(608).isValid())
- break;
- if (skipScrolling || floorWindow.getComponent(765).getText().contains("" + fNumber)) {
- floorWindow.getComponent(761).interact("Confirm");
- } else floorWindow.getComponent(608 + cProg).interact("Select-floor");
- sleep(700, 1000);
- }
- } else mouse.moveRandomly(200);
- } else if (cWindow.getComponent(42).isValid()) {
- lastMessage = "";
- while (cWindow.getComponent(42).isValid()) {
- if (lastMessage.contains("access complexity")) {
- selComplexity--;
- lastMessage = "";
- }
- if (!cWindow.getComponent(42).getText().contains("" + selComplexity)) {
- cWindow.getComponent(55 + 5 * selComplexity).interact("Select-complexity");
- } else if (cWindow.getComponent(37).interact("Confirm")) {
- sleep(400);
- }
- sleep(600, 800);
- }
- } else if (updateProgress() && fNumber > 1 && maxFloor > 0 && (fNumber + (forcePrestige ? 1 : 0) > maxFloor ||
- (username.isEmpty() && dungeonCount > 6))) {
- if (!resetPrestige())
- return;
- } else if (doObjAction(entrance, "Climb-down")) {
- waitToStop(false);
- }
- sleep(600, 1000);
- }
- newDungeon = true;
- inDungeon = true;
- aComplexity = selComplexity;
- }
- private void exitDungeon() {
- status = "Exiting dungeon...";
- selectTab(Game.TAB_INVENTORY, 3);
- exit = true;
- idleTimer = new Timer(0);
- while (inDungeon()) {
- if (failBasic())
- return;
- if (player().isInCombat()) {
- getCurrentRoom();
- setTargetRoom(currentRoom);
- if (bossRoom == null && npcs.getNearest(guardians) != null)
- intentionallyBacktrack();
- } else if (interfaces.get(236).isValid()) {
- interfaces.getComponent(236, 1).interact("Continue");
- } else if (interfaces.get(211).isValid()) {
- interfaces.getComponent(211, 3).interact("Continue");
- } else if (openPartyTab()) {
- interfaces.getComponent(939, 34).interact("Leave-party");
- }
- sleep(700, 1100);
- }
- floor = Floor.OUTSIDE;
- inDungeon = false;
- newDungeon = false;
- }
- private void exploreRoom() {
- if (roomNumber == 1) {
- pickUpAll();
- open = true;
- roomHooded = false;
- return;
- }
- if (areaContains(bossRoom, myLoc())) {
- retrace = false;
- bossFight = true;
- return;
- }
- boolean unexplored = newRoom != null;
- if (unexplored)
- protection = null;
- roomHooded = shadowHooded && !roomContains(targetRoom, guardianDoors);
- if (floor == Floor.OCCULT) {
- spawnRoom = getNpcInRoom("Necromancer") != null;
- } else if (floor == Floor.WARPED) {
- spawnRoom = getNpcInRoom("Reborn mage") != null;
- } else spawnRoom = false;
- if (rooms.size() > 1)
- status = "Exploring a " + (unexplored ? "new" : "old") + " room";
- newRoom = null;
- boolean toCheck = false;
- int puzzleCheck = 0;
- getCurrentRoom();
- if (aComplexity > 4 && (unexplored || (!finishedPuzzles.contains(targetRoom) && !finishedRooms.contains(targetRoom))))
- {
- for (RSTile door : drawDoors) {
- if (areaContains(targetRoom, door) && !finishedDoors.contains(door)) {
- toCheck = true;
- break;
- }
- }
- }
- if (developer && unexplored) {
- for (RSNPC warrior : getNpcsInRoom("Forgotten warrior")) {
- if (!intMatch(warrior.getID(), CHAIN_WARRIORS) && !intMatch(warrior.getID(), PLATE_WARRIORS))
- log(BLK, "Unknown warrior ID: " + warrior.getID());
- }
- }
- if (toCheck) {
- puzzleSolved = false;
- puzzleRepeat = false;
- roomSwitch = false;
- entryDoor = null;
- if (!unexplored) {
- for (RSTile oD : openedDoors) {
- if (calc.distanceTo(oD) < 4) {
- entryDoor = oD;
- break;
- }
- }
- }
- puzzleCheck = checkPuzzles();
- puzzlePoints.clear();
- if (puzzleCheck != 2 && failSafe())
- puzzleCheck = 2;
- if (puzzleCheck == 2 && secondaryStatus.startsWith("Attempting to"))
- puzzleCheck = -1;
- nearItem = null;
- nearMonster = null;
- String puzzleName = status.contains("Puzzle room: ") ? status.substring(status.indexOf(":") + 2) : "Unknown puzzle";
- if (puzzleCheck == 1 || puzzleSolved) {
- if (puzzleTimer != null && puzzleTimer.getElapsed() > 1000) {
- log(GN5, "Puzzle room: " + puzzleName + " completed successfully in " + puzzleTimer.toElapsedString() + "!");
- puzzleCount++;
- }
- safeTile = null;
- puzzleRooms.remove(targetRoom);
- clearedRooms.add(targetRoom);
- failTimer = new Timer(random(360000, 480000));
- idleTimer = new Timer(0);
- finishedRooms.remove(targetRoom);
- deathPath.clear();
- } else if (puzzleCheck == 2) {
- if (exit)
- return;
- if (puzzleTimer != null && (!puzzleTimer.isRunning() || status.contains("reengage"))) {
- log.severe("Took too long to solve Puzzle: " + puzzleName + " (" + (puzzleTimer != null ?
- puzzleTimer.toElapsedString() : "unknown time") + ")");
- if (developer)
- env.saveScreenshot(false);
- retrace = true;
- tempMode = Melee.NONE;
- finishedDoors.addAll(newDoors);
- finishedRooms.add(targetRoom);
- goodDoors.removeAll(finishedDoors);
- allDoors.removeAll(finishedDoors);
- skipRoom = true;
- puzzleTimer = null;
- deathPath.clear();
- teleHome(false);
- secondaryStatus = "";
- } else open = true;
- safeTile = null;
- failTimer = new Timer(random(360000, 480000));
- idleTimer = new Timer(0);
- return;
- } else if (puzzleCheck == -1) {
- if (failReason.contains("requirements") || failReason.contains("Members") || failReason.contains
- ("Prayer")) {
- log("Unable to complete Puzzle: " + puzzleName + "; Reason: " + failReason + ".");
- } else {
- log(RED, "Unable to complete Puzzle: " + puzzleName + "; Reason: " + failReason + ".");
- if (developer)
- env.saveScreenshot(false);
- }
- safeTile = null;
- retrace = true;
- tempMode = Melee.NONE;
- finishedDoors.addAll(newDoors);
- finishedRooms.add(targetRoom);
- goodDoors.removeAll(finishedDoors);
- allDoors.removeAll(finishedDoors);
- skipRoom = true;
- failTimer = new Timer(random(360000, 480000));
- idleTimer = new Timer(0);
- deathPath.clear();
- }
- if (!puzzleRepeat)
- finishedPuzzles.add(targetRoom);
- puzzleTimer = null;
- }
- if (puzzleCheck != -1) {
- if (unexplored && !slayerCheck()) {
- for (RSTile door : guardianDoors) {
- if (areaContains(targetRoom, door)) {
- log(RED, "Unkillable slayer monster in this room, removing Guardian door");
- finishedDoors.add(door);
- allDoors.remove(door);
- goodDoors.remove(door);
- }
- }
- }
- guardianDoors.removeAll(finishedDoors);
- if (skipRooms.contains(targetRoom)) {
- skipRoom = true;
- } else if (unexplored) {
- if (roomContains(targetRoom, guardianDoors)) {
- if (skipRoom) {
- if (npcs.getNearest(monster) != null) {
- if (developer)
- log("We can't skip through this room!");
- skipRoom = false;
- } else skipRooms.add(targetRoom);
- }
- } else if (isRushing && !skipRoom && newRoom != null) {
- skipRoom = true;
- if (npcs.getNearest(monster) != null)
- log("No guardian doors, skipping through this room!");
- skipRooms.add(targetRoom);
- }
- }
- if (skipRoom) {
- if (!pickUpAll())
- return;
- } else {
- setRetaliate(true);
- if (!fightMonsters())
- return;
- if (!pickUpAll())
- return;
- eatFood(foods, 45, 50);
- buryBones();
- if (Option.RANGE.enabled() && invCount(true, arrows) > (random(10, 40)))
- doItemAction(inventory.getItem(arrows), "Wield");
- if (!pickUpAll())
- return;
- getCurrentRoom();
- }
- }
- if (failSafe())
- return;
- allDoors.removeAll(backDoors);
- goodDoors.removeAll(backDoors);
- goodDoors.removeAll(openedDoors);
- goodDoors.removeAll(finishedDoors);
- if (puzzleCheck < 1) {
- if (puzzleCheck == -1 || (!roomContains(targetRoom, allDoors) && !roomContains(targetRoom, goodDoors) && !
- roomContains(targetRoom, openedDoors))) {
- finishedRooms.add(targetRoom);
- for (RSTile door : drawDoors) {
- if (calc.distanceBetween(door, targetRoom.getNearestTile(door)) < 3)
- finishedDoors.add(door);
- }
- } else if (!clearedRooms.contains(targetRoom)) {
- clearedRooms.add(targetRoom);
- }
- }
- allDoors.removeAll(finishedDoors);
- goodDoors.removeAll(finishedDoors);
- guardianDoors.removeAll(finishedDoors);
- openedDoors.removeAll(finishedDoors);
- secondaryStatus = "";
- if (finishedRooms.contains(targetRoom)) {
- retrace = true;
- } else open = true;
- newRoom = null;
- roomHooded = false;
- }
- private void finishDungeon() {
- status = "Completing the dungeon...";
- RSObject finishedLadder = objects.getNearest(FINISHED_LADDERS);
- if (finishedLadder != null) {
- safeTile = finishedLadder.getLocation();
- log(BLK, "Exit found" + (dungTimer != null ? " in " + dungTimer.toElapsedString() : "") + ", completing the dungeon.");
- bossTimer = null;
- failTimer.reset();
- if (bossRoom == null)
- bossRoom = targetRoom;
- o:while (!interfaces.get(933).isValid()) {
- if (failSafe())
- return;
- if (lastMessage.startsWith("You have already") && idleTimer.getElapsed() > random(45000, 60000)) {
- log(RED, "The exit ladder is glitched, unable to finish this dungeon");
- exit = true;
- return;
- }
- if (itemReceived) {
- if (developer && inventory.containsOneOf(16905, 16909))
- waitForResponse();
- improveBossWeapon();
- improveWeaponBinding();
- itemReceived = false;
- } else if (interfaces.get(236).isValid()) {
- if (interfaces.getComponent(236, 1).doClick()) {
- for (int i = 0; i < 10; i++) {
- if (interfaces.get(933).isValid())
- break o;
- sleep(200, 300);
- }
- }
- } else if ((finishedLadder = objects.getTopAt(safeTile)) != null) {
- if (calc.distanceTo(finishedLadder) < 3 && !adjacentTo(finishedLadder))
- walkTo(finishedLadder.getLocation(), 0);
- if (smartSleep(doObjAction(finishedLadder, "End-dungeon"), true)) {
- for (int c = 0; c < 10; c++) {
- if (interfaces.get(236).isValid())
- continue o;
- sleep(100, 200);
- }
- }
- }
- sleep(200, 300);
- }
- status = "Waiting for the next dungeon...";
- dungeonCount++;
- fNumber++;
- cProg++;
- long dungeonTime = dungTimer.getElapsed();
- if (dungeonTime < fastestMillis) {
- if (slowestMillis == 0 && fastestMillis != 999999) {
- long millis = fastestMillis;
- String time = fastestTime;
- slowestMillis = millis;
- slowestTime = time;
- } else if (password.isEmpty() && dungeonCount > random(5, 20)) {
- exit = true;
- }
- fastestMillis = dungeonTime;
- fastestTime = dungTimer.toElapsedString();
- } else if (dungeonTime > slowestMillis) {
- slowestMillis = dungeonTime;
- slowestTime = dungTimer.toElapsedString();
- }
- tpf = Math.rint(runTimer.getElapsed() * 10 / dungeonCount / 60000) / 10;
- int trueTime = (int) (dungeonTime / 1000);
- int truePrestige = prestigeCount - reportedPrestige;
- reportedPrestige = prestigeCount;
- clearAll();
- updateProgress();
- RSInterface notice = interfaces.get(519);
- if ((notice.isValid() && fNumber + 1 > maxFloor && notice.getText().toLowerCase().contains("not available at")) || fNumber > maxFloor) {
- log(BLU, "Last floor reached, prestiging!");
- if (fNumber > maxFloor)
- forcePrestige = true;
- exit = true;
- }
- boolean clicked = false;
- int tokensGained = 0, expGained = 0;
- RSInterface finishWindow;
- o:while ((finishWindow = interfaces.get(933)).isValid()) {
- if (failBasic())
- break;
- if (!clicked && clickComponent(finishWindow.getComponent(13), "")) {
- sleep(200, 300);
- }
- if (clickComponent(finishWindow.getComponent(322), "")) {
- sleep(300, 500);
- if (!clicked) {
- String tokenString = finishWindow.getComponent(41).getText().replace("%", "").trim();
- String expString = finishWindow.getComponent(39).getText().replace("%", "").trim();
- if (!tokenString.isEmpty())
- tokensGained = Integer.parseInt(tokenString);
- if (!expString.isEmpty())
- expGained = Integer.parseInt(expString);
- tokens += tokensGained;
- if (tokensGained > 0) {
- clicked = true;
- updateSiggy(trueTime, expGained, tokensGained, truePrestige);
- } else log(RED, "Stat uploading failed!");
- }
- for (int i = 0; i < 40; i++) {
- if (!finishWindow.isValid())
- break o;
- sleep(200, 300);
- }
- } else
- sleep(100, 200);
- }
- updateProgress();
- if (failSafe())
- return;
- }
- }
- private boolean openNextDoor() {
- if (roomNumber == 1 && areaContains(startRoom, myLoc()) && (memberWorld || cookReady) && getSaleCount() < 28) {
- if (memberWorld && bossRoom == null && floor != Floor.FROZEN && !invContains(ANTIPOISON)) {
- int coinCount = inventory.getCount(true, COINS);
- int poisonCount = coinCount / 200;
- if (poisonCount > random(1, 3))
- poisonCount = floor == Floor.ABANDONED && rooms.size() == 1 ? random(2, 4) : 2;
- if (poisonCount > 0 && inventory.getCount() < random(20, 24))
- shop(464, poisonCount);
- }
- unPoison();
- if ((cookReady || readyToCook()) && getSaleCount() < 24) {
- cookReady = false;
- failTimer = new Timer(random(360000, 480000));
- if (fish != null && logs != null && inventory.contains(TINDERBOX)) {
- status = "Cook: " + fish.getName(true) + " on " + logs.getName(true);
- log(BLU, status);
- idleTimer.reset();
- lastMessage = "";
- o:for (int c = 0; c < 2; c++) {
- omNomNom();
- if (!inventory.contains(fish.rawID())) {
- RSObject fire = getObjInRoom(FIRES);
- if (getSaleCount() > random(25, 27) || inventory.getCount(true, COINS) < (fire
- != null ? logs.price() : 0) + fish.price(random(1, 3)))
- break;
- }
- while (!inventory.isFull() && !lastMessage.contains("inventory space") && !
- lastMessage.contains("afford") && !lastMessage.contains("enough money")) {
- if (failCheck())
- break o;
- failInterfaces();
- if (!inventory.contains(TINDERBOX)) {
- RSGroundItem tinder = getItemInRoom(targetRoom, TINDERBOX);
- if (tinder != null) {
- smartSleep(pickUpItem(tinder), false);
- continue;
- }
- break o;
- }
- if (!shop(fish, logs))
- sleep(400, 800);
- }
- idleTimer.reset();
- boolean textReady = false;
- i:while (inventory.contains(fish.rawID())) {
- if (failCheck())
- break o;
- failInterfaces();
- boolean toWait = false;
- RSObject fire = getObjInRoom(FIRES);
- if (interfaces.get(740).isValid()) {
- clickComponent(interfaces.getComponent(740, 3), "Continue");
- } else if (fire == null) {
- if (!inventory.contains(TINDERBOX))
- break i;
- int logID = logs.getID();
- if (!inventory.contains(logID))
- logID = getItemID("branches");
- if (logID == -1) {
- getItemInRoom(startRoom, UNLIT);
- if (nearItem != null) {
- toWait = pickUpItem(nearItem);
- } else if (!shop(fish, logs)) {
- break o;
- }
- } else if (lastMessage.contains("can't light")) {
- walkAdjacentTo(myLoc(), 2);
- lastMessage = "";
- }
- RSObject obelisk = getObjInRoom("Summoning obelisk");
- if (calc.distanceTo(startRoom.getCentralTile()) == 1 && (obelisk ==
- null || calc.distanceBetween(myLoc(), obelisk.getLocation()) == 2)) {
- walkAdjacentTo(myLoc(), random(1, 3));
- } else if (logID != -1 && inventory.useItem(TINDERBOX, logID)) {
- for (int i = 0; i < 10; i++) {
- if (getObjInRoom(FIRES) != null)
- continue i;
- if (player().getAnimation() != -1)
- i = 0;
- sleep(200, 300);
- }
- }
- } else if (player().getAnimation() != 897) {
- if (textReady && interfaces.getComponent(752, 5).getText().isEmpty())
- {
- keyboard.sendText("" + random(22, 99), true);
- toWait = true;
- textReady = false;
- } else if (interfaces.getComponent(944, 78).isValid()) {
- String amount = inventory.getCount(fish.rawID()) > 10 ? "X" :
- "10";
- if (clickComponent(interfaces.getComponent(944, 78), "Make " +
- amount)) {
- if (amount.equals("X")) {
- textReady = true;
- } else toWait = true;
- }
- } else toWait = useItem(fish.rawID(), fire);
- }
- smartSleep(toWait, false);
- }
- }
- }
- }
- makeSpace(true);
- }
- if (roomNumber != 1 && !rechargePrayer())
- return false;
- nearDoor = null;
- nearDoor2 = null;
- newRoom = null;
- allDoors.removeAll(finishedDoors);
- allDoors.removeAll(backDoors);
- goodDoors.removeAll(finishedDoors);
- goodDoors.removeAll(backDoors);
- goodDoors.removeAll(openedDoors);
- openedDoors.removeAll(finishedDoors);
- for (int i = clearedRooms.size() - 1; i >= 0; i--) {
- RSArea cRoom = clearedRooms.get(i);
- if (cRoom != null && !finishedRooms.contains(cRoom)) {
- if (!roomContains(cRoom, allDoors) && !roomContains(cRoom, goodDoors) && !roomContains(cRoom,
- openedDoors)) {
- finishedRooms.add(cRoom);
- for (RSTile door : drawDoors) {
- if (door != null && calc.distanceBetween(door, cRoom.getNearestTile(door)) < 4)
- finishedDoors.add(door);
- }
- }
- }
- }
- clearedRooms.removeAll(finishedRooms);
- openedDoors.removeAll(finishedDoors);
- allDoors.removeAll(finishedDoors);
- allDoors.removeAll(backDoors);
- goodDoors.removeAll(finishedDoors);
- goodDoors.removeAll(backDoors);
- goodDoors.removeAll(openedDoors);
- updateLocks();
- getCurrentRoom();
- if (currentRoom != null) {
- lastMessage = "";
- oldRoom = getCurrentRoom();
- if (roomNumber == 1 && aComplexity > 4 && !inventory.contains(GGS) && rooms.size() > 1) {
- status = "Teleporting back to where we died";
- boolean blockedDest = false;
- while (!inventory.contains(GGS) && getItemInRoom(currentRoom, GGS) == null) {
- if (failSafe())
- return false;
- if (lastMessage.contains("destination") || lastMessage.contains("blocking you")) {
- blockedDest = true;
- break;
- }
- if (player().getAnimation() == -1) {
- if (!areaContains(startRoom, myLoc()) && !areaContains(groupRoom, myLoc())) {
- unBacktrack(true);
- } else if (telePortal()) {
- waitToStop(false);
- }
- }
- sleep(300, 400);
- getCurrentRoom();
- }
- if (!blockedDest) {
- setTargetRoom(groupRoom != null ? groupRoom : currentRoom);
- groupRoom = null;
- if (!areaEquals(targetRoom, startRoom)) {
- deathPath.clear();
- if (puzzleRooms.contains(targetRoom) || (bossRoom != null && (bossName.equals
- ("Sagittare") || bossName.equals("Stomp") || bossName.startsWith("Kal'Ger")))) {
- for (int c = 0; c < 5; c++) {
- if (inventory.contains(GGS) || inventory.isFull())
- break;
- smartSleep(pickUpItem(getItemInRoom(targetRoom, GGS)), false);
- }
- }
- explore = true;
- return true;
- }
- }
- }
- if (disableBossPath && goodDoors.isEmpty()) {
- log(BLU, "Remaining openable rooms explored, returning to the boss!");
- disableBossPath = false;
- if (teleTo(GATESTONE))
- return true;
- }
- if (!disableBossPath && bossRoom != null && !bossPath.isEmpty()) {
- for (RSTile door : bossPath) {
- if (areaContains(currentRoom, door)) {
- nearDoor = door;
- doorTimer = new Timer(0);
- idleTimer = new Timer(0);
- crossTheChasm(nearDoor);
- status = "Opening a door back to the Boss";
- if (bossDoor != null && nearDoor.equals(bossDoor)) {
- walkToDoor(1);
- waitToEat(false);
- if (floor != Floor.ABANDONED || getNpcInRoom(SKINWEAVER) == null)
- omNomNom();
- setTargetRoom(bossRoom);
- if (!prepareForBoss())
- return false;
- setTargetRoom(getCurrentRoom());
- }
- return openOldDoor();
- }
- }
- }
- if (groupRoom != null && !deathPath.isEmpty()) {
- if (!areaEquals(currentRoom, groupRoom)) {
- for (RSTile door : deathPath) {
- if (areaContains(currentRoom, door)) {
- nearDoor = door;
- doorTimer = new Timer(0);
- idleTimer = new Timer(0);
- crossTheChasm(nearDoor);
- status = "Opening a door back to where we died";
- return openOldDoor();
- }
- }
- }
- deathPath.clear();
- }
- setTargetRoom(currentRoom);
- int doorType = getBestDoor();
- if (nearDoor != null) {
- doorTimer = new Timer(0);
- idleTimer = new Timer(0);
- crossTheChasm(destDoor);
- lastMessage = "";
- if (!calc.tileOnScreen(nearDoor))
- walkToDoor(1);
- threadPitch(100);
- switch (doorType) {
- case 1:
- return openBasicDoor();
- case 2:
- return openBlockedDoor();
- case 3:
- return openLockedDoor();
- case 4:
- return openSkillDoor();
- case 5:
- return openOldDoor();
- }
- }
- }
- return false;
- }
- private void retraceDungeon() {
- if (areaContains(bossRoom, myLoc())) {
- bossFight = true;
- return;
- }
- boolean teleBack = false;
- restarts++;
- restartCount++;
- allDoors.removeAll(finishedDoors);
- allDoors.removeAll(backDoors);
- goodDoors.removeAll(finishedDoors);
- goodDoors.removeAll(backDoors);
- if (bossRoom != null && getObjInRoom(FINISHED_LADDERS) != null) {
- finish = true;
- return;
- }
- if (npcs.getNearest(guardians) == null && !pickUpAll())
- return;
- if (gateRoom != null) {
- updateLocks();
- for (RSTile t : goodDoors) {
- if (areaContains(gateRoom, t)) {
- log(PRP, "Gatestone teleporting to the next good door");
- setTargetRoom(gateRoom);
- while (!areaEquals(getCurrentRoom(), targetRoom)) {
- teleTo(GATESTONE);
- }
- gateRoom = null;
- open = true;
- return;
- }
- }
- }
- if (restartCount > 2) {
- if (failSafe())
- return;
- if (roomNumber == 1 && !deathPath.isEmpty())
- deathPath.clear();
- updateLocks();
- if (goodDoors.isEmpty()) {
- if (bossRoom == null) {
- if (skipDoorFound) {
- log(RED, "An unopenable door is preventing us from solving this dungeon");
- } else {
- log.severe("No good doors remain.. Aborting dungeon");
- if (floor == Floor.WARPED)
- waitForResponse();
- abortedCount++;
- }
- exit = true;
- } else {
- disableBossPath = false;
- oldDoor = null;
- oldRoom = null;
- open = true;
- }
- return;
- } else if (rooms.size() == 1) {
- walkTo(currentRoom.getCentralTile(), 3);
- }
- if (areaContains(startRoom, myLoc())) {
- oldDoor = null;
- oldRoom = null;
- open = true;
- return;
- }
- if (disableBossPath)
- disableBossPath = false;
- if (restarts > random(aComplexity + 5, aComplexity + 8)) {
- log.severe("Restarted too many times.. Aborting dungeon");
- abortedCount++;
- exitDungeon();
- return;
- }
- if (!monsterBacktrack())
- return;
- restartCount = 0;
- teleBack = true;
- } else if (unBacktrackable.contains(currentRoom)) {
- teleBack = true;
- }
- if (rooms.size() == 1)
- return;
- status = "Backtracking through the dungeon";
- getCurrentRoom();
- if (areaContains(targetRoom, myLoc()) && !finishedRooms.contains(currentRoom) && roomNumber != 1) {
- if (castable(Spell.MAKE_GATESTONE)) {
- for (RSTile t : allDoors) {
- if (areaContains(targetRoom, t) && calc.distanceTo(t) > 4) {
- walkFast(t, 1);
- break;
- }
- }
- makeGatestone();
- }
- }
- goodDoors.removeAll(backDoors);
- goodDoors.removeAll(openedDoors);
- nearDoor = null;
- nearDoor2 = null;
- RSTile backDoor = null;
- boolean cantTele = false;
- if (npcs.getNearest(guardians) != null) {
- if (unBacktrackable.contains(targetRoom)) {
- if (!fightMonsters() || !pickUpAll())
- return;
- } else {
- cantTele = true;
- teleBack = false;
- }
- }
- if (targetRoom != null && !teleBack) {
- boolean autoSkip = cantTele || (skipRoom && npcs.getNearest(monster) != null);
- for (RSTile d : backDoors) {
- if (areaContains(targetRoom, d)) {
- if (autoSkip) {
- backDoor = d;
- } else {
- RSArea room = getNextRoom(d);
- if (room != null && areaEquals(room, startRoom) || roomContains(room, goodDoors))
- backDoor = d;
- }
- break;
- }
- }
- }
- getCurrentRoom();
- if (currentRoom != null && roomNumber != 1) {
- crossTheChasm(backDoor);
- o:while (areaEquals(currentRoom, targetRoom) && roomNumber != 1) {
- if (failSafe())
- break;
- if (backDoor == null) {
- if (npcs.getNearest(monster) != null) {
- log("Finishing off monsters before teleporting home");
- if (!fightMonsters() || !pickUpAll())
- return;
- } else if (npcs.getNearest(guardians) != null) {
- log("Bad monster found, backtracking.");
- backDoor = getBackDoor();
- } else teleHome(false);
- } else {
- RSObject door = objects.getTopAt(backDoor);
- if (door != null) {
- if (doObjAction(door, "Enter")) {
- if (combat.isAutoRetaliateEnabled() || !selectTab(Game.TAB_ATTACK, 3))
- sleep(600, 800);
- while (isMoving() && areaContains(targetRoom, myLoc())) {
- if (player().getInteracting() != null)
- continue o;
- sleep(100, 200);
- }
- sleep(300, 500);
- }
- } else backDoor = null;
- }
- sleep(100, 200);
- getCurrentRoom();
- }
- }
- if (bossRoom == null && roomNumber == 1) {
- updateLocks();
- if (!roomContains(startRoom, goodDoors) && !roomContains(startRoom, openedDoors)) {
- log.severe("No good doors remain at the start room.. Aborting dungeon");
- abortedCount++;
- if (floor == Floor.WARPED)
- waitForResponse();
- exit = true;
- return;
- }
- }
- if (npcs.getNearest(monster) == null)
- setRetaliate(true);
- oldRoom = targetRoom;
- setTargetRoom(currentRoom);
- explore = true;
- skipRoom = false;
- }
- private void startDungeon() {
- int c = 0;
- status = "Beginning a new dungeon!";
- idleTimer = new Timer(0);
- log("");
- RSObject exitLadder;
- if (Option.LOGOUT.enabled() && logoutTimer.getElapsed() > random(14400000, 21000000)) {
- status = "Logging out to reset the timer";
- log(PRP, "Voluntarily logging out to avoid the 6-hour timer");
- while (!game.logout(true)) {
- sleep(100, 300);
- }
- while (game.getClientState() != 10) {
- if (!authCheck)
- return;
- failLoginScreen();
- sleep(1000, 2000);
- }
- welcomeBack = false;
- logoutTimer = new Timer(0);
- }
- newDungeon = false;
- while ((exitLadder = objects.getNearest(EXIT_LADDERS)) == null || !inDungeon()) {
- if (failBasic())
- return;
- c++;
- if (inDungeon()) {
- if (!authCheck || !goodDungeon())
- return;
- if (c == 11)
- log(RED, "Exit ladder is null!");
- }
- if (c > 10) {
- inDungeon = false;
- return;
- }
- sleep(300, 600);
- }
- if (Option.RUSH.enabled()) {
- if (cProg < rushTo) {
- isRushing = true;
- if (aComplexity != rComplexity) {
- log(BLU, "Rushing enabled, exiting to update to your rush Complexity.");
- exit = true;
- }
- } else {
- isRushing = false;
- if (!Option.PRESTIGE.enabled()) {
- log(PRP, "Last rush floor reached with Prestiging disabled! Shutting down script..");
- authCheck = false;
- }
- if (aComplexity != complexity) {
- log(BLU, "Last rush floor reached, exiting to change to your main Complexity.");
- exit = true;
- }
- }
- }
- if (exit || !authCheck || !goodDungeon())
- return;
- log(BLK, "Starting a new dungeon");
- clearAll();
- walking.setRun(true);
- ridItem(primaryWep, "Wield");
- while (!getNewRoomArea()) {
- if (failSafe())
- return;
- if (developer)
- log.severe("Reattempting to define the startroom area.");
- sleep(500, 700);
- }
- getCurrentRoom();
- startRoom = currentRoom;
- RSComponent complexityMenu = interfaces.getComponent(519, 1);
- if (complexityMenu.isValid() && complexityMenu.getText().indexOf(":") > 0) {
- String menuText = complexityMenu.getText();
- String complexityText = "" + menuText.charAt(menuText.indexOf(":") - 1);
- if (Integer.parseInt(complexityText) < 7)
- aComplexity = Integer.parseInt(complexityText);
- } else if (inventory.contains(GGS) || groundItems.getNearest(GGS) != null) {
- aComplexity = 6;
- } else if (getObjInRoom("Summoning obelisk") != null) {
- aComplexity = 6;
- } else if (getObjInRoom("Spinning wheel") != null) {
- aComplexity = 4;
- } else if (getObjInRoom("Runecrafting altar") != null) {
- aComplexity = 3;
- } else if (getNpcInRoom(SMUGGLER) != null) {
- aComplexity = 1;
- }
- if (!Option.RUSH.enabled())
- complexity = aComplexity;
- switch (exitLadder.getID()) {
- case 51156:
- floor = Floor.FROZEN;
- if (Option.STYLE_SWAP.enabled()) {
- if (Melee.CRUSH.enabled()) {
- attackMode = Melee.CRUSH.index();
- } else attackMode = valueOf(defaultMode);
- }
- break;
- case 50604:
- floor = Floor.ABANDONED;
- if (Option.STYLE_SWAP.enabled()) {
- if (Melee.SLASH.enabled()) {
- attackMode = Melee.SLASH.index();
- } else if (Melee.STAB.enabled()) {
- attackMode = Melee.STAB.index();
- } else attackMode = valueOf(defaultMode);
- }
- break;
- case 51704:
- floor = Floor.FURNISHED;
- if (Option.STYLE_SWAP.enabled()) {
- if (Melee.SLASH.enabled()) {
- attackMode = Melee.SLASH.index();
- } else if (Melee.CRUSH.enabled()) {
- attackMode = Melee.CRUSH.index();
- } else attackMode = valueOf(defaultMode);
- }
- break;
- case 54675:
- floor = Floor.OCCULT;
- if (Option.STYLE_SWAP.enabled()) {
- if (Melee.SLASH.enabled()) {
- attackMode = Melee.SLASH.index();
- } else if (Melee.STAB.enabled()) {
- attackMode = Melee.STAB.index();
- } else attackMode = valueOf(defaultMode);
- }
- break;
- case 56149:
- floor = Floor.WARPED;
- if (Option.STYLE_SWAP.enabled()) {
- if (Melee.SLASH.enabled()) {
- attackMode = Melee.SLASH.index();
- } else attackMode = valueOf(defaultMode);
- }
- break;
- default:
- log(RED, "Unable to detect the floor type, returning to a lower floor.");
- exit = true;
- return;
- }
- runSettings();
- if (!authCheck)
- return;
- getNewDoorTiles();
- if (skipDoorFound) {
- log(RED, "A skipped door type is in the start room, trying another dungeon.");
- exit = true;
- return;
- }
- idleTimer = new Timer(0);
- if (failSafe())
- return;
- if (!Option.RUSH.enabled() && complexity != aComplexity)
- log(RED, "Complexity mismatch - selected: " + complexity + ", actual: " + aComplexity);
- if (!Option.STYLE_SWAP.enabled())
- attackMode = valueOf(defaultMode);
- dungTimer = new Timer(0);
- threadPitch(100);
- if (aComplexity < 5)
- dropAllExceptSaves();
- setRetaliate(true);
- selectTab(Game.TAB_INVENTORY, 3);
- exploreRoom();
- if (Option.SECONDARY_RANGE.enabled() && secondaryWep < 1 && arrows > 0 && floor == Floor.OCCULT) {
- int bowId = getItemID("longbow") > 0 ? getItemID("longbow") : getItemID("shortbow");
- if (bowId > 0) {
- log(BLU, "Enabling secondary range with bow ID: " + bowId + " for this Occult floor.");
- secondaryWep = bowId;
- bounds.add((Integer) bowId);
- Style.RANGE.set(true);
- }
- }
- if (aComplexity > 4) {
- if (!inventory.containsAll(TOOLS)) {
- secondaryStatus = "Purchasing a toolkit";
- o:while (!inventory.containsAll(TOOLS)) {
- if (failSafe())
- return;
- if (inventory.contains(TOOLKIT)) {
- makeSpace(true);
- inventory.getItem(TOOLKIT).doClick(true);
- for (int i = 0; i < 10; i++) {
- if (inventory.containsAll(TOOLS))
- break o;
- sleep(100, 130);
- }
- } else if (!shopToolkit()) {
- if (exit)
- return;
- sleep(200, 400);
- }
- }
- }
- secondaryStatus = "";
- ridItem(primaryWep, "Wield");
- }
- }
- final static int[] RUNEBOUND_ACTIVES = { 53977, 53979, 53978 };
- final static int[] GRAVE_PADS = { 54444, 54450, 54458 };
- final static int[] BLINK_PILLARS = { 32184, 32196, 32202, 32195, 32201, 32231 };
- final static int BEHEMOTH_CARCASS = 49283;
- final int[] ACTIVE_STONES = { 49278, 49279, 49276, 49277, 49274, 49275 };
- final int[] BLUE_STONES = { 49278, 49279 }, GREEN_STONES = { 49276, 49277 }, RED_STONES = { 49274, 49275 };
- final int[][] ALL_STONES = { BLUE_STONES, GREEN_STONES, RED_STONES };
- final int[] K_SPEC_ANIMS = { 13426, 13427, 13428, 13429 }, K_START_ANIMS = { 13427, 13429 };
- final int BEHEMOTH_WALL = 51180, BLOCK_ROCKS = 49268, FALLING_ROCKS = 49269;
- final int[] RAISED_PILLARS = { 32184, 32196, 32202 };
- final int[] SUNKEN_PILLARS = { 32195, 32201, 32231 };
- private void frozenBoss() {
- RSObject carcass = getObjInRoom(BEHEMOTH_CARCASS);
- if (carcass != null) {
- RSNPC behemoth = getNpcInRoom("Gluttonous behemoth");
- setBoss("Gluttonous Behemoth", true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- setRetaliate(true);
- safeTile = carcass.getLocation();
- RSTile wall = getNearestObjTo(safeTile, BEHEMOTH_WALL);
- if (wall != null) {
- for (RSTile t : getAdjacentTo(safeTile)) {
- int wDist = (int) calc.distanceBetween(t, wall);
- if (wDist == 3) {
- safeTile = t;
- break;
- }
- }
- }
- walkToMap(safeTile, 0);
- setPrayer(true, Style.RANGE, true);
- updateFightMode();
- while (getObjInRoom(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (behemoth != null && behemoth.getAnimation() == 13720) {
- secondaryStatus = "Waiting for the behemoth to eat";
- while (behemoth != null && behemoth.getAnimation() == 13720) {
- topUp(true);
- sleep(300, 500);
- }
- secondaryStatus = "";
- }
- if (calc.distanceTo(safeTile) > 1) {
- secondaryStatus = "Repositioning to guard the food";
- if (!isMoving())
- walkTo(safeTile, 0);
- waitToStop(false);
- attackBoss(behemoth, true);
- secondaryStatus = "";
- }
- eatFood(topFoods, 50, 60);
- sleep(200, 300);
- }
- } else if (bossName.equals("Astea Frostweb") || getNpcInRoom("Frostweb") != null) {
- RSNPC frostWeb;
- setBoss("Astea Frostweb", false);
- boolean invincible = false;
- setPrayer(true, Style.MAGIC, true);
- swapStyle(Style.RANGE);
- tempMode = Melee.SLASH;
- while (getObjInRoom(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((frostWeb = getNpcInRoom("Frostweb")) != null) {
- int style = combatStyle == Style.MELEE ? 0 : combatStyle == Style.RANGE ? 2 : 1;
- invincible = isProtecting(frostWeb, 9964, style);
- secondaryStatus = invincible ? "Astea is protecting against us!" : "";
- if (lastMessage.contains("A magical force")) {
- lastMessage = "";
- topUp(true);
- } else if (unreachable) {
- if (combatStyle == Style.MELEE && !isEdgeTile(frostWeb.getLocation())) {
- RSNPC spider = getNpcInRoom("spider");
- if (spider != null) {
- if (attackNpc(spider))
- sleep(500, 900);
- } else topUp(true);
- } else topUp(true);
- unreachable = false;
- } else if (invincible) {
- if (!swapStyle(true, Style.RANGE, Style.MELEE)) {
- RSNPC spider = getNpcInRoom("spider");
- if (spider != null) {
- if (attackNpc(spider))
- sleep(500, 800);
- } else if (!topUp(false) && combatStyle == Style.MELEE && calc.distanceTo
- (frostWeb) > 1) {
- attackBoss(frostWeb, false);
- }
- }
- unreachable = false;
- } else attackBoss(frostWeb, false);
- eatFood(topFoods, 50, 55);
- }
- sleep(200, 300);
- }
- } else if (bossName.equals("Icy Bones") || getNpcInRoom("Bones") != null) {
- setBoss("Icy Bones", false);
- setPrayer(true, Style.MELEE, true);
- tempMode = Melee.CRUSH;
- if (!genericBossFight())
- return;
- } else if (bossName.equals("Luminescent Icefiend") || getNpcInRoom("Luminescent") != null) {
- RSNPC iceFiend;
- setBoss("Luminescent Icefiend", true);
- RSTile oldCorner = null;
- setPrayer(false, Style.RANGE, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- while (getObjInRoom(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((iceFiend = getNpcInRoom("Luminescent")) != null) {
- if (iceFiend.getAnimation() == 13338) {
- RSObject corner = getObjInRoom(51300);
- if (corner == null || walking.getEnergy() < random(8, 13)) {
- secondaryStatus = corner != null ? "Out of run.. Eating after the attack" :
- "Eating after the attack";
- while (iceFiend.getAnimation() == 13338) {
- sleep(100, 200);
- }
- } else {
- secondaryStatus = "Dodging the icicles!";
- RSObject next = getNextObj(corner, 51300);
- if (next != null)
- oldCorner = next.getLocation();
- if (!walking.isRunEnabled()) {
- walking.setRun(true);
- } else sleep(400, 600);
- safeTile = corner.getLocation();
- sleep(300, 400);
- walkTo(safeTile, 1);
- int dist = calc.distanceTo(safeTile);
- sleep(dist * 100, dist * 150);
- while (iceFiend != null && iceFiend.getAnimation() == 13338 && areaContains
- (bossRoom, myLoc())) {
- if (failSafe())
- return;
- if (safeTile != null) {
- walkToMap(safeTile, 1);
- waitToStart(true);
- idleTimer = new Timer(0);
- while (calc.distanceBetween(myLoc(), safeTile) > 8.5) {
- if (failCheck())
- break;
- if (!isMoving() || player().getAnimation() != -1) {
- walkToMap(safeTile, 1);
- if (!isMoving())
- sleep(400, 600);
- sleep(500, 800);
- }
- sleep(30, 50);
- }
- }
- if (iceFiend.getAnimation() != 13338)
- break;
- for (RSObject o : getObjsInRoom(51300)) {
- if (o != null) {
- RSTile oTile = o.getLocation();
- if (oldCorner != null && oTile.equals(oldCorner))
- continue;
- if (safeTile == null || (!oTile.equals(safeTile) &&
- (oTile.getX() == safeTile.getX() || oTile.getY() == safeTile.getY()))) {
- oldCorner = safeTile;
- safeTile = oTile;
- break;
- }
- }
- }
- }
- eatFood(topFoods, 15, 15);
- if (iceFiend != null)
- walkTo(iceFiend.getLocation(), 1);
- safeTile = null;
- }
- secondaryStatus = "";
- }
- attackBoss(iceFiend, false);
- eatFood(topFoods, 40, 40);
- }
- sleep(200, 300);
- }
- } else if (bossName.equals("Plane-Freezer Lakhrahnaz") || getNpcInRoom("Lakhrahnaz") != null) {
- RSNPC planeFreezer;
- setBoss("Plane-Freezer Lakhrahnaz", false);
- swapStyle(Style.RANGE);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- setPrayer(false, Style.RANGE, true);
- while (getObjInRoom(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((planeFreezer = getNpcInRoom("Lakhrahnaz")) != null) {
- if (unreachable || (combatStyle == Style.MELEE && calc.distanceTo(planeFreezer) > 2)) {
- if (!isMoving()) {
- walkTo(planeFreezer.getLocation(), 0);
- unreachable = false;
- }
- }
- RSObject corner = getObjInRoom(SNOWY_CORNER);
- if (!isAttacking(planeFreezer) && calc.distanceTo(planeFreezer) < 3 && !isMoving() && corner
- != null && calc.distanceTo(corner) < 3) {
- walkTo(myLoc(), 2);
- waitToStart(false);
- }
- attackBoss(planeFreezer, true);
- eatFood(topFoods, 45, 55);
- }
- sleep(100, 200);
- }
- RSObject finishedLadder = objects.getNearest(FINISHED_LADDERS);
- if (finishedLadder != null) {
- RSObject corner;
- RSTile finishTile = finishedLadder.getLocation();
- walkToMap(finishTile, 1);
- waitToEat(false);
- secondaryStatus = "Navigating to the nearest corner";
- while ((corner = getObjInRoom(SNOWY_STOPS)) != null && !myLoc().equals(safeTile = corner.getLocation
- ()) && calc.distanceTo(finishTile) > 1) {
- if (failSafe())
- return;
- if (!isMoving())
- walkTo(safeTile, 0);
- if (!isMoving())
- walkTo(myLoc(), 5);
- sleep(300, 400);
- }
- walkToMap(safeTile = finishTile, 0);
- }
- } else if (bossName.equals("Blood Chiller") || getNpcInRoom("Bloodchiller") != null) {
- setBoss("Blood Chiller", true);
- setPrayer(true, Style.MAGIC, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.CRUSH;
- if (!genericBossFight())
- return;
- } else if (!unknownBossFight()) {
- return;
- }
- finish = true;
- }
- private void abandonedBoss() {
- if (bossName.equals("Skeletal Hoarde") || getNpcInRoom(SKINWEAVER) != null) {
- RSNPC skinweaver = getNpcInRoom(SKINWEAVER);
- setBoss("Skeletal Hoarde", true);
- boolean tunnelReady = false;
- RSObject tunnel = null;
- setRetaliate(combatStyle !=Style.MELEE);
- setPrayer(false, Style.RANGE, true);
- tempMode = Melee.CRUSH;
- updateFightMode();
- selectTab(Game.TAB_INVENTORY, 3);
- while (getObjInRoom(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (skinweaver != null) {
- String skinMsg = skinweaver.getMessage();
- if (skinMsg != null && !skinMsg.contains("Chat later"))
- tunnelReady = true;
- tunnel = getObjInRoom("Tunnel");
- if (tunnelReady && tunnel != null) {
- secondaryStatus = "Blocking the next tunnel!";
- safeTile = tunnel.getLocation();
- lastMessage = "";
- doObjAction(tunnel, "Block");
- waitToStart(false);
- while (tunnel != null) {
- if (failSafe())
- return;
- if (lastMessage.contains("fully powered"))
- break;
- if (calc.distanceTo(safeTile) > 4)
- walkTo(safeTile, 1);
- if (doObjAction(tunnel, "Block"))
- waitToObject(false);
- eatFood(topFoods, 20, 20);
- sleep(50, 100);
- if (!getName(tunnel = objects.getTopAt(safeTile)).equals("Tunnel"))
- break;
- }
- secondaryStatus = "";
- if (!lastMessage.contains("fully powered")) {
- if (bossStage < 5)
- bossStage++;
- status = "Skeletal Hoarde: " + bossStage + " of 5 blocked";
- }
- lastMessage = "";
- safeTile = null;
- if (combat.getHealth() > 40)
- doNpcAction(npcs.getNearest(monster), "Attack");
- tunnelReady = false;
- }
- if (tunnel == null && npcs.getNearest(guardians) == null) {
- doNpcAction(skinweaver, "Talk-To");
- sleep(700, 1100);
- } else if (combat.getHealth() < 30 + npcs.getAll(guardians).length * 3 + aComplexity +
- (calc.distanceTo(skinweaver) / 3)) {
- safeTile = skinweaver.getLocation();
- while (combat.getHealth() < 95 && getHpPercent(player()) < 95) {
- if (failSafe())
- return;
- skinMsg = skinweaver.getMessage();
- if (skinMsg != null && !skinMsg.contains("Chat later"))
- tunnelReady = true;
- nearMonster = npcs.getNearest(monster);
- eatFood(topFoods, 20, 20);
- if (calc.distanceTo(skinweaver) > 3 || myLoc().equals(safeTile)) {
- walkAdjacentTo(safeTile, 2);
- } else if (nearMonster != null && calc.distanceBetween(safeTile,
- nearMonster.getLocation()) < 5) {
- attackBoss(nearMonster, false);
- }
- sleep(300, 600);
- }
- sleep(1400, 1800);
- safeTile = null;
- }
- } else skinweaver = getNpcInRoom(SKINWEAVER);
- attackBoss(npcs.getNearest(monster), false);
- eatFood(topFoods, 20, 20);
- sleep(200, 400);
- }
- } else if (bossName.equals("Hobgoblin Geomancer") || getNpcInRoom("Geomancer") != null) {
- setBoss("Hobgoblin Geomancer", true);
- setPrayer(true, null, false);
- tempMode = Melee.SLASH;
- if (!genericBossFight())
- return;
- } else if (bossName.equals("Bulwark Beast") || getNpcInRoom("Bulwark beast") != null) {
- boolean pickWielded = false;
- setBoss("Bulwark Beast", true);
- RSNPC bulwark = getNpcInRoom("Bulwark beast");
- if (bulwark != null) {
- if (bossID < 1)
- bossID = bulwark.getID();
- status = "Killing the Bulwark Beast" + (bulwark.getID() == bossID ? " (armored)" : "!");
- }
- setPrayer(combatStyle == Style.MAGIC, Style.MAGIC, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.CRUSH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((bulwark = getNpcInRoom("Bulwark beast")) != null && combatStyle != Style.MAGIC) {
- RSItem pWeapon = inventory.getItem(primaryWep);
- if (bulwark.getID() == bossID) {
- RSItem pickAxe = inventory.getItem(PICKAXE);
- if (!pickWielded && pickAxe == null) {
- if (equipment.containsAll(PICKAXE)) {
- pickWielded = true;
- } else {
- secondaryStatus = "Pulling a pickaxe from the stone";
- setRetaliate(false);
- RSObject pickRock = getObjInRoom(49295);
- while (pickRock != null && !inventory.contains(PICKAXE)) {
- if (isDead())
- break;
- doObjAction(pickRock, "Take-pickaxe");
- sleep(500, 800);
- }
- secondaryStatus = "";
- }
- }
- if (pickAxe != null && pWeapon == null) {
- if (ridItem(PICKAXE, "Wield") || inventory.contains(primaryWep))
- pickWielded = true;
- }
- } else if (pWeapon != null) {
- status = "Killing the Bulwark Beast!";
- ridItem(primaryWep, "Wield");
- }
- }
- if (attackBoss(bulwark, true))
- setRetaliate(true);
- eatFood(topFoods, 50, 60);
- sleep(200, 300);
- }
- } else if (bossName.equals("Unholy Cursebearer") || getNpcInRoom("cursebearer") != null) {
- setBoss("Unholy Cursebearer", true);
- setPrayer(true, Style.MELEE, true);
- tempMode = Melee.CRUSH;
- if (!genericBossFight())
- return;
- } else if (bossName.equals("Shadow-Forger Ihlakhizan") || getNpcInRoom("Ihlakhizan") != null) {
- RSNPC ihlakhizan = getNpcInRoom("Ihlakhizan");
- setBoss("Shadow-Forger", true);
- setPrayer(true, combatStyle == Style.MELEE ? Style.MELEE : Style.MAGIC, true);
- tempMode = Melee.STAB;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (ihlakhizan != null) {
- if (ihlakhizan.getAnimation() == 13030) {
- if (safeTile == null || calc.distanceTo(safeTile) > 3) {
- RSObject pillar = getObjInRoom(51110), corner = getObjInRoom(50749);
- if (pillar != null && corner != null) {
- int pX = pillar.getLocation().getX(), pY = pillar.getLocation().getY
- ();
- int cX = corner.getLocation().getX(), cY = corner.getLocation().getY
- ();
- safeTile = new RSTile(pX + (cX - pX) / 4, pY + (cY - pY) / 4);
- }
- }
- walkTo(safeTile, random(0, 2));
- sleep(100, 600);
- while (ihlakhizan.getAnimation() == 13030 && !isDead()) {
- sleep(200, 400);
- if (calc.distanceTo(safeTile) > 1 && walkTo(safeTile, 1))
- sleep(600, 800);
- }
- } else {
- attackBoss(ihlakhizan, true);
- if (!roomSwitch && ihlakhizan.getAnimation() != 13030)
- eatFood(topFoods, 50, 0);
- }
- }
- sleep(100, 300);
- }
- } else if (bossName.equals("Bal'lak the Pummeller") || getNpcInRoom("Pummeller") != null) {
- RSNPC pummeller = getNpcInRoom("Pummeller");
- setBoss("Bal'lak the Pummeller", false);
- int maxDef = random(80, 120);
- setPrayer(true, Style.MELEE, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (pummeller != null) {
- RSObject slime = getObjInRoom(49298);
- if (slime != null && calc.distanceTo(slime) < 3) {
- if (!isMoving())
- walkToMap(pummeller.getLocation(), 1);
- waitToStart(false);
- } else if (interfaces.getComponent(945, 17).getRelativeX() < maxDef) {
- eatFood(topFoods, 50, 60);
- } else if (!inventory.contains(GGS) && getItemInRoom(bossRoom, GGS) == null) {
- secondaryStatus = "Teleporting out, degenerating defense";
- if (teleTo(GGS)) {
- omNomNom();
- if (readyToCook()) {
- teleHome(true);
- return;
- }
- defenseDegenerate();
- unBacktrack(true);
- }
- secondaryStatus = "";
- }
- attackBoss(pummeller, true);
- }
- sleep(100, 200);
- }
- } else if (!unknownBossFight()) {
- return;
- }
- finish = true;
- }
- private void furnishedBoss() {
- if (bossName.equals("Rammernaut") || getNpcInRoom("Rammernaut") != null) {
- RSNPC rammernaut = getNpcInRoom("Rammernaut");
- setBoss("Rammernaut", false);
- swapStyle(Style.MAGIC);
- tempMode = Melee.STAB;
- prayTimer = new Timer(random(4000, 6000));
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (rammernaut != null) {
- String shout = rammernaut.getMessage();
- if (shout != null && shout.contains("CHAA")) {
- secondaryStatus = "Running for cover!";
- safeTile = safeCorner(rammernaut.getLocation());
- if (safeTile != null) {
- walkToMap(safeTile, 0);
- for (int i = 0; i < 7 && !isDead(); i++) {
- if (rammernaut != null && rammernaut.getMessage() == null)
- break;
- if (!isMoving() && calc.distanceTo(safeTile) < 3 && calc.distanceTo
- (rammernaut) < 3)
- break;
- if (!topUp(true))
- sleep(400, 600);
- }
- for (int i = 0; i < 20 && !isDead(); i++) {
- if (rammernaut != null) {
- String msg = rammernaut.getMessage();
- if (msg != null && msg.contains("Oo"))
- break;
- }
- if (calc.distanceTo(safeTile) < 3 && calc.distanceTo(rammernaut) < 4)
- break;
- sleep(200, 300);
- }
- if (failSafe())
- return;
- if (rammernaut != null && rammernaut.getMessage() == null) {
- walkToScreen(currentRoom.getCentralTile());
- sleep(600, 1000);
- }
- }
- secondaryStatus = "";
- } else if (rammernaut.getAnimation() == 13705) {
- topUp(true);
- } else {
- RSObject corner = getObjInRoom(51762);
- if (rammernaut.getMessage() == null && (isEdgeTile(myLoc()) || (corner != null &&
- calc.distanceTo(corner) < 4))) {
- walkToScreen(currentRoom.getCentralTile());
- sleep(400, 800);
- }
- setPrayer(true, Style.MELEE, true);
- attackBoss(rammernaut, true);
- if (rammernaut.getMessage() != null)
- continue;
- eatFood(topFoods, 50, 20);
- }
- }
- sleep(100, 200);
- }
- } else if (bossName.equals("Stomp") || getNpcInRoom("Stomp") != null) {
- RSNPC stomp = getNpcInRoom("Stomp");
- ArrayList<RSTile> stoneChecks = new ArrayList<RSTile>();
- int dX = 0, dY = 0, stoneCount = random(10, 16);
- if (setBoss("Stomp", false)) {
- bounds.add((Integer) 15750);
- bounds.add((Integer) 15751);
- bounds.add((Integer) 15752);
- }
- tempMode = Melee.STAB;
- if (stomp != null) {
- RSTile backDoor = getBackDoor(), bossTile = stomp.getLocation();
- walkFast(bossTile, 2);
- setPrayer(true, null, false);
- if (backDoor != null) {
- if (backDoor.getX() - bossTile.getX() > 3) {
- dX = 1;
- } else if (backDoor.getX() - bossTile.getX() < -3) {
- dX = -1;
- }
- if (backDoor.getY() - bossTile.getY() > 3) {
- dY = 1;
- } else if (backDoor.getY() - bossTile.getY() < -3) {
- dY = -1;
- }
- }
- for (RSObject o : getObjsInRoom("lodestone")) {
- if (o != null) {
- RSTile oT = o.getLocation();
- stoneChecks.add(new RSTile(oT.getX() + dX, oT.getY() + dY));
- }
- }
- }
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (getObjInRoom(ACTIVE_STONES) != null) {
- boolean pickup = true;
- int reachCount = 0;
- Timer stoneTimer = new Timer(random(14000, 15000));
- badTiles.clear();
- stoneCount = random(10, 15);
- sleep(500, 1000);
- for (int I = 0; I < ALL_STONES.length; I++) {
- if (objects.getNearest(ALL_STONES[I]) != null) {
- bossStage = 1 + I;
- break;
- }
- }
- if (bossStage == 0)
- bossStage = 1;
- final int CRYSTAL_ID = 15749 + bossStage;
- status = "Killing Stomp (stage " + bossStage + " of 3)";
- int newCount = 0, oldCount = 0;
- for (RSTile t : stoneChecks) {
- RSObject blockObj = objects.getTopAt(t);
- if (blockObj != null) {
- if (blockObj.getID() == FALLING_ROCKS) {
- newCount++;
- } else if (blockObj.getID() == BLOCK_ROCKS) {
- oldCount++;
- }
- }
- }
- if (newCount == 1 && oldCount == 0) {
- for (RSTile t : stoneChecks) {
- if (calc.distanceTo(t) < 5) {
- RSObject blockObj = objects.getTopAt(t);
- if (blockObj != null && blockObj.getID() == FALLING_ROCKS) {
- walkTo(t, 0);
- break;
- }
- }
- }
- }
- setPrayersOff();
- lastMessage = "";
- for (RSTile t : stoneChecks) {
- if (myLoc().equals(t) || objects.getTopAt(t) == null)
- reachCount++;
- }
- while (getObjInRoom(ACTIVE_STONES) != null) {
- if (failSafe())
- return;
- int crystalsNeeded = 2;
- unreachable = false;
- if (reachCount == 2) {
- RSObject[] actives = getObjsInRoom(ACTIVE_STONES);
- crystalsNeeded = actives != null ? actives.length : 0;
- }
- if (inventory.getCount(CRYSTAL_ID) < crystalsNeeded) {
- RSGroundItem crystal = getRoomItem(stompCrystal);
- if (crystal != null) {
- if (pickup && pickUpItem(crystal))
- waitToStop(false);
- if (unreachable)
- badTiles.add(crystal.getLocation());
- } else if (!topUp(true) && (stoneTimer == null || !stoneTimer.isRunning()) &&
- !lastMessage.contains("currently invulnerable")) {
- if (doNpcAction(stomp, "Attack"))
- waitToStop(false);
- }
- } else if (reachCount == 2 && stoneTimer != null && stoneTimer.isRunning()) {
- for (RSTile t : stoneChecks) {
- if (!myLoc().equals(t) && objects.getTopAt(t) != null) {
- stoneTimer = null;
- break;
- }
- }
- if (stoneTimer != null) {
- RSObject nextStone = getObjInRoom(ACTIVE_STONES);
- if (nextStone != null) {
- safeTile = nextStone.getLocation();
- if (doObjAction(nextStone, "Charge")) {
- waitToStop(false);
- if (unreachable) {
- reachCount--;
- safeTile = null;
- } else if (stoneTimer != null) {
- stoneTimer.reset();
- }
- }
- }
- }
- } else if (!topUp(true) && (stoneTimer == null || !stoneTimer.isRunning()) && !
- lastMessage.contains("currently invulnerable")) {
- if (doNpcAction(stomp, "Attack"))
- waitToStop(true);
- }
- sleep(200, 300);
- }
- safeTile = null;
- badTiles.clear();
- setPrayer(true, null, false);
- } else if (stomp != null && bossStage == 3 && stomp.getAnimation() == 13449) {
- for (RSTile t : stoneChecks) {
- if (calc.distanceTo(t) > 2) {
- walkTo(t, 1);
- topUp(true);
- sleep(600, 900);
- break;
- }
- }
- } else {
- boolean blocked = false;
- for (RSTile t : stoneChecks) {
- if (objects.getTopAt(t) != null) {
- blocked = true;
- break;
- }
- }
- if (blocked || getObjsInRoom(BLOCK_ROCKS).length > stoneCount) {
- lastMessage = "";
- setRetaliate(combatStyle == Style.MELEE);
- RSObject block = getObjInRoom(BLOCK_ROCKS);
- if (block != null) {
- safeTile = block.getLocation();
- if (!isMoving() && (calc.distanceTo(safeTile) > 1 || isAttacking(stomp))) {
- walkTo(safeTile, 1);
- } else topUp(true);
- }
- } else {
- eatFood(topFoods, 50, 50);
- setRetaliate(true);
- if (!lastMessage.contains("currently invulnerable")) {
- attackBoss(stomp, false);
- safeTile = null;
- } else topUp(true);
- }
- }
- sleep(200, 300);
- }
- } else if (bossName.equals("Har'laak the Riftsplitter") || getNpcInRoom("Riftsplitter") != null) {
- RSNPC riftsplitter = getNpcInRoom("Riftsplitter");
- boolean newShout = false;
- String shout = null;
- ArrayList<RSArea> portals = new ArrayList<RSArea>();
- ArrayList<RSTile> corners = new ArrayList<RSTile>();
- setBoss("Riftsplitter", true);
- setPrayer(true, Style.MAGIC, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (riftsplitter != null) {
- if (riftsplitter.getMessage() != null && shout != null && shout.equals
- (riftsplitter.getMessage())) {
- newShout = false;
- } else {
- shout = riftsplitter.getMessage();
- newShout = true;
- }
- if (shout != null && newShout) {
- secondaryStatus = "Look out for that portal!";
- RSTile mT = myLoc();
- if (corners.isEmpty()) {
- portals.clear();
- portals.add(new RSArea(new RSTile(mT.getX() - 1, mT.getY() - 1), new RSTile
- (mT.getX() + 1, mT.getY() + 1)));
- o:for (RSObject obj : getObjsInRoom(51866)) {
- RSTile oTile = obj.getLocation();
- for (RSArea portal : portals) {
- if (areaContains(portal, oTile))
- continue o;
- }
- corners.add(obj.getLocation());
- }
- } else portals.add(new RSArea(new RSTile(mT.getX() - 1, mT.getY() - 1), new RSTile
- (mT.getX() + 1, mT.getY() + 1)));
- int dist = 20;
- if (safeTile == null) {
- for (RSTile corner : corners) {
- if (calc.distanceTo(corner) > 2 && calc.distanceTo(corner) < dist) {
- safeTile = corner;
- dist = calc.distanceTo(corner);
- }
- }
- }
- if (safeTile != null) {
- walkFast(safeTile, 0);
- corners.remove(safeTile);
- topUp(true);
- for (int c = 0; c < 10; c++) {
- if (isDead() || calc.distanceTo(safeTile) < 4)
- break;
- if (!isMoving()) {
- walkTo(safeTile, 0);
- } else if (!topUp(true)) {
- sleep(300, 500);
- }
- }
- safeTile = null;
- }
- secondaryStatus = "";
- } else {
- attackBoss(riftsplitter, true);
- eatFood(topFoods, 50, 20);
- if (calc.distanceTo(riftsplitter) < 3 && !player().isInCombat() && !
- riftsplitter.isInCombat())
- walkToMap(currentRoom.getCentralTile(), 1);
- }
- }
- sleep(100, 200);
- }
- } else if (bossName.equals("Lexicus Runewright") || getNpcInRoom("Lexicus") != null) {
- RSNPC lexicus = getNpcInRoom("Lexicus");
- setBoss("Lexicus Runewright", false);
- String shout = "";
- setPrayer(false, Style.MAGIC, true);
- swapStyle(Style.RANGE);
- tempMode = Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (lexicus != null) {
- shout = lexicus.getMessage();
- if (shout != null && shout.contains("barrage")) {
- RSObject corner = objects.getNearest(bookCorner);
- if (corner != null) {
- safeTile = corner.getLocation();
- walkToMap(safeTile, 1);
- if (!topUp(true))
- sleep(500, 700);
- sleep(600, 800);
- doNpcAction(lexicus, "Attack");
- safeTile = null;
- }
- secondaryStatus = "";
- } else if (getNpcInRoom("Tome") != null) {
- if (smartSleep(attackNpc(getNpcInRoom("Tome")), false))
- eatFood(topFoods, 40, 20);
- } else if (lexicus.getAnimation() == 13499) {
- for (int i = 0; i < 15 && !isDead(); i++) {
- if (getNpcInRoom("Tome") != null)
- break;
- topUp(false);
- sleep(100, 200);
- }
- } else attackBoss(lexicus, false);
- }
- eatFood(topFoods, 40, 20);
- sleep(100, 200);
- }
- } else if (bossName.equals("Sagittare") || getObjInRoom(51887) != null) {
- RSNPC sagittare;
- setBoss("Sagittare", false);
- if (combatStyle == Style.RANGE) {
- if (swapAlternative()) {
- log("Swapped our attack style for Sagittare");
- } else {
- log.severe("We don't have a way to kill Sagittare, aborting dungeon!");
- exit = true;
- return;
- }
- }
- setPrayer(true, Style.MAGIC, true);
- tempMode = Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((sagittare = getNpcInRoom("Sagittare")) != null) {
- if (lastMessage.contains("stops you") || lastMessage.contains("bound"))
- topUp(true);
- if (sagittare.getAnimation() == 13270 || sagittare.getMessage() != null) {
- if (calc.distanceTo(currentRoom.getCentralTile()) > 2) {
- safeTile = currentRoom.getCentralTile();
- } else {
- RSObject door = objects.getNearest(50352);
- safeTile = door != null ? door.getLocation() : sagittare.getLocation();
- }
- walkToMap(safeTile, 1);
- sleep(2500, 4000);
- safeTile = null;
- } else if (combatStyle != Style.MAGIC && calc.distanceTo(sagittare) > 1) {
- if (isMoving()) {
- topUp(false);
- } else walkToMap(sagittare.getLocation(), 1);
- RSTile dest = walking.getDestination();
- if (dest != null && calc.distanceBetween(dest, sagittare.getLocation()) > 1) {
- walkToMap(sagittare.getLocation(), 0);
- waitToStart(false);
- }
- }
- eatFood(topFoods, 50, 50);
- if (sagittare.getAnimation() != 8939 /*&& sagittare.getGraphic() != 1576*/)
- attackBoss(sagittare, false);
- }
- sleep(100, 200);
- }
- } else if (bossName.equals("Night-gazer Khighorahk") || getNpcInRoom("Khighorahk") != null) {
- RSNPC khighorahk = getNpcInRoom("Khighorahk");
- setBoss("Night-gazer", true);
- if (khighorahk != null && bossID < 1) {
- bossID = khighorahk.getID();
- bossStage = 1;
- }
- setPrayer(false, Style.MAGIC, true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- status = "Killing the Night-gazer (stage " + bossStage + " of 2)";
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((khighorahk = getNpcInRoom("Khighorahk")) != null) {
- if (intMatch(khighorahk.getAnimation(), K_SPEC_ANIMS) && (isMoving() || calc.distanceTo
- (khighorahk.getLocation()) < 6)) {
- safeTile = safePillar(khighorahk.getLocation());
- RSObject pillar = getObjInRoom(49265);
- if (safeTile != null) {
- walkToMap(safeTile, 1);
- waitToStart(false);
- RSTile bossTile = khighorahk.getLocation();
- for (int i = 0; i < 7 && !isDead(); i++) {
- if (pillar != null && calc.distanceTo(pillar) < 4) {
- if (doObjAction(pillar, "Light")) {
- waitToObject(false);
- if (player().getAnimation() != 13355 || player
- ().getAnimation() != 13354)
- doObjAction(pillar, "Light");
- break;
- }
- }
- if (player().getAnimation() == 10070) {
- topUp(true);
- break;
- }
- if (walking.isRunEnabled()) {
- sleep(200, 300);
- } else if (calc.distanceTo(safeTile) < 3 || calc.distanceTo(bossTile)
- > 7) {
- break;
- }
- if (calc.distanceBetween(myLoc(), bossTile) > 4 && !intMatch
- (khighorahk.getAnimation(), K_START_ANIMS))
- break;
- sleep(200, 250);
- if (!intMatch(khighorahk.getAnimation(), K_SPEC_ANIMS))
- break;
- }
- for (int c = 0; c < 5 && !isDead(); c++) {
- if (intMatch(khighorahk.getAnimation(), K_START_ANIMS))
- break;
- if (attackBoss(khighorahk, true)) {
- waitToAnimate();
- break;
- }
- sleep(400, 600);
- }
- safeTile = null;
- }
- } else {
- RSObject[] litPillars = getObjsInRoom(49266, 49267);
- if (litPillars != null && litPillars.length < 2) {
- if (doObjAction(objects.getNearest(49265), "Light"))
- waitToObject(false);
- } else if (!intMatch(khighorahk.getAnimation(), K_START_ANIMS)) {
- eatFood(topFoods, 50, 20);
- if (!intMatch(khighorahk.getAnimation(), K_START_ANIMS))
- attackBoss(khighorahk, true);
- if (khighorahk.getID() != bossID) {
- bossID = khighorahk.getID();
- bossStage = 2;
- status = "Killing the Night-gazer (stage 2 of 2)";
- }
- }
- }
- }
- sleep(100, 200);
- }
- } else if (!unknownBossFight()) {
- return;
- }
- finish = true;
- }
- private void occultBoss() {
- if (bossName.equals("Skeletal Trio") || getNpcInRoom("Skeletal warrior") != null || getNpcInRoom("Skeletal sorcerer")
- != null || getNpcInRoom("Skeletal archer") != null) {
- RSNPC meleer, archer, sorcerer, targ = null;
- status = "Killing the Skeletal Trio!";
- setBoss("Skeletal Trio", true);
- tempMode = Melee.CRUSH.enabled() ? Melee.CRUSH : Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- boolean mInvincible = true, aInvincible = true, sInvincible = true;
- int remaining = 0;
- if ((meleer = getNpcInRoom("Skeletal warrior")) != null) {
- mInvincible = isProtecting(meleer, 11939, combatStyle.index());
- remaining++;
- }
- if ((archer = getNpcInRoom("Skeletal archer")) != null) {
- aInvincible = isProtecting(archer, 12043, combatStyle.index());
- remaining++;
- }
- if ((sorcerer = getNpcInRoom("Skeletal sorcerer")) != null) {
- sInvincible = isProtecting(sorcerer, 11998, combatStyle.index());
- remaining++;
- }
- switch (combatStyle) {
- case MELEE:
- protection = sorcerer != null ? Style.MAGIC : archer != null ? Style.RANGE : Style.MELEE;
- targ = !aInvincible ? archer : !sInvincible ? sorcerer : !mInvincible ? meleer : null;
- break;
- case RANGE:
- protection = meleer != null? Style.MELEE : sorcerer != null ? Style.MAGIC : Style.RANGE;
- targ = !sInvincible ? sorcerer : !mInvincible ? meleer : !aInvincible ? archer : null;
- break;
- case MAGIC:
- protection = archer != null ? Style.RANGE : meleer != null ? Style.MELEE : Style.MAGIC;
- targ = !mInvincible ? meleer : !aInvincible ? archer : !sInvincible ? sorcerer : null;
- break;
- }
- setPrayer(true, protection, true);
- if (targ != null) {
- attackNpc(targ);
- if (!eatFood(topFoods, 50, 50))
- sleep(400, 600);
- } else if (remaining == 3 || !swapAlternative()) {
- topUp(true);
- }
- sleep(200, 300);
- }
- } else if (bossName.equals("Runebound Behemoth") || getObjInRoom(RUNEBOUND_ACTIVES) != null) {
- RSNPC runebound = getNpcInRoom("Runebound behemoth");
- setBoss("Runebound Behemoth", true);
- tempMode = Melee.CRUSH;
- if (bossID < 1 && runebound != null)
- bossID = runebound.getID();
- setPrayer(true, Style.MAGIC, true);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (runebound != null) {
- if (runebound.getAnimation() == 14440 || runebound.getMessage() != null) {
- secondaryStatus = "Dodging the lightning!";
- RSObject corner = getObjInRoom(54786);
- walkToScreen(calc.distanceTo(corner) > 2 && !isEdgeTile(myLoc()) ? reflect
- (runebound.getLocation(), myLoc(), .5) : bossRoom.getCentralTile());
- if (!topUp(true))
- sleep(400, 600);
- secondaryStatus = "";
- } else {
- int differential = bossID - runebound.getID();
- boolean meleeI = true, rangeI = true, magicI = true;
- if (differential == 15) {
- meleeI = false;
- } else if (differential == 30) {
- rangeI = false;
- } else if (differential == 60) {
- magicI = false;
- } else if (differential == -15) {
- meleeI = false;
- magicI = false;
- } else if (differential == -30) {
- rangeI = false;
- meleeI = false;
- } else if (differential == -45) {
- rangeI = false;
- magicI = false;
- }
- boolean[] invin = { meleeI, rangeI, magicI };
- if (!invin[combatStyle.index()]) {
- attackBoss(runebound, true);
- eatFood(topFoods, 30, 15);
- } else {
- eatFood(topFoods, 50, 20);
- RSObject styleActive = getObjInRoom(RUNEBOUND_ACTIVES[combatStyle.index()]);
- if (styleActive != null) {
- if (combat.getHealth() > random(8, 15) && doObjAction(styleActive,
- "Deactivate"))
- waitToStop(false);
- } else {
- for (int I = 0; I < 3; I++) {
- Style test = styleOf(I);
- if (combatStyle != test && test.enabled() && (!invin[I] ||
- getObjInRoom(RUNEBOUND_ACTIVES[I]) != null)) {
- RSObject active = getObjInRoom(RUNEBOUND_ACTIVES[I]);
- if (active != null)
- walkFast(active.getLocation(), 1);
- swapStyle(test);
- break;
- }
- if (I == 2)
- topUp(true);
- }
- }
- }
- }
- }
- sleep(100, 200);
- }
- } else if (bossName.equals("Gravecreeper") || getObjInRoom(54447) != null) {
- RSNPC gravecreeper;
- setBoss("Gravecreeper", true);
- if (combatStyle == Style.RANGE)
- swapStyle(Style.MELEE);
- tempMode = Melee.SLASH.enabled() ? Melee.SLASH : Melee.CRUSH;
- setPrayer(true, combatStyle == Style.MELEE ? Style.MELEE : Style.RANGE, true);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((gravecreeper = getNpcInRoom(bossName)) != null) {
- RSObject aGrave = getObjInRoom(GRAVE_PADS);
- String graveMessage = gravecreeper.getMessage();
- if (graveMessage != null) {
- if (graveMessage.equals("Burrrn")) {
- secondaryStatus = "Dodging the burn spots!";
- RSTile badTile = gravecreeper.getLocation();
- safeTile = safeGrave(badTile);
- if (safeTile != null && badTile != null) {
- for (int c = 0; c < 10; c++) {
- if (calc.distanceTo(badTile) < 2) {
- walkTo(safeTile, 1);
- c++;
- } else if (topUp(false)) {
- c++;
- }
- sleep(400, 500);
- }
- }
- secondaryStatus = "";
- } else if (graveMessage.contains("Buuu")) {
- omNomNom();
- } else if (graveMessage.contains("Diii")) {
- omNomNom();
- } else if (graveMessage.contains("Braa")) {
- omNomNom();
- }
- } else if (aGrave != null && calc.distanceTo(aGrave) < 2) {
- safeTile = safeGrave(gravecreeper.getLocation());
- if (safeTile != null) {
- walkTo(safeTile, 1);
- } else walkToScreen(bossRoom.getCentralTile());
- sleep(600, 1000);
- } else {
- attackBoss(gravecreeper, false);
- eatFood(topFoods, 50, 20);
- }
- } else topUp(true);
- sleep(100, 200);
- }
- } else if (bossName.equals("Necrolord") || getObjInRoom(54475) != null) {
- RSNPC necrolord = getNpcInRoom("Necrolord");
- setBoss("Necrolord", true);
- if (combatStyle == Style.MELEE && !swapAlternative()) {
- log.severe("We can't kill this boss with melee, aborting dungeon");
- abortedCount++;
- exit = true;
- return;
- }
- if (necrolord != null && calc.distanceTo(necrolord) > 3)
- walkToMap(necrolord.getLocation(), 1);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- RSNPC minion = getNpcInRoom("Skeletal minion");
- setPrayer(true, minion != null && calc.distanceTo(minion) < 4 ? Style.MELEE : Style.MAGIC, true);
- if (combatStyle == Style.MELEE) {
- log.severe("We can't kill this boss with melee, aborting dungeon");
- exit = true;
- return;
- }
- if (unreachable) {
- if (!isAttacking(necrolord))
- topUp(true);
- unreachable = false;
- }
- attackBoss(necrolord, false);
- eatFood(topFoods, 50, 60);
- sleep(200, 400);
- }
- } else if (bossName.equals("Flesh-Spoiler Haasghenahk") || getNpcInRoom("Flesh-Spoiler") != null) {
- RSNPC fleshSpoiler = getNpcInRoom("Flesh-Spoiler");
- if (setBoss("Flesh-Spoiler", true)) {
- if (fleshSpoiler != null)
- bossID = fleshSpoiler.getID();
- bossStage = 1;
- }
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- setPrayer(true, null, false);
- status = "Killing the Flesh-Spoiler (Stage " + bossStage + " of 2)";
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((fleshSpoiler = getNpcInRoom(bossName)) != null) {
- if (Option.PRAY.enabled() && getNpcInRoom("spawn") != null)
- setPrayer(true, Style.MELEE, true);
- attackBoss(fleshSpoiler, true);
- eatFood(topFoods, 50, 40);
- if (fleshSpoiler.getID() != bossID) {
- status = "Killing the Flesh-Spoiler (Stage 2 of 2)";
- bossID = fleshSpoiler.getID();
- bossStage = 2;
- }
- }
- sleep(200, 300);
- }
- } else if (bossName.equals("Yk'Lagor the Thunderous") || getNpcInRoom("Yk'Lagor the Thunderous") != null) {
- RSNPC thunderous;
- setBoss("Yk'Lagor the Thunderous", false);
- roomSwitch = false;
- swapStyle(Style.MAGIC);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.SLASH;
- ArrayList<RSTile> spots = new ArrayList<RSTile>();
- for (RSObject p : getObjsInRoom(55057)) {
- for (RSTile t : getAdjacentTo(p.getLocation())) {
- if (isEdgeTile(t)) {
- spots.add(t);
- break;
- }
- }
- }
- if (getNpcInRoom("Mysterious mage") != null) {
- secondaryStatus = "Freeing Yk'Lagor from the mages";
- walkFast(bossRoom.getCentralTile(), 2);
- setRetaliate(false);
- setPrayer(false, Style.MAGIC, true);
- while (getNpcInRoom("Mysterious mage") != null) {
- if (failSafe())
- return;
- if (npcs.getAll(unInteracting).length <= 4) {
- safeTile = getNearestTileTo(myLoc(), spots);
- walkTo(safeTile, 0);
- waitToEat(false);
- } else {
- if (attackNpc(npcs.getNearest(unInteracting)))
- sleep(600, 800);
- eatFood(topFoods, 50, 50);
- }
- }
- secondaryStatus = "";
- if (myLoc().equals(safeTile))
- omNomNom();
- setRetaliate(true);
- selectTab(Game.TAB_INVENTORY, 3);
- }
- setPrayer(true, combatStyle == Style.MELEE ? Style.MELEE : Style.MAGIC, true);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((thunderous = getNpcInRoom(bossName)) != null) {
- String shout = thunderous.getMessage();
- if (shout != null) {
- if (shout.startsWith("This is")) {
- secondaryStatus = "Taking cover from the quake!";
- safeTile = getNearestTileTo(myLoc(), spots);
- Timer quakeTimer = new Timer(random(3000, 3500));
- if (safeTile != null) {
- while (!myLoc().equals(safeTile) && quakeTimer.isRunning()) {
- if (failSafe())
- return;
- if (thunderous != null && thunderous.getAnimation() == -1)
- break;
- if (myLoc().equals(safeTile)) {
- topUp(true);
- } else if (!isMoving()) {
- walkTo(safeTile, 0);
- }
- sleep(100, 200);
- }
- }
- } else if (shout.startsWith("Come")) {
- secondaryStatus = "Dodging his grasp!";
- safeTile = getNearestTileTo(myLoc(), spots);
- Timer graspTimer = new Timer(random(4000, 5000));
- if (safeTile != null) {
- while (!roomSwitch && graspTimer.isRunning()) {
- if (failSafe())
- return;
- if (roomSwitch) {
- if (lastMessage.contains("stunned")) {
- log("Damn it.. Got sucked in.");
- sleep(4000, 6000);
- }
- break;
- }
- if (myLoc().equals(safeTile)) {
- topUp(true);
- } else if (walkTo(safeTile, 0)) {
- waitToEat(false);
- }
- sleep(100, 200);
- }
- roomSwitch = false;
- }
- }
- secondaryStatus = "";
- } else {
- if (!isMoving()) {
- RSTile safety = getNearestTileTo(myLoc(), spots);
- if (calc.distanceTo(safety) > (combatStyle == Style.MELEE ? 4 : 3)) {
- walkToScreen(safety);
- if (thunderous != null && thunderous.getMessage() == null)
- waitToStart(false);
- } else attackBoss(thunderous, true);
- } else attackBoss(thunderous, true);
- eatFood(topFoods, 50, 0);
- }
- }
- sleep(200, 400);
- }
- } else if (!unknownBossFight()) {
- return;
- }
- finish = true;
- }
- private void warpedBoss() {
- if (bossName.equals("Blink") || getObjInRoom(BLINK_PILLARS) != null) {
- RSNPC blink;
- setBoss("Blink", false);
- boolean respawn = true;
- RSTile center = bossRoom.getCentralTile();
- tempMode = Melee.STAB;
- if (combatStyle == Style.MAGIC)
- swapAlternative();
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((blink = getNpcInRoom(bossName)) == null) {
- RSObject pillar = getObjInRoom(RAISED_PILLARS);
- secondaryStatus = "";
- respawn = true;
- if (pillar == null) {
- if (doObjAction(getCloseObjTo(center, SUNKEN_PILLARS), "Raise"))
- waitToStop(false);
- } else {
- puzzlePoints.clear();
- topUp(false);
- }
- } else if (respawn || blink.isMoving() || !stringMatch("Attack", blink.getActions())) {
- if (respawn) {
- RSObject pillar = getObjInRoom(RAISED_PILLARS);
- boolean aligned = false;
- safeTile = blink.getLocation();
- if (pillar != null) {
- RSTile pTile = pillar.getLocation();
- aligned = safeTile.getX() == pTile.getX() || safeTile.getY() == pTile.getY();
- }
- puzzlePoints.clear();
- if (aligned) {
- secondaryStatus = "Got him! Time to dish the pain";
- for (int c = 0; c < 10; c++) {
- if (blink == null || !blink.isMoving() || isDead())
- break;
- sleep(200, 400);
- }
- } else blinkPath(blink);
- respawn = false;
- }
- if (!puzzlePoints.isEmpty()) {
- RSTile near = getNearestTileTo(myLoc(), puzzlePoints);
- if (near != null && calc.distanceTo(near) < 5 && walkToMap(reflect(near, myLoc(), 1),
- 1)) {
- puzzlePoints.clear();
- topUp(false);
- }
- } else topUp(true);
- } else {
- attackBoss(blink, false);
- eatFood(topFoods, 40, 0);
- }
- sleep(100, 300);
- }
- puzzlePoints.clear();
- } else if (bossName.equals("Warped gulega") || getNpcInRoom("Warped gulega") != null) {
- RSNPC gulega = getNpcInRoom("Warped gulega");
- setBoss("Warped Gulega", true);
- setPrayer(true, Style.MAGIC, true);
- tempMode = Melee.SLASH;
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (gulega != null) {
- int gAnim = gulega.getAnimation();
- if (gAnim != -1) {
- if (gAnim == 15004) {
- RSTile start = myLoc();
- Timer graphicTimer = new Timer(random(2000, 2500));
- secondaryStatus = "Analyzing Boss attack data...";
- while (gulega.getAnimation() == 15004 && calc.distanceTo(start) < 1) {
- if (/*gulega.getGraphic() == 2877 &&*/ !graphicTimer.isRunning()) {
- secondaryStatus = "Special attack detected - Ruuun!";
- if (walkToMap(start, 2))
- waitToStart(false);
- walkAdjacentTo(start, 2);
- while (gulega != null && !failBasic() && gulega.getAnimation()
- == 15004) {
- attackBoss(gulega, true);
- sleep(300, 600);
- }
- secondaryStatus = "";
- break;
- }
- sleep(50, 100);
- }
- secondaryStatus = "";
- } else if (developer) {
- if (gAnim == 15001) {
- } else if (gAnim == 15007) {
- }
- }
- } else {
- eatFood(topFoods, 50, 0);
- if (gulega != null && gulega.getAnimation() == -1)
- attackBoss(gulega, true);
- }
- }
- sleep(100, 200);
- }
- } else if (bossName.equals("Dreadnaut") || getNpcInRoom("Dreadnaut") != null) {
- RSNPC dreadnaut = getNpcInRoom("Dreadnaut");
- setBoss("Dreadnaut", false);
- swapStyle(Style.MAGIC);
- setPrayer(true, Style.MELEE, true);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- eatFood(topFoods, 50, 60);
- attackBoss(dreadnaut, true);
- setPrayer(true, Style.MELEE, true);
- sleep(200, 400);
- }
- } else if (bossName.equals("Hope Devourer") || getNpcInRoom("Hope devourer") != null) {
- RSNPC devourer = getNpcInRoom("Hope devourer");
- setBoss("Hope Devourer", true);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.CRUSH;
- prayTimer = new Timer(random(4000, 6000));
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (devourer != null) {
- if (devourer.getMessage() != null) {
- if (setPrayersOff()) {
- attackBoss(devourer, true);
- sleep(600, 1200);
- }
- } else if (prayTimer != null && devourer.getAnimation() == 14460) {
- prayTimer = null;
- if (!eatFood(topFoods, 50, 40))
- sleep(500, 800);
- } else {
- setPrayer(true, Style.MELEE, true);
- eatFood(topFoods, 50, 0);
- attackBoss(devourer, true);
- }
- }
- sleep(200, 400);
- }
- } else if (bossName.equals("World-gorger Shukarhazh") || getNpcInRoom("World-gorger shukarhazh") != null) {
- RSNPC worldGorger = getNpcInRoom("World-gorger shukarhazh");
- setBoss("World-gorger", true);
- String[] eyeNames = { "warrior-eye", "ranger-eye", "mage-eye" };
- eyeNames[primaryStyle.index()] = null;
- tempMode = Melee.STAB;
- setPrayer(true, Style.MAGIC, true);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if (worldGorger != null) {
- boolean noneDown = getNpcsInRoom(eyeNames).length == 2;
- int hp = combat.getHealth();
- RSNPC eye = null;
- if (noneDown || hp > 40) {
- for (int I = 0; I < eyeNames.length; I++) {
- if (eyeNames[I] == null)
- continue;
- if ((eye = getGoodNpc(eyeNames[I])) == null)
- continue;
- Style style = styleOf(I);
- if ((style.enabled() && swapStyle(style)) || noneDown || hp > 65)
- break;
- eye = null;
- }
- }
- if (eye == null)
- swapStyle(primaryStyle);
- attackBoss(eye != null ? eye : worldGorger, eye == null);
- eatFood(topFoods, 55, 70);
- }
- sleep(200, 400);
- }
- } else if (bossName.equals("Kal'Ger the Warmonger") || getObjInRoom(56038) != null) {
- RSNPC kalger = getNpcInRoom("Kal'Ger the Warmonger");
- setBoss("Kal'Ger the Warmonger",false);
- Style kStyle = kalgerStyle();
- kalgerState(kStyle);
- tempMode = Melee.STAB.enabled() ? Melee.STAB : Melee.CRUSH;
- if (bossStage == 0) {
- status = "Waiting for the cutscene to finish...";
- setRetaliate(false);
- while ((kalger = getNpcInRoom(bossName)) != null && !reachable(kalger.getLocation(), true)) {
- if (failSafe())
- return;
- unBacktrack(true);
- sleep(300, 600);
- }
- bossStage = 1;
- }
- status = "Killing the Warmonger! (Stage " + bossStage + " of 6)";
- if (kalger != null && bossID < 1)
- bossID = kalger.getID();
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return;
- if ((kalger = getNpcInRoom(bossName)) != null) {
- String shout = kalger.getMessage();
- if (shout != null && shout.startsWith("GRRR") && combat.getHealth() > random(15, 20)) {
- secondaryStatus = "Disabling prayers too cool him off";
- setPrayersOff();
- prayTimer = new Timer(random(15000, 25000));
- } else if (kalger.getAnimation() == 14968 || calc.distanceBetween(myLoc(), kalger.getLocation
- ()) < 3) {
- walkTo(reflect(kalger.getLocation(), myLoc(), 1), 1);
- }
- int currStage = bossStage;
- bossStage = (kalger.getID() - bossID + 15) / 15;
- if (bossStage != currStage) {
- status = "Killing the Warmonger! (Stage " + bossStage + " of 6)";
- kalgerState(kStyle = kalgerStyle());
- } else if (kalger.getAnimation() == 1) {
- protection = null;
- setPrayersOff();
- }
- if (protection != null) {
- if (prayTimer != null && combat.getHealth() < random(15, 25))
- prayTimer = null;
- if (prayTimer == null || !prayTimer.isRunning()) {
- secondaryStatus = "";
- setPrayer(true, protection, true);
- } else setPrayer(true, protection, false);
- }
- if ((combatStyle == Style.MELEE || kStyle == Style.MELEE) && !reachable(kalger.getLocation(),
- true)) {
- if (player().getAnimation() != 13493) {
- RSNPC orb = getNpcInRoom(12842);
- if (orb != null && !myLoc().equals(orb.getLocation())) {
- walkTo(orb.getLocation(), 0);
- } else topUp(true);
- }
- } else {
- setPrayer(true, protection, true);
- eatFood(topFoods, 50, 0);
- attackBoss(kalger, true);
- }
- }
- sleep(200, 400);
- }
- } else if (!unknownBossFight()) {
- return;
- }
- finish = true;
- }
- @Override
- public int loop() {
- if (!authCheck)
- return -1;
- if (!verified) {
- threadPitch(100);
- } else if (game.isLoggedIn()) {
- mouse.setSpeed(random(5, 8));
- if (inDungeon) {
- getCurrentRoom();
- if (exit) {
- exitDungeon();
- exit = false;
- } else if (finish) {
- finishDungeon();
- finish = false;
- } else if (newDungeon) {
- startDungeon();
- newDungeon = false;
- } else if (settingsFinished) {
- if (bossFight) {
- safeTile = null;
- if (getObjInRoom(FINISHED_LADDERS) != null) {
- finish = true;
- } else if (floor == Floor.FROZEN) {
- frozenBoss();
- } else if (floor == Floor.ABANDONED) {
- abandonedBoss();
- } else if (floor == Floor.FURNISHED) {
- furnishedBoss();
- } else if (floor == Floor.OCCULT) {
- occultBoss();
- } else if (floor == Floor.WARPED) {
- warpedBoss();
- }
- bossFight = false;
- retrace = false;
- } else if (explore) {
- exploreRoom();
- explore = false;
- } else if (open) {
- if (openNextDoor()) {
- explore = true;
- } else retrace = true;
- nearDoor = null;
- nearDoor2 = null;
- doorTimer = null;
- open = false;
- } else if (retrace) {
- retraceDungeon();
- retrace = false;
- } else {
- if (failSafe())
- return 100;
- if (developer)
- secondaryStatus = "We don't know what to do :(";
- return random(500, 1000);
- }
- }
- } else {
- if (newDungeon && inDungeon()) {
- status = "Starting a new dungeon!";
- inDungeon = true;
- } else if (objects.getNearest(END_STAIRS) != null) {
- status = "Jumping down the stairs...";
- if (doObjAction(objects.getNearest(END_STAIRS), "Jump-down")) {
- if (waitToStop(true))
- waitToStop(true);
- }
- } else if (objects.getNearest(ENTRANCE) != null) {
- enterDungeon();
- } else {
- // Failsafe
- }
- }
- }
- secondaryStatus = "";
- unreachable = false;
- return random(0, 20);
- }
- private boolean checkRoom() {
- skipRoom = false;
- getNewDoorTiles();
- doorTimer = null;
- if (newRoom == null)
- newRoom = targetRoom;
- if (newDoors.size() == 0) {
- RSObject finishedLadder = getObjInRoom(FINISHED_LADDERS);
- RSObject bDoor = getObjInRoom(BOSS_DOORS);
- if (finishedLadder != null) {
- log("Dungeon exit ahead!");
- finishDungeon();
- return false;
- }
- if (bDoor != null) {
- if (bossRoom == null) {
- bossRoom = newRoom;
- bossDoor = nearDoor;
- backDoors.add(bDoor.getLocation());
- openedDoors.add(bossDoor);
- bossPath = generatePath(bossRoom);
- restartCount = 0;
- }
- if (!areaContains(bossRoom, myLoc())) {
- boolean exploreCheck = Option.EXPLORER.enabled() && !goodDoors.isEmpty() && !bossPath.isEmpty
- ();
- secondaryStatus = "Preparing for the boss battle";
- if ((floor != Floor.ABANDONED || getNpcInRoom(SKINWEAVER) == null) && !inTrueCombat())
- omNomNom();
- if (!skipRoom && !isRushing && (exploreCheck || Option.MAKE_FOOD.enabled()) && !areaContains
- (bossRoom, myLoc())) {
- if (exploreCheck) {
- log(BLU, "Boss room found.. Looks like we've got some more exploring to do first!");
- makeGatestone();
- setTargetRoom(currentRoom);
- disableBossPath = true;
- return true;
- }
- if (inventory.contains(GGS) && readyToCook()) {
- log(BLU, "Boss room found.. Returning home to prepare food before taking them on!");
- setTargetRoom(currentRoom);
- teleHome(true);
- return true;
- }
- }
- }
- if (!prepareForBoss())
- return true;
- finishedRooms.remove(newRoom);
- open = false;
- explore = false;
- bossFight = true;
- return retrace = false;
- }
- RSTile kTile = getKey();
- if (kTile != null) {
- secondaryStatus = "Grabbing a key from the dead end";
- if (areaContains(targetRoom, myLoc()))
- walkToMap(kTile, 1);
- selectTab(Game.TAB_INVENTORY, 3);
- walking.setRun(true);
- skipRoom = true;
- } else {
- secondaryStatus = "Skipping the dead end";
- finishedDoors.add(nearDoor);
- openedDoors.removeAll(finishedDoors);
- goodDoors.removeAll(finishedDoors);
- allDoors.removeAll(finishedDoors);
- skipRoom = true;
- skipRooms.add(targetRoom);
- setTargetRoom(currentRoom);
- newRoom = null;
- return true;
- }
- }
- return false;
- }
- private void clearAll() {
- newObjects = new ArrayList<RSObject>();
- blockedDoors.clear();
- allDoors.clear();
- goodDoors.clear();
- newDoors.clear();
- openedDoors.clear();
- lockedDoors.clear();
- backDoors.clear();
- finishedDoors.clear();
- drawDoors.clear();
- deathPath.clear();
- bossPath.clear();
- oldObjectTiles.clear();
- newObjectTiles.clear();
- rooms.clear();
- finishedRooms.clear();
- puzzleRooms.clear();
- clearedRooms.clear();
- chasmRooms.clear();
- skipRooms.clear();
- finishedPuzzles.clear();
- unBacktrackable.clear();
- badTiles.clear();
- lockIDs.clear();
- startRoom = null;
- currentRoom = null;
- targetRoom = null;
- groupRoom = null;
- oldRoom = null;
- bossRoom = null;
- nearMonster = null;
- nearDoor = null;
- nearDoor2 = null;
- safeTile = null;
- nearItem = null;
- bossDoor = null;
- oldDoor = null;
- puzzleTimer = null;
- bossHp = 100;
- roomNumber = 0;
- bossID = 0;
- restarts = 0;
- restartCount = 0;
- bossStage = 0;
- tempMode = Melee.NONE;
- if (temporarySecondary)
- secondaryWep = -1;
- bossName = "";
- secondaryStatus = "";
- aborted = false;
- retrace = false;
- explore = false;
- open = false;
- bossFight = false;
- finish = false;
- exit = false;
- skipRoom = false;
- skipDoorFound = false;
- isDead = false;
- outOfAmmo = false;
- disrobed = false;
- newDungeon = true;
- cookReady = false;
- roomSwitch = false;
- spawnRoom = false;
- disableBossPath = false;
- failTimer = new Timer(random(360000, 480000));
- idleTimer = new Timer(0);
- prayTimer = null;
- combatStyle = styleOf(primaryStyle.index());
- }
- private boolean fightMonsters() {
- boolean activated = false, primariesCleared = false, secondariesCleared = false;
- if (finishedRooms.contains(targetRoom))
- return true;
- nearMonster = npcs.getNearest(monster);
- unreachable = false;
- if (nearMonster != null) {
- crossTheChasm(nearMonster.getLocation());
- secondaryStatus = "Clearing the room of monsters";
- while (npcs.getNearest(monster) != null) {
- if (failSafe())
- return false;
- if (!isGoodMonster(nearMonster)) {
- if (!secondariesCleared) {
- RSNPC primary = !primariesCleared ? npcs.getNearest(primaryMonster) : null;
- if (primary == null) {
- RSNPC secondary = npcs.getNearest(secondaryMonster);
- primariesCleared = true;
- if (secondary == null) {
- secondariesCleared = true;
- nearMonster = npcs.getNearest(monster);
- } else nearMonster = secondary;
- } else nearMonster = primary;
- } else nearMonster = npcs.getNearest(monster);
- }
- if (unreachable) {
- topUp(true);
- unreachable = false;
- } else if (attackNpc(nearMonster)) {
- getBestStyle(nearMonster);
- if (!updateFightMode())
- sleep(900, 1400);
- }
- if (Option.PRAY.enabled()) {
- monsterPrayer();
- if (protection != null) {
- if (setPrayer(false, protection, getGoodNpc(strongestMonster) != null))
- activated = true;
- } else if (activated) {
- activated = setPrayersOff();
- }
- }
- if (status.startsWith("Puzzle room: Follow")) {
- RSObject obj = objects.getTopAt(myLoc());
- if (obj != null && intMatch(obj.getID(), ACTIVE_PADS))
- walkAdjacentTo(myLoc(), 2);
- }
- eatFood(goodFoods, 45, 55);
- sleep(200, 400);
- }
- if (activated)
- setPrayersOff();
- nearMonster = null;
- double mDist = random(3, 7);
- while (npcs.getNearest(dying) != null) {
- if (failSafe())
- return false;
- if (inventory.getCount() < 27 || !topUp(false)) {
- getGoodItem();
- if (nearItem != null && calc.distanceTo(nearItem.getLocation()) < mDist) {
- if (pickUpItem(nearItem))
- waitToStop(false);
- } else if (!topUp(false) || getGoodItem() == null) {
- sleep(300, 600);
- }
- } else sleep(300, 600);
- }
- secondaryStatus = "";
- }
- return true;
- }
- private boolean unknownBossFight() {
- setBoss("an unknown boss...", false);
- setPrayer(true, null, false);
- return genericBossFight();
- }
- private boolean genericBossFight() {
- RSNPC boss = npcs.getNearest(bossMonster);
- while (objects.getNearest(FINISHED_LADDERS) == null) {
- if (failSafe())
- return false;
- if (unreachable) {
- if (!topUp(true))
- sleep(500, 1000);
- unreachable = false;
- }
- attackBoss(boss, true);
- eatFood(goodFoods, 50, 60);
- sleep(400, 800);
- }
- return finish = true;
- }
- private int getBestDoor() {
- int[] puzzleDoors = floor != Floor.WARPED ? PUZZLE_DOORS : WARPED_PUZZLE_DOORS;
- double dist = 99.99;
- int doorID = -1;
- RSTile nextDoor = null, start = myLoc();
- destDoor = null;
- nearDoor = null;
- nearDoor2 = null;
- ArrayList<RSTile> goodRoomDoors = new ArrayList<RSTile>();
- for (RSTile gDoor : goodDoors) {
- if (areaContains(targetRoom, gDoor))
- goodRoomDoors.add(gDoor);
- }
- if (!goodRoomDoors.isEmpty()) {
- for (RSTile door : goodRoomDoors) {
- double dDist = calc.distanceBetween(start, door);
- if (dDist < dist) {
- RSObject doorObj = objects.getTopAt(door);
- if (doorObj != null) {
- dist = dDist;
- doorID = doorObj.getID();
- nextDoor = door;
- }
- }
- }
- if (nextDoor != null && doorID > 0) {
- for (RSTile bDoor : blockedDoors) {
- if (calc.distanceBetween(nextDoor, bDoor) < 3) {
- nearDoor = nextDoor;
- nearDoor2 = bDoor;
- destDoor = nearDoor2;
- return 2;
- }
- }
- for (RSTile lDoor : lockedDoors) {
- if (calc.distanceBetween(nextDoor, lDoor) < 3) {
- nearDoor = nextDoor;
- nearDoor2 = lDoor;
- destDoor = nearDoor2;
- return 3;
- }
- }
- if (intMatch(doorID, STANDARD_DOORS)) {
- nearDoor = nextDoor;
- destDoor = nearDoor;
- return 1;
- }
- if (skillDoors.contains(nextDoor)) {
- nearDoor = nextDoor;
- destDoor = nearDoor;
- return 4;
- }
- if (intMatch(doorID, puzzleDoors)) {
- nearDoor = nextDoor;
- destDoor = nearDoor;
- return 1;
- }
- }
- }
- boolean verifyBoss = disableBossPath && bossDoor != null;
- for (RSTile door : openedDoors) {
- if ((!verifyBoss || !bossDoor.equals(door)) && (oldDoor == null || !door.equals(oldDoor)) && areaContains
- (targetRoom, door)) {
- RSArea room = getNextRoom(door);
- if (room != null && (roomContains(room, goodDoors) || roomContains(room, openedDoors))) {
- nearDoor = door;
- destDoor = nearDoor;
- return 5;
- }
- }
- }
- return 0;
- }
- private void getNewDoorTiles() {
- int[] puzzleDoors = floor != Floor.WARPED ? PUZZLE_DOORS : WARPED_PUZZLE_DOORS;
- newDoors.clear();
- nextObj:for (RSObject obj : newObjects) {
- int objID = obj.getID();
- RSTile objTile = obj.getLocation();
- if (intMatch(objID, BASIC_DOORS)) {
- if (nearDoor != null && calc.distanceBetween(nearDoor, objTile) < 4) {
- backDoors.add(objTile);
- continue nextObj;
- }
- newDoors.add(objTile);
- goodDoors.add(objTile);
- continue nextObj;
- }
- if (intMatch(objID, GUARDIAN_DOORS)) {
- guardianDoors.add(objTile);
- newDoors.add(objTile);
- goodDoors.add(objTile);
- continue nextObj;
- }
- for (int[] color : KEY_DOORS) {
- if (intMatch(objID - floor.diff(), color)) {
- newDoors.add(objTile);
- continue nextObj;
- }
- if (intMatch(objID, color)) {
- lockIDs.add(objID);
- lockedDoors.add(objTile);
- continue nextObj;
- }
- }
- if (aComplexity > 4) {
- if (intMatch(objID, FREE_BLOCK_DOORS)) {
- blockedDoors.add(objTile);
- } else if (intMatch(objID, MEMBER_BLOCK_DOORS)) {
- if (memberWorld) {
- blockedDoors.add(objTile);
- } else finishedDoors.add(objTile);
- } else if (intMatch(objID, PRAYER_DOORS)) {
- if (!Option.PRAY_DOORS.enabled()) {
- finishedDoors.add(objTile);
- skipDoorFound = true;
- } else blockedDoors.add(objTile);
- } else if (intMatch(objID, SUMMON_DOORS)) {
- if (!Option.SUMMON.enabled()) {
- finishedDoors.add(objTile);
- skipDoorFound = true;
- } else blockedDoors.add(objTile);
- } else if (intMatch(objID, FREE_SKILL_DOORS)) {
- skillDoors.add(objTile);
- newDoors.add(objTile);
- goodDoors.add(objTile);
- } else if (intMatch(objID, MEMBER_SKILL_DOORS)) {
- if (memberWorld) {
- skillDoors.add(objTile);
- newDoors.add(objTile);
- goodDoors.add(objTile);
- } else finishedDoors.add(objTile);
- } else if (intMatch(objID, puzzleDoors)) {
- newDoors.add(objTile);
- goodDoors.add(objTile);
- }
- }
- }
- newObjectTiles.clear();
- newObjects.clear();
- ArrayList<RSTile> removals = new ArrayList<RSTile>();
- for (RSTile fDoor : finishedDoors) {
- if (areaContains(newRoom, fDoor)) {
- for (RSTile nDoor : newDoors) {
- if (calc.distanceBetween(nDoor, fDoor) < 4)
- removals.add(nDoor);
- }
- }
- }
- finishedDoors.addAll(removals);
- drawDoors.addAll(removals);
- newDoors.removeAll(finishedDoors);
- goodDoors.removeAll(finishedDoors);
- drawDoors.addAll(blockedDoors);
- drawDoors.addAll(lockedDoors);
- drawDoors.addAll(newDoors);
- allDoors.addAll(newDoors);
- if (nearDoor != null) {
- openedDoors.add(nearDoor);
- goodDoors.remove(nearDoor);
- oldDoor = nearDoor;
- }
- return;
- }
- private boolean getNewRoomArea() {
- boolean newDoor = false;
- if (currentRoom != null && nearDoor != null) {
- for (RSObject o : objects.getAll()) {
- if (o != null && intMatch(o.getID(), BACK_DOORS) && calc.distanceBetween(o.getLocation(), nearDoor) <
- 3 && !areaContains(currentRoom, o.getLocation())) {
- newDoor = true;
- break;
- }
- }
- }
- if (!newDoor && rooms.size() > 0)
- return false;
- if (game.getClientState() == 11) {
- while (game.getClientState() == 11) {
- sleep(200, 300);
- }
- sleep(300);
- }
- sleep(400);
- for (RSObject obj : objects.getAll(roomObjects)) {
- RSTile objTile = obj.getLocation();
- if (!oldObjectTiles.contains(objTile)) {
- newObjectTiles.add(objTile);
- newObjects.add(obj);
- }
- }
- if (newObjectTiles.size() > 60) {
- int swX = 20000, swY = 20000;
- for (RSTile t : newObjectTiles) {
- if (t.getX() <= swX && t.getY() <= swY) {
- swX = t.getX();
- swY = t.getY();
- }
- }
- newRoom = new RSArea(swX, swY, swX + 15, swY + 15);
- rooms.add(newRoom);
- if (dropItem(GUARD_KEY) && bounds.contains((Integer) GUARD_KEY))
- bounds.remove((Integer) GUARD_KEY);
- setTargetRoom(newRoom);
- oldObjectTiles.addAll(newObjectTiles);
- restartCount = 0;
- restarts = 0;
- failTimer.reset();
- doorTimer = null;
- return true;
- }
- return false;
- }
- private boolean openBasicDoor() {
- status = "Opening a standard door";
- while (!areaContains(newRoom, myLoc())) {
- if (failSafe() || nearDoor == null)
- return false;
- if (areaContains(getCurrentRoom(), nearDoor)) {
- if (calc.distanceTo(nearDoor) > 4) {
- lastMessage = "";
- } else if (lastMessage.contains("guardians")) {
- if (npcs.getNearest(monster) != null) {
- if (!fightMonsters() || !pickUpAll())
- return false;
- doorTimer = new Timer(0);
- } else {
- log("Unkillable Guardians, removing door.");
- finishedDoors.add(nearDoor);
- allDoors.remove(nearDoor);
- openedDoors.remove(nearDoor);
- goodDoors.remove(nearDoor);
- return true;
- }
- lastMessage = "";
- } else if (unreachable && calc.tileOnScreen(nearDoor)) {
- if (calc.distanceTo(nearDoor) < 4) {
- camera.moveRandomly(random(800, 1400));
- clickTile(nearDoor, "");
- } else walkToMap(nearDoor, 1);
- unreachable = false;
- } else if (lastMessage.contains("not open") || lastMessage.contains("won't open")) {
- log("Undetected puzzle door, removing!");
- if (developer)
- env.saveScreenshot(false);
- finishedDoors.add(nearDoor);
- allDoors.remove(nearDoor);
- goodDoors.remove(nearDoor);
- waitForResponse();
- return true;
- } else if (lastMessage.contains("don't have the correct")) {
- log.severe("Hmm.. we got tricked, we don't have the right key!");
- finishedDoors.add(nearDoor);
- finishedDoors.add(nearDoor2);
- goodDoors.remove(nearDoor);
- return true;
- }
- if (doObjAction(objects.getTopAt(nearDoor))) {
- waitToObject(false);
- if (waitForRoom(false))
- return true;
- } else while (isMoving() && !calc.tileOnScreen(nearDoor)) {
- sleep(100, 200);
- }
- }
- sleep(100, 200);
- }
- return true;
- }
- private boolean openBlockedDoor() {
- RSObject block;
- status = "Opening a blocked door";
- while ((block = objects.getTopAt(nearDoor2)) != null) {
- if (failSafe())
- return false;
- if (intMatch(player().getAnimation(), BLOCK_ANIMS))
- break;
- if (calc.distanceTo(nearDoor2) < 4 && (getName(block).isEmpty() || block.getArea().getTileArray().length !=
- 2))
- break;
- if (!doorCheck()) {
- finishedDoors.add(nearDoor2);
- allDoors.remove(nearDoor2);
- openedDoors.remove(nearDoor2);
- goodDoors.remove(nearDoor2);
- drawDoors.remove(nearDoor);
- return true;
- }
- if (doObjAction(block)) {
- if (!waitToObject(false))
- continue;
- eatFood(foods, 50, 50);
- } else {
- while (block != null && isMoving() && !block.isOnScreen()) {
- sleep(100, 200);
- }
- }
- waitForDamage();
- sleep(100, 200);
- }
- drawDoors.remove(nearDoor2);
- allDoors.remove(nearDoor2);
- blockedDoors.remove(nearDoor2);
- goodDoors.remove(nearDoor2);
- openedDoors.remove(nearDoor2);
- doorTimer = new Timer(0);
- int attempts = 0;
- while (!areaContains(newRoom, myLoc())) {
- if (failSafe())
- return false;
- if (areaContains(getCurrentRoom(), nearDoor)) {
- RSObject door = objects.getTopAt(nearDoor);
- if (door != null) {
- if (doorTimer != null && attempts < 10 && doorTimer.getElapsed() > 30000) {
- door = getObjInRoom(FREE_BLOCK_DOORS);
- if (door == null || calc.distanceTo(door) > 2) {
- door = getObjInRoom(MEMBER_BLOCK_DOORS);
- if (door != null && calc.distanceTo(door) > 2)
- door = null;
- }
- attempts ++;
- unreachable = false;
- }
- if (doObjAction(door)) {
- waitToObject(false);
- if (waitForRoom(false))
- return true;
- } else while (isMoving() && !calc.tileOnScreen(nearDoor)) {
- sleep(100, 200);
- }
- }
- }
- sleep(100, 200);
- }
- return true;
- }
- private boolean openLockedDoor() {
- status = "Opening a locked door";
- lockDown = false;
- while (!lockDown) {
- if (failSafe())
- return false;
- if (player().getAnimation() == 13798)
- break;
- RSObject lock = objects.getTopAt(nearDoor2);
- if (calc.distanceTo(nearDoor2) < 4 && (getName(lock).isEmpty() || lock.getArea().getTileArray().length != 2))
- break;
- if (lastMessage.contains("don't have the correct")) {
- log.severe("Hmm.. we got tricked, we don't have the right key!");
- goodDoors.remove(nearDoor);
- goodDoors.remove(nearDoor2);
- return true;
- }
- if (doObjAction(lock)) {
- waitToAnimate();
- if (player().getAnimation() == 13798)
- break;
- waitToObject(false);
- } else while (lock != null && isMoving() && !lock.isOnScreen()) {
- sleep(100, 200);
- }
- sleep(200, 400);
- }
- int attempts = 0;
- lockDown = false;
- drawDoors.remove(nearDoor2);
- allDoors.remove(nearDoor2);
- goodDoors.remove(nearDoor2);
- lockedDoors.remove(nearDoor2);
- doorTimer = new Timer(0);
- while (!areaContains(newRoom, myLoc())) {
- if (failSafe())
- return false;
- RSObject door = objects.getTopAt(nearDoor);
- if (door != null) {
- if (unreachable || (doorTimer != null && attempts < 10 && doorTimer.getElapsed() > 30000)) {
- door = getObjInRoom(door.getID() - floor.diff());
- if (door == null)
- door = objects.getTopAt(nearDoor2);
- unreachable = false;
- attempts++;
- }
- if (doObjAction(door)) {
- waitToObject(false);
- if (waitForRoom(false))
- return true;
- }
- }
- sleep(200, 400);
- getCurrentRoom();
- }
- return true;
- }
- private boolean openSkillDoor() {
- status = "Opening a skill door";
- while (!areaContains(newRoom, myLoc())) {
- if (failSafe())
- return false;
- if (!doorCheck())
- return true;
- if (lastMessage.contains("need an empty vial")) {
- if (inventory.contains(ANTIPOISON)) {
- ridItem(ANTIPOISON, "Drink");
- } else {
- finishedDoors.add(nearDoor);
- allDoors.remove(nearDoor);
- openedDoors.remove(nearDoor);
- goodDoors.remove(nearDoor);
- return true;
- }
- }
- if (areaContains(getCurrentRoom(), nearDoor)) {
- RSObject door = objects.getTopAt(nearDoor);
- if (door != null) {
- if (doObjAction(door)) {
- waitToObject(true);
- if (newRoom == null && staticDamage() && (intMatch(door.getID(), FREE_SKILL_DOORS) ||
- intMatch(door.getID(), MEMBER_SKILL_DOORS)))
- topUp(true);
- if (waitForRoom(true))
- return true;
- } else while (door != null && isMoving() && !door.isOnScreen()) {
- sleep(100, 200);
- }
- if (!doorCheck())
- return true;
- }
- }
- eatFood(foods, 40, 50);
- sleep(200, 400);
- }
- oldDoor = nearDoor;
- return true;
- }
- private boolean openOldDoor() {
- if (!status.contains("Opening"))
- status = "Opening an old door";
- for (RSArea room : rooms) {
- if (!areaEquals(room, oldRoom) && calc.distanceBetween(nearDoor, room.getNearestTile(nearDoor)) < 3) {
- newRoom = room;
- break;
- }
- }
- if (newRoom == null)
- return false;
- doorTimer = new Timer(0);
- o:while (!areaContains(newRoom, myLoc())) {
- if (failSafe())
- return false;
- if (areaContains(getCurrentRoom(), nearDoor)) {
- if (doObjAction(objects.getTopAt(nearDoor))) {
- waitToObject(false);
- for (int i = 0; i < 4; i++) {
- if (areaContains(newRoom, myLoc()))
- break o;
- sleep(200, 250);
- }
- } else {
- while (isMoving() && !calc.tileOnScreen(nearDoor)) {
- topUp(false);
- sleep(100, 200);
- }
- }
- }
- sleep(200, 400);
- }
- setTargetRoom(getCurrentRoom());
- newRoom = null;
- openedDoors.remove(nearDoor);
- openedDoors.add(nearDoor);
- oldDoor = nearDoor;
- return true;
- }
- private boolean pickUpAll() {
- if (getGoodItem() == null || (finishedRooms.contains(targetRoom) && (puzzleRooms.contains(targetRoom) || !reachable
- (nearItem.getLocation(), true))))
- return true;
- boolean guardian = npcs.getNearest(guardians) != null;
- int invCheck = inventory.getCount(true);
- RSTile iTile = nearItem.getLocation();
- improveEquipment();
- crossTheChasm(iTile);
- if (secondaryStatus.isEmpty()) {
- secondaryStatus = "Picking up food & keys";
- if (Option.BONES.enabled())
- secondaryStatus += " & bones";
- if (Option.ARROWS.enabled())
- secondaryStatus += " & arrows";
- }
- Timer pickupTimer = new Timer(0);
- unreachable = false;
- o:while (getGoodItem() != null) {
- if (failSafe())
- return false;
- if (pickupTimer.getElapsed() > random(30000, 90000) || secondaryStatus.contains("reengage"))
- return true;
- iTile = nearItem.getLocation();
- makeSpace(!skipRoom);
- if (pickUpItem(nearItem)) {
- if (calc.distanceTo(iTile) > 2 && !waitToStart(false))
- unStick();
- while (isMoving() && calc.distanceTo(iTile) > 2) {
- if (guardian && player().getInteracting() != null)
- continue o;
- sleep(100, 200);
- }
- sleep(0, 300);
- if (unreachable) {
- walkToMap(iTile, 1);
- waitToStart(false);
- unreachable = false;
- } else {
- for (int c = 0; c < (!isMoving() && myLoc().equals(iTile) ? 4 : 8); c++) {
- if (inventory.getCount(true) > invCheck) {
- improveEquipment();
- break;
- }
- sleep(200, 300);
- if (!isMoving()) {
- if (roomNumber != 1 && !myLoc().equals(iTile))
- break;
- c++;
- } else if (guardian && player().getInteracting() != null) {
- continue o;
- }
- }
- }
- } else {
- if (roomNumber == 1)
- threadDefault();
- unStick();
- }
- if (!isMoving() && calc.distanceTo(iTile) > 2 && reachable(iTile, true) && pickupTimer.getElapsed() > random
- (3000, 6000))
- walkTo(iTile, 2);
- if (inventory.getCount(true) > invCheck || isMoving()) {
- invCheck = inventory.getCount(true);
- pickupTimer = new Timer(0);
- } else if (pickupTimer.getElapsed() > random(14000, 20000)) {
- getCurrentRoom();
- unStick();
- if (calc.distanceTo(iTile) > 1 && reachable(iTile, true)) {
- walkBlockedTile(iTile, 2);
- } else if (!badTiles.contains(iTile)) {
- pickupTimer = new Timer(0);
- badTiles.add(iTile);
- }
- }
- sleep(200, 300);
- }
- if (skipRoom)
- eatFood(foods, 30, 30);
- improveArmorWielding();
- improveWeaponBinding();
- secondaryStatus = "";
- return true;
- }
- private boolean resetPrestige() {
- if (Option.PRESTIGE.enabled()) {
- secondaryStatus = "Resetting prestige";
- while (cProg != 0) {
- if (failBasic())
- return false;
- if (dungeonCount > 5 && password.isEmpty()) {
- walkTo(ORIGIN, 1000);
- } else if (interfaces.get(213).isValid()) {
- interfaces.getComponent(213, 5).interact("Continue");
- } else if (interfaces.get(228).isValid()) {
- interfaces.getComponent(228, 2).interact("Continue");
- } else if (openPartyTab()) {
- clickComponent(interfaces.getComponent(939, 87), "Reset");
- }
- sleep(600, 1000);
- updateProgress();
- }
- prestigeCount++;
- forcePrestige = false;
- secondaryStatus = "";
- return true;
- } else {
- log(RED, "Last floor reached, but prestiging is disabled! Shutting down script.");
- authCheck = false;
- }
- return false;
- }
- private void runSettings() {
- threadDefault();
- bounds.clear();
- prayerLevel = skills.getRealLevel(Skills.PRAYER);
- slayerLevel = skills.getRealLevel(Skills.SLAYER);
- if (!settingsFinished) {
- if (!authCheck)
- return;
- attStart = skills.getCurrentExp(Skills.ATTACK);
- strStart = skills.getCurrentExp(Skills.STRENGTH);
- defStart = skills.getCurrentExp(Skills.DEFENSE);
- hitStart = skills.getCurrentExp(Skills.CONSTITUTION);
- rngStart = skills.getCurrentExp(Skills.RANGE);
- mgcStart = skills.getCurrentExp(Skills.MAGIC);
- prayStart = skills.getCurrentExp(Skills.PRAYER);
- dungStart = skills.getCurrentExp(Skills.DUNGEONEERING);
- runeStart = skills.getCurrentExp(Skills.RUNECRAFTING);
- mineStart = skills.getCurrentExp(Skills.MINING);
- fireStart = skills.getCurrentExp(Skills.FIREMAKING);
- woodStart = skills.getCurrentExp(Skills.WOODCUTTING);
- smthStart = skills.getCurrentExp(Skills.SMITHING);
- crftStart = skills.getCurrentExp(Skills.CRAFTING);
- agilStart = skills.getCurrentExp(Skills.AGILITY);
- thevStart = skills.getCurrentExp(Skills.THIEVING);
- summStart = skills.getCurrentExp(Skills.SUMMONING);
- herbStart = skills.getCurrentExp(Skills.HERBLORE);
- cnstStart = skills.getCurrentExp(Skills.CONSTRUCTION);
- cookStart = skills.getCurrentExp(Skills.COOKING);
- fishStart = skills.getCurrentExp(Skills.FISHING);
- slayStart = skills.getCurrentExp(Skills.SLAYER);
- dungStartLevel = skills.getRealLevel(Skills.DUNGEONEERING);
- dungLevel = skills.getRealLevel(Skills.DUNGEONEERING);
- isCursing = prayer.isCursing();
- if (levelGoal <= dungLevel)
- levelGoal = dungLevel + 1;
- //if (!loadSettings()) {
- if (prayerLevel > 11) {
- Option.PRAY_DOORS.set(true);
- if (prayerLevel > 36)
- Option.PRAY.set(true);
- }
- if (skills.getRealLevel(Skills.CONSTITUTION) < 60)
- Option.CRABS.set(true);
- if (skills.getRealLevel(Skills.DEFENSE) < 20) {
- Option.PURE.set(true);
- } else Option.STYLE_SWAP.set(true);
- //}
- if (groundItems.getNearest(CAVE_MORAY, BLUE_CRAB, SALVE_EEL, BOULDABASS, WEB_SNIPPER) == null) {
- game.open(Game.TAB_FRIENDS, false);
- String world = interfaces.getComponent(550, 18).getText();
- selectTab(Game.TAB_INVENTORY, 3);
- if (!world.isEmpty()) {
- world = world.concat(".");
- for (String w : FREE_WORLDS) {
- if (world.contains(" " + w + ".")) {
- memberWorld = false;
- break;
- }
- }
- }
- }
- oTab = 0;
- hidePaint = false;
- showStats = false;
- showOptions = false;
- showSettings = true;
- game.setChatOption(Game.ChatButton.GAME, Game.ChatMode.VIEW);
- env.setUserInput(Environment.INPUT_MOUSE | Environment.INPUT_KEYBOARD);
- while (showSettings) {
- if (!authCheck)
- return;
- sleep(300, 600);
- }
- env.setUserInput(Environment.INPUT_KEYBOARD);
- game.setChatOption(Game.ChatButton.ASSIST, Game.ChatMode.OFF);
- defaultMode = combat.getFightMode();
- if (Option.MAGIC.enabled()) {
- defaultMode = 4;
- } else if (defaultMode == 4) {
- defaultMode = 1;
- }
- attackMode = valueOf(defaultMode);
- selectTab(Game.TAB_EQUIPMENT, 5);
- int attackLevel = skills.getRealLevel(Skills.ATTACK), defenseLevel = skills.getRealLevel(Skills.DEFENSE);
- defenseTier = defenseLevel == 99 ? 11 : defenseLevel / 10 + 1;
- attackTier = attackLevel == 99 ? 11 : attackLevel / 10 + 1;
- if (Option.RANGE.enabled()) {
- int rangeLevel = skills.getRealLevel(Skills.RANGE);
- attackTier = rangeLevel == 99 ? 11 : rangeLevel / 10 + 1;
- primaryStyle = Style.RANGE;
- armorTiers = LEATHER_TIERS;
- slotNames = RANGE_SLOTS;
- weaponTiers = WOOD_TIERS;
- } else if (Option.MAGIC.enabled()) {
- primaryStyle = Style.MAGIC;
- armorTiers = CLOTH_TIERS;
- slotNames = MAGIC_SLOTS;
- weaponTiers = null;
- }
- RSItem weaponSlot = equipment.getItem(Equipment.WEAPON);
- if (weaponSlot != null && weaponSlot.getID() > 0) {
- primaryWep = weaponSlot.getID();
- String wName = equipmentName(weaponSlot);
- String wMetal = equipmentMaterial(wName);
- weaponTier = equipmentTier(wName);
- weaponType = equipmentType(wName);
- Weapon weapon = enumOf(Weapon.class, weaponType);
- if (weapon == null) {
- log.severe("Unknown weapon type. Please try restarting the script for best results");
- } else {
- int level = skills.getRealLevel(weapon.skill());
- Melee.STAB.set(weapon.stab());
- Melee.SLASH.set(weapon.slash());
- Melee.CRUSH.set(weapon.crush());
- if (combatStyle == Style.MELEE)
- Melee.DEFENSE.set(weapon.defensive());
- attackTier = level == 99 ? 11 : level / 10 + 1;
- twoHanded = weapon.isTwoHanded();
- if (weaponTier == 0)
- weaponTier = 11;
- log(BLU, "Weapon: " + wMetal + " " + weaponType + " - Tier: " + weaponTier + "; Max tier: " +
- attackTier + "; Two-handed: " + (twoHanded ? "Yes" : "No") + "; Upgrading: " + (weaponTier < attackTier ? "Yes" : "No"));
- if (Option.STYLE_SWAP.enabled && weapon.slash() == -1)
- Option.STYLE_SWAP.set(false);
- }
- }
- if (Option.PURE.enabled() && (defaultMode == defenseMode || defaultMode == 3))
- defaultMode = 1;
- RSItem ammo = equipment.getItem(Equipment.AMMO);
- if (ammo != null && ammo.getID() > 0)
- arrows = ammo.getID();
- for (int I = 0; I < EQUIP_SLOTS.length; I++) {
- RSItem eq = equipment.getItem(EQUIP_SLOTS[I]);
- if (eq != null && eq.getID() > 0) {
- String eqName = equipmentName(eq);
- int tier = equipmentTier(eqName);
- if (eq.getName().contains("(b)")) {
- if (I == 0 && eqName.contains("silk hood")) {
- initialEquipmentTiers[I] = 11;
- shadowHooded = true;
- } else if (I == 2 && (eqName.contains("blastbox") || eqName.contains("surgebox"))) {
- blastBox = eq.getID();
- initialEquipmentTiers[I] = 11;
- twoHanded = true;
- } else if (I == 4 && eqName.contains("precision")) {
- initialEquipmentTiers[I] = 11;
- } else initialEquipmentTiers[I] = tier;
- if (initialEquipmentTiers[I] == 0)
- initialEquipmentTiers[I] = 11;
- if (initialEquipmentTiers[I] < defenseTier) {
- startArmor = eq.getID();
- armorSlot = I;
- armorType = equipmentType(eqName);
- }
- equipmentTiers[I] = valueOf(initialEquipmentTiers[I]);
- tempTiers[I] = valueOf(initialEquipmentTiers[I]);
- log(BLU, "Armor: " + eqName + " - Tier: " + equipmentTiers[I] + "; Max tier: " +
- defenseTier + "; Upgrading: " + (equipmentTiers[I] < defenseTier ? "Yes" : "No"));
- } else {
- equipmentTiers[I] = tier;
- tempTiers[I] = tier;
- }
- }
- }
- if (combatSpell != null) {
- Magic spellType = combatSpell.type();
- if (spellType != null && spellType != Magic.NONE)
- spellType.set(4);
- }
- }
- for (RSItem item : inventory.getItems()) {
- if (item == null)
- continue;
- int itemId = item.getID();
- if (itemId < 1)
- continue;
- String iName = equipmentName(item);
- int tier = equipmentTier(iName);
- if (tier > 0) {
- String iType = equipmentType(iName);
- for (int I = 0; I < slotNames.length; I++) {
- if (iType.contains(slotNames[I])) {
- if (tier > equipmentTiers[I] && ridItem(itemId, "Wear"))
- equipmentTiers[I] = tier;
- break;
- }
- }
- }
- }
- Style.MELEE.set(Option.MELEE.enabled() || (Option.SECONDARY_MELEE.enabled() && secondaryWep > 0));
- Style.RANGE.set(Option.RANGE.enabled() || (Option.SECONDARY_RANGE.enabled() && arrows > 0 && secondaryWep > 0));
- Style.MAGIC.set(Option.MAGIC.enabled() || (Option.SECONDARY_MAGIC.enabled() && (secondaryWep > 0 || blastBox > 0)));
- temporarySecondary = secondaryWep < 1;
- int goodOffset = skills.getRealLevel(Skills.CONSTITUTION) / (memberWorld ? 34 : 46);
- foods = FOOD_ARRAY;
- goodFoods = new int[foods.length - goodOffset];
- int[] newTop = new int[foods.length - goodOffset - 1];
- topFoods = new int[newTop.length];
- if (skills.getRealLevel(Skills.DEFENSE) < random(5, 20) && username.isEmpty())
- Option.PURE.set(true);
- System.arraycopy(foods, goodOffset, goodFoods, 0, goodFoods.length);
- System.arraycopy(goodFoods, 1, newTop, 0, newTop.length);
- for (int I = 0; I < newTop.length; I++) {
- topFoods[I] = newTop[newTop.length - 1 - I];
- }
- if (!Option.CRABS.enabled()) {
- foods = new int[FOOD_ARRAY.length - 1];
- System.arraycopy(FOOD_ARRAY, 1, foods, 0, foods.length);
- }
- for (int food : foods) {
- bounds.add((Integer) food);
- }
- if (Option.BONES.enabled()) {
- for (int bone : BONES) {
- bounds.add((Integer) bone);
- }
- }
- if (Option.MAKE_FOOD.enabled())
- bounds.add((Integer) COINS);
- if (primaryWep > 0)
- bounds.add((Integer) primaryWep);
- if (secondaryWep > 0)
- bounds.add((Integer) secondaryWep);
- if (blastBox > 0)
- bounds.add((Integer) blastBox);
- if (arrows > 0)
- bounds.add((Integer) arrows);
- for (int[] color : KEYS) {
- for (int key : color) {
- bounds.add((Integer) key);
- }
- }
- if (aComplexity > 4) {
- for (Integer tool : TOOLS) {
- bounds.add(tool);
- }
- int magicLevel = skills.getRealLevel(Skills.MAGIC);
- if (magicLevel > 31) {
- bounds.add((Integer) GGS);
- for (Integer rune : COSMIC_RUNES) {
- bounds.add(rune);
- }
- if (magicLevel > 63 && floor != Floor.FROZEN) {
- for (Integer rune : LAW_RUNES) {
- bounds.add(rune);
- }
- }
- }
- if (!memberWorld) {
- bounds.remove((Integer) 17490);
- bounds.remove((Integer) 17754);
- } else bounds.add((Integer) ANTIPOISON);
- } else if (floor == Floor.ABANDONED) {
- bounds.add((Integer) PICKAXE);
- }
- if (Option.RUSH.enabled() && cProg < 1)
- openPartyTab();
- for (RSItem item : inventory.getItems()) {
- if (item != null && item.getName().contains("(b)"))
- bounds.add((Integer) item.getID());
- }
- if (Option.RANGE.enabled()) {
- ridItem(arrows, "Wield");
- } else if (Option.MAGIC.enabled() && ridItem(blastBox, "Wield")) {
- while (!isAutoCasting()) {
- if (failCheck())
- return;
- if (castDungeonSpell(combatSpell, "Autocast"))
- sleep(300, 600);
- sleep(100, 200);
- }
- }
- combatStyle = styleOf(primaryStyle.index());
- if (!settingsFinished) {
- settingsFinished = true;
- saveSettings();
- runTimer = new Timer(0);
- log(PRP, "Settings complete!");
- }
- failTimer = new Timer(random(360000, 480000));
- }
- private class threadAngle extends Thread {
- public void run() {
- try {
- while (Math.abs(camera.getAngleTo(degrees)) > 5) {
- camera.setAngle(degrees);
- sleep(0, 20);
- }
- } catch (Exception e) { }
- }
- }
- private class threadPitch extends Thread {
- public void run() {
- try {
- while (camera.getPitch() != pitch) {
- camera.setPitch(pitch);
- sleep(0, 20);
- }
- } catch (Exception e) { }
- }
- }
- private boolean shop(final Food fish, final Logs logs) {
- boolean sold = false;
- int toScroll = random(175, 200);
- lastMessage = "";
- while ((!sold || !inventory.isFull()) && !lastMessage.contains("afford") && !lastMessage.contains("enough money")) {
- if (failCheck())
- return false;
- RSInterface shop = interfaces.get(956);
- if (!shop.isValid()) {
- smartSleep(doNpcAction(getNpcInRoom(SMUGGLER), "Trade"), false);
- } else if (!sellToShop()) {
- RSComponent logItem = shop.getComponent(24).getComponent((memberWorld ? 197 : 97) + logs.tier() * 5);
- RSComponent scrollBar = shop.getComponent(25);
- while (scrollBar.isValid() && logItem.getAbsoluteY() > toScroll) {
- clickComponent(scrollBar.getComponent(5), "");
- sleep(0, 50);
- }
- if (logs != null && getObjInRoom(FIRES) == null && !inventory.contains(logs.getID())) {
- if (clickComponent(logItem, "Buy 1")) {
- for (int c = 0; c < 10; c++) {
- if (inventory.contains(logs.getID()))
- break;
- sleep(150, 250);
- }
- }
- } else if (fish != null) {
- RSComponent foodItem = shop.getComponent(24).getComponent((memberWorld ? 147 : 72) +
- fish.tier() * 5);
- int startCount = inventory.getCount();
- if (clickComponent(foodItem, "Buy 50")) {
- for (int c = 0; c < 10; c++) {
- if (inventory.getCount() > startCount)
- break;
- sleep(150, 250);
- }
- }
- }
- sold = true;
- }
- sleep(50, 200);
- }
- while (interfaces.get(956).isValid()) {
- interfaces.getComponent(956, 18).interact("Close");
- sleep(700, 1000);
- }
- return true;
- }
- private boolean shop(final int idx, final int amount) {
- lastMessage = "";
- while (!interfaces.get(956).isValid()) {
- if (failCheck())
- return false;
- if (doNpcAction(getNpcInRoom(SMUGGLER), "Trade"))
- waitToStop(false);
- sleep(600, 800);
- }
- sellToShop();
- RSComponent scrollBar = interfaces.getComponent(956, 25);
- Point sP = scrollBar.getComponent(5).getCenter();
- while (scrollBar.isValid() && scrollBar.getComponent(3).getRelativeY() < 225) {
- mouse.click(sP.x, sP.y - 25, 5, 17, true);
- sleep(200, 600);
- }
- RSComponent item = interfaces.getComponent(956, 24).getComponent(idx);
- for (int c = 0; c < amount; c++) {
- if (lastMessage.contains("don't have enough"))
- break;
- if (!clickComponent(item, "Buy 1")) {
- if (!interfaces.get(956).isValid())
- break;
- c--;
- }
- }
- while (interfaces.get(956).isValid()) {
- interfaces.getComponent(956, 18).interact("Close");
- sleep(700, 1000);
- }
- return true;
- }
- private boolean shopToolkit() {
- boolean ret = true;
- int failCount = 0, sellCount = 0, sellFood = -1;
- lastMessage = "";
- while (!inventory.contains(TOOLKIT) && !inventory.containsAll(TOOLS)) {
- if (failCheck()) {
- ret = false;
- break;
- }
- if (!interfaces.get(956).isValid()) {
- smartSleep(doNpcAction(getNpcInRoom(SMUGGLER), "Trade"), false);
- sleep(200, 400);
- continue;
- }
- boolean sold = false;
- if (sellCount < 3) {
- for (RSItem item : inventory.getItems()) {
- int testID = item.getID();
- if (testID == -1)
- continue;
- if (testID != sellFood && !intMatch(testID, TOOLS) && (intMatch(testID, COINS, TOOLKIT) ||
- bounds.contains((Integer) testID)))
- continue;
- for (int c = 0; c < random(3, 5); c++) {
- if (item.interact("Sell 50")) {
- sleep(100, 300);
- if (item.getStackSize() > 50 && item.interact("Sell 50"))
- sleep(30, 300);
- if (!sold) {
- sellCount++;
- sold = true;
- }
- break;
- }
- sleep(10, 100);
- }
- }
- if (sold)
- continue;
- }
- sellFood = -1;
- if (lastMessage.contains("enough money")) {
- failCount++;
- sleep(300, 500);
- if (failCount > 1) {
- sellFood = foodLowest();
- if (sellFood == -1 && failCount > 2) {
- log(RED, "Unable to purchase a toolkit, trying a new floor.");
- if (developer)
- env.saveScreenshot(false);
- exit = true;
- ret = false;
- break;
- }
- }
- lastMessage = "";
- } else {
- RSComponent scrollBar = interfaces.getComponent(956, 25);
- Point sP = scrollBar.getComponent(5).getCenter();
- while (scrollBar.isValid() && scrollBar.getComponent(3).getRelativeY() < 225) {
- mouse.click(sP.x, sP.y - 25, 5, 17, true);
- sleep(200, 600);
- }
- if (memberWorld && dungeonCount == 0)
- memberWorld = interfaces.getComponent(956, 24).getComponents().length > 400;
- if (clickComponent(interfaces.getComponent(956, 24).getComponent(memberWorld ? 469 : 254),
- "Buy 1")) {
- for (int c = 0; c < 10; c++) {
- if (inventory.contains(TOOLKIT))
- break;
- sleep(100, 200);
- }
- }
- }
- }
- while (interfaces.get(956).isValid()) {
- interfaces.getComponent(956, 18).interact("Close");
- sleep(700, 1000);
- }
- return ret;
- }
- private boolean hidePaint = false, backPage = false, pauseiDungeon = false, confirmToStop = false;
- private boolean showStats = true, showOptions = false, showSettings = false, showChat = false;
- private final Option[] opTab1 = { Option.MELEE, Option.RANGE, Option.MAGIC, Option.SECONDARY_MELEE, Option.SECONDARY_RANGE,
- Option.SECONDARY_MAGIC, Option.LOAD_SETTINGS, Option.SAVE_SETTINGS };
- private final Option[] opTab2 = { Option.BONES, Option.ARROWS, Option.CRABS, Option.PRAY, Option.QUICK_PRAY,
- Option.PRAY_DOORS, Option.PURE, Option.STYLE_SWAP, Option.SUMMON, Option.MAKE_FOOD, Option.EXPLORER, Option.LOGOUT };
- private final Option[] opTab3 = { Option.PRESTIGE, Option.MEDIUM, Option.DEBUG, Option.VIDEO, Option.RUSH, Option.RUSH_FOOD };
- private final Option[][] options = { opTab1, opTab2, opTab3 };
- private static final Color GN1 = new Color(0, 255, 0, 130);
- private static final Color GN2 = new Color(0, 180, 0, 80);
- private static final Color RD1 = new Color(255, 0, 0, 130);
- private static final Color RD2 = new Color(180, 0, 0, 100);
- private final Color BLU = new Color(0, 0, 255);
- private final Color BL1 = new Color(0, 0, 255, 150);
- private final Color BLK = new Color(0, 0, 0);
- private final Color BT1 = new Color(0, 0, 0, 225);
- private final Color BT2 = new Color(0, 0, 0, 180);
- private final Color BT3 = new Color(0, 0, 0, 110);
- private final Color BT4 = new Color(0, 0, 0, 200);
- private final Color DPL = new Color(255, 0, 255);
- private final Color GLD = new Color(255, 215, 0, 140);
- private final Color GRN = new Color(0, 240, 0);
- private final Color GN3 = new Color(0, 255, 0, 100);
- private final Color GN5 = new Color(0, 150, 0);
- private final Color RED = new Color(255, 0, 0);
- private final Color PRP = new Color(160, 0, 160);
- private final Color PT1 = new Color(160, 0, 160, 100);
- private final Color PT2 = new Color(160, 0, 160, 160);
- private final Color PT3 = new Color(160, 0, 160, 40);
- private final Color SKY = new Color(0, 190, 255, 140);
- private final Color WHT = new Color(255, 255, 255);
- private final Color WT1 = new Color(255, 255, 255, 100);
- private final Color WT2 = new Color(255, 255, 255, 150);
- private final Color WT3 = new Color(255, 255, 255, 220);
- private final Color YLW = new Color(240, 240, 0);
- private final Font FONT_1 = new Font("Arial", Font.BOLD, 13);
- private final Font FONT_2 = new Font("Trebuchet MS", 0, 15);
- private final Font FONT_3 = new Font("Trebuchet MS", 0, 11);
- private final Font FONT_4 = new Font("Arial", Font.BOLD, 12);
- private final Rectangle RECT_STATS = new Rectangle(7, 344, 80, 17);
- private final Rectangle RECT_OPTIONS = new Rectangle(7 + 84, 344, 80, 17);
- private final Rectangle RECT_STATUS = new Rectangle(7 + 168, 344, 222, 17);
- private final Rectangle RECT_CONTROL = new Rectangle(7 + 394, 344, 112, 19);
- private final Rectangle RECT_CHAT = new Rectangle(7, 458, 506, 16);
- private final Rectangle RECT_TAB_1 = new Rectangle(6, 363, 81, 32);
- private final Rectangle RECT_TAB_2 = new Rectangle(6, 395, 81, 32);
- private final Rectangle RECT_TAB_3 = new Rectangle(6, 427, 81, 31);
- private final Rectangle RECT_C_UP = new Rectangle(121, 389, 20, 15);
- private final Rectangle RECT_C_DOWN = new Rectangle(121, 420, 20, 15);
- private final Rectangle RECT_RC_UP = new Rectangle(310, 389, 20, 15);
- private final Rectangle RECT_RC_DOWN = new Rectangle(310, 420, 20, 15);
- private final Rectangle RECT_F_UP = new Rectangle(380, 389, 20, 15);
- private final Rectangle RECT_F_DOWN = new Rectangle(380, 420, 20, 15);
- private final Rectangle RECT_MINI_UP = new Rectangle(285, 367, 9, 8);
- private final Rectangle RECT_MINI_DOWN = new Rectangle(285, 375, 9, 7);
- private final Rectangle RECT_PLAY = new Rectangle(405, 346, 18, 18);
- private final Rectangle RECT_INFO = new Rectangle(425, 346, 18, 18);
- private final Rectangle RECT_HELP = new Rectangle(445, 346, 18, 18);
- private final Rectangle RECT_STOP = new Rectangle(465, 346, 18, 18);
- private final Rectangle RECT_HIDE = new Rectangle(495, 346, 18, 18);
- private final Rectangle RECT_CONTINUE = new Rectangle(438, 437, 69, 16);
- private final Rectangle RECT_BACK = new Rectangle(12, 437, 69, 16);
- private final Rectangle RECT_BLOCK_1 = new Rectangle(7, 458, 100, 16);
- private final Rectangle RECT_BLOCK_2 = new Rectangle(570, 235, 133, 12);
- private final Rectangle RECT_BLOCK_3 = new Rectangle(367, 56, 100, 15);
- private final Rectangle RECT_PICKUP = new Rectangle(97, 387, 197, 18);
- private final Rectangle RECT_DESTROY = new Rectangle(305, 387, 197, 18);
- final Point o = new Point(7, 344);
- private int page = 0, sTab = 1, oTab = 1, typeTo = -1;
- private String username = "", password = "", pickupName = "", destroyName = "";
- private void drawBevel(final Graphics g, final Rectangle r) {
- g.draw3DRect(r.x, r.y, r.width, r.height, true);
- }
- private void drawRect(final Graphics g, final Rectangle r) {
- g.fillRect(r.x, r.y, r.width, r.height);
- }
- private void drawTile(final Graphics g, final RSTile t, double m) {
- if (t == null)
- return;
- final int tX = t.getX(), tY = t.getY();
- Point p1 = calc.worldToMinimap(tX - m, tY - m), p2 = calc.worldToMinimap(tX - m, tY + m);
- Point p3 = calc.worldToMinimap(tX + m, tY + m), p4 = calc.worldToMinimap(tX + m, tY - m);
- if (p1.x != -1 && p2.x != -1 && p3.x != -1 && p4.x != -1) {
- int[] allX = new int[] { p1.x, p2.x, p3.x, p4.x };
- int[] allY = new int[] { p1.y, p2.y, p3.y, p4.y };
- g.fillPolygon(allX, allY, 4);
- }
- }
- public void onRepaint(final Graphics g) {
- ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- if (!authCheck || game.isLoggedIn()) {
- g.setFont(FONT_2);
- if (Option.DEBUG.enabled() && inDungeon && currentRoom != null && targetRoom != null) {
- if (skipRooms.contains(targetRoom)) {
- g.setColor(GLD);
- } else if (startRoom != null && areaEquals(targetRoom, startRoom)) {
- g.setColor(SKY);
- } else if ((puzzleRooms.contains(targetRoom)) || (bossRoom != null && areaEquals(targetRoom,
- bossRoom))) {
- g.setColor(RD1);
- } else if (finishedRooms.contains(targetRoom)) {
- g.setColor(PT2);
- } else if (finish || clearedRooms.contains(targetRoom)) {
- g.setColor(GN3);
- } else g.setColor(BL1);
- for (RSTile f : roomFlags) {
- if (!f.equals(safeTile))
- drawTile(g, f, 0.5);
- }
- if (safeTile != null) {
- g.setColor(GRN);
- drawTile(g, safeTile, 0.5);
- }
- for (RSTile dT : drawDoors) {
- if (calc.distanceBetween(myLoc(), dT) < 17) {
- RSObject dObj = objects.getTopAt(dT);
- if (dObj != null) {
- if (finishedDoors.contains(dT)) {
- g.setColor(DPL);
- } else if (lockedDoors.contains(dT) || blockedDoors.contains(dT)) {
- g.setColor(RED);
- } else if (openedDoors.contains(dT)) {
- g.setColor(GRN);
- } else g.setColor(YLW);
- for (RSTile t : dObj.getArea().getTileArray()) {
- drawTile(g, t, 0.5);
- }
- }
- }
- }
- g.setColor(BL1);
- for (RSTile t : puzzlePoints) {
- if (!t.equals(safeTile)) {
- drawTile(g, t, 0.3);
- }
- }
- }
- if (Option.VIDEO.enabled()) {
- g.setColor(BLK);
- drawRect(g, RECT_BLOCK_1);
- if ((exit || status.contains("Entering D")) && game.getCurrentTab() != Game.TAB_INVENTORY)
- drawRect(g, RECT_BLOCK_2);
- if (status.contains("next dungeon...") || (newDungeon && dungeonCount != 0 && startRoom == null))
- drawRect(g, RECT_BLOCK_3);
- }
- if (!hidePaint) {
- if (RECT_CHAT.contains(mp)) {
- g.setColor(BLK);
- g.drawString((userRank != 0 ? "Highscores rank: " + userRank + " || " : "") + (userCount != 0
- ? userCount + " users online || " : "") + "by kiko & ShadowMoose", 92 + rankOffset + userOffset, 472);
- }
- g.setColor(BT1);
- if (showSettings && page != 1)
- g.fillRect(7, 363, 80, 95);
- g.fillRect(87, 363, 426, 95);
- g.setColor(BLK);
- if (showChat) {
- g.setColor(BT3);
- } else if (RECT_CHAT.contains(mp)) {
- g.setColor(BT4);
- }
- drawRect(g, RECT_CHAT);
- g.setColor(WT2);
- g.drawLine(6, 458, 512, 458);
- if (showStats || showOptions || (showSettings && page == 1)) {
- g.drawLine(87, 363, 87, 457);
- g.drawLine(87, RECT_TAB_1.y, 511, RECT_TAB_1.y);
- }
- if (showStats && !showSettings) {
- double runTime = runTimer.getElapsed();
- if (settingsFinished && runTime != 0) {
- attGain = skills.getCurrentExp(Skills.ATTACK) - attStart;
- strGain = skills.getCurrentExp(Skills.STRENGTH) - strStart;
- defGain = skills.getCurrentExp(Skills.DEFENSE) - defStart;
- hitGain = skills.getCurrentExp(Skills.CONSTITUTION) - hitStart;
- rngGain = skills.getCurrentExp(Skills.RANGE) - rngStart;
- mgcGain = skills.getCurrentExp(Skills.MAGIC) - mgcStart;
- prayGain = skills.getCurrentExp(Skills.PRAYER) - prayStart;
- runeGain = skills.getCurrentExp(Skills.RUNECRAFTING) - runeStart;
- mineGain = skills.getCurrentExp(Skills.MINING) - mineStart;
- fireGain = skills.getCurrentExp(Skills.FIREMAKING) - fireStart;
- woodGain = skills.getCurrentExp(Skills.WOODCUTTING) - woodStart;
- crftGain = skills.getCurrentExp(Skills.CRAFTING) - crftStart;
- smthGain = skills.getCurrentExp(Skills.SMITHING) - smthStart;
- agilGain = skills.getCurrentExp(Skills.AGILITY) - agilStart;
- thevGain = skills.getCurrentExp(Skills.THIEVING) - thevStart;
- summGain = skills.getCurrentExp(Skills.SUMMONING) - summStart;
- herbGain = skills.getCurrentExp(Skills.HERBLORE) - herbStart;
- cnstGain = skills.getCurrentExp(Skills.CONSTRUCTION) - cnstStart;
- cookGain = skills.getCurrentExp(Skills.COOKING) - cookStart;
- fishGain = skills.getCurrentExp(Skills.FISHING) - fishStart;
- slayGain = skills.getCurrentExp(Skills.SLAYER) - slayStart;
- dungGain = skills.getCurrentExp(Skills.DUNGEONEERING) - dungStart;
- ceph = (int) (3600000 / runTime * (attGain + defGain + strGain + rngGain + mgcGain +
- hitGain + prayGain));
- deph = (int) (3600000 / runTime * dungGain);
- seph = (int) (3600000 / runTime * (runeGain + mineGain + fireGain + woodGain +
- smthGain + crftGain + agilGain + thevGain + summGain + herbGain + cnstGain + cookGain + fishGain + slayGain));
- fph = Math.rint((3600000 / runTime * dungeonCount) * 10) / 10;
- }
- if (sTab == 1) {
- g.setColor(BT1);
- drawRect(g, RECT_TAB_1);
- g.setColor(RECT_TAB_2.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_2);
- g.setColor(RECT_TAB_3.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_3);
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_1);
- g.clearRect(RECT_TAB_1.x + RECT_TAB_1.width, RECT_TAB_1.y + 1, 1, RECT_TAB_1.height -
- 1);
- g.drawString("Total Time: " + timeFormat(runTimer.getElapsed()), 93, 380);
- g.drawString("Dung. Level: " + dungLevel + " (+" + (dungLevel - dungStartLevel) + ")",
- 93, 398);
- g.drawString("Exp per Hour: " + deph, 93, 416);
- g.drawString("Exp Gained: " + dungGain, 93, 434);
- g.drawString("Tokens Gained: " + tokens, 93, 452);
- g.drawString("Time to Level " + levelGoal + ": " + (deph > 0 ? timeFormat
- (getDungExpToLevel() * 360 / deph * 10000) : EMPTY_TIMER), 295, 380);
- g.drawString("Dungeons Completed: " + dungeonCount + " (" + abortedCount + ")", 295,
- 398);
- g.drawString("Floors per Hour: " + fph, 295, 416);
- g.drawString("Deaths: " + deaths + " (" + perFloor(deaths) + " per floor)", 295, 434);
- g.drawString("Puzzles: " + puzzleCount + " (" + perFloor(puzzleCount) + " per floor)",
- 295, 452);
- g.drawString(RECT_MINI_UP.contains(mp) || RECT_MINI_DOWN.contains(mp) ? MINIS_S :
- MINIS, RECT_MINI_UP.x + 1, RECT_MINI_UP.y + 1);
- } else if (sTab == 2) {
- String roomString = "" + roomNumber;
- if (roomNumber == 1) {
- roomString = "Start";
- } else if (bossFight) {
- roomString = "Boss";
- }
- g.setColor(RECT_TAB_1.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_1);
- g.setColor(BT1);
- drawRect(g, RECT_TAB_2);
- g.setColor(RECT_TAB_3.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_3);
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_2);
- g.clearRect(RECT_TAB_2.x + RECT_TAB_2.width, RECT_TAB_2.y + 1, 1, RECT_TAB_2.height -
- 1);
- g.drawString("Floor Time: " + (dungTimer != null ? dungTimer.toElapsedString() :
- EMPTY_TIMER), 93, 380);
- g.drawString("Floor Type: " + floor.getName(), 93, 398);
- g.drawString("Floor Number: " + (fNumber > 0 ? fNumber : "??") + " (C" + aComplexity +
- ")", 93, 416);
- g.drawString("Current Room: " + roomString + " (of " + rooms.size() + ")", 93, 434);
- g.drawString("Prestige Count: " + prestigeCount, 93, 452);
- g.drawString("Progress: " + (maxFloor > 0 ? cProg + " of " + maxFloor + " floors" :
- "Unknown"), 295, 380);
- g.drawString("Avg. Floor Time: " + tpf + " mins", 295, 398);
- g.drawString("Fastest Dungeon: " + fastestTime, 295, 416);
- g.drawString("Slowest Dungeon: " + slowestTime, 295, 434);
- g.drawString("Floor Success Rate: " + (dungeonCount + abortedCount != 0 ? dungeonCount
- * 100 / (dungeonCount + abortedCount) : 100) + "%" , 295, 452);
- } else if (sTab == 3) {
- g.setColor(RECT_TAB_1.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_1);
- g.setColor(RECT_TAB_2.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_2);
- g.setColor(BT1);
- drawRect(g, RECT_TAB_3);
- String cbName = "Melee";
- String cbStyle = "";
- if (primaryStyle == Style.MELEE) {
- if (attGain > 0) {
- cbStyle = defGain > 0 ? "Controlled" : "Accurate";
- } else if (defGain > 0) {
- cbStyle = "Defensive";
- } else if (strGain > 0) {
- cbStyle = "Aggressive";
- } else cbStyle = "Unknown";
- } else if (primaryStyle == Style.RANGE) {
- cbName = "Range";
- cbStyle = defGain > 0 ? "Longrange" : "Rapid";
- } else if (primaryStyle == Style.MAGIC) {
- cbStyle = "Magic";
- cbStyle = defGain > 0 ? "Defensive casting" : "Autocasting";
- }
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_3);
- g.clearRect(RECT_TAB_3.x + RECT_TAB_3.width, RECT_TAB_3.y + 1, 1, RECT_TAB_3.height -
- 1);
- g.drawString(cbName + " Style: " + cbStyle, 93, 380);
- g.drawString("Pray gain: " + prayGain + ", Def gain: " + defGain, 93, 398);
- g.drawString("Combat Exp per Hour: " + ceph, 93, 416);
- g.drawString("Skills Exp per Hour: " + seph, 93, 434);
- g.drawString("Total Exp per Hour: " + (ceph + deph + seph), 93, 452);
- }
- g.setFont(FONT_1);
- g.setColor(WT3);
- g.drawString("Overview", 18, 384);
- g.drawString("Dungeons", 16, 415);
- g.drawString("Misc.", 32, 446);
- g.setColor(BT4);
- g.fillRect(7, 361, 80, 2);
- } else if (RECT_STATS.contains(mp)) {
- g.setColor(BLK);
- g.setFont(FONT_1);
- g.drawString("Statistics", 19, 358);
- g.setFont(FONT_2);
- g.setColor(BT2);
- } else g.setColor(BT4);
- drawRect(g, RECT_STATS);
- if (showOptions) {
- g.setColor(BT4);
- g.fillRect(91, 361, 80, 2);
- } else if (RECT_OPTIONS.contains(mp)) {
- g.setColor(BLK);
- g.setFont(FONT_1);
- g.drawString("Options", 108, 358);
- g.setFont(FONT_2);
- g.setColor(BT2);
- } else g.setColor(BT4);
- drawRect(g, RECT_OPTIONS);
- if ((showOptions || (showSettings && page < 2)) && oTab != 3) {
- for (Option o : options[oTab]) {
- g.setColor(o.color());
- drawRect(g, o.button());
- g.setColor(WT3);
- drawBevel(g, o.button());
- g.setColor(WT3);
- g.drawString(o.getName(), o.p().x, o.p().y);
- }
- }
- if (showOptions || page == 1) {
- if (oTab == 1) {
- g.setColor(BT1);
- drawRect(g, RECT_TAB_1);
- g.setColor(RECT_TAB_2.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_2);
- g.setColor(!showSettings && RECT_TAB_3.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_3);
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_1);
- g.clearRect(RECT_TAB_1.x + RECT_TAB_1.width, RECT_TAB_1.y + 1, 1, RECT_TAB_1.height -
- 1);
- g.setColor(WHT);
- g.drawString("Pickup:", 100, 383);
- g.drawString("Prayer:", 100, 405);
- g.drawString("Exp:", 115, 427);
- g.drawString("Other:", 105, 449);
- } else if (oTab == 2) {
- g.setColor(RECT_TAB_1.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_1);
- g.setColor(BT1);
- drawRect(g, RECT_TAB_2);
- g.setColor(!showSettings && RECT_TAB_3.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_3);
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_2);
- g.clearRect(RECT_TAB_2.x + RECT_TAB_2.width, RECT_TAB_2.y + 1, 1, RECT_TAB_2.height -
- 1);
- g.setColor(PT3);
- g.fillRect(124, 403, 19, 19);
- g.fillRect(310, 403, 19, 19);
- g.fillRect(380, 403, 22, 19);
- g.setColor(WT2);
- g.draw3DRect(124, 403, 19, 19, true);
- g.draw3DRect(310, 403, 19, 19, true);
- g.draw3DRect(380, 403, 22, 19, true);
- g.setColor(WHT);
- g.drawString("Complexity:", 93, 382);
- g.drawString("Rush Settings:", 270, 382);
- g.drawString("" + complexity, 130, 418);
- g.drawString("" + rComplexity, 316, 418);
- g.drawString("" + rushTo, rushTo < 10 ? 387 : 383, 418);
- g.setColor(WT3);
- g.drawString("Complexity", 280, 452);
- g.drawString("To floor", 365, 452);
- g.drawString(RECT_C_UP.contains(mp) ? UPARROW_S : UPARROW, 124, 387);
- g.drawString(RECT_C_DOWN.contains(mp) ? DOWNARROW_S : DOWNARROW, 124, 422);
- g.drawString(RECT_RC_UP.contains(mp) ? UPARROW_S : UPARROW, 310, 387);
- g.drawString(RECT_RC_DOWN.contains(mp) ? DOWNARROW_S : DOWNARROW, 310, 422);
- g.drawString(RECT_F_UP.contains(mp) ? UPARROW_S : UPARROW, 381, 387);
- g.drawString(RECT_F_DOWN.contains(mp) ? DOWNARROW_S : DOWNARROW, 381, 422);
- } else if (oTab == 3 && !showSettings) {
- g.setColor(RECT_TAB_1.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_1);
- g.setColor(RECT_TAB_2.contains(mp) ? BT2 : BT4);
- drawRect(g, RECT_TAB_2);
- g.setColor(BT1);
- drawRect(g, RECT_TAB_3);
- g.setColor(WHT);
- g.drawString("Loot Item:", RECT_PICKUP.x, RECT_PICKUP.y - 5);
- g.drawString("Destroy Item:", RECT_DESTROY.x, RECT_DESTROY.y - 5);
- g.setColor(PT3);
- drawRect(g, RECT_PICKUP);
- drawRect(g, RECT_DESTROY);
- g.setColor(WT3);
- drawBevel(g, RECT_TAB_3);
- g.clearRect(RECT_TAB_3.x + RECT_TAB_3.width, RECT_TAB_3.y + 1, 1, RECT_TAB_3.height -
- 1);
- g.drawString("Type in the exact item names (case-insensitive).", RECT_PICKUP.x + 1,
- RECT_PICKUP.y + 37);
- g.drawString("Enter an item to destroy if you don't have an extra bind slot.",
- RECT_PICKUP.x + 1, RECT_PICKUP.y + 53);
- drawBevel(g, RECT_PICKUP);
- drawBevel(g, RECT_DESTROY);
- if (pickupName.isEmpty() && typeTo != 0) {
- g.setColor(WT1);
- g.drawString("Item to Look For", RECT_PICKUP.x + 4, RECT_PICKUP.y + 15);
- } else g.drawString(pickupName + (typeTo == 0 ? "_" : ""), RECT_PICKUP.x + 4,
- RECT_PICKUP.y + 15);
- if (destroyName.isEmpty() && typeTo != 1) {
- g.setColor(WT1);
- g.drawString("Optional Item to Destroy", RECT_DESTROY.x + 4, RECT_DESTROY.y +
- 15);
- } else {
- g.setColor(WT3);
- g.drawString(destroyName + (typeTo == 1 ? "_" : ""), RECT_DESTROY.x + 4,
- RECT_DESTROY.y + 15);
- }
- }
- g.setFont(FONT_1);
- g.setColor(WT3);
- g.drawString("General", 22, 383);
- g.drawString("Complexity", 12, 415);
- if (!showSettings)
- g.drawString("Binding", 22, 447);
- }
- if (showSettings) {
- g.setFont(FONT_2);
- if (page > 0) {
- if (RECT_BACK.contains(mp)) {
- g.setColor(BT1);
- g.drawString("Back", 31, 450);
- g.setColor(PT2);
- } else g.setColor(PT1);
- drawRect(g, RECT_BACK);
- g.setColor(WT3);
- drawBevel(g, RECT_BACK);
- g.setColor(WHT);
- g.drawString("Back", 32, 451);
- }
- if (RECT_CONTINUE.contains(mp)) {
- g.setColor(BT1);
- g.drawString("Continue", 442, 450);
- g.setColor(PT2);
- } else g.setColor(PT1);
- drawRect(g, RECT_CONTINUE);
- g.setColor(WT3);
- drawBevel(g, RECT_CONTINUE);
- g.setColor(WHT);
- g.drawString("Continue", 443, 451);
- if (page == 0) {
- g.drawString("Choose your primary combat style", 15, 382);
- g.drawString("Choose your secondary combat style", 15, 422);
- g.drawString("Settings options:", 300, 382);
- } else if (page == 2) {
- if (Option.MELEE.enabled()) {
- page = backPage ? --page : ++page;
- } else if (Option.MAGIC.enabled()) {
- g.drawString("Wield your staff and blastbox (optional) to use.", 15, 380);
- g.drawString("Then turn the spell you want to use to autocast.", 15, 395);
- if (isAutoCasting()) {
- Spell spell = getSpell(getSelectedSpell());
- if (spell != null)
- combatSpell = spell;
- g.setColor(WT3);
- }
- g.drawString("Spell selected: " + (combatSpell != null ? combatSpell.getName()
- : "None"), 15, 415);
- } else if (Option.RANGE.enabled()) {
- g.drawString("Bind and wield the arrows you would like to use.", 15, 380);
- }
- } else if (page == 3) {
- if (Option.SECONDARY_MELEE.enabled()) {
- RSItem selected = null;
- String name = null;
- g.drawString("Bind your backup melee weapon.", 15, 395);
- g.drawString("Right click the item and select 'Use'.", 15, 410);
- if (game.getCurrentTab() == Game.TAB_INVENTORY)
- selected = inventory.getSelectedItem();
- if (selected != null) {
- secondaryWep = selected.getID();
- name = equipmentName(selected);
- }
- g.drawString("Secondary Weapon: " + (name != null ? name : "None"), 15, 425);
- } else if (Option.SECONDARY_RANGE.enabled()) {
- RSItem selected = null;
- String name = null;
- g.drawString("Bind the bow and arrows you would like to use.", 15, 380);
- g.drawString("Equip the arrows and leave the bow in your inventory.", 15,
- 395);
- g.drawString("Right click the bow and select 'Use'.", 15, 410);
- if (game.getCurrentTab() == Game.TAB_INVENTORY)
- selected = inventory.getSelectedItem();
- if (selected != null) {
- secondaryWep = selected.getID();
- name = equipmentName(selected);
- }
- g.drawString("Secondary Weapon: " + (name != null ? name : "None"), 15, 425);
- } else if (Option.SECONDARY_MAGIC.enabled()) {
- g.drawString("You'll need a filled blastbox or combat runes to use secondary magic.", 15, 380);
- g.drawString("Autocast the spell to use, then return the items to your inventory.", 15, 395);
- if (isAutoCasting()) {
- Spell spell = getSpell(getSelectedSpell());
- if (spell != null)
- combatSpell = spell;
- if (game.getCurrentTab() == Game.TAB_INVENTORY) {
- int staff = getItemID("staff (b)");
- int bBox = getItemID("blastbox (b)");
- if (bBox == -1)
- bBox = getItemID("surgebox (b)");
- if (bBox != -1)
- blastBox = bBox;
- if (staff != -1)
- secondaryWep = staff;
- }
- g.setColor(WT3);
- }
- g.drawString("Spell: " + (combatSpell != null ? combatSpell.getName() :
- "None") + ", Staff: " + (secondaryWep > 0 ? game.getCurrentTab() == Game.TAB_INVENTORY ? equipmentName(inventory.getItem
- (secondaryWep)).replace(" staff", "") : secondaryWep : "None") + ", Blastbox: " + (blastBox > 0 ? "Yes" : "No"), 15, 415);
- } else page = backPage ? --page : ++page;
- } else if (page == 4) {
- g.drawString("Be sure to bind and wield the primary weapon you would like to use.",
- 15, 380);
- g.drawString("Then select the combat style you would like to use.", 15, 395);
- g.drawString("Press continue to complete the settings.", 15, 421);
- }
- g.setColor(BT1);
- g.fillRect(175, 361, 222, 2);
- }
- g.setColor(RECT_STATUS.contains(mp) ? BT4 : BT1);
- drawRect(g, RECT_STATUS);
- if (RECT_STATUS.contains(mp)) {
- g.setColor(BLK);
- g.setFont(FONT_4);
- if (!showSettings) {
- if (!RECT_CONTROL.contains(mp) || controlStatus.isEmpty()) {
- if (secondaryStatus.isEmpty() || !showSecondary) {
- g.drawString(status, 181, 358);
- } else g.drawString("+ " + secondaryStatus, 181, 358);
- } else g.drawString(controlStatus, 181, 358);
- } else g.drawString(statusSettings, 181, 358);
- }
- g.setColor(PRP);
- g.setFont(FONT_1);
- g.drawString("Statistics", 18, 357);
- g.drawString("Options", 107, 357);
- g.setFont(FONT_4);
- if (!showSettings) {
- if (controlStatus.isEmpty() || !RECT_CONTROL.contains(mp)) {
- g.setColor(GN1);
- g.drawString(secondaryStatus.isEmpty() || !showSecondary ? status : "+ " +
- secondaryStatus, 180, 357);
- } else {
- g.setColor(RED);
- g.drawString(controlStatus, 180, 357);
- }
- } else g.drawString(statusSettings, 180, 357);
- g.setColor(PRP);
- if (settingsFinished) {
- g.setFont(FONT_3);
- g.drawString("v" + VERSION, 484, 455);
- }
- g.setFont(FONT_2);
- g.drawString((userRank != 0 ? "Highscores rank: " + userRank + " || " : "") + (userCount != 0 ?
- userCount + " users online || " : "") + "by kiko & ShadowMoose", 91 + rankOffset + userOffset, 471);
- }
- g.setColor(BT1);
- drawRect(g, RECT_CONTROL);
- if (RECT_CONTROL.contains(mp)) {
- if (!pauseiDungeon) {
- g.drawString(RECT_PLAY.contains(mp) ? PLAY_S : PLAY, RECT_PLAY.x, RECT_PLAY.y);
- } else g.drawString(RECT_PLAY.contains(mp) ? PAUSE_S : PAUSE, RECT_PLAY.x, RECT_PLAY.y);
- g.drawString(RECT_INFO.contains(mp) ? INFO_S : INFO, RECT_INFO.x, RECT_INFO.y);
- g.drawString(RECT_HELP.contains(mp) ? HELP_S : HELP, RECT_HELP.x, RECT_HELP.y);
- g.drawString(RECT_STOP.contains(mp) ? STOP_S : STOP, RECT_STOP.x, RECT_STOP.y);
- } else g.drawString(LOGO, RECT_CONTROL.x, RECT_CONTROL.y);
- g.drawString(RECT_HIDE.contains(mp) ? HIDE_S : HIDE, RECT_HIDE.x, RECT_HIDE.y);
- }
- }
- public void keyPressed(KeyEvent e) { }
- public void keyReleased(KeyEvent e) { }
- public void keyTyped(KeyEvent e) {
- if (!hidePaint && showOptions && oTab == 3) {
- char key = e.getKeyChar();
- if (key == KeyEvent.VK_ENTER || key == KeyEvent.VK_TAB) {
- typeTo = typeTo < 1 ? ++typeTo : -1;
- env.setUserInput(typeTo != -1 ? 0 : Environment.INPUT_KEYBOARD);
- } else if (typeTo == 0) {
- if (key == KeyEvent.VK_BACK_SPACE && pickupName.length() > 0) {
- pickupName = pickupName.substring(0, pickupName.length() - 1);
- } else if (key != KeyEvent.VK_BACK_SPACE && pickupName.length() < 25) {
- pickupName += key;
- }
- } else if (typeTo == 1) {
- if (key == KeyEvent.VK_BACK_SPACE && destroyName.length() > 0) {
- destroyName = destroyName.substring(0, destroyName.length() - 1);
- } else if (key != KeyEvent.VK_BACK_SPACE && destroyName.length() < 25) {
- destroyName += key;
- }
- }
- }
- }
- public void messageReceived(MessageEvent e) {
- int id = e.getID();
- String msg = e.getMessage();
- if (id == MessageEvent.MESSAGE_SERVER) {
- if (msg.equals("Welcome to RuneScape.")) {
- welcomeBack = true;
- } else if (msg.startsWith("Oh dear")) {
- isDead = true;
- } else if (msg.startsWith("Floor <")) {
- int idx = msg.indexOf(">") + 1;
- if (idx != 0) {
- fNumber = Integer.parseInt(msg.substring(idx, idx + 2).trim());
- cProg = fNumber - 1;
- }
- } else if (msg.startsWith("You unlock the door")) {
- lockDown = true;
- } else if (msg.contains("been frozen") || msg.contains("force prevents") || msg.contains("force stops") ||
- msg.contains("You're stunned")) {
- unreachable = true;
- } else if (msg.contains("cannot teleport")) {
- finish = true;
- } else if ((msg.startsWith("You need a") || msg.contains("require a")) && msg.contains("level of")) {
- levelRequirement = false;
- } else if (msg.contains("need at least ") && msg.contains("to do that")) {
- levelRequirement = false;
- } else if (combatStyle == Style.RANGE && msg.contains("ammo left in") && !secondaryStatus.startsWith
- ("Swapping")) {
- outOfAmmo = true;
- } else if (combatStyle == Style.MAGIC && msg.contains("runes to cast") && !secondaryStatus.startsWith
- ("Swapping") && (msg.contains("air") || msg.contains("chaos") || msg.contains("death") || msg.contains("blood"))) {
- outOfAmmo = true;
- } else if (msg.contains("advanced a Dung")) {
- dungLevel++;
- if (levelGoal <= dungLevel)
- levelGoal = dungLevel + 1;
- } else if (puzzleTimer != null) {
- if (msg.contains("toggle back off") || msg.contains("both the chest in")) {
- roomSwitch = true;
- } else if (msg.contains("hear a click") || msg.contains("now unlocked") || msg.contains("challenge room has already")) {
- puzzleSolved = true;
- } else if (msg.contains("sever the plant") || msg.contains("monolith reaches")) {
- puzzleSolved = true;
- }
- } else if (bossFight) {
- if (msg.contains("got caught")) {
- roomSwitch = true;
- }
- if (msg.contains(" pull")) {
- roomSwitch = true;
- } else if (msg.contains("received item: ")) {
- itemReceived = true;
- } else if (msg.contains("prayer") && (msg.contains("deactivated") || msg.contains("injured"))) {
- prayTimer = new Timer(random(10000, 20000));
- } else if (floor == Floor.WARPED) {
- if (msg.contains("consumes your prayers"))
- prayTimer = new Timer(random(25000, 35000));
- }
- }
- } else if (id == 4 && msg.contains("can't reach")) {
- unreachable = true;
- }
- if (id == MessageEvent.MESSAGE_SERVER || id == MessageEvent.MESSAGE_EXAMINE_NPC || id == MessageEvent.MESSAGE_ACTION)
- lastMessage = msg;
- }
- public void mouseMoved(MouseEvent e) {
- mp = e.getPoint();
- if (RECT_CONTROL.contains(mp)) {
- if (RECT_PLAY.contains(mp)) {
- controlStatus = (!pauseiDungeon ? "Pause" : "Resume") + " iDungeon";
- } else if (RECT_STOP.contains(mp)) {
- controlStatus = "Terminate iDungeon";
- } else if (RECT_INFO.contains(mp)) {
- controlStatus = "Visit the iDungeon forums";
- } else if (RECT_HELP.contains(mp)) {
- controlStatus = "iDungeon help guide";
- } else if (RECT_HIDE.contains(mp)) {
- controlStatus = "Hide paint";
- } else controlStatus = "";
- } else if (showSettings) {
- statusSettings = statusSettings.isEmpty() || statusSettings.startsWith("Hover") ? "Hover over an option to find out more" : "Please choose your settings";
- if (page > 0 && RECT_BACK.contains(mp)) {
- statusSettings = "<<< Previous page";
- } else if (RECT_CONTINUE.contains(mp)) {
- statusSettings = page < 5 ? statusSettings = "Next page >>>" : "Finish the settings";
- } else if (RECT_CHAT.contains(mp)) {
- statusSettings = "These guys kick ass!";
- } else if (page == 0 && oTab == 0) {
- if (Option.MELEE.contains(mp)) {
- statusSettings = "Set your primary combat to melee";
- } else if (Option.RANGE.contains(mp)) {
- statusSettings = "Set your primary combat to range";
- } else if (Option.MAGIC.contains(mp)) {
- statusSettings = "Set your primary combat to range";
- } else if (Option.SECONDARY_MELEE.contains(mp)) {
- statusSettings = "Set your secondary combat to melee";
- } else if (Option.SECONDARY_RANGE.contains(mp)) {
- statusSettings = "Set your secondary combat to range";
- } else if (Option.SECONDARY_MAGIC.contains(mp)) {
- statusSettings = "Set your secondary combat to mage";
- } else if (Option.LOAD_SETTINGS.contains(mp)) {
- statusSettings = "Load your settings on startup";
- } else if (Option.SAVE_SETTINGS.contains(mp)) {
- statusSettings = "Save your settings for next time";
- }
- } else if (page == 1) {
- if (RECT_TAB_1.contains(mp)) {
- statusSettings = "General script settings";
- } else if (RECT_TAB_2.contains(mp)) {
- statusSettings = "Advanced floor settings & complexity";
- } else if (!showSettings && RECT_TAB_3.contains(mp)) {
- statusSettings = "Search and bind an item";
- } else if (oTab == 1) {
- if (Option.BONES.contains(mp)) {
- statusSettings = "Pick up and bury bones";
- } else if (Option.ARROWS.contains(mp)) {
- statusSettings = "Collect the arrows you use up";
- } else if (Option.CRABS.contains(mp)) {
- statusSettings = "Loot heim crabs, for extra hp";
- } else if (Option.PRAY.contains(mp)) {
- statusSettings = "Use protection prayers for monsters";
- } else if (Option.QUICK_PRAY.contains(mp)) {
- statusSettings = "Use quick prayers in addition";
- } else if (Option.PRAY_DOORS.contains(mp)) {
- statusSettings = "Enable this to open prayer doors";
- } else if (Option.PURE.contains(mp)) {
- statusSettings = "Prevents defense training";
- } else if (Option.STYLE_SWAP.contains(mp)) {
- statusSettings = "Switch attack styles by weakness";
- } else if (Option.SUMMON.contains(mp)) {
- statusSettings = "Gain summoning experience";
- } else if (Option.MAKE_FOOD.contains(mp)) {
- statusSettings = "Make food when you're running low";
- } else if (Option.EXPLORER.contains(mp)) {
- statusSettings = "Open all explorable rooms on the floor";
- } else if (Option.LOGOUT.contains(mp)) {
- statusSettings = "Avoid the 6-hour logout timer";
- }
- } else if (oTab == 2) {
- if (RECT_C_UP.contains(mp) || RECT_C_DOWN.contains(mp)) {
- statusSettings = "Cycle the Dungeon's Complexity level";
- } else if (RECT_RC_UP.contains(mp) || RECT_RC_DOWN.contains(mp)) {
- statusSettings = "Select the complexity to rush at";
- } else if (RECT_F_UP.contains(mp) || RECT_F_DOWN.contains(mp)) {
- statusSettings = "Select the floor to rush to";
- } else if (Option.PRESTIGE.contains(mp)) {
- statusSettings = "Intelligently reset your progress";
- } else if (Option.MEDIUM.contains(mp)) {
- statusSettings = "Explore Medium dungeons";
- } else if (Option.DEBUG.contains(mp)) {
- statusSettings = "Paint doors and rooms on the map";
- } else if (Option.VIDEO.contains(mp)) {
- statusSettings = "Blacks out all usernames - BETA";
- } else if (Option.RUSH.contains(mp)) {
- statusSettings = "Enable rushing of certain floors";
- } else if (Option.RUSH_FOOD.contains(mp)) {
- statusSettings = "Enable food pickup when rushing";
- }
- }
- }
- }
- }
- public void mouseClicked(MouseEvent e) {
- Point p = e.getPoint();
- cp = e.getPoint();
- if (RECT_STATUS.contains(p)) {
- if (confirmToStop) {
- authCheck = true;
- status = "Shutting down iDungeon Pro";
- secondaryStatus = "";
- } else if (secondaryStatus.isEmpty()) {
- showSecondary = true;
- } else showSecondary = !showSecondary;
- } else if (RECT_PLAY.contains(p)) {
- pauseiDungeon = !pauseiDungeon;
- } else if (RECT_STOP.contains(p)) {
- confirmToStop = !confirmToStop;
- showSecondary = true;
- secondaryStatus = confirmToStop ? "Click here to confirm shutdown" : "";
- } else if (RECT_INFO.contains(p)) {
- try {
- Desktop.getDesktop().browse(new URI("http://shadowscripting.org/forums/viewforum.php?f=2"));
- } catch (Exception ex) {
- log(RED, "Unable to load the forums :(");
- }
- } else if (RECT_HELP.contains(p)) {
- try {
- Desktop.getDesktop().browse(new URI("http://shadowscripting.wordpress.com/idungeon-users-guide/"));
- } catch (Exception ex) {
- log(RED, "Unable to load the help manual :(");
- }
- } else if (RECT_HIDE.contains(p)) {
- hidePaint = !hidePaint;
- } else if (!hidePaint) {
- if (RECT_CHAT.contains(p)) {
- showChat = !showChat;
- } else if (RECT_STATS.contains(p) && !showSettings) {
- showStats = true;
- showOptions = false;
- } else if (RECT_OPTIONS.contains(p) && !showSettings) {
- showStats = false;
- showOptions = true;
- } else if (showSettings && page == 0) {
- if (Option.MELEE.contains(p)) {
- if (!Option.SECONDARY_RANGE.enabled())
- Option.ARROWS.set(false);
- Option.MELEE.set(true);
- Option.RANGE.set(false);
- Option.MAGIC.set(false);
- Option.SECONDARY_MELEE.set(false);
- } else if (Option.RANGE.contains(p)) {
- if (!Option.SECONDARY_MAGIC.enabled())
- Option.SECONDARY_MELEE.set(true);
- Option.MELEE.set(false);
- Option.RANGE.set(true);
- Option.MAGIC.set(false);
- Option.SECONDARY_RANGE.set(false);
- Option.ARROWS.set(true);
- } else if (Option.MAGIC.contains(p)) {
- if (!Option.SECONDARY_RANGE.enabled()) {
- Option.ARROWS.set(true);
- Option.SECONDARY_MELEE.set(true);
- }
- Option.MELEE.set(false);
- Option.RANGE.set(false);
- Option.MAGIC.set(true);
- Option.SECONDARY_MAGIC.set(false);
- } else if (Option.SECONDARY_MELEE.contains(p)) {
- if (!Option.MELEE.enabled()) {
- Option.SECONDARY_MELEE.toggle();
- if (Option.SECONDARY_MELEE.enabled()) {
- Option.SECONDARY_RANGE.set(false);
- Option.SECONDARY_MAGIC.set(false);
- }
- if (!Option.RANGE.enabled())
- Option.ARROWS.set(true);
- }
- } else if (Option.SECONDARY_RANGE.contains(p)) {
- if (!Option.RANGE.enabled()) {
- Option.SECONDARY_RANGE.toggle();
- if (Option.SECONDARY_RANGE.enabled()) {
- Option.SECONDARY_MELEE.set(false);
- Option.SECONDARY_MAGIC.set(false);
- }
- Option.ARROWS.set(true);
- }
- } else if (Option.SECONDARY_MAGIC.contains(p)) {
- if (!Option.MAGIC.enabled()) {
- Option.SECONDARY_MAGIC.toggle();
- if (Option.SECONDARY_MAGIC.enabled()) {
- Option.SECONDARY_MELEE.set(false);
- Option.SECONDARY_RANGE.set(false);
- }
- if (!Option.RANGE.enabled())
- Option.ARROWS.set(false);
- }
- } else if (Option.LOAD_SETTINGS.contains(p)) {
- Option.LOAD_SETTINGS.toggle();
- } else if (Option.SAVE_SETTINGS.contains(p)) {
- Option.SAVE_SETTINGS.toggle();
- }
- } else if (showStats && sTab == 1) {
- if (RECT_MINI_UP.contains(p)) {
- levelGoal = levelGoal == 120 ? dungLevel + 1 : ++levelGoal;
- } else if (RECT_MINI_DOWN.contains(p)) {
- levelGoal = levelGoal == dungLevel + 1 ? 120 : --levelGoal;
- }
- } else if ((showSettings && page == 1) || showOptions) {
- if (RECT_TAB_1.contains(p)) {
- oTab = 1;
- } else if (RECT_TAB_2.contains(p)) {
- oTab = 2;
- } else if (!showSettings && RECT_TAB_3.contains(p)) {
- oTab = 3;
- } else if (oTab == 1) {
- if (Option.BONES.contains(p)) {
- Option.BONES.toggle();
- } else if (Option.ARROWS.contains(p)) {
- if (Option.RANGE.enabled() || Option.SECONDARY_RANGE.enabled())
- Option.ARROWS.toggle();
- } else if (Option.CRABS.contains(p)) {
- Option.CRABS.toggle();
- } else if (Option.PRAY.contains(p)) {
- Option.PRAY.toggle();
- } else if (Option.QUICK_PRAY.contains(p)) {
- Option.QUICK_PRAY.toggle();
- } else if (Option.PRAY_DOORS.contains(p)) {
- Option.PRAY_DOORS.toggle();
- if (!Option.PRAY_DOORS.enabled())
- log(RED, "Warning! Disabling prayer doors & puzzles will force the bot to abort dungeons");
- } else if (Option.PURE.contains(p)) {
- Option.PURE.toggle();
- } else if (Option.STYLE_SWAP.contains(p)) {
- if (!settingsFinished || Melee.SLASH.index() != -1)
- Option.STYLE_SWAP.toggle();
- } else if (Option.SUMMON.contains(p)) {
- Option.SUMMON.toggle();
- if (!Option.SUMMON.enabled())
- log(RED, "Warning! Disabling summoning doors & puzzles will force the bot to abort dungeons");
- } else if (Option.MAKE_FOOD.contains(p)) {
- Option.MAKE_FOOD.toggle();
- } else if (Option.EXPLORER.contains(p)) {
- Option.EXPLORER.toggle();
- } else if (Option.LOGOUT.contains(p)) {
- Option.LOGOUT.toggle();
- }
- } else if (oTab == 2) {
- if (RECT_C_UP.contains(p)) {
- if (complexity < 6) {
- complexity++;
- } else complexity = 1;
- } else if (RECT_C_DOWN.contains(p)) {
- if (complexity > 1) {
- complexity--;
- } else complexity = 6;
- } else if (RECT_RC_UP.contains(p)) {
- if (rComplexity != 6) {
- rComplexity++;
- } else rComplexity = 1;
- } else if (RECT_RC_DOWN.contains(p)) {
- if (rComplexity != 1) {
- rComplexity--;
- } else rComplexity = 6;
- } else if (RECT_F_UP.contains(p)) {
- if (maxFloor > 0) {
- rushTo = rushTo < maxFloor ? ++rushTo : 1;
- } else if (rushTo < 35) {
- rushTo++;
- } else rushTo = 1;
- } else if (RECT_F_DOWN.contains(p)) {
- if (rushTo > 1) {
- rushTo--;
- } else if (maxFloor > 0) {
- rushTo = valueOf(maxFloor);
- } else rushTo = 35;
- } else if (Option.RUSH.contains(p)) {
- Option.RUSH.toggle();
- } else if (Option.PRESTIGE.contains(p)) {
- Option.PRESTIGE.toggle();
- } else if (Option.MEDIUM.contains(p)) {
- Option.MEDIUM.toggle();
- } else if (Option.DEBUG.contains(p)) {
- Option.DEBUG.toggle();
- } else if (Option.RUSH_FOOD.contains(p)) {
- Option.RUSH_FOOD.toggle();
- } else if (Option.VIDEO.contains(p)) {
- Option.VIDEO.toggle();
- }
- } else if (!showSettings && oTab == 3) {
- if (RECT_PICKUP.contains(p)) {
- env.setUserInput(0);
- typeTo = 0;
- } else if (RECT_DESTROY.contains(p)) {
- env.setUserInput(0);
- typeTo = 1;
- } else {
- env.setUserInput(Environment.INPUT_KEYBOARD);
- typeTo = -1;
- }
- }
- }
- if (showSettings) {
- if (RECT_CONTINUE.contains(p)) {
- if (page == 0)
- oTab = 1;
- backPage = false;
- page++;
- if (page > 4) {
- showSettings = false;
- showStats = true;
- &nbs