Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.Decanter;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api.util.ABCUtil;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.types.RSItem;
- public class Clicking{
- static ABCUtil abc = new ABCUtil();
- public static boolean clickUsePotion(String potionName) {
- RSItem[] potions = Decanter.getPotionsWithout(potionName, 1,false);
- if (potions.length > 0) {
- RSItem p = potions[0];
- if (p != null) {
- String itemAction = "Use";
- if (!Game.isUptext(itemAction)) {
- p.click(itemAction);
- return Timing.waitCondition(new Condition()
- {
- @Override
- public boolean active()
- {
- General.sleep(100,200);
- return Game.isUptext("Use");
- }
- }, General.random(3000, 4000));
- }
- }
- }
- return false;
- }
- public static boolean usePotionOnVial() {
- RSItem[] vials = Inventory.find("Vial");
- if (vials.length > 0) {
- RSItem v = vials[0];
- if (v != null) {
- String itemAction = "Use";
- if (Game.isUptext(itemAction)) {
- v.click(itemAction);
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next() );
- return Timing.waitCondition(new Condition()
- {
- @Override
- public boolean active()
- {
- General.sleep(100,200);
- return !Game.isUptext("Use");
- }
- }, General.random(3000, 4000));
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement