Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.clues;
- import java.util.ArrayList;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.util.ABCUtil;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Equipment;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Equipment.SLOTS;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSItemDefinition;
- import scripts.methods.Methods;
- public class Equipped {
- private final ABCUtil abc = new ABCUtil();
- private ArrayList<String> playerEquipment = new ArrayList<String>();
- private Main main;
- public Equipped(Main main) {
- setMain(main);
- }
- public boolean wearOriginalEquipment() {
- getMain().setStatus("Equipping Original Equipment");
- Interfaces.closeAll();
- for(String itemName : playerEquipment) {
- if(Equipment.isEquipped(itemName)) {
- continue;
- }
- RSItem[] item = Inventory.find(itemName);
- if(item != null && item.length > 0) {
- RSItemDefinition def = item[0].getDefinition();
- if(def != null) {
- if(item[0].click(def.getActions()[0])) {
- General.sleep(abc.DELAY_TRACKER.SWITCH_OBJECT_COMBAT.next());
- abc.DELAY_TRACKER.SWITCH_OBJECT_COMBAT.reset();
- }
- }
- }
- }
- return wearingOriginalEquipment();
- }
- public boolean wearingOriginalEquipment() {
- boolean allEquipped = true;
- for(String s : playerEquipment) {
- if(!Equipment.isEquipped(s)) {
- allEquipped = false;
- break;
- }
- }
- return allEquipped;
- }
- public boolean hasOriginalEquipment() {
- boolean hasAll = true;
- for(String s : playerEquipment) {
- if(!Equipment.isEquipped(s) && Inventory.getCount(s) <= 0) {
- hasAll = false;
- break;
- }
- }
- return hasAll;
- }
- public Object[][] getItemRequirements(String[] items) {
- getMain().println("Searching for item requirements...");
- Object[][] req = new Object[4][2];
- int index = 0;
- for(Object[] r : req) {
- r[0] = null;
- r[1] = 0;
- }
- for(String s : items) {
- if(s.equals("Coif")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.RANGED;
- req[index][1] = 20;
- }
- if(s.equals("Steel full helm")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 5;
- }
- if(s.equals("Steel platebody")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 5;
- }
- if(s.equals("Steel plateskirt")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 5;
- }
- if(s.equals("Steel axe")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 5;
- }
- if(s.equals("Steel pickaxe")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 5;
- }
- if(s.equals("Steel med helm")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 5;
- }
- if(s.equals("Studded body")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.RANGED;
- req[index][1] = 20;
- index++;
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 20;
- }
- if(s.equals("Studded chaps")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.RANGED;
- req[index][1] = 20;
- }
- if(s.equals("Black axe")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 10;
- }
- if(s.equals("Oak shortbow")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.RANGED;
- req[index][1] = 5;
- }
- if(s.equals("Hardleather body")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 10;
- }
- if(s.equals("Mithril pickaxe")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 20;
- }
- if(s.equals("Black platebody")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.DEFENCE;
- req[index][1] = 10;
- }
- if(s.equals("Steel mace")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 5;
- }
- if(s.equals("Steel longsword")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.ATTACK;
- req[index][1] = 5;
- }
- if(s.equals("Oak longbow")) {
- getMain().println("Found " + s + " Requirements.");
- req[index][0] = SKILLS.RANGED;
- req[index][1] = 5;
- }
- SKILLS skill = (SKILLS) req[index][0];
- if(skill != null) {
- int lvl = (Integer) req[index][1];
- getMain().println("Level " + lvl + " " + Methods.correctCapitalization(skill.toString()) + " Required!");
- }
- index++;
- }
- return req;
- }
- public boolean setEquipment() {
- for(SLOTS s : SLOTS.values()) {
- if(s.equals(SLOTS.AMULET)
- || s.equals(SLOTS.RING))
- continue;
- RSItem i = Equipment.getItem(s);
- if(i != null) {
- RSItemDefinition def = i.getDefinition();
- if(def != null) {
- playerEquipment.add(def.getName());
- }
- }
- }
- String s = "Setting Equipment: ";
- for(String item : playerEquipment) {
- s = s + " " + item + ", ";
- }
- getMain().println(s);
- return true;
- }
- public boolean unequipAllItems() {
- getMain().setStatus("Removing All Equipment");
- for(SLOTS s : SLOTS.values()) {
- if(Inventory.isFull()) {
- if(Inventory.isFull())
- getMain().getHamDungeon().eatFood();
- }
- Equipment.remove(s);
- General.sleep(abc.DELAY_TRACKER.SWITCH_OBJECT_COMBAT.next());
- abc.DELAY_TRACKER.SWITCH_OBJECT_COMBAT.reset();
- }
- boolean unequipped = true;
- for(SLOTS s : SLOTS.values()) {
- if(Equipment.getItem(s) != null) {
- unequipped = false;
- }
- }
- return unequipped;
- }
- public boolean wearingRequiredEquipment(ClueTask task) {
- if(task.getEmoteClue() != null) {
- String[] items = task.getEmoteClue().getItems();
- if(items[0].equals("")) {
- boolean unequipped = true;
- for(SLOTS s : SLOTS.values()) {
- if(Equipment.getItem(s) != null) {
- unequipped = false;
- }
- }
- return unequipped;
- }
- boolean hasItems = true;
- for(int i = 0; i < items.length; i++) {
- if(items[i].length() > 0) {
- if(!Equipment.isEquipped(items[i])) {
- hasItems = false;
- }
- }
- }
- return hasItems;
- }
- return false;
- }
- public boolean wearRequiredEquipment(String[] required) {
- getMain().setStatus("Wearing Required Equipment");
- if(Banking.isBankScreenOpen())
- Banking.close();
- boolean wearingAll = true;
- for(int i = 0; i < required.length; i++) {
- if(required[i].length() > 0) {
- RSItem[] item = Inventory.find(required[i]);
- if(item != null && item.length > 0) {
- RSItemDefinition def = item[0].getDefinition();
- if(def != null) {
- if(item[0].click(def.getActions()[0])) {
- if(isWearingItem(required[i], getMain().getProfile().getRandomGeneralSleep())) {
- continue;
- }
- General.sleep(abc.DELAY_TRACKER.SWITCH_OBJECT_COMBAT.next());
- abc.DELAY_TRACKER.SWITCH_OBJECT.reset();
- }
- }
- }
- }
- }
- for(String s : required) {
- if(!Equipment.isEquipped(s)) {
- wearingAll = false;
- }
- }
- return wearingAll;
- }
- public boolean isWearingItem(int item, int i) {
- long l = System.currentTimeMillis();
- while(Timing.timeFromMark(l) <= i) {
- if(Equipment.isEquipped(item)) {
- return true;
- }
- General.sleep(50, 150);
- }
- return false;
- }
- public boolean isWearingItem(String item, int i) {
- long l = System.currentTimeMillis();
- while(Timing.timeFromMark(l) <= i) {
- if(Equipment.isEquipped(item)) {
- return true;
- }
- General.sleep(50, 150);
- }
- return false;
- }
- public boolean hasRing() {
- return Inventory.getCount(Constants.DUEL_RING_ID) > 0
- || Equipment.isEquipped(Constants.DUEL_RING_ID);
- }
- public boolean hasNecklace() {
- return Inventory.getCount(Constants.GAMES_NECKLACE_ID) > 0
- || Equipment.isEquipped(Constants.GAMES_NECKLACE_ID);
- }
- public Main getMain() {
- return main;
- }
- public void setMain(Main main) {
- this.main = main;
- }
- public ArrayList<String> getPlayerEquipment() {
- return playerEquipment;
- }
- public void setPlayerEquipment(ArrayList<String> playerEquipment) {
- this.playerEquipment = playerEquipment;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement