Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.reflect.InvocationTargetException;
- import java.util.ArrayList;
- import java.util.Collections;
- import javax.swing.SwingUtilities;
- import org.osbot.rs07.api.Magic;
- import org.osbot.rs07.api.Quests;
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.map.constants.Banks;
- import org.osbot.rs07.api.model.Item;
- import org.osbot.rs07.api.model.NPC;
- import org.osbot.rs07.api.ui.EquipmentSlot;
- import org.osbot.rs07.api.ui.Message;
- import org.osbot.rs07.api.ui.RS2Widget;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.api.ui.Spells;
- import org.osbot.rs07.api.ui.Tab;
- import org.osbot.rs07.event.WebWalkEvent;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import org.osbot.rs07.utility.Condition;
- import org.osbot.rs07.utility.ConditionalSleep;
- import java.awt.*;
- @ScriptManifest(name = "Slayer", author = "Pandy", version = 1.0, info = "Slays Shit", logo = "")
- public class SlayerScript extends Script {
- int pid = -10;
- int mIndex = 0;
- String[] TuraelMonsters = {"banshee", "giant bat", "chicken", "bear", "cave bug", "cave crawler", "cave slime", "cow", "crawling hand",
- "desert lizard", "jackal", "dwarf", "ghost", "goblin", "icefiend", "kalphite worker", "minotaur", "monkey", "giant rat", "scorpion",
- "skeleton", "giant spider", "wolf", "zombie", "none"};
- int[] styles = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
- String SlayerMonster = "";
- String Paint = "";
- int monNumber = 0;
- ArrayList<String> Setup = new ArrayList<String>();
- ArrayList<String> Inventory = new ArrayList<String>();
- Shantay shantayShop = new Shantay(this);
- Attackit attack = new Attackit(this);
- Eat eat = new Eat(this);
- Pot pot = new Pot(this);
- Loot loot = new Loot(this);
- ToBank tobank = new ToBank(this);
- private GUI gui = new GUI();
- private Areas sArea = new Areas();
- Area slayerArea = null;
- Area slayerBank = null;
- Area desertBank = new Area(3298, 3126, 3310, 3117);
- Area rogueBank = new Area(3035, 4975, 3046, 4961).setPlane(1);
- Area Turael = new Area(2930, 3538, 2933, 3535);
- boolean canHomeTP = false;
- boolean neededItem = false;
- boolean canTP = false;
- boolean swampRope = true;
- boolean hasIce = false;
- boolean hasFood = true;
- boolean canReach = true;
- boolean isPoisoned = false;
- boolean isUnder = false;
- @Override
- public void onStart() {
- try {
- SwingUtilities.invokeAndWait(() -> {
- gui = new GUI();
- gui.open();
- });
- } catch (InterruptedException | InvocationTargetException e) {
- e.printStackTrace();
- stop();
- return;
- }
- // If the user closed the dialog and didn't click the Start button
- pid = gui.getStatus();
- }
- public void onMessage(Message message)
- {
- String text = message.getMessage().toLowerCase();
- if (text.contains(";"))
- {
- SlayerMonster = text.substring(24, text.indexOf(";") -1);
- monNumber = Integer.parseInt(text.substring(text.indexOf(";") +7).substring(0, text.substring(text.indexOf(";") +7).indexOf(" ")));
- if(SlayerMonster.contains("dwarve")) SlayerMonster = "dwarf";
- if(SlayerMonster.contains("wolve")) SlayerMonster = "wolf";
- if(SlayerMonster.contains("dog")) SlayerMonster = "jackal";
- if(SlayerMonster.contains("bird")) SlayerMonster = "chicken";
- for(int i = 0; i< TuraelMonsters.length; i++)
- {
- if (TuraelMonsters[i].toLowerCase().contains(SlayerMonster))
- {
- mIndex = i;
- slayerArea = sArea.getArea(mIndex);
- slayerBank = sArea.getBank(mIndex);
- break;
- }
- }
- Paint = SlayerMonster;
- }
- if (text.toLowerCase().contains("minutes to cast this spell"))
- {
- canHomeTP = false;
- }
- if (text.toLowerCase().contains("before you can use the minigame teleports.") ||
- text.toLowerCase().contains("you can't use that teleport at the moment"))
- {
- canTP = false;
- }
- if (text.equalsIgnoreCase("You need something new to hunt.") || text.equalsIgnoreCase("you've completed "))
- {
- SlayerMonster = "None";
- monNumber = 0;
- Paint = SlayerMonster;
- }
- if (text.toLowerCase().contains("return to a slayer master"))
- {
- SlayerMonster = "None";
- Paint = SlayerMonster;
- pid = 0;
- }
- if (text.toLowerCase().contains("i can't reach that!"))
- {
- canReach = false;
- }
- if (text.toLowerCase().contains("you have been poisoned!"))
- {
- isPoisoned = true;
- }
- if (text.toLowerCase().contains("you drink some of your antipoison potion"))
- {
- isPoisoned = false;
- }
- if (text.toLowerCase().contains("already under attack"))
- {
- isUnder = true;
- }
- }
- @Override
- public void onExit() {
- }
- @Override
- public int onLoop() {
- RS2Widget Inv = getWidgets().get(164,63);
- if(pid == -99){ if(shantayShop.store("Waterskin(4)",27)) pid=2; }
- if(pid < 0 && gui.getCStatus())
- {
- pid = gui.getStatus();
- }
- if(pid == -9)
- {
- gui.setStatus(false);
- Item[] items = getEquipment().getItems();
- Item[] itemsInv = getInventory().getItems();
- for (int i = 0; i<items.length;i++) {
- if(items[i] != null && !Setup.contains(items[i])){
- Setup.add(items[i].getName());
- log("Equipment Item Added: " + items[i].getName());
- }
- }
- for (int i = 0; i<itemsInv.length;i++) {
- if(itemsInv[i] != null){
- Inventory.add(itemsInv[i].getName());
- log("Inventory Item Added: " + itemsInv[i].getName());
- }
- }
- pid = -1000;
- }
- if(pid == -8)
- {
- if(true)
- {
- if(slayerBank == Banks.AL_KHARID || slayerBank == desertBank)
- {
- if(getEquipment().contains("Ring of dueling") &&
- getEquipment().getItemInSlot(EquipmentSlot.RING.slot).getName().contains("("))
- {
- getEquipment().getItemInSlot(EquipmentSlot.RING.slot).interact("");
- } else
- {
- getWalking().webWalk(desertBank, Banks.DRAYNOR,Banks.AL_KHARID,Banks.ARCEUUS_HOUSE,Banks.ARDOUGNE_NORTH,Banks.ARDOUGNE_SOUTH,
- Banks.CAMELOT, Banks.CANIFIS, Banks.CASTLE_WARS, Banks.CATHERBY, Banks.DUEL_ARENA, Banks.EDGEVILLE,
- Banks.FALADOR_EAST, Banks.FALADOR_WEST, Banks.GNOME_STRONGHOLD, Banks.GRAND_EXCHANGE, Banks.HOSIDIUS_HOUSE,
- Banks.LOVAKENGJ_HOUSE, Banks.LOVAKITE_MINE, Banks.LUMBRIDGE_LOWER, Banks.LUMBRIDGE_UPPER, Banks.PEST_CONTROL,
- Banks.PISCARILIUS_HOUSE, Banks.SHAYZIEN_HOUSE, Banks.TZHAAR, Banks.VARROCK_EAST, Banks.VARROCK_WEST, Banks.YANILLE);
- }
- }
- }
- }
- if(pid == -7)
- {
- Area areaV = new Area(2760, 3126, 2772, 3116);
- Paint = "Going to buy Antipoison";
- if(getBank().isOpen()) getBank().depositAll();
- if(!getInventory().contains("Coins"))
- {
- getBank().withdraw("Coins", 20000);
- getBank().close();
- } else if(!getBank().isOpen() && !areaV.contains(myPosition()))
- {
- getWalking().webWalk(areaV);
- } else if(areaV.contains(myPosition()) && !getStore().isOpen())
- {
- if(getNpcs().closestThatContains("jiminua") !=null) getNpcs().closestThatContains("jiminua").interact("Trade");
- } else if(getStore().isOpen() && !getInventory().isFull() &&
- getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 500)
- {
- getStore().buy("Antipoison(3)", 10);
- if(getStore().getItem("Antipoison(3)").getAmount() == 0)
- {
- getStore().close();
- worlds.hopToP2PWorld();
- }
- }else if(getInventory().isFull() || getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() <= 500)
- {
- pid = 2;
- }
- }
- if(pid == -6)
- {
- if (!bank.isOpen() && getObjects().closest("Bank chest") != null &&
- getObjects().closest("Bank chest").interact("Use")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- }
- if(bank.isOpen() && getBank().contains("Ice cooler"))
- {
- pid = 2;
- hasIce = true;
- }
- if(bank.isOpen() && !hasIce)
- {
- if (!getInventory().contains("Coins") && getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
- if (getInventory().contains("Coins")) getBank().depositAll("Coins");
- getBank().withdraw("Coins", 1000);
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 1000) getBank().close();
- } else if (getInventory().contains("Coins") && !Turael.contains(myPosition()) && !hasIce)
- {
- getWalking().webWalk(Turael);
- }
- if(!getStore().isOpen() && getNpcs().closest("Turael") != null && getNpcs().closest("Turael").interact("Trade"))
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getStore().isOpen();
- }
- }.sleep();
- }
- if(getStore().isOpen())
- {
- getStore().buy("Ice cooler", 50);
- if(getInventory().getItemInSlot(getInventory().getSlot("Ice cooler")) != null &&
- getInventory().getItemInSlot(getInventory().getSlot("Ice cooler")).getAmount() >= 850) {
- getStore().close();
- hasIce = true;
- pid = 2;
- }
- }
- }
- if(pid == -5)
- {
- Paint = "Need Candle / Swamp Rope";
- Area areaCandle = new Area(3165, 3179, 3176, 3168);
- if (getInventory().contains("Lit candle")) pid = 2;
- if (!areaCandle.contains(myPosition()) && getWalking().webWalk(areaCandle)) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return areaCandle.contains(myPosition());
- }
- }.sleep();
- }
- if(getInventory().contains("Rope") && getInventory().getItem("Rope").interact())
- {
- getObjects().closest("Dark hole").interact();
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return !getInventory().contains("Rope") || getDialogues().inDialogue();
- }
- }.sleep();
- swampRope = true;
- }
- if(dialogues.inDialogue())
- {
- if(dialogues.isPendingOption())
- dialogues.selectOption(1);
- else
- dialogues.clickContinue();
- }
- if(!dialogues.inDialogue() && getNpcs().closest("Candle seller") != null &&
- getNpcs().closest("Candle seller").interact("Talk-to") && !getInventory().contains("Lit candle"))
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getInventory().contains("Lit candle");
- }
- }.sleep();
- }
- }
- if(pid == -4)
- {
- Paint = "Need Rope";
- if (!getStore().isOpen() && getNpcs().closest("Ned") != null && getNpcs().closest("Ned").interact("Trade")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getStore().isOpen();
- }
- }.sleep();
- }
- if(getStore().isOpen())
- {
- getStore().buy("Rope", 5);
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getInventory().contains("Rope");
- }
- }.sleep();
- pid = 2;
- }
- }
- if(pid == -3)
- {
- Paint = "Need Shantay Pass";
- if (!getStore().isOpen() && getNpcs().closest("Shantay") != null && getNpcs().closest("Shantay").interact("Trade")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getStore().isOpen();
- }
- }.sleep();
- } else
- {
- getStore().buy("Shantay pass", 100);
- pid = 5;
- }
- }
- if(pid == -1)
- {
- Paint = "Traveling to slayer master.";
- RS2Widget miniButton = getWidgets().get(629, 13);
- RS2Widget miniTab = getWidgets().get(76, 1);
- RS2Widget miniBox = getWidgets().get(76, 8);
- RS2Widget grChoice = getWidgets().get(76, 18,3);
- RS2Widget miniTP = getWidgets().get(76, 28);
- RS2Widget questTab = getWidgets().get(164,62);
- if(canTP && npcs.closest("Turael") == null)
- {
- if(!tabs.isOpen(Tab.QUEST) && questTab.interact())
- if(miniTab == null && miniButton.interact())
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return miniTab.isVisible();
- }
- }.sleep();
- }
- if(miniBox != null && !miniBox.getMessage().contains("Burthorpe Games Room"))
- {
- if(grChoice == null && miniBox.interact())
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return grChoice.isVisible();
- }
- }.sleep();
- }
- if(grChoice != null && grChoice.interact())
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return miniBox.getMessage().contains("Burthorpe Games Room");
- }
- }.sleep();
- }
- } else if(miniBox != null && miniBox.getMessage().contains("Burthorpe Games Room") && miniTP.interact())
- {
- new ConditionalSleep(15000) {
- @Override
- public boolean condition() {
- return getNpcs().closest("Sam") != null || canTP == false;
- }
- }.sleep();
- if(getNpcs().closest("Sam") != null || myPlayer().isHitBarVisible()) canTP = false;
- }
- } else
- {
- log(tobank.gethasFood());
- if(tobank.gethasFood() != -1)
- {
- if(npcs.closest("Turael") == null)
- {
- tobank.bank(Turael,null);
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return npcs.closest("Turael") != null;
- }
- }.sleep();
- }
- log(npcs.closest("Turael") != null);
- if(npcs.closest("Turael") != null)
- {
- pid=1;
- }
- } else if(tobank.gethasFood() == -1)
- tobank.bank(Banks.CAMELOT, Banks.EDGEVILLE);
- pid = 3;
- }
- }
- if(pid==0)
- {
- gui.setStatus(false);
- neededItem = false;
- canTP = true;
- if(Inv != null) Inv.interact();
- if (!getInventory().contains("Enchanted gem") && !bank.isOpen())
- {
- Paint = "Finding Slayer Gem";
- if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- } else if (getObjects().closest("Bank chest") != null && getObjects().closest("Bank chest").interact("use")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- } else if (getObjects().closest("Bank booth") != null && getObjects().closest("Bank booth").interact("Bank")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- }
- else
- {
- getWalking().webWalk(Banks.DRAYNOR,Banks.AL_KHARID,Banks.ARCEUUS_HOUSE,Banks.ARDOUGNE_NORTH,Banks.ARDOUGNE_SOUTH,
- Banks.CAMELOT, Banks.CANIFIS, Banks.CASTLE_WARS, Banks.CATHERBY, Banks.DUEL_ARENA, Banks.EDGEVILLE,
- Banks.FALADOR_EAST, Banks.FALADOR_WEST, Banks.GNOME_STRONGHOLD, Banks.GRAND_EXCHANGE, Banks.HOSIDIUS_HOUSE,
- Banks.LOVAKENGJ_HOUSE, Banks.LOVAKITE_MINE, Banks.LUMBRIDGE_LOWER, Banks.LUMBRIDGE_UPPER, Banks.PEST_CONTROL,
- Banks.PISCARILIUS_HOUSE, Banks.SHAYZIEN_HOUSE, Banks.TZHAAR, Banks.VARROCK_EAST, Banks.VARROCK_WEST, Banks.YANILLE);
- }
- //if (!inventory.isEmpty()) bank.depositAll();
- if(getBank().isOpen() && !bank.contains("Enchanted gem"))
- {
- bank.withdraw("Coins", 1);
- bank.close();
- pid = -1;
- } else if(getBank().isOpen() && bank.contains("Enchanted gem"))
- {
- bank.withdraw("Enchanted gem",1);
- bank.close();
- pid = 1;
- }
- } else if (getInventory().contains("Enchanted gem"))
- {
- pid = 1;
- }
- }
- if(pid==1)
- {
- if(!dialogues.inDialogue() && SlayerMonster == "None" && npcs.closest("Turael") != null && npcs.closest("Turael").interact("Assignment"))
- {
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return dialogues.inDialogue();
- }
- }.sleep();
- }
- if(dialogues.inDialogue())
- {
- if(dialogues.isPendingOption())
- dialogues.selectOption(1);
- else
- dialogues.clickContinue();
- }
- if (getInventory().getItem("Enchanted Gem") != null && getInventory().getItem("Enchanted Gem").interact("Check")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return SlayerMonster != "None" || SlayerMonster != "";
- }
- }.sleep();
- SlayerMonster = "Pending...";
- if (SlayerMonster == "Pending...") {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return SlayerMonster != "Pending...";
- }
- }.sleep();
- }
- }
- Paint = SlayerMonster;
- if (npcs.closest("Turael") == null && SlayerMonster == "" || SlayerMonster == "None" && pid == 1) pid=-1;
- if (SlayerMonster != "None")
- {
- if(getInventory().contains("Ice cooler")) hasIce =true;
- if(hasIce || !SlayerMonster.contains("lizard"))
- pid = 2;
- else if (!hasIce && SlayerMonster.contains("lizard"))
- {
- getWalking().webWalk(rogueBank, desertBank);
- Paint = "Need Ice Cooler";
- pid = -6;
- }
- }
- }
- if(pid == 2)
- {
- Paint = "Walking to nearest " + SlayerMonster + " area.";
- if(slayerArea.contains(myPosition()))
- pid=5;
- if (pid == 2 && ((slayerBank == Banks.LUMBRIDGE_UPPER || slayerBank == Banks.AL_KHARID || slayerBank == desertBank)))
- {
- canHomeTP = true;
- if(!myPlayer().isAnimating() && !Banks.LUMBRIDGE_UPPER.contains(myPosition()) &&
- !slayerBank.contains(myPosition()) && canHomeTP && getMagic().getCurrentBook() == Magic.Book.NORMAL
- && getMagic().castSpell(Spells.NormalSpells.HOME_TELEPORT))
- {
- Area Lumbridge = new Area(3217, 3225, 3226, 3211);
- new ConditionalSleep(15000) {
- @Override
- public boolean condition() {
- return Lumbridge.contains(myPosition());
- }
- }.sleep();
- if(Lumbridge.contains(myPosition())) canHomeTP = false;
- }
- if((slayerBank == Banks.AL_KHARID || slayerBank == desertBank) && !getQuests().isComplete(Quests.Quest.PRINCE_ALI_RESCUE))
- {
- Paint = "Need Coins For Gate";
- neededItem = false;
- if (getInventory().contains("Coins"))
- {
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 10)
- {
- if(pid == 2 && getWalking().webWalk(slayerBank, slayerArea))
- pid = 3;
- }
- } else
- {
- getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
- if(getBank().isOpen())
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (getBank().isOpen() && getBank().withdraw("Coins",10)) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 10;
- }
- }.sleep();
- neededItem = true;
- }
- } else
- {
- if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank"))
- {
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return getBank().isOpen();
- }
- }.sleep();
- }
- }
- }
- }else neededItem =true;
- } else neededItem =true;
- if(neededItem == true && pid == 2 && !canHomeTP)
- {
- tobank.bank(slayerBank, slayerArea);
- neededItem = false;
- if(slayerBank.contains(myPosition()))
- pid = 3;
- }
- }
- if(pid == 3)
- {
- Paint = "Withdrawing Items";
- if (styles[mIndex] == 1)
- {
- getBank().depositAll();
- for (int i = 0; i < Setup.size(); i++)
- {
- if(bank.isOpen() && !getEquipment().contains(Setup.get(i)))
- {
- bank.withdraw(Setup.get(i), 1);
- }
- }
- if(SlayerMonster != "None")
- pid=4;
- else pid=-1;
- }
- }
- if(pid == 4)
- {
- Paint = "Equipping Armor";
- int count = 1;
- if(getEquipment().isEmpty())
- {
- for (int i = 0; i < Setup.size(); i++)
- {
- if(getInventory().getItem(Setup.get(i)) != null && !getInventory().isEmpty())
- {
- if (getInventory().getItem(Setup.get(i)).hasAction("Wear"))
- getInventory().getItem(Setup.get(i)).interact("Wear");
- else if (getInventory().getItem(Setup.get(i)).hasAction("Wield"))
- getInventory().getItem(Setup.get(i)).interact("Wield");
- } else
- break;
- }
- } else
- {
- getBank().depositAll();
- for (int i = 0; i < Inventory.size(); i++)
- {
- if(Inventory.get(i) != null && !getInventory().contains(Inventory.get(i)))
- {
- if (getBank().contains(Inventory.get(i)))
- getBank().withdraw(Inventory.get(i), Collections.frequency(Inventory, Inventory.get(i)));
- }
- }
- pid = 5;
- }
- }
- if(pid == 5)
- {
- Paint = "Moving to " + SlayerMonster;
- if(!bank.isOpen())
- {
- if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- } else if (getObjects().closest("Bank chest") != null && getObjects().closest("Bank chest").interact("use")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- } else if (getObjects().closest("Bank booth") != null && getObjects().closest("Bank booth").interact("Bank")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return getBank().isOpen();
- }
- }.sleep();
- }
- } else if (bank.isOpen())
- {
- if(SlayerMonster.contains("monkey"))
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 60);
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 60) neededItem = true;
- } else if (SlayerMonster.contains("kalphit") || SlayerMonster.contains("lizard") || SlayerMonster.contains("jackal"))
- {
- if (getInventory().contains("Shantay pass") && getInventory().getItem("Shantay pass").getAmount() > 1) getBank().depositAll("Shantay pass");
- if(getBank().contains("Shantay pass"))
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (!getInventory().contains("Shantay pass")) getBank().withdraw("Shantay pass", 1);
- if (getInventory().contains("Shantay pass")) neededItem = true;
- if(SlayerMonster.contains("lizard") || SlayerMonster.contains("jackal"))
- {
- neededItem = false;
- if(getBank().contains("Waterskin(4)"))
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 6);
- if (!getInventory().contains("Waterskin(4)")) getBank().withdraw("Waterskin(4)", 6);
- if (getInventory().contains("Waterskin(4)") && SlayerMonster.contains("lizard"))
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (!getInventory().contains("Ice cooler")) getBank().withdrawAll("Ice cooler");
- if (getInventory().contains("Ice cooler"))
- neededItem = true;
- } else if (getInventory().contains("Waterskin(4)") && SlayerMonster.contains("jackal"))
- neededItem = true;
- }else if (!getBank().contains("Waterskin(4)"))
- {
- Paint = "Buying Waterskin(4)";
- pid = -99;
- }
- }
- } else
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 500);
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 500 && getBank().close()) pid = -3;
- }
- } else if (SlayerMonster.contains("cave sli") || SlayerMonster.contains("cave bu"))
- {
- if(swampRope && getInventory().contains("Rope")) getBank().depositAll("Rope");
- if((!getInventory().contains("Rope") || swampRope) && (!getInventory().contains("Candle") ||
- !getInventory().contains("Lit candle")))
- neededItem = false;
- if(getInventory().contains("Rope")) getBank().depositAll("Rope");
- if (getBank().contains("Rope") && !swampRope)
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- getBank().withdraw("Rope",1);
- } else if (!getBank().contains("Rope") && !swampRope)
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 3);
- if (getInventory().contains("Coins") && getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() < 40) getBank().depositAll("Coins");
- if (!getInventory().contains("Coins")) getBank().withdraw("Coins", 40);
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 40 && getBank().close())
- if(pid == 5 && getWalking().webWalk(new Area(3096, 3260, 3100, 3256)))
- pid = -4;
- }
- if(getInventory().contains("Rope") || swampRope)
- {
- if(getInventory().contains("Candle")) getBank().depositAll("Candle");
- if(getInventory().contains("Lit candle")) getBank().depositAll("Lit candle");
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (getBank().contains("Candle") && !getInventory().contains("Lit candle") && !getInventory().contains("Candle"))
- {
- getBank().withdraw("Candle",1);
- }
- if (getBank().contains("Lit candle") && !getInventory().contains("Candle") && !getInventory().contains("Lit candle"))
- {
- getBank().withdraw("Lit candle",1);
- }
- if(getInventory().contains("Candle") || getInventory().contains("Lit candle") || SlayerMonster.contains("cave craw"))
- {
- if(SlayerMonster.contains("cave sli"))
- {
- Paint = "Need Antipoison";
- if(getBank().getItem("Antipoison(3)") != null)
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
- getBank().withdraw("Antipoison(3)",2);
- if (getInventory().contains("Antipoison(3)")) neededItem = true;
- } else pid = -7;
- } else
- neededItem = true;
- }
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- if (getBank().contains("Tinderbox") && !getInventory().contains("Tinderbox")) getBank().withdraw("Tinderbox",1);
- if (neededItem == false && !getInventory().contains("Candle") && !getInventory().contains("Lit candle"))
- {
- if (!getInventory().contains("Coins") && getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 2);
- if (getInventory().contains("Coins")) getBank().depositAll("Coins");
- getBank().withdraw("Coins", 1000);
- if (getInventory().getItemInSlot(getInventory().getSlot("Coins")).getAmount() >= 1000 && getBank().close())
- pid=-5;
- } else if ((getInventory().contains("Candle") || getInventory().contains("Lit candle")) && !swampRope)
- pid=-5;
- }
- }
- else if(SlayerMonster.contains("cave craw"))
- {
- Paint = "Need Antipoison";
- if(getBank().getItem("Antipoison(3)") != null)
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 4);
- getBank().withdraw("Antipoison(3)",4);
- if (getInventory().contains("Antipoison(3)")) neededItem = true;
- } else pid = -7;
- } else if(isPoisoned)
- {
- if(getInventory().getSlotForNameThatContains("Antipoison") != -1)
- {
- Paint = "Need Antipoison";
- if(getBank().getItemInSlot(getBank().getSlotForNameThatContains("Antipoison")) != null)
- {
- if (getInventory().isFull()) getBank().deposit(getInventory().getItemInSlot(27).getName(), 1);
- getBank().withdraw(getBank().getSlotForNameThatContains("Antipoison"),1);
- } else pid = -7;
- } else
- {
- if(getBank().isOpen()) getBank().close();
- getInventory().getItemInSlot(getInventory().getSlotForNameThatContains("Antipoison")).interact("Drink");
- neededItem = true;
- }
- }
- else neededItem = true;
- }
- if (pid == 5 && neededItem == true)
- {
- tobank.bank(null, slayerArea);
- if(slayerArea.contains(myPosition())) pid = 6;
- }
- }
- if(pid == 6)
- {
- Paint = "Attacking " + SlayerMonster;
- Area drops = attack.getDead();
- if(drops != null)
- if(loot.lootItems(drops)) pid = 7;
- if(getInventory().getSelectedItemId() != -1)
- getInventory().deselectItem();
- monNumber = attack.Combat(TuraelMonsters[mIndex], styles[mIndex], slayerArea, monNumber, isUnder);
- if (monNumber <=0) pid = 0;
- pot.potUp();
- if(isPoisoned && getInventory().getSlotForNameThatContains("Antipoison") == -1) pid = 7;
- if(myPlayer().getHealthPercent() < 50)
- {
- if(!eat.doEat())
- {
- pid = 7;
- log("3");
- }
- }
- isUnder = attack.underAttack;
- if(isPoisoned) pot.poison();
- if(getInventory().getItem("Waterskin(4)") == null && getInventory().getItem("Waterskin(3)") == null &&
- getInventory().getItem("Waterskin(2)") == null && getInventory().getItem("Waterskin(1)") == null &&
- getInventory().getItem("Waterskin(0)") != null) pid = 7;
- }
- if(pid == 7)
- {
- hasFood = false;
- Paint = "Banking";
- if(tobank.bank(slayerBank, null)) pid = 3;
- }
- return 700; //The amount of time in milliseconds before the loop starts over
- }
- @Override
- public void onPaint(Graphics2D g) {
- RS2Widget Chatbox = getWidgets().get(162,59);
- g.setColor(Color.GREEN);
- g.drawString(Paint, Chatbox.getWidth() +25, Chatbox.getAbsY()+15);
- g.drawString(monNumber + " " + SlayerMonster + " left", Chatbox.getWidth()+25, Chatbox.getAbsY()+25);
- g.drawString(String.valueOf(pid), Chatbox.getWidth()+25, Chatbox.getAbsY()+35);
- }
- }
- public class Loot
- {
- private final MethodProvider methods;
- String[] itemList = {"Coins", "Bones", "Bronze boots", "Nature rune", "Grimy ranarr", "White berry"};
- boolean full = false;
- public Loot(final MethodProvider methods)
- {
- this.methods = methods;
- }
- public boolean lootItems(Area dead)
- {
- GroundItem item = null;
- if (dead != null)
- {
- if(methods.getInventory().isFull())
- {
- full = true;
- for (int x = 0; x < 28; x++)
- {
- if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).hasAction("Bury")
- && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Bury"))
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return !methods.getInventory().isFull();
- }
- }.sleep();
- full = false;
- }
- else if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).hasAction("Eat")
- && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Eat"))
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return !methods.getInventory().isFull();
- }
- }.sleep();
- full = false;
- }
- else if(methods.getInventory().getItemInSlot(x) !=null && methods.getInventory().getItemInSlot(x).getName() == "Vial"
- && methods.getInventory().isFull() && methods.getInventory().getItemInSlot(x).interact("Drop"))
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return !methods.getInventory().isFull();
- }
- }.sleep();
- full = false;
- }
- }
- }
- for (int i = 0; i < itemList.length; i++)
- {
- if(methods.getGroundItems().closest(dead, itemList[i]) != null)
- {
- item = closestItemInArea(dead, itemList[i]).get();
- }
- if(!methods.getInventory().isFull() && item !=null)
- item.interact("Take");
- }
- }
- return full;
- }
- final Optional<GroundItem> closestItemInArea(final Area area, final String itemName)
- {
- return Optional.ofNullable(methods.getGroundItems().closest(new AreaFilter<>(area), new NameFilter<>(itemName)));
- }
- }
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.event.WebWalkEvent;
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.utility.Condition;
- import org.osbot.rs07.utility.ConditionalSleep;
- public class ToBank
- {
- private final MethodProvider methods;
- boolean hasfood = true;
- public ToBank(final MethodProvider methods) {
- this.methods = methods;
- }
- public boolean bank(Area slayerBank, Area slayerArea)
- {
- if (slayerArea == null) slayerArea = slayerBank;
- if (slayerBank == null) slayerBank = slayerArea;
- if (!slayerBank.contains(methods.myPosition()) || !slayerArea.contains(methods.myPosition())) {
- if (methods.myPlayer().getHealthPercent() < 50)
- {
- if(gethasFood() != -1)
- {
- methods.getInventory().getItemInSlot(gethasFood()).interact("Eat");
- bank(slayerBank, slayerArea);
- hasfood = true;
- new ConditionalSleep(1000) {
- @Override
- public boolean condition() {
- return methods.myPlayer().isAnimating();
- }
- }.sleep();
- }
- }
- final WebWalkEvent webWalkEvent = new WebWalkEvent(slayerBank, slayerArea);
- webWalkEvent.setBreakCondition(new Condition()
- {
- @Override
- public boolean evaluate()
- {
- return methods.myPlayer().getHealthPercent() < 50 && hasfood;
- }
- });
- if (methods.myPlayer().getHealthPercent() > 50 || !hasfood || methods.myPlayer().isHitBarVisible()) methods.execute(webWalkEvent);
- }
- if(!methods.getBank().isOpen())
- {
- if ((methods.npcs.closest("Banker") != null && methods.npcs.closest("Banker").interact("Bank"))
- || (methods.getObjects().closest("Bank chest") != null && methods.getObjects().closest("Bank chest").interact("use"))
- || (methods.getObjects().closest("Bank booth") != null && methods.getObjects().closest("Bank booth").interact("Bank"))) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return methods.getBank().isOpen();
- }
- }.sleep();
- }
- } else if (methods.getBank().isOpen())
- {
- methods.getBank().depositAll();
- }
- if(methods.getBank().isOpen()) return true;
- else return false;
- }
- public int gethasFood()
- {
- int slot = -1;
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Eat"))
- slot = i;
- else if (i == 27) slot = -1;
- }
- return slot;
- }
- }
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.utility.ConditionalSleep;
- public class Pot
- {
- private final MethodProvider methods;
- public Pot(final MethodProvider methods) {
- this.methods = methods;
- }
- public void potUp()
- {
- if (methods.getSkills().getDynamic(Skill.ATTACK) == methods.getSkills().getStatic(Skill.ATTACK))
- {
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null &&
- methods.getInventory().getItemInSlot(i).hasAction("Drink"))
- {
- if (methods.getInventory().getItemInSlot(i).getName().contains("attack")
- || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
- {
- methods.getInventory().getItemInSlot(i).interact("Drink");
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return methods.getSkills().getDynamic(Skill.ATTACK) > methods.getSkills().getStatic(Skill.ATTACK);
- }
- }.sleep();
- break;
- }
- }
- }
- }
- if (methods.getSkills().getDynamic(Skill.STRENGTH) == methods.getSkills().getStatic(Skill.STRENGTH))
- {
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
- {
- if (methods.getInventory().getItemInSlot(i).getName().contains("strength")
- || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
- {
- methods.getInventory().getItemInSlot(i).interact("Drink");
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return methods.getSkills().getDynamic(Skill.STRENGTH) > methods.getSkills().getStatic(Skill.STRENGTH);
- }
- }.sleep();
- break;
- }
- }
- }
- }
- if (methods.getSkills().getDynamic(Skill.DEFENCE) == methods.getSkills().getStatic(Skill.DEFENCE))
- {
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
- {
- if (methods.getInventory().getItemInSlot(i).getName().contains("defence") || methods.getInventory().getItemInSlot(i).getName().contains("combat"))
- {
- methods.getInventory().getItemInSlot(i).interact("Drink");
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return methods.getSkills().getDynamic(Skill.DEFENCE) > methods.getSkills().getStatic(Skill.DEFENCE);
- }
- }.sleep();
- break;
- }
- }
- }
- }
- }
- public void poison()
- {
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Drink"))
- {
- if (methods.getInventory().getItemInSlot(i).getName().toLowerCase().contains("antipoison"))
- {
- methods.getInventory().getItemInSlot(i).interact("Drink");
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return methods.myPlayer().isAnimating();
- }
- }.sleep();
- break;
- }
- }
- }
- }
- }
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.utility.ConditionalSleep;
- public class Eat
- {
- boolean hasFood = true;
- private final MethodProvider methods;
- public Eat(final MethodProvider methods) {
- this.methods = methods;
- }
- public boolean doEat()
- {
- if (hasFood)
- {
- for (int i = 0; i < 28; i++)
- {
- if (methods.getInventory().getItemInSlot(i) != null && methods.getInventory().getItemInSlot(i).hasAction("Eat"))
- {
- int preEat = methods.myPlayer().getHealthPercent();
- if (methods.getInventory().getItemInSlot(i).interact("Eat"))
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return preEat < methods.myPlayer().getHealthPercent();
- }
- }.sleep();
- hasFood = true;
- break;
- }
- else if (i == 27) hasFood = false;
- }
- }
- if(hasFood) return true;
- else return false;
- }
- }
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.model.NPC;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.utility.ConditionalSleep;
- public class Attackit
- {
- private final MethodProvider methods;
- NPC target = null;
- NPC prevMonster = null;
- int xpTracker = 0;
- boolean underAttack = false;
- boolean canReach = true;
- Areas areas = new Areas();
- int lastHP = 0;
- public Attackit(final MethodProvider methods) {
- this.methods = methods;
- }
- public int Combat(String monster, int x, Area slayerArea, int monNumber, boolean isUnder)
- {
- if (x == 1 )
- {
- if (slayerArea.contains(methods.myPosition()))
- {
- if(isUnder)
- {
- target = methods.getNpcs().closestThatContains(monster);
- underAttack = false;
- }
- if(target == null && (monster.contains("cave bug"))) target = methods.getNpcs().closest(monster);
- else if(target == null) target = methods.getNpcs().closestThatContains(monster);
- lastHP = methods.myPlayer().getHealthPercent();
- if(target != null)
- {
- if(target != null && target.getHealthPercent() == 0)
- {
- if( methods.getInventory().contains("Ice cooler") && methods.getInventory().getItem("Ice cooler").interact())
- {
- target.interact();
- }else methods.getInventory().deselectItem();
- if (prevMonster != target && target.getHealthPercent() == 0)
- {
- monNumber -=1;
- prevMonster = target;
- target = null;
- }
- }
- if (target != null && !target.isHitBarVisible())
- {
- if(target != null && !slayerArea.contains(target))
- {
- methods.log("flee unreachable");
- methods.getWalking().webWalk(target.getPosition());
- target = methods.getNpcs().closestThatContains(monster);
- }
- if (!isUnder && target.interact("Attack"))
- {
- new ConditionalSleep(5000)
- {
- @Override
- public boolean condition()
- {
- return target.isHitBarVisible() || methods.myPlayer().isUnderAttack();
- }
- }.sleep();
- } else target = null;
- if (target != null && !target.isHitBarVisible() && methods.myPlayer().getHealthPercent() < lastHP)
- {
- underAttack = true;
- methods.log("flee danger");
- target = null;
- methods.getWalking().walk( methods.myPosition().translate( methods.random(1,5), methods.random(1,5)));
- }
- }
- }
- } else methods.getWalking().webWalk(slayerArea);
- }
- return monNumber;
- }
- public Area getDead()
- {
- if (prevMonster != null)
- {
- Area area = new Area(prevMonster.getX()-2, prevMonster.getY()-2, prevMonster.getX()+2, prevMonster.getY()+2);
- return area;
- }
- else return null;
- }
- }
- import org.osbot.rs07.script.MethodProvider;
- import org.osbot.rs07.utility.ConditionalSleep;
- public class Shantay {
- private final MethodProvider methods;
- public Shantay(final MethodProvider methods) {
- this.methods = methods;
- }
- int selectedPrice = 0;
- int buyInc = 0;
- boolean withdrew = false;
- boolean purchased = false;
- public boolean store(String item , int x)
- {
- if(x >= methods.getInventory().getEmptySlots()) buyInc = 50;
- if(x >= 10) buyInc = 10;
- if(x >= 5 && x <=10) buyInc = 5;
- if(x <= 5) buyInc = 1;
- if(item == "Waterskin(4)")
- {
- selectedPrice = 40*x;
- }else if (item == "Shantay pass")
- {
- selectedPrice = 7*x;
- }
- if(methods.getBank().isOpen())
- {
- if (methods.getInventory().contains("Waterskin(4)")) methods.getBank().depositAll();
- if (methods.getBank().contains("Waterskin(4)")) return true;
- if (methods.getInventory().getEmptySlots() < x) methods.getBank().depositAll();
- if (!methods.getInventory().contains("Coins") || (methods.getInventory().contains("Coins")
- && methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() < selectedPrice))
- methods.getBank().withdraw("Coins", selectedPrice);
- if (methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")) != null &&
- methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() >= selectedPrice
- && methods.getBank().close()) withdrew = true;
- } else if (!withdrew)
- {
- if (methods.getObjects().closest("Bank chest") != null &&
- methods.getObjects().closest("Bank chest").interact("Use")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return methods.getBank().isOpen();
- }
- }.sleep();
- }
- }
- if (!methods.getStore().isOpen() && withdrew && !purchased && methods.getNpcs().closest("Shantay") != null
- && methods.getNpcs().closest("Shantay").interact("Trade")) {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return methods.getStore().isOpen();
- }
- }.sleep();
- } else if(methods.getStore().isOpen())
- {
- new ConditionalSleep(5000) {
- @Override
- public boolean condition() {
- return methods.getStore().buy(item, buyInc);
- }
- }.sleep();
- }
- if((methods.getInventory().getItemInSlot(methods.getInventory().getSlot(item)) !=null &&
- methods.getInventory().getItemInSlot(methods.getInventory().getSlot(item)).getAmount() >= x
- || methods.getInventory().getItemInSlot(methods.getInventory().getSlot("Coins")).getAmount() <= 50) ||
- methods.getInventory().isFull())
- {
- withdrew = false;
- } else
- withdrew = true;
- return false;
- }
- }
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.map.constants.Banks;
- public class Areas
- {
- Area[] tmAreas = {new Area(3432, 3533, 3448, 3567), //banshee
- new Area(2898, 9823, 2927, 9841), //bat
- new Area(3014, 3297, 3020, 3282), //bird
- new Area(2688, 3349, 2718, 3324), //bear
- new Area(3142, 9580, 3158, 9554), //cave bug
- new Area(2774, 10005, 2811, 9989), //cave crawler
- new Area(3142, 9568, 3161, 9537), //cave slime
- new Area(3253, 3255, 3265, 3287), // Cows
- new Area(3405, 3530, 3431, 3552), //Hands
- new Area(3394, 3046, 3447, 3009), //Lizard
- new Area(3374, 2890, 3394, 2939), //jackals
- new Area(3013, 9853, 3041, 9819), //Dwarf
- new Area(3236, 9919, 3245, 9911), //ghosts
- new Area(1855, 5233, 1867, 5213), //goblin
- new Area(2992, 3466, 3023, 3489), //Ice fiend
- new Area(3314,9492,3335,9517), //Kalphite
- new Area(1870, 5223, 1882, 5208), //minotaur
- new Area(2866, 3183, 2888, 3138), //Monkeys
- new Area(3215, 9875, 3242, 9857), //Rats
- new Area(3295, 3275, 3303, 3315), //Scorpions
- new Area(3093, 9915, 3103, 9887), //Skeletons
- new Area(3156, 3252, 3180, 3219), //Spider
- new Area(1868, 5224, 1875, 5245), //wolves
- new Area(3138, 9881, 3151, 9904)}; //Zombies
- Area[] tmBanks = {Banks.CANIFIS, //banshee
- Banks.FALADOR_WEST, //bats
- Banks.FALADOR_EAST, //bird
- Banks.ARDOUGNE_SOUTH, //bear
- Banks.DRAYNOR, //cave bug
- Banks.CAMELOT, // cave crawler
- Banks.DRAYNOR, //cave slime
- Banks.LUMBRIDGE_UPPER, // Cows
- Banks.CANIFIS, //Hands
- new Area(3298, 3126, 3310, 3117), //Lizards (Desert Bank)
- new Area(3298, 3126, 3310, 3117), //dogs (Desert Bank)
- Banks.EDGEVILLE, //dwarf
- Banks.VARROCK_EAST, //ghosts
- Banks.EDGEVILLE, //goblin
- Banks.EDGEVILLE, //Icefiend
- new Area(3298, 3126, 3310, 3117), //Kalphites (Desert Bank)
- Banks.EDGEVILLE, //minotaur
- Banks.PEST_CONTROL, //Monkeys
- Banks.VARROCK_EAST, //Rats
- Banks.AL_KHARID, // Scorpions
- Banks.EDGEVILLE, //Skeletons
- Banks.LUMBRIDGE_UPPER, //Spider
- Banks.EDGEVILLE, //Wolves
- Banks.EDGEVILLE}; //Zombies
- public Area getArea(int x)
- {
- return tmAreas[x];
- }
- public Area getBank(int x)
- {
- return tmBanks[x];
- }
- }
- import javax.swing.*;
- import javax.swing.border.EmptyBorder;
- import java.awt.*;
- public class GUI {
- private final JFrame mainDialog;
- private final JComboBox<Masters> MasterSelector;
- int status = -10;
- boolean CStatus = false;
- private boolean started;
- public GUI() {
- mainDialog = new JFrame();
- mainDialog.setTitle("Slayer");
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- mainPanel.setBorder(new EmptyBorder(20, 20, 20, 20));
- mainDialog.getContentPane().add(mainPanel);
- JPanel SlayerPanel = new JPanel();
- SlayerPanel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- JLabel SlayerSelectionLabel = new JLabel("Select Slayer Master: ");
- c.fill = GridBagConstraints.BOTH;
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 0.5;
- SlayerPanel.add(SlayerSelectionLabel,c);
- MasterSelector = new JComboBox<>(Masters.values());
- SlayerPanel.add(MasterSelector);
- c.fill = GridBagConstraints.BOTH;
- c.gridx = 1;
- c.gridy = 0;
- c.weighty = 0.5;
- mainPanel.add(SlayerPanel,c);
- JLabel meleeSelectionLabel = new JLabel("Select Melee Gear Including Food:");
- c.gridx = 0;
- c.gridy = 2;
- c.anchor = GridBagConstraints.LINE_END;
- SlayerPanel.add(meleeSelectionLabel,c);
- JButton MeleeButton = new JButton("Melee");
- MeleeButton.addActionListener(e -> {
- started = true;
- CStatus = true;
- status = -9;
- });
- c.gridx = 1;
- c.gridy =2;
- SlayerPanel.add(MeleeButton,c);
- JLabel rangedSelectionLabel = new JLabel("Select Ranged Gear:");
- c.gridx = 0;
- c.gridy = 4;
- SlayerPanel.add(rangedSelectionLabel,c);
- JButton rangeButton = new JButton("Range");
- rangeButton.addActionListener(e -> {
- started = true;
- CStatus = true;
- status = -8;
- });
- c.gridx = 1;
- c.gridy =4;
- SlayerPanel.add(rangeButton,c);
- JLabel mageSelectionLabel = new JLabel("Select Mage Gear:");
- c.gridx = 0;
- c.gridy =5;
- SlayerPanel.add(mageSelectionLabel,c);
- JButton mageButton = new JButton("Mage");
- mageButton.addActionListener(e -> {
- started = true;
- CStatus = true;
- status = -7;
- });
- c.gridx = 1;
- c.gridy =5;
- SlayerPanel.add(mageButton,c);
- JButton startButton = new JButton("Start");
- startButton.addActionListener(e -> {
- started = true;
- CStatus = true;
- status = 0;
- close();
- });
- c.gridx = 0;
- c.gridy =6;
- SlayerPanel.add(startButton,c);
- mainDialog.pack();
- }
- public boolean isStarted() {
- return started;
- }
- public int getStatus() {
- return status;
- }
- public boolean getCStatus() {
- return CStatus;
- }
- public int setStatus(boolean x) {
- CStatus = x;
- return status;
- }
- public void open() {
- mainDialog.setVisible(true);
- }
- public void close() {
- mainDialog.setVisible(false);
- mainDialog.dispose();
- }
- }
- enum Masters {
- Turael,
- a,
- b,
- c;
- @Override
- public String toString() {
- return name().toLowerCase();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement