Ejemplo n.º 1
0
  @Override
  public void execute() {
    NPC stiles = NPCs.getNearest(11267);

    if (Inventory.getCount(379) == 26) {
      Variables.status = "Noting cooked lobbies";
      if (stiles.isOnScreen()) {
        stiles.interact("Exchange");

        while (Inventory.getCount(379) > 0) {
          sleep(10, 20);
        }
      }
      sleep(200, 300);

      while (Variables.twentySeconds.isRunning()) {
        if (Players.getLocal().isIdle()) {
          break;
        }
      }
    }

    if (Inventory.getCount(379) == 0) {
      Walking.findPath(new Tile(2868, 3146, 0)).traverse();
    }
  }
Ejemplo n.º 2
0
  @Override
  public void run() {
    Filter attackingGhoul =
        new Filter<NPC>() {
          public boolean accept(NPC npc) {
            return npc.getName().equals("Hellhound") && npc.getInteracting() == Players.getLocal();
          }
        };

    Filter freeGhoulToAttack =
        new Filter<NPC>() {
          public boolean accept(NPC npc) {
            return !npc.isInCombat() && npc.getName().equals("Hellhound");
          }
        };

    if (NPCs.getNearest(attackingGhoul) != null) Main.Hellhound = NPCs.getNearest(attackingGhoul);
    else Main.Hellhound = NPCs.getNearest(freeGhoulToAttack);

    if (Main.Hellhound.isOnScreen()) {
      if (Main.Hellhound.getInteracting() == null
          && !underAttack()
          && Main.Hellhound.isOnScreen()
          && Main.Hellhound != null) {
        Mouse.move(Main.Hellhound.getCentralPoint().x, Main.Hellhound.getCentralPoint().y);
        Time.sleep(50);
        if (!Menu.select("Attack")) {
          Mouse.move(Main.Hellhound.getCentralPoint().x, Main.Hellhound.getCentralPoint().y);
          Time.sleep(50);
          Menu.select("Attack");
        }
      }
    } else {
      if (Calculations.distance(Players.getLocal().getLocation(), Main.Hellhound.getLocation())
          <= 5) {
        Camera.turnTo(Main.Hellhound);
      } else {
        Walking.walk(Main.Hellhound.getLocation());
      }
    }
    Time.sleep(Random.nextInt(1000, 1200));
    while (Players.getLocal().isMoving() && !Main.Hellhound.isInCombat()) {
      Time.sleep(100);
    }
  }
Ejemplo n.º 3
0
 private void teleportToMine() {
   if (Util.inAuburyShop()) {
     NPC aubury = NPCs.getNearest(Util.auburyId);
     if (aubury.interact("teleport")) {
       int time = 0;
       while (!Util.inEssenceMine() && time <= 4000) {
         time += 50;
         Time.sleep(50);
       }
     }
   }
 }
Ejemplo n.º 4
0
 public static NPC[] getNearestAgressiveMob() {
   return NPCs.getLoaded(
       new Filter<NPC>() {
         @Override
         public boolean accept(NPC mob) {
           return mob != null
               && mob.getInteracting() != null
               && !mob.equals(Summoning.getFamiliar())
               && mob.getInteracting().equals(Players.getLocal());
         }
       });
 }
Ejemplo n.º 5
0
 private boolean inCombat() {
   return Players.getLocal().isInCombat()
       || NPCs.getNearest(
               new Filter<NPC>() {
                 @Override
                 public boolean accept(final NPC npc) {
                   return npc.getInteracting() != null
                       && npc.getInteracting().equals(Players.getLocal())
                       && Arrays.binarySearch(GlobalConstant.LRC_NPC, npc.getId()) >= 0;
                 }
               })
           != null;
 }
