Пример #1
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);
    }
  }
 boolean interact(Entity entity, int lowerBound, int upperBound, String action) {
   while (!Mouse.isReady()) ;
   if (entity == null || !entity.validate()) {
     return false;
   }
   Point entityPoint =
       new Point(
           entity.getCentralPoint().x + Random.nextInt(lowerBound, upperBound),
           entity.getCentralPoint().y + Random.nextInt(lowerBound, upperBound));
   while (!Mouse.getLocation().equals(entityPoint)) {
     Mouse.hop(
         entity.getCentralPoint().x + Random.nextInt(lowerBound, upperBound),
         entity.getCentralPoint().y + Random.nextInt(lowerBound, upperBound));
   }
   if (Mouse.getLocation().equals(entityPoint)) {
     Mouse.click(false);
     if (Menu.contains(action)) {
       Menu.select(action);
     }
   }
   return true;
 }
Пример #3
0
  // Author: Zasz
  public static void takeitem(GroundItem item) {
    Point point = item.getCentralPoint();
    point = new Point(point.x - 3, point.y - 10);
    boolean taken = false;
    for (int i = 0; i < 7; i++) {
      Mouse.move(point.x, point.y);
      Time.sleep(50);
      // log.info(item.getGroundItem().getName());
      if (Menu.select("Take", item.getGroundItem().getName())) {
        Sleeping.waitWhileMoving();
        taken = true;
        break;
      }
      if (i > 5) {
        Camera.setAngle(Camera.getAngleTo(Random.nextInt(15, 25)));
      }
      point = new Point(point.x + i, point.y + i);
    }

    if (taken) {
      addLootTaken(item.getGroundItem(), item.getGroundItem().getStackSize());
    }
  }