- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Point;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.net.URL;
- import org.powerbot.event.events.ServerMessageEvent;
- import org.powerbot.event.listeners.PaintListener;
- import org.powerbot.event.listeners.ServerMessageListener;
- import org.powerbot.script.Script;
- import org.powerbot.script.ScriptManifest;
- import org.powerbot.script.methods.Skills;
- import org.powerbot.script.util.Filter;
- import org.powerbot.script.util.Timer;
- import org.powerbot.script.util.WindowUtil;
- import org.powerbot.script.wrappers.RSCharacter;
- import org.powerbot.script.wrappers.RSGroundItem;
- import org.powerbot.script.wrappers.RSNPC;
- import org.powerbot.script.wrappers.RSObject;
- import org.powerbot.script.wrappers.RSTile;
- import java.awt.*;
- import org.rsbot.script.*;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- public class Liamsresponder extends Random {
- public int dyingAnimation = 836;
- String reply = "NO REPLY";
- String textSent;
- String[] oldQ = {""};
- long nextTalk = System.currentTimeMillis() + random(160000, 170000 * random(2, 4));
- long lastCheck = -1; //lets make it do a check at the start
- String[] attackNames = {"Attack", "attack", "ATT", "Att", "att", "atk"};
- String[] defenseNames = {"Defence", "defence", "Defense", "defense", "Def", "def"};
- String[] strengthNames = {"Strength", "strength", "STR", "Str", "str"};
- String[] hitpointsNames = {"Hitpoints", "hitpoints", "Hp", "hp"};
- String[] rangeNames = {"Range", "range", "Ranged", "ranged"};
- String[] prayerNames = {"Prayer", "prayer", "Pray", "prayr"};
- String[] magicNames = {"Magic", "magic", "Mage", "mage"};
- String[] cookingNames = {"Cooking", "cooking", "Cook", "cook", "Cookn", "cookn"};
- String[] woodcuttingNames = {"Woodcutting", "woodcutting", "Wc", "wc", "Woodcuttn", "woodcuttn"};
- String[] fletchingNames = {"Fletching", "fletching", "Fletch", "fletch", "Flechn", "flechn"};
- String[] fishingNames = {"Fishing", "fishing", "Fish", "fish"};
- String[] firemakingNames = {"Firemaking", "firemaking", "Firemake", "firemake", "Fm", "fm"};
- String[] craftingNames = {"Crafting", "crafting", "Craft", "craft"};
- String[] smithingNames = {"Smithing", "smithing", "Smith", "smith"};
- String[] miningNames = {"Mining", "mining", "Mine", "mine"};
- String[] herbloreNames = {"Herblore", "herblore", "Herb", "herb"};
- String[] agilityNames = {"Agility", "agility", "Agil", "agil"};
- String[] thievingNames = {"Thieving", "thieving", "Theif", "thief"};
- String[] slayerNames = {"Slayer", "slayer", "Slay", "slay"};
- String[] runecraftingNames = {"Runecrafting", "runecrafting", "Runecraft", "runecraft", "RC", "Rc", "rc"};
- String[] farmingNames = {"Farming", "farming", "Farm", "farm"};
- String[] hunterNames = {"Hunting", "hunting", "Hunter", "hunter"};
- String[] constructionNames = {"Construction", "construction", "constructing", "constructing"};
- String[] summoningNames = {"Summoning", "summoning", "Summon", "summon", "Summonin", "summonin"};
- public int dist;
- public String statName(int stat) {
- if (stat == Skills.ATTACK) {
- return pickRandomName(attackNames);
- }
- if (stat == Skills.DEFENSE) {
- return pickRandomName(defenseNames);
- }
- if (stat == Skills.STRENGTH) {
- return pickRandomName(strengthNames);
- }
- if (stat == Skills.CONSTITUTION) {
- return pickRandomName(hitpointsNames);
- }
- if (stat == Skills.RANGE) {
- return pickRandomName(rangeNames);
- }
- if (stat == Skills.PRAYER) {
- return pickRandomName(prayerNames);
- }
- if (stat == Skills.MAGIC) {
- return pickRandomName(magicNames);
- }
- if (stat == Skills.COOKING) {
- return pickRandomName(cookingNames);
- }
- if (stat == Skills.WOODCUTTING) {
- return pickRandomName(woodcuttingNames);
- }
- if (stat == Skills.FLETCHING) {
- return pickRandomName(fletchingNames);
- }
- if (stat == Skills.FISHING) {
- return pickRandomName(fishingNames);
- }
- if (stat == Skills.FIREMAKING) {
- return pickRandomName(firemakingNames);
- }
- if (stat == Skills.CRAFTING) {
- return pickRandomName(craftingNames);
- }
- if (stat == Skills.SMITHING) {
- return pickRandomName(smithingNames);
- }
- if (stat == Skills.MINING) {
- return pickRandomName(miningNames);
- }
- if (stat == Skills.HERBLORE) {
- return pickRandomName(herbloreNames);
- }
- if (stat == Skills.AGILITY) {
- return pickRandomName(agilityNames);
- }
- if (stat == Skills.THIEVING) {
- return pickRandomName(thievingNames);
- }
- if (stat == Skills.SLAYER) {
- return pickRandomName(slayerNames);
- }
- if (stat == Skills.RUNECRAFTING) {
- return pickRandomName(runecraftingNames);
- }
- if (stat == Skills.FARMING) {
- return pickRandomName(farmingNames);
- }
- if (stat == Skills.HUNTER) {
- return pickRandomName(hunterNames);
- }
- if (stat == Skills.CONSTRUCTION) {
- return pickRandomName(constructionNames);
- }
- if (stat == Skills.SUMMONING) {
- return pickRandomName(summoningNames);
- }
- return null;
- }
- public void talk() {
- long currentTime = System.currentTimeMillis();
- long minutes = (currentTime - lastCheck) / (60000);
- if (lastCheck == -1) {
- for (int i = 0; i < training.length; i++) {
- oldXP[i] = skills.getCurrentExp(i);
- }
- }
- if (minutes >= 1) {
- lastCheck = System.currentTimeMillis();
- for (int i = 0; i < training.length; i++) {
- if (oldXP[i] != skills.getCurrentExp(i)) {
- if (training[i] <= 5) {
- training[i]++;
- }
- } else {
- training[i] = 0;
- }
- }
- for (int i = 0; i < training.length; i++) {
- oldXP[i] = skills.getCurrentExp(i);
- }
- }
- int biggest = -1;
- int biggestNum = -1;
- for (int i = 0; i < training.length; i++) {
- if (training[i] > biggest && training[i] > 0) {
- biggest = training[i];
- biggestNum = i;
- }
- }
- if (biggest > 0) {
- talk2(biggestNum);
- }
- }
- public String xpToString(int level) {
- String[] extraArray = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ". :\\", ".:\\", " :\\", ":\\", ". :O", ".:O", " :O", "O.O",
- ". :)", ".;]]", " :)", ":)", ". :[]", ".:]", " :]", ":]",
- ". :P", ".:P", " :P", ":D", ". :D", ".:O", " :O", ":L",};
- int percent = skills.getPercentToNextLevel(level);
- int xpTo = skills.getExpToNextLevel(level);
- int skillLevel = skills.getCurrentLevel(level);
- String only = "";
- String temp = "";
- String[] toArray = {"to", "to", "to", "2", "till", "till", "until", "until"};
- String to = toArray[random(0, toArray.length)];
- String[] onlyArray = {"only", "just"};
- if (percent < 20 && random(1, 5) == 3) {
- only = onlyArray[random(0, 1)] + " ";
- }
- String k = "k";
- String m = "m";
- if (random(0, 2) == 0) {
- k = "K";
- m = "M";
- }
- if (xpTo > 1000000) {
- temp = xpTo / 1000000 + m;
- } else if (xpTo > 1000) {
- temp = xpTo / 1000 + k;
- } else {
- temp = "" + xpTo;
- }
- String[] moreArray = {"to go", "more", "left", "To Go", "More", "Left"};
- String more = moreArray[random(0, moreArray.length)];
- String[] xpArray = {"xp", "XP", "Xp", "EXP", "Exp", "exp", "Experience", "experience"};
- String xp = xpArray[random(0, xpArray.length)];
- String[] levelArray = {"Lvl", "LVL", "lvl",
- "Lev", "lev", "LV", "lv", "Lv", "Level", "level"};
- String lvl = levelArray[random(0, levelArray.length)];
- String[] talkArray = {only + temp + xp + " " + more + " " + to + " " + lvl + " " + (skillLevel + 1), only + temp + " " + statName(level) + " " + xp + " " + more + " " + to + " " + lvl + " " + (skillLevel + 1),
- "i " + only + "need " + temp + " " + xp + " " + more + " " + to + " " + lvl + " " + skillLevel, "i " + only + "need " + temp + " " + statName(level) + " " + xp + " " + more + " " + to + " " + lvl + " " + (skillLevel + 1)};
- return talkArray[random(0, talkArray.length)] + extraArray[random(0, extraArray.length)];
- }
- public void hoverInterface(int iface, int child) {
- hoverInterface(interfaces.getComponent(iface, child));
- }
- public void hoverInterface(RSComponent i) {
- if (!i.isValid()) {
- return;
- }
- Rectangle pos = i.getArea();
- mouse.move((int) random(pos.getMinX(), pos.getMaxX()), (int) random(pos.getMinY(), pos.getMaxY()));
- }
- public void talk2(int skill) {
- if (nextTalk > System.currentTimeMillis()) {
- return;
- }
- nextTalk = System.currentTimeMillis() + random(140000, 160000 * random(2, 4));
- getNearestPlayerDistance();
- if (dist >= 5) //nobodys close enough to talk to.
- {
- return;
- }
- String[] extraArray = {"", "", "", "?", "?", "?", "."};
- String extra = extraArray[random(0, extraArray.length)];
- int gamble = random(1, 3);
- String stat = statName(skill);
- int level = skills.getCurrentLevel(skill);
- String only = "";
- String[] onlyArray = {"only", "just"};
- if (level < 30 && random(1, 5) == 3) {
- only = onlyArray[random(0, 1)] + " ";
- }
- String[] extraArray2 = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ". =\\", ".x[)", " =\\", " lol", ". =O", ".=O", " =O", "=O",
- ". =)", ".=)", " =)", "=)", ". =]", ".=]", " =]", "=]",
- ". =P", ".=P", " =P", "=P", ". =D", ".=D", " =D", "=D",};
- String extra2 = extraArray2[random(0, extraArray2.length)];
- String[] levelArray = {"", "", "", "", "", "Lvl ", "LVL ", "lvl ",
- "Lev ", "lev ", "LV ", "lv ", "Lv ", "Level ", "level "};
- String lvl = levelArray[random(0, levelArray.length)];
- String[] misc1 = {"what's your", "wuts ur", "whats your", "what's your", "whuts yur"};
- String[] echoMineArray = {"mine is " + only + lvl + level, "mine is " + only + lvl + level, "mine is " + only + lvl + level, only + lvl + level + " here",
- only + lvl + level + " over here"};
- String echoMine = echoMineArray[random(0, echoMineArray.length)];
- if (gamble == 1) {
- textSent = misc1[random(0, misc1.length)] + " " + stat + " level" + extra;
- keyboard.sendText(textSent, true);
- sleep(random(100, 300));
- if (random(0, 21) != 20) //one in 20 chance it wont say your level back.
- {
- sleep(random(6000, 7000));
- }
- keyboard.sendText(echoMine + extra2, true);
- } else if (gamble == 2) {
- int oldTab = game.getCurrentTab();
- game.openTab(Game.TAB_STATS);
- sleep(random(100, 200));
- hoverInterface(320, 125 + random(0, 5));
- sleep(random(500, 2000));
- String text = xpToString(skill);
- System.out.println("\n\n\n" + text + "\n\n\n");
- keyboard.sendText(text, true);
- game.openTab(oldTab);
- }
- }
- public String getName() { //Name of the Script
- return "KaiChatResponder"; //between "" what will show up in RSBot script selector
- }
- public double getVersion() { //Version of the Script
- return 1.0; //what will show up in RSBot script selector
- }
- public String getAuthor() { //Author of the Script
- return "Kai Bliss"; //what will show up in RSBot script selector
- }
- public boolean onStart(String[] args) { //First thing run, when a Script is started (holds an array called "args" which contain the arguments put in by user in Script Selector
- return true; //return true = Start Script; return false = Don't Start Script
- }
- public String getChildText(int iface, int child) {
- return interfaces.get(iface).getComponent(child).getText();
- }
- public String[] getChatMessages(boolean stripName) {
- String[] temp = new String[100];
- int tempi = 0;
- for (int i = 155; i >= 56; i--) {
- if (getChildText(137, i).contains("<col=0000ff>")) {
- if (stripName) {
- temp[tempi] = getChildText(137, i).substring(getChildText(137, i).indexOf("<col=0000ff>") + 12);
- tempi++;
- } else {
- temp[tempi] = getChildText(137, i).replaceAll("<col=0000ff>", "");
- tempi++;
- }
- }
- }
- return temp;
- }
- String oldChat = "";
- String[] chat = new String[100];
- String[] chat2 = new String[100];
- int[] training = new int[Skills.SUMMONING];
- int[] oldXP = new int[Skills.SUMMONING];
- public boolean activateCondition() { //Main function of the Script
- reply();
- talk();
- return false;
- }
- public void reply() {
- chat = getChatMessages(true);
- chat2 = getChatMessages(false);
- if (chat[0] == null || oldChat.equalsIgnoreCase(chat2[0])) {
- return;
- }
- if (oldQ[0].equalsIgnoreCase(chat2[0])) {
- return;
- }
- String temp = chat2[0];
- String name = temp.substring(0, temp.indexOf(":"));
- if (name.equalsIgnoreCase(getMyPlayer().getName())) {
- return;
- }
- if (replyToPlayer(chat[0])) {
- log("KaiChatResponder is replying to: ");
- log(chat2[0]);
- log("Successfully talked with:");
- log(reply);
- oldQ[0] = chat2[0];
- }
- }
- public int loop() {
- return -1; //wtf? this shouldn't be called.
- }
- public String pickRandomName(String[] possible) { //it needs to USUALLY pick the first two.
- if (random(0, 5) == 3) {
- return possible[random(0, possible.length)];
- } else {
- return possible[random(0, 1)];
- }
- }
- public boolean replyToPlayer(String text) {
- text = text.toLowerCase();
- reply = "NO REPLY";
- Boolean doPrefix = true;
- int oldTab = -1;
- if (getMyPlayer().getAnimation() == dyingAnimation) {
- String[] deathArray = {"aww thats nooby", "well that sucks dunt it", "oh man", "dang it", "..."};
- String death = deathArray[random(0, deathArray.length)];
- keyboard.sendText(death, true);
- reply = death;
- return true;
- }
- if (text.contains("hey") || text.contains("hi") || text.contains("hello") || text.contains("hai der") || text.contains("yo") || text.contains("sappnin") || text.contains("hai")) {
- String[] AccountArray = {"Hello", "Hey!", "shut up please i cba talking", "uhh hey", "Hai der", "Sup kid", "Can't be botherd talking no offence", "What you want? I'm not in a good mood.."};
- String Account = AccountArray[random(0, AccountArray.length)];
- keyboard.sendText(Account, true);
- reply = Account;
- return true;
- }
- if (text.contains("botting?") || text.contains("ur a bot") || text.contains("bot?") || text.contains("macro?") || text.contains("bot..")) {
- String[] bottingArray = {"Don't Think So Kid.", "Nope Just don't Like talking Much", "Wouldn't Risk My account Kiddo", ":L Botting Fails", "Nope i'm all Legit mate", "Nooo Don't be mad", "I've never Botted never Will", "So now that i don't talk i get accused of botting?"};
- String botting = bottingArray[random(0, bottingArray.length)];
- keyboard.sendText(botting, true);
- reply = botting;
- return true;
- }
- if (text.contains("im bored") || text.contains("i'm bored") || text.contains("i am bored") || text.contains("i ma bored")) {
- String[] boredArray = {"Same hard work this.", "I am a lil", "*sleeps* me too", "so am i", "i am also", "I could sleep on my Keyboard ATM", "LOLATYOU", "i'm not", "Neeh im not", "Rs is too call to be board, im just tired"};
- String bored = boredArray[random(0, boredArray.length)];
- keyboard.sendText(bored, true);
- reply = bored;
- return true;
- }
- if (text.contains("leveld") || text.contains("yes finally level up") || text.contains("w00t level up") || text.contains("yipee") || text.contains("yay! level up")) {
- String[] wootArray = {"Gratz", "Nice", "congratulations", "Congratz mate"};
- String woot = wootArray[random(0, wootArray.length)];
- keyboard.sendText(woot, true);
- reply = woot;
- return true;
- }
- if (text.contains("k till") || text.contains("k untill")) {
- String[] ktillArray = {"oooo", "Lol nice, good luck bro", "good luck mate", "nice", "that's nice", "sweet", "wow", "gratz"};
- String ktill = ktillArray[random(0, ktillArray.length)];
- keyboard.sendText(ktill, true);
- reply = ktill;
- return true;
- }
- if (text.contains("m till") || text.contains("m untill")) {
- String[] mtillArray = {"OMG GL", "LOL", "dang man!", "dang", "holy cow", "w0w", "good luck!", "going to take you forever"};
- String mtill = mtillArray[random(0, mtillArray.length)];
- keyboard.sendText(mtill, true);
- reply = mtill;
- return true;
- }
- if (text.contains("why are you doing that") || text.contains("why are you doin that") || text.contains("y r u doing that")) {
- String[] looperrorArray = {"Who said i cant?", "because i want to got a problem?", "LOLATYOU", "why aren't you?!", "Because i'm cool"};
- String looperror = looperrorArray[random(0, looperrorArray.length)];
- keyboard.sendText(looperror, true);
- reply = looperror;
- return true;
- }
- if (text.contains("goodbye") || text.contains("bye") || text.contains("cya") || text.contains("later") || text.contains("seeya")) {
- String[] cyaArray = {"later man nice speaking to you", "bye bro", "bai!", "cya", "ok bye then"};
- String cya = cyaArray[random(0, cyaArray.length)];
- keyboard.sendText(cya, true);
- reply = cya;
- return true;
- }
- if (text.endsWith("how are you") || text.contains("You ok") || text.contains("You ok?") || text.contains("you ok mate?") || text.contains("you alright") || text.startsWith("you alright?") && text.indexOf("fish") == -1 && text.indexOf("smithing") == -1 && text.indexOf("hitp") == -1 && text.indexOf("which") == -1 && text.indexOf("the") == -1 && text.indexOf("not") == -1 && text.indexOf("high") == -1 && text.indexOf("this") == -1) {
- String[] greetingArray = {"i'm great", "yea man", "obv couldnt be better", "ye", "mhmm", "great", "Nahh :( Don't wana talk about it."};
- String greeting = greetingArray[random(0, greetingArray.length)];
- keyboard.sendText(greeting, true);
- reply = greeting;
- return true;
- }
- if ((text.contains("level") || text.contains("lv")) && (text.indexOf(" ") == text.lastIndexOf(" ") || text.startsWith("what") || text.endsWith("?") || text.endsWith("lv") || text.endsWith("lvl") || text.endsWith("lev") || text.endsWith("level"))) { //asking for a level
- int whichSkill = -1;
- String statName;
- if (text.contains("att")) {
- whichSkill = Skills.ATTACK;
- statName = pickRandomName(attackNames);
- } else if (text.contains("def")) {
- whichSkill = Skills.DEFENSE;
- statName = pickRandomName(defenseNames);
- } else if (text.contains("str")) {
- whichSkill = Skills.STRENGTH;
- statName = pickRandomName(strengthNames);
- } else if (text.contains("hp") || text.contains("hit")) {
- whichSkill = Skills.CONSTITUTION;
- statName = pickRandomName(hitpointsNames);
- } else if (text.contains("range")) {
- whichSkill = Skills.RANGE;
- statName = pickRandomName(rangeNames);
- } else if (text.contains("pray")) {
- whichSkill = Skills.PRAYER;
- statName = pickRandomName(prayerNames);
- } else if (text.contains("mag")) {
- whichSkill = Skills.MAGIC;
- statName = pickRandomName(magicNames);
- } else if (text.contains("cook")) {
- whichSkill = Skills.COOKING;
- statName = pickRandomName(cookingNames);
- } else if (text.contains("wc") || text.contains("woodcut")) {
- whichSkill = Skills.WOODCUTTING;
- statName = pickRandomName(woodcuttingNames);
- } else if (text.contains("fletch")) {
- whichSkill = Skills.FLETCHING;
- statName = pickRandomName(fletchingNames);
- } else if (text.contains("fish")) {
- whichSkill = Skills.FISHING;
- statName = pickRandomName(fishingNames);
- } else if (text.contains("fm") || text.contains("fire")) {
- whichSkill = Skills.FIREMAKING;
- statName = pickRandomName(firemakingNames);
- } else if (text.contains("craft")) {
- whichSkill = Skills.CRAFTING;
- statName = pickRandomName(craftingNames);
- } else if (text.contains("smith")) {
- whichSkill = Skills.SMITHING;
- statName = pickRandomName(smithingNames);
- } else if (text.contains("mining") || text.contains("mine")) {
- whichSkill = Skills.MINING;
- statName = pickRandomName(miningNames);
- } else if (text.contains("herb")) {
- whichSkill = Skills.HERBLORE;
- statName = pickRandomName(herbloreNames);
- } else if (text.contains("agil")) {
- whichSkill = Skills.AGILITY;
- statName = pickRandomName(agilityNames);
- } else if (text.contains("thiev") || text.contains("theiv")) {
- whichSkill = Skills.THIEVING;
- statName = pickRandomName(thievingNames);
- } else if (text.contains("slay")) {
- whichSkill = Skills.SLAYER;
- statName = pickRandomName(slayerNames);
- } else if (text.contains("farm")) {
- whichSkill = Skills.FARMING;
- statName = pickRandomName(farmingNames);
- } else if (text.contains("runecraft") || text.contains("rc")) {
- whichSkill = Skills.RUNECRAFTING;
- statName = pickRandomName(runecraftingNames);
- } else if (text.contains("hunt")) {
- whichSkill = Skills.HUNTER;
- statName = pickRandomName(hunterNames);
- } else if (text.contains("construct")) {
- whichSkill = Skills.CONSTRUCTION;
- statName = pickRandomName(constructionNames);
- } else if (text.contains("summon")) {
- whichSkill = Skills.SUMMONING;
- statName = pickRandomName(summoningNames);
- } else {
- statName = "NO STAT!";
- }
- if (whichSkill != -1) {
- oldTab = game.getCurrentTab();
- game.openTab(Game.TAB_STATS);
- int gambleInt = random(1, 4);
- String[] extraArray = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".", ".",
- ". =\\", ".=\\", " =\\", "=\\", ". =O", ".=O", " =O", "=O",
- ". =)", ".=)", " =)", "=)", ". =]", ".=]", " =]", "=]",
- ". =P", ".=P", " =P", "=P", ". =D", ".=D", " =D", "=D",};
- String extra = extraArray[random(0, extraArray.length)];
- if (extra.contains("=") && random(1, 3) == 1) {
- extra = extra.replaceAll("=", ":"); //transforms some happyfaces :D =D
- }
- String[] onlyArray = {"only", "just"};
- String[] levelArray = {"Lvl", "LVL", "lvl", "Lev", "lev", "LV", "lv", "Lv", "Level", "level"};
- String[] haveArray = {"have", "have", "have", "have", "got", "Have", "Got"};
- String misc = "";
- String only = "";
- String have = haveArray[random(0, haveArray.length)];
- if (random(0, 2) == 1 && statName.endsWith("ing")) {
- statName = statName.substring(0, statName.length() - 1); //will sometimes remove g at end (e.g mining to minin)
- }
- int skillLevel = skills.getCurrentLevel(whichSkill);
- if (skillLevel < 30 && random(1, 5) == 3) {
- only = onlyArray[random(0, 1)] + " ";
- }
- misc += levelArray[random(0, levelArray.length)];
- if (misc.length() > 0) {
- misc = " " + misc;
- }
- if (gambleInt == 1) {
- reply = "" + skillLevel + extra;
- } else if (gambleInt == 2) {
- reply = "My " + statName + misc + " is " + only + skillLevel + extra;
- } else if (gambleInt == 3) {
- reply = "I " + only + "have " + skillLevel + " " + statName + extra;
- }
- }
- }
- if (reply.equals("NO REPLY")) {
- return false;
- } else {
- String prefix = "";
- sleep(random(2000, 3000));
- if (random(1, 6) == 2) {
- reply = reply.toLowerCase();
- }
- keyboard.sendText(reply, true);
- if (oldTab != -1) {
- sleep(random(10, 100));
- game.openTab(oldTab);
- }
- return true;
- }
- }
- public String getScriptCategory() {
- return "Antiban";
- }
- public void getNearestPlayerDistance() {
- RSPlayer[] p = players.getAll();
- for (int i = 0; i < p.length - 1; i++) {
- try {
- RSPlayer cP = p[i];
- String nameP = cP.getName();
- String nameMe = getMyPlayer().getName();
- if (cP != null
- && (nameP != null && nameMe != null && !nameP.equals(nameMe)) && cP.isOnScreen()) {
- dist = calc.distanceTo(cP.getLocation());
- } else if (cP == null) {
- dist = 999;
- }
- } catch (NullPointerException e) {
- }
- }
- }
- }
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.RenderingHints;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.io.IOException;
- import java.net.URL;
- import java.text.NumberFormat;
- import java.util.ArrayList;
- import com.rarebot.event.listeners.PaintListener;
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.methods.Game.Tab;
- 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.RSComponent;
- import com.rarebot.script.wrappers.RSGroundItem;
- import com.rarebot.script.wrappers.RSItem;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSObject;
- import com.rarebot.script.wrappers.RSTile;
- import com.rarebot.script.wrappers.RSTilePath;
- import com.rarebot.script.wrappers.RSWeb;
- @ScriptManifest(authors ={ "chuma" }, name = "chumasblueDragons", version = 1.0, description = "1.0")
- public class chumasblueDragons extends Script implements PaintListener {
- {
- private Conditional conditional;}
- private ArrayList<State> states = new ArrayList<State>();
- private ScriptSettings scriptSettings;
- private int tab;
- public boolean onStart() {
- conditional = new Conditional();
- scriptSettings = new ScriptSettings();
- scriptSettings.antifirePotions = equipment.containsOneOf(new int[]{11284, 1540});
- if (scriptSettings.antifirePotions) {
- log.severe("Script currently doesn't support antifire potions.");
- log.severe("Please equip a Dragonfire sheild and restart");
- log("Don't worry it will be included soon");
- return false;
- }
- if (isModernSetActive()) {
- if (Modern.PROTECT_FROM_MAGIC.getRequiredLevel() < skills.getCurrentLevel(Skills.PRAYER)) {
- log("Unable to use prayers?");
- stopScript(false);
- }
- } else {
- if (Ancient.DEFLECT_MAGIC.getRequiredLevel() < skills.getCurrentLevel(Skills.PRAYER)) {
- log("Unable to use prayers?");
- stopScript(false);
- }
- }
- init();
- return true;
- }
- @Override
- public int loop() {
- if (ScriptSettings.optionsOpen) {
- return 1;
- }
- return getStateLoop();
- }
- private void init() {
- states.add(new Fight());
- states.add(new Bank());
- states.add(new WalkToBank());
- states.add(new WalkToDragons());
- }
- private int getStateLoop() {
- for (State state : states) {
- if (state.activeCondition()) {
- return state.loop();
- }
- }
- return 1;
- }
- private static class ScriptSettings {
- static boolean optionsOpen;
- static boolean antifirePotions;
- boolean weaponSpecial;
- boolean useCannon;
- boolean useFamiliar;
- boolean rangeMode;
- Familiar farmiliar;
- ScriptSettings() {
- optionsOpen = true;
- }
- }
- private enum Familiar; {
- PACKYAK("Pack yak", 12093, 12435, true, true),
- WARTORTOISE("Wartortoise", 12031, 12439, true, false),
- SPIRITTERRORBIRD("Spirit terrorbird", 12007, 12441, true, false);
- String name;
- int pouchID;
- int scrollID;
- boolean canStore;
- boolean useSpecial;
- Familiar(String name, int pouchID, int scrollID, boolean canStore, boolean useSpecial) {
- this.name = name;
- this.pouchID = pouchID;
- this.scrollID = scrollID;
- this.canStore = canStore;
- this.useSpecial = useSpecial;
- }
- }
- private interface Items {
- final static int dragonBone = 18832;
- final static int visage = 11286;
- final static int houseTab = 8013;
- final static int faladorTab = 8009;
- final static int crimsonCharm = 0;
- final static int blueCharm = 0;
- final static int shark = 385;
- final static int vial = 229;
- final int[] prayerPots = {143, 141, 139, 2434};
- }
- private interface Objects; {
- final static int housePortal = 13405;
- final static int obelisk = 29953;
- final static int trapDoor = 9472;
- final static int dungeon = 52859;
- final static int door = 39978;
- final static int alter = 39842;
- }
- private interface Areas; {
- final static RSArea bank = new RSArea(new RSTile(2820, 3486), new RSTile(2814, 3474));
- final static RSArea dragon = new RSArea(new RSTile(0, 0), new RSTile(0, 0));
- }
- private interface Paths {
- final static RSTile[] houseToTrap = {
- new RSTile(2954, 3223), new RSTile(2959, 3224),
- new RSTile(2965, 3223), new RSTile(2970, 3222),
- new RSTile(2972, 3217), new RSTile(2974, 3212),
- new RSTile(2977, 3208), new RSTile(2980, 3204),
- new RSTile(2983, 3200), new RSTile(2985, 3195),
- new RSTile(2987, 3190), new RSTile(2989, 3185),
- new RSTile(2991, 3179), new RSTile(2993, 3174),
- new RSTile(2993, 3169), new RSTile(2995, 3164),
- new RSTile(2999, 3161), new RSTile(3004, 3160),
- new RSTile(3006, 3155), new RSTile(3007, 3150)
- };
- final static RSTile[] houseToAlter = {
- new RSTile(2951, 3223), new RSTile(2959, 3222),
- new RSTile(2964, 3222), new RSTile(2969, 3222),
- new RSTile(2972, 3218), new RSTile(2974, 3213),
- new RSTile(2977, 3209), new RSTile(2980, 3205),
- new RSTile(2984, 3202), new RSTile(2988, 3194),
- new RSTile(2991, 3189), new RSTile(2994, 3185),
- new RSTile(2999, 3183), new RSTile(3002, 3179)
- };
- final static RSTile[] houseToObelisk = {
- new RSTile(2952, 3223), new RSTile(2957, 3223),
- new RSTile(2963, 3223), new RSTile(2968, 3223),
- new RSTile(2973, 3223), new RSTile(2978, 3222),
- new RSTile(2983, 3222), new RSTile(2988, 3220),
- new RSTile(2991, 3214), new RSTile(2995, 3210),
- new RSTile(2999, 3206), new RSTile(3001, 3200),
- new RSTile(3000, 3195)
- };
- public final RSTile[] obeliskToAlter = {
- new RSTile(3001, 3191), new RSTile(3001, 3186),
- new RSTile(3002, 3181), new RSTile(3001, 3177)
- };
- final static RSTile[] alterToTrap = {
- new RSTile(3000, 3178), new RSTile(3004, 3175),
- new RSTile(3005, 3170), new RSTile(3007, 3162),
- new RSTile(3008, 3157), new RSTile(3008, 3151)
- };
- final static RSTile[] faladorToBank = {
- new RSTile(2964, 3381), new RSTile(2959, 3380),
- new RSTile(2954, 3380), new RSTile(2949, 3378),
- new RSTile(2944, 3376), new RSTile(2943, 3370),
- new RSTile(2947, 3366)
- };
- final static RSTile[] trapToDungeon = {
- new RSTile(3007, 9550), new RSTile(3006, 9550),
- new RSTile(3003, 9549), new RSTile(3002, 9549),
- new RSTile(2999, 9549), new RSTile(2998, 9549),
- new RSTile(2995, 9551), new RSTile(2995, 9552),
- new RSTile(2995, 9553), new RSTile(2995, 9554),
- new RSTile(2995, 9557), new RSTile(2995, 9558),
- new RSTile(2995, 9559), new RSTile(2995, 9560),
- new RSTile(2995, 9563), new RSTile(2995, 9564),
- new RSTile(2995, 9565), new RSTile(2995, 9566),
- new RSTile(2995, 9569), new RSTile(2995, 9570),
- new RSTile(2996, 9571), new RSTile(2997, 9571),
- new RSTile(2998, 9574), new RSTile(2998, 9575),
- new RSTile(2998, 9576), new RSTile(2999, 9577),
- new RSTile(3002, 9579), new RSTile(3003, 9579),
- new RSTile(3004, 9579), new RSTile(3005, 9579),
- new RSTile(3008, 9579), new RSTile(3009, 9579),
- new RSTile(3010, 9579), new RSTile(3011, 9579),
- new RSTile(3014, 9579), new RSTile(3015, 9579),
- new RSTile(3016, 9579), new RSTile(3017, 9579),
- new RSTile(3020, 9580), new RSTile(3021, 9580),
- new RSTile(3022, 9580), new RSTile(3023, 9580),
- new RSTile(3026, 9581), new RSTile(3027, 9581),
- new RSTile(3028, 9582), new RSTile(3029, 9582),
- new RSTile(3032, 9583), new RSTile(3033, 9584),
- new RSTile(3034, 9585), new RSTile(3034, 9586),
- new RSTile(3034, 9589), new RSTile(3034, 9590),
- new RSTile(3035, 9591), new RSTile(3035, 9592),
- new RSTile(3035, 9595), new RSTile(3034, 9596),
- new RSTile(3034, 9597), new RSTile(3033, 9598),
- };
- }
- private class Conditional; {
- boolean isInventReady() {
- return (!inventory.contains(Items.shark) && combat.getLifePoints() < 400) &&
- (!inventory.containsOneOf(Items.prayerPots) && combat.getLifePoints() < 20);
- //TODO: add checks for antidragons;
- }
- boolean inHouse() {
- return objects.getNearest(Objects.housePortal) != null;
- }
- boolean cannonNeedsReseting() {
- return false;
- }
- boolean cannonNeedsReloading() {
- return false;
- }
- boolean isTeleporting() {
- return true;
- }
- boolean runFromFight() {
- return (!inventory.contains(Items.shark) && combat.getLifePoints() < 400) &&
- (!inventory.containsOneOf(Items.prayerPots) && combat.getLifePoints() < 20);
- //TODO: add checks for antidragons;
- }
- boolean isReadyToEnter() {
- return !runFromFight() && inventory.contains(Items.faladorTab);
- }
- }
- //States
- private abstract class State; {
- abstract int loop();
- abstract boolean activeCondition();
- }
- private class Bank extends State; {
- @Override
- int loop() {
- if (Areas.bank.contains(getMyPlayer().getLocation())) {
- if (!bank.isOpen()) {
- if (inventory.contains(Items.shark) && combat.getLifePoints() < 500) {
- RSItem shark = inventory.getItem(Items.shark);
- if (shark != null) {
- shark.doAction("Eat");
- }
- } else{
- bank.open();
- }
- } else {
- if (!inventory.contains(Items.shark) || combat.getLifePoints() < 500) {
- if(!inventory.contains(Items.shark)){
- bank.withdraw(Items.shark, 2);
- }
- bank.close();
- } else {
- if (inventory.contains(Items.dragonBone)) {
- bank.deposit(Items.dragonBone, 0);
- }
- if (inventory.contains(Items.visage)) {
- bank.deposit(Items.visage, 0);
- }
- if (!inventory.contains(Items.houseTab)) {
- if (bank.getCount(Items.houseTab) >= 1) {
- bank.withdraw(Items.houseTab, 1);
- } else {
- try {
- throw new BankingException("Out of house tablets");
- } catch (Exception ignore) {
- }
- }
- }
- if (!inventory.contains(Items.faladorTab)) {
- if (bank.getCount(Items.faladorTab) >= 1) {
- bank.withdraw(Items.faladorTab, 1);
- } else {
- try {
- throw new BankingException("Out of Falador tablets");
- } catch (Exception ignore) {
- }
- }
- }
- if(inventory.getCount(Items.shark) < 4){
- if(bank.getCount(Items.shark) >= 4){
- bank.withdraw(Items.shark, (4 - inventory.getCount(Items.shark)));
- } else {
- try {
- throw new BankingException("Out of sharks");
- } catch (Exception ignore) {
- }
- }
- }else if (inventory.getCount(Items.shark) > 4){
- bank.deposit(Items.shark, (inventory.getCount(Items.shark) - 4));
- }
- }
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.faladorToBank);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- return 100;
- }
- @Override
- boolean activeCondition() {
- return Areas.bank.contains(getMyPlayer().getLocation()) && !conditional.isInventReady();
- }
- }
- private class WalkToDragons extends State; {
- @Override
- int loop() {
- if (conditional.inHouse()) {
- RSObject exit = objects.getNearest(Objects.housePortal);
- if (exit != null) {
- exit.doAction("Enter");
- }
- } else if (game.getPlane() == 0) {
- if (summoning.getSummoningPoints() < 10 && scriptSettings.useFamiliar) {
- RSObject obelisk = objects.getNearest(Objects.obelisk);
- if (obelisk != null) {
- if (obelisk.isOnScreen()) {
- obelisk.doAction("Renew");
- } else {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) <= 5) {
- walking.walkTileMM(walking.getClosestTileOnMap(obelisk.getLocation()));
- }
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.houseToObelisk);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- } else if (prayer.getPrayerPercentLeft() < 85) {
- RSObject door = objects.getNearest(Objects.door);
- RSObject alter = objects.getNearest(Objects.alter);
- if (alter != null) {
- if (door != null) {
- if (door.isOnScreen()) {
- door.doAction("Open");
- } else {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) <= 5) {
- walking.walkTileMM(walking.getClosestTileOnMap(door.getLocation()));
- }
- }
- } else {
- if (alter.isOnScreen() && calc.canReach(alter.getLocation(), true)) {
- alter.doAction("Pray");
- } else {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) <= 5) {
- walking.walkTileMM(walking.getClosestTileOnMap(alter.getLocation()));
- }
- }
- }
- } else {
- if (objects.getNearest(Objects.obelisk) != null) {
- RSTilePath path = walking.newTilePath(Paths.obeliskToAlter);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.houseToAlter);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- }
- } else {
- RSObject trapDoor = objects.getNearest(Objects.trapDoor);
- if (trapDoor != null) {
- if (trapDoor.isOnScreen() && calc.canReach(trapDoor.getLocation(), true)) {
- trapDoor.doAction("Climb"); //TODO: check.
- } else {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) <= 5) {
- walking.walkTileMM(walking.getClosestTileOnMap(trapDoor.getLocation()));
- }
- }
- } else {
- if (objects.getNearest(Objects.alter) != null) {
- RSTilePath path = walking.newTilePath(Paths.alterToTrap);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.houseToTrap);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- }
- }
- } else if (game.getPlane() == -1) {
- RSObject dungeon = objects.getNearest(Objects.dungeon);
- if (dungeon != null) {
- if (dungeon.isOnScreen() && calc.canReach(dungeon.getLocation(), true)) {
- if (conditional.isReadyToEnter()) {
- dungeon.doAction("Enter");
- } else {
- log.severe("Stopping script inventory not ready?");
- game.logout(false);
- return -1;
- }
- } else {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) <= 5) {
- walking.walkTileMM(walking.getClosestTileOnMap(dungeon.getLocation()));
- }
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.alterToTrap);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- }
- return 100;
- }
- @Override
- boolean activeCondition() {
- return conditional.isInventReady() && !Areas.dragon.contains(getMyPlayer().getLocation());
- }
- }
- private class WalkToBank extends State; {
- @Override
- int loop() {
- if (getActivePrayers().length > 0) {
- for (Prayers prayer : getActivePrayers()) {
- setActivated(prayer, false);
- }
- }
- if (Areas.dragon.contains(getMyPlayer().getLocation())) {
- if (!conditional.isTeleporting()) {
- if (inventory.getCount(Items.faladorTab) >= 1) {
- RSItem faladorTab = inventory.getItem(Items.faladorTab);
- if (faladorTab != null) {
- faladorTab.doAction("Break");
- }
- } else {
- //Walk to dungeon
- //logout..
- }
- }
- } else {
- RSTilePath path = walking.newTilePath(Paths.faladorToBank);
- if (path != null && path.getNext() != null) {
- path.traverse();
- }
- }
- return 100;
- }
- @Override
- boolean activeCondition() {
- return !Areas.bank.contains(getMyPlayer().getLocation()) && !conditional.isInventReady() && conditional.runFromFight();
- }
- }
- private class Fight extends State; {
- private int weaponSpecial;
- private PotionMethods potionMethods;
- private Fight() {
- weaponSpecial = specialUsage();
- potionMethods = new PotionMethods();
- }
- private class Potion {
- private int[] ids;
- private int[] boostedSkills;
- private Potion(int[] ids, int[] boostedSkills) {
- this.ids = ids;
- this.boostedSkills = boostedSkills;
- }
- private Potion(int[] ids, int boostedSkill) {
- this(ids, new int[boostedSkill]);
- }
- private int getAmount() {
- return inventory.getCount(true, ids);
- }
- }
- private class PotionMethods {
- private LinkedList<Potion> getPotions() {
- LinkedList<Potion> potions = new LinkedList<Potion>();
- potions.add(new Potion(new int[]{3040, 3042, 3044, 3046,
- 11513, 11515, 13520, 13521, 13522, 13523},
- Skills.MAGIC)); // Magic pots
- potions.add(new Potion(new int[]{2444, 169, 171, 173, 11509,
- 11511, 13524, 13525, 15326, 15327}, Skills.RANGE)); // Range
- // pots
- potions.add(new Potion(new int[]{9739, 9741, 9743, 9745,
- 11445, 11447}, new int[]{Skills.ATTACK,
- Skills.STRENGTH})); // Combat pots
- potions.add(new Potion(new int[]{2428, 121, 123, 125, 2436,
- 145, 147, 149, 11429, 11431, 11429, 11431, 11429,
- 11431, 11469, 11471, 15308, 15309, 15310, 15311},
- Skills.ATTACK)); // Attack pots
- potions.add(new Potion(new int[]{113, 115, 117, 119, 2440,
- 157, 159, 161, 11443, 11441, 11485, 11487, 15312,
- 15313, 15314, 15315}, Skills.STRENGTH)); // Strength
- // pots
- potions.add(new Potion(new int[]{2432, 133, 135, 137, 2442,
- 163, 165, 167, 11457, 11459, 11497, 11499, 15316,
- 15317, 15318, 15319}, Skills.DEFENSE)); // Defense pots
- potions.add(new Potion(
- new int[]{15332, 15333, 15334, 15335}, new int[]{
- Skills.STRENGTH, Skills.ATTACK, Skills.DEFENSE,
- Skills.MAGIC, Skills.RANGE})); // Overloads
- return potions;
- }
- private Potion needToPot() {
- for (Potion p : getPotions()) {
- if (p.getAmount() > 1 && areSkillsBoosted(p.boostedSkills)) {
- return p;
- }
- }
- return null;
- }
- public boolean usePotions() {
- if (inventory.containsOneOf(Items.vial)) {
- RSItem[] vials = inventory.getItems(Items.vial);
- for (RSItem item : vials) {
- item.doAction("Drop");
- }
- }
- Potion pot = needToPot();
- if (pot != null) {
- RSItem item = inventory.getItem(pot.ids);
- if (item != null) {
- return item.doClick(true);
- }
- }
- return false;
- }
- private boolean areSkillsBoosted(int[] skillsArray) {
- for (int skill : skillsArray) {
- if (skills.getCurrentLevel(skill) <= skills
- .getRealLevel(skill)) {
- return true;
- }
- }
- return false;
- }
- }
- private void weaponSpecial() {
- if (scriptSettings.weaponSpecial && weaponSpecial != -1) {
- if (getMyPlayer().getInteracting() != null) {
- if (!combat.isSpecialEnabled() && settings.getSetting(300) >= weaponSpecial * 10) {
- if (game.getCurrentTab() != Game.TAB_ATTACK) {
- switch (random(1, 3)) {
- case 1:
- game.openTab(Game.TAB_ATTACK);
- break;
- case 2:
- game.openTab(Game.TAB_ATTACK, true);
- break;
- }
- sleep(random(300, 900));
- }
- mouse.click(645 + random(0, 4), 425 + random(0, 4), true);
- sleep(3000, 5000);
- }
- }
- }
- }
- private void loot() {
- RSGroundItem loot = groundItems.getNearest(Items.visage);
- if (loot != null) {
- if (inventory.isFull()) {
- if (inventory.contains(Items.vial)) {
- inventory.dropAllExcept(Items.vial);
- } else if (inventory.contains(Items.shark)) {
- RSItem shark = inventory.getItem(Items.shark);
- if (shark != null) {
- shark.doAction("Eat");
- }
- } else if (inventory.contains(Items.dragonBone)) {
- RSItem dragonBone = inventory.getItem(Items.dragonBone);
- if (dragonBone != null) {
- dragonBone.doAction("Bury");
- }
- }
- sleep(100, 200);
- }
- if (!loot.isOnScreen()) {
- camera.turnTo(loot.getLocation());
- if (!loot.isOnScreen()) {
- walking.walkTileMM(walking.getClosestTileOnMap(loot.getLocation()));
- sleep(300, 400);
- }
- }
- if (!inventory.isFull()) {
- if (loot.isOnScreen()) {
- loot.doAction("Take");
- }
- }
- }
- //TODO: add effiges
- loot = groundItems.getNearest(Items.dragonBone);
- if (loot != null) {
- if (inventory.isFull()) {
- if (inventory.contains(Items.vial)) {
- inventory.dropAllExcept(Items.vial);
- } else if (inventory.contains(Items.shark)) {
- RSItem shark = inventory.getItem(Items.shark);
- if (shark != null) {
- shark.doAction("Eat");
- }
- }
- sleep(100, 200);
- }
- if (!loot.isOnScreen()) {
- camera.turnTo(loot.getLocation());
- if (!loot.isOnScreen()) {
- walking.walkTileMM(walking.getClosestTileOnMap(loot.getLocation()));
- sleep(300, 400);
- }
- }
- if (!inventory.isFull()) {
- if (loot.isOnScreen()) {
- loot.doAction("Take");
- }
- }
- }
- loot = groundItems.getNearest(Items.blueCharm);
- if (loot != null) {
- if (inventory.isFull() && inventory.getCount(Items.blueCharm) >= 1) {
- if (inventory.contains(Items.vial)) {
- inventory.dropAllExcept(Items.vial);
- }
- sleep(100, 200);
- }
- if (!loot.isOnScreen()) {
- camera.turnTo(loot.getLocation());
- if (!loot.isOnScreen()) {
- walking.walkTileMM(walking.getClosestTileOnMap(loot.getLocation()));
- sleep(300, 400);
- }
- }
- if (!inventory.isFull()) {
- if (loot.isOnScreen()) {
- loot.doAction("Take");
- }
- }
- }
- loot = groundItems.getNearest(Items.crimsonCharm);
- if (loot != null) {
- if (inventory.isFull() && inventory.getCount(Items.crimsonCharm) >= 1) {
- if (inventory.contains(Items.vial)) {
- inventory.dropAllExcept(Items.vial);
- }
- sleep(100, 200);
- }
- if (!loot.isOnScreen()) {
- camera.turnTo(loot.getLocation());
- if (!loot.isOnScreen()) {
- walking.walkTileMM(walking.getClosestTileOnMap(loot.getLocation()));
- sleep(300, 400);
- }
- }
- if (!inventory.isFull()) {
- if (loot.isOnScreen()) {
- loot.doAction("Take");
- }
- }
- }
- }
- private void restore() {
- if (combat.getLifePoints() < 700) {
- if (inventory.contains(Items.shark)) {
- RSItem shark = inventory.getItem(Items.shark);
- if (shark != null) {
- shark.doAction("Eat");
- }
- }
- }
- if (combat.getPrayerPoints() < 30) {
- for (int pot : Items.prayerPots) {
- if (inventory.contains(pot)) {
- inventory.getItem(pot).doAction("Drink");
- sleep(1200, 1500);
- }
- }
- }
- }
- @Override
- int loop() {
- weaponSpecial();
- potionMethods.usePotions();
- loot();
- restore();
- return 100;
- }
- @Override
- boolean activeCondition() {
- return Areas.dragon.contains(getMyPlayer().getLocation()) && !conditional.runFromFight();
- }
- private int specialUsage() {
- int[] amountUsage = {10, 25, 33, 35, 45, 50, 55, 60, 80, 85, 100};
- String[][] weapons = {
- {"Rune thrownaxe", "Rod of ivandis"},
- {"Dragon Dagger", "Dragon dagger (p)", "Dragon dagger (p+)",
- "Dragon dagger (p++)", "Dragon Mace", "Dragon Spear",
- "Dragon longsword", "Rune claws"},
- {"Dragon Halberd"},
- {"Magic Longbow"},
- {"Magic Composite Bow"},
- {"Dragon Claws", "Abyssal Whip", "Granite Maul", "Darklight",
- "Barrelchest Anchor", "Armadyl Godsword"},
- {"Magic Shortbow"},
- {"Dragon Scimitar", "Dragon 2H Sword", "Zamorak Godsword",
- "Korasi's sword"},
- {"Dorgeshuun Crossbow", "Bone Dagger", "Bone Dagger (p+)",
- "Bone Dagger (p++)"},
- {"Brine Sabre"},
- {"Bandos Godsword", "Dragon Battleaxe", "Dragon Hatchet",
- "Seercull Bow", "Excalibur", "Enhanced excalibur",
- "Ancient Mace", "Saradomin sword"}};
- String str = equipment.getItem(
- org.rsbot.script.methods.Equipment.WEAPON).getName();
- str = str.substring(str.indexOf(">") + 1);
- for (int i = 0; i < weapons.length; i++) {
- for (int j = 0; j < weapons[i].length; j++) {
- if (weapons[i][j].equalsIgnoreCase(str)) {
- return amountUsage[i];
- }
- }
- }
- return -1;
- }
- }
- //Exceptions
- private class BankingException extends Exception; {
- BankingException(String cause) {
- log.severe("Banking exception: " + cause);
- stopScript(true);
- }
- }
- private class CannonException extends Exception; {
- CannonException(String cause) {
- log.severe("Cannon exception: " + cause);
- //Stop using cannon?
- }
- }
- //Paint
- private Image getImage(String url); {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- private enum Skill; {
- ATTACK(Skills.ATTACK, "Attack", 0),
- STRENGTH(Skills.STRENGTH, "Strength", 1),
- DEFENCE(Skills.DEFENSE, "Defence", 2),
- CONSTITUTION(Skills.CONSTITUTION, "Constitution", 3),
- RANGE(Skills.RANGE, "Range", 4);
- int skillID;
- String skillName;
- int index;
- private Skill(int skillID, String skillName, int index) {
- this.skillID = skillID;
- this.skillName = skillName;
- this.index = index;
- }
- }
- private final Image closed = getImage("http://i52.tinypic.com/i1i1wi.png");
- private final Image tabOne = getImage("http://i56.tinypic.com/mo3zl.png");
- private final Image tabOptions = getImage("http://i52.tinypic.com/2la8mpt.png");
- private final Rectangle hideRect = new Rectangle(477, 336, 34, 37);
- private final Rectangle tabOneRect = new Rectangle(177, 335, 147, 37);
- private final Rectangle tabTwoRect = new Rectangle(327, 336, 148, 37);
- public void onRepaint(Graphics g1); {
- Graphics2D g = (Graphics2D) g1;
- if (!scriptSettings.optionsOpen) {
- if (tab == 1) {
- g.drawImage(tabOne, -1, 287, null);
- drawSkillBars(g);
- } else {
- g.drawImage(closed, 162, 287, null);
- }
- } else {
- g.drawImage(tabOptions, -1, 287, null);
- }
- }
- private void drawSkillBars(Graphics g) {
- for (Skill s : Skill.values()) {
- int x = s.index <= 3 ? 20 : 180;
- int y = s.index <= 3 ? 390 + (s.index * 20) : 390 + ((s.index - 3) * 20);
- g.setColor(new Color(153, 153, 153));
- g.drawRect(x, y, 150, 15);
- g.setColor(new Color(0, 0, 0, 80));
- g.fillRect(x, y, (int) (skills.getPercentToNextLevel(s.skillID) * 1.5), 15);
- g.setColor(new Color(90, 15, 15));
- g.setFont(new Font("Serif", 0, 12));
- g.drawString(s.skillName + ": " + skills.getPercentToNextLevel(s.skillID)
- + "% to level " + (skills.getRealLevel(s.skillID) + 1), x + 4, y + 12);
- g.setColor(new Color(255, 255, 255, 90));
- g.drawString(s.skillName + ": " + skills.getPercentToNextLevel(s.skillID)
- + "% to level " + (skills.getRealLevel(s.skillID) + 1), x + 5, y + 13);
- }
- }