Ejemplo n.º 6
0
 public static boolean underAttack() {
   Filter ghoul =
       new Filter<NPC>() {
         public boolean accept(NPC npc) {
           return npc.getId() == 49;
         }
       };
   for (NPC attackingGhoul : NPCs.getLoaded(ghoul)) {
     if (attackingGhoul.getInteracting() == Players.getLocal()) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 7
0
 @Override
 public boolean validate() {
   return NPCs.getNearest(2477) != null;
 }
Ejemplo n.º 8
0
 @Override
 public void execute() {
   if (GlobalConstant.WIELDED_ID != -1
       && Settings.get(300) == 1000
       && Checks.getLP() < Skills.getRealLevel(Skills.CONSTITUTION) * 10 - 200) {
     if (Players.getLocal().getAppearance()[GlobalConstant.WEAPON] != GlobalConstant.EXCALIBUR
         && (Tabs.getCurrent().equals(Tabs.INVENTORY) || Tabs.INVENTORY.open())) {
       final Item excalibur = Inventory.getItem(GlobalConstant.EXCALIBUR);
       if (excalibur != null) {
         excalibur.getWidgetChild().click(true);
         PauseHandler.pause(
             new PauseHandler.Condition() {
               @Override
               public boolean validate() {
                 return Players.getLocal().getAppearance()[GlobalConstant.WEAPON]
                     == GlobalConstant.EXCALIBUR;
               }
             },
             (long) Random.nextInt(750, 1500));
       }
     } else if (Tabs.getCurrent().equals(Tabs.ATTACK) || Tabs.ATTACK.open()) {
       final WidgetChild bar = Widgets.get(884, 4);
       if (bar.validate()) {
         bar.click(true);
         PauseHandler.pause(
             new PauseHandler.Condition() {
               @Override
               public boolean validate() {
                 return Settings.get(300) != 1000;
               }
             },
             (long) Random.nextInt(400, 800));
       }
     }
     return;
   }
   if (GlobalConstant.KEEP_ALIVE
       && Checks.getLP() < Skills.getRealLevel(Skills.CONSTITUTION) * 0.4f * 10) {
     if (Checks.isOutside()) {
       if (Players.getLocal().getAnimation() == -1) {
         final WidgetChild[] widgets = {Widgets.get(750, 2), Widgets.get(750, 6)};
         if (widgets[0].validate() && widgets[1].validate()) {
           if (widgets[Random.nextInt(0, widgets.length)].interact("Rest"))
             PauseHandler.pause(
                 new PauseHandler.Condition() {
                   @Override
                   public boolean validate() {
                     return Players.getLocal().getAnimation() != -1;
                   }
                 },
                 (long) Random.nextInt(750, 1500));
         }
       }
       Task.sleep(400, 800);
     } else {
       if (Calculations.distanceTo(GlobalConstant.TILE_BANK) > 5) {
         if (Traverse.walk(GlobalConstant.TILE_BANK)) {
           PauseHandler.pause(
               new PauseHandler.Condition() {
                 @Override
                 public boolean validate() {
                   return Walking.getDestination() == null
                       || Calculations.distanceTo(Walking.getDestination()) < 8;
                 }
               },
               (long) Random.nextInt(500, 1000));
         }
       }
     }
   } else {
     if (Checks.isOutside()) {
       final SceneObject ladder = SceneEntities.getNearest(GlobalConstant.ROPE_DOWN_ID);
       if (ladder != null && ladder.interact("Climb"))
         PauseHandler.pause(
             new PauseHandler.Condition() {
               @Override
               public boolean validate() {
                 return !Checks.isOutside();
               }
             },
             750l);
       else if (ladder != null && Calculations.distanceTo(ladder) > 5)
         PauseHandler.walk(ladder, (long) Random.nextInt(250, 750));
     } else if (inCombat() || Players.getLocal().isInCombat()) {
       final Tile rockTile = GlobalConstant.TILE_ROCKS[Checks.isGold()][Mine.getCurrent()];
       if (true
           || Calculations.distanceTo(GlobalConstant.TILE_BANK)
               < Calculations.distanceTo(rockTile)) {
         if (Calculations.distanceTo(GlobalConstant.TILE_BANK) > 6
             && Traverse.walk(GlobalConstant.TILE_BANK)) {
           PauseHandler.pause(
               new PauseHandler.Condition() {
                 @Override
                 public boolean validate() {
                   return Walking.getDestination() == null
                       || Calculations.distanceTo(Walking.getDestination()) < 8;
                 }
               },
               (long) Random.nextInt(200, 500));
         }
       } else {
         final SceneObject rock = SceneEntities.getAt(rockTile);
         final NPC npc =
             NPCs.getNearest(
                 new Filter<NPC>() {
                   @Override
                   public boolean accept(final NPC npc) {
                     return npc.getInteracting() != null
                         && npc.getInteracting().equals(Players.getLocal())
                         && Arrays.binarySearch(GlobalConstant.LRC_NPC, npc.getId()) >= 0;
                   }
                 });
         if (rock != null && npc != null) {
           final Tile hardcodedSafe =
               GlobalConstant.MINE_GOLD && Mine.getCurrent() == 0
                   ? GlobalConstant.GOLD_SAFE_SPOT
                   : !GlobalConstant.MINE_GOLD && Mine.getCurrent() == 2
                       ? GlobalConstant.COAL_SAFE_SPOT
                       : null;
           if (hardcodedSafe != null) {
             hardcodedSafe
                 .randomize(0, Mine.getCurrent() == 2 ? 4 : 1, 1, Mine.getCurrent() == 0 ? -4 : 1)
                 .clickOnMap();
           } else {
             final Tile[] bounds = rock.getArea().getBoundingTiles();
             Arrays.sort(
                 bounds,
                 new Comparator<Tile>() {
                   @Override
                   public int compare(final Tile t1, final Tile t2) {
                     return Calculations.distance(t1, npc.getLocation())
                             < Calculations.distance(t2, npc.getLocation())
                         ? 1
                         : -1;
                   }
                 });
             final int[][] flags = Walking.getCollisionFlags(Game.getPlane());
             final Tile colOffset =
                 Walking.getCollisionOffset(Game.getPlane())
                     .derive(Game.getBaseX(), Game.getBaseY());
             Tile toWalk = null;
             for (final int[] offset : new int[][] {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}) {
               final Tile derive = bounds[0].derive(offset[0], offset[1]);
               if (Nodes.walkable(flags, colOffset, derive)) {
                 if (toWalk == null
                     || Calculations.distance(derive, npc) > Calculations.distance(toWalk, npc))
                   toWalk = derive;
               }
             }
             if (toWalk != null) {
               if (!toWalk.isOnScreen()) Camera.turnTo(toWalk);
               toWalk.interact("Walk here");
             }
           }
           Task.sleep(100, 300);
           final int lp = Checks.getLP();
           final Timer timer = new Timer((long) Random.nextInt(7500, 10000));
           while (Players.getLocal().isInCombat()
               && Checks.getLP() >= lp
               && !Context.get().getScriptHandler().isPaused()
               && timer.isRunning()) Task.sleep(200, 800);
         }
       }
     }
   }
 }
Ejemplo n.º 9
0
 private void fish() throws Exception {
   Walking.walk(NPCs.getNearest(320).getLocation());
   setCameraRelativeTo(NPCs.getNearest(320).getLocation());
   NPCs.getNearest(320).click(true);
   Task.sleep(10000, 10500);
 }
Ejemplo n.º 10
0
public class Variables {
  public static int TALISMAN_ID;
  public static int ELEMENTALRUNE_ID;
  public static int CRAFTEDRUNE_ID;
  public static int ESSENCE_ID;
  public static int BINDINGNECKY_ID = 5521;

  public static SceneObject ALTERENTRENCE = SceneEntities.getNearest(2452);
  public static SceneObject EXITPORTAL = SceneEntities.getNearest(2465);
  public static SceneObject BANKBOOTH = SceneEntities.getNearest(782);
  public static SceneObject ALTER = SceneEntities.getNearest(2478);

  public static NPC MUSICIAN = NPCs.getNearest(8699);

  public static Timer twoMinutes = new Timer(200000);
  public static Timer tenSeconds = new Timer(10000);

  public static String status = "Loading";
  public static String dynamicSleepStatus = "Not In";
  public static String SleepName;

  public static boolean neckyCheck() {
    if (Bank.isOpen()) {
      Widgets.get(762).getChild(120).interact("Show Equipment Stats");
      Task.sleep(50, 80);
      if (Widgets.get(667).getChild(190).getChild(2).getActions() != null) {
        Widgets.get(667).getChild(13).interact("Show Bank");
        Task.sleep(50, 80);
        return true;
      } else {
        Widgets.get(667).getChild(13).interact("Show Bank");
        Task.sleep(50, 80);
      }
    }
    return false;
  }

  public static void DyanmicSleep() {
    Area InsideBank = Areas.Bank;
    String SleepType = SleepName;

    // Dynamic Sleeps
    switch (SleepType) {
      case "EnterAlter": // Dynamic EnterAlter Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In EnterAlter";
          Area OutsideAlter = Areas.AlterEntrence;
          if (!OutsideAlter.contains(Players.getLocal().getLocation())) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "CraftRunes": // Dynamic Crafting Runes Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In CraftRunes";
          if (Inventory.getItem(CRAFTEDRUNE_ID) != null) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "ExitPortal": // Dynamic Leaving Alter Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In ExitPortal";
          Area InsideAlter = Areas.InsideAlter;
          if (!InsideAlter.contains(Players.getLocal().getLocation())) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "Resting": // Dynamic Resting Sleep
        while (twoMinutes.isRunning()) {
          dynamicSleepStatus = "In Resting";
          int EnergyLevel = Walking.getEnergy();
          if (EnergyLevel == Random.nextInt(90, 100)) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "OpenBank": // Dynamic Bank is Open Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In OpenBank";
          if (Bank.isOpen()) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "PlayerIsIdle": // Dynamic Player is Idle Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In PlayerIsIdle";
          if (Players.getLocal().isIdle()) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
      case "EssenceInInventory": // Dynamic Essences in Inventory Sleep
        while (tenSeconds.isRunning()) {
          dynamicSleepStatus = "In EssenceInInventory";
          if (Inventory.getItem(ESSENCE_ID) == null) {
            dynamicSleepStatus = "Not In";
            break;
          }
        }
        break;
    }
  }
}