@Override
  public void onRepaint(Graphics g1) {
    Graphics2D g = (Graphics2D) g1;

    final Color color1 = new Color(213, 214, 175);
    final Color color2 = new Color(0, 0, 0);
    final Color color3 = new Color(1, 1, 1);

    final BasicStroke stroke1 = new BasicStroke(1);

    final Font font1 = new Font("Verdana", 3, 18);
    final Font font2 = new Font("Verdana", 1, 12);

    if (Game.isLoggedIn()) {
      currentWcExp = Skills.getExperience(Skills.WOODCUTTING);
      woodcuttingExpGained = currentWcExp - startWoodcuttingExp;
      int xpHour = (int) (3600000.0 / (runTime.getElapsed()) * woodcuttingExpGained);

      g.setColor(color1);
      g.fillRect(8, 394, 487, 114);
      g.setColor(color2);
      g.setStroke(stroke1);
      g.drawRect(8, 394, 487, 114);
      g.setFont(font1);
      g.setColor(color3);
      g.drawString("AnDraynorWillowChopper v0.3", 219, 421);
      g.setFont(font2);
      g.drawString("Status: " + Status, 18, 433);
      g.drawString("Run Time: " + runTime.toElapsedString(), 18, 452);
      g.drawString("Xp gained: " + woodcuttingExpGained + "(" + xpHour + ")/hr", 19, 472);
      g.drawString("WoodCutting Level: " + Skills.getLevel(Skills.WOODCUTTING), 18, 491);
    }
  }
Ejemplo n.º 2
0
 public static void make() {
   if (Bank.isOpen()) {
     Bank.close();
   } else {
     if (Inventory.getCount(Variables.glassID) != 0) {
       Variables.status = "Crafting";
       Item glass = Inventory.getItem(Variables.glassID);
       if (Widgets.get(1371, 0).validate()) {
         if (Widgets.get(1370, 56).getText().equals(Variables.urnType)) {
           Crafting.clickStart();
           final Timer glassTimer = new Timer(60000);
           while (glassTimer.isRunning() && Inventory.getCount(Variables.glassID) != 0) {
             Task.sleep(50);
           }
         } else {
           Widgets.get(1371, 44).getChild(20).click(true);
           Task.sleep(500, 600);
           Crafting.clickStart();
           final Timer glassTimer = new Timer(60000);
           while (glassTimer.isRunning() && Inventory.getCount(Variables.glassID) != 0) {
             Task.sleep(50);
           }
         }
       } else {
         if (glass != null) {
           if (glass.getWidgetChild() != null) {
             Variables.status = "Crafting";
             glass.getWidgetChild().click(true);
             Task.sleep(800, 900);
           }
         }
       }
     }
   }
 }
Ejemplo n.º 3
0
 public static void setRun(final boolean enabled) {
   if (isRunEnabled() != enabled && Widgets.get(WIDGET, WIDGET_RUN).click(true)) {
     final Timer t = new Timer(1800);
     while (t.isRunning() && isRunEnabled() != enabled) {
       Task.sleep(5);
     }
   }
 }
Ejemplo n.º 4
0
 @Override
 public void execute() {
   SceneObject firePit = SceneEntities.getNearest(Constants.LIT_FIRE_PIT);
   if (firePit != null) {
     if (Settings.root.getRoot() == 2) {
       if (Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) {
         if (firePit.getLocation().distanceTo() > 5) {
           Walking.walk(firePit.getLocation());
         } else {
           if (!firePit.isOnScreen()) {
             Camera.turnTo(firePit);
           } else {
             Inventory.getItem(Constants.INVENTORY_STRAIGHT_ROOT_ID)
                 .getWidgetChild()
                 .interact("use");
             firePit.interact("Use", "Straight root -> Firepit");
           }
         }
       }
     } else {
       Settings.burning = doAction("Add", firePit);
     }
   } else {
     firePit = SceneEntities.getNearest(Constants.UNLIT_FIRE_PIT);
     if (firePit != null) {
       Settings.burning = doAction("Light", firePit);
     } else {
       firePit = SceneEntities.getNearest(Constants.EMPTY_FIRE_PIT);
       if (firePit != null) {
         if (Settings.root.getRoot() == 2) {
           System.out.println("Find a world you can leech in.");
           Sagaie.stop = -1;
         } else {
           Settings.burning = doAction("Add", firePit);
         }
       }
     }
   }
   if (Settings.root.getRoot() == 2) {
     final Timer timeout = new Timer(5000);
     while (timeout.isRunning() && !validate(Constants.FLETCH_WIDGET)) {
       Task.sleep(50);
     }
     if (validate(Constants.FLETCH_WIDGET)) {
       Widgets.get(1370, 38).click(true);
       Task.sleep(2000);
     }
   }
 }
Ejemplo n.º 5
0
  @Override
  public void execute() {
    // TODO Auto-generated method stub
    try {
      SceneObject well = SceneEntities.getNearest(Constants.WELL_ID);
      Timer wait = new Timer(1000);
      if (!Constants.edgevillArea.contains(Players.getLocal())) {
        Teleport.teleportTo(Teleport.EDGEVILL);
      }

      if (well != null) {
        if (well.isOnScreen()) {
          if (Bank.isOpen()) Bank.close();

          if (Widgets.get(905, 14).validate()) {
            boolean isInteracted = false;
            if (Widgets.get(905, 14).getBoundingRectangle().contains(Mouse.getLocation())) {
              Mouse.click(true);
              isInteracted = true;
            } else {
              Widgets.get(905, 14).interact("Make All");
              isInteracted = true;
            }
            Task.sleep(1000);
            if (isInteracted) {
              Utilities.showDebug(
                  "Softening clays for profit of " + Progress.profitSoftening + "gp each.");
              softeningTimer.setEndIn(2500);
            }

          } else {
            if (!softeningTimer.isRunning()) {
              if (Inventory.selectItem(Constants.CLAY_ID)) {
                if (well.interact("Use")) {
                  Utilities.showDebug("Interacting well.");
                  Mouse.move(271, 475, 5, 5);
                }
              }
              wait.setEndIn(2000);
              while (wait.isRunning() && !Widgets.get(905, 14).validate()) {
                if (Players.getLocal().isMoving()) wait.setEndIn(1000);
                Task.sleep(100);
              }
            }
          }
        } else {
          Utilities.showDebug("Found well but not on screen. Walking..");

          Walking.walk(Walking.findPath(well).getEnd());
          wait.setEndIn(3000);
          while (wait.isRunning() && !well.isOnScreen()) {
            Task.sleep(300);
          }
        }
      }
    } catch (Exception e) {
    }
    ;
  }
Ejemplo n.º 6
0
  public static void evokeCombat(Graphics g1, boolean hide, int skill) {

    final Color color1 = new Color(0, 0, 0);
    final Color color2 = new Color(255, 0, 0);

    final BasicStroke stroke1 = new BasicStroke(1);

    final Font font1 = new Font("Arial", 0, 10);
    final Font font2 = new Font("Arial", 0, 18);

    if (!hide) {
      Graphics2D g = (Graphics2D) g1;
      g.setColor(color1);
      g.fillRect(1, 1, 162, 180);
      g.setStroke(stroke1);
      g.drawRect(1, 1, 162, 180);
      g.setFont(font1);
      g.setColor(color2);
      g.drawString("Current Level: " + Skills.getLevel(skill), 5, 48);
      g.drawString("Levels Gained: " + sd.level(skill), 5, 65);
      g.drawString("Experiance / hour: " + getXpHr(skill), 5, 82);
      g.drawString("TTL: " + getTtl(skill), 6, 100);
      g.setFont(font2);
      g.drawString("Monk Killer", 6, 26);
      g.setFont(font1);
      g.drawString("Run Time: " + runTime.toElapsedString(), 6, 116);
      g.drawString("Monks Killed: " + monksKilled, 6, 133);
      g.drawString("Bones looted: " + bonesLooted, 6, 150);
      g.setFont(font2);
      g.drawString("By: Kirinsoul!", 5, 176);
    }
  }
Ejemplo n.º 7
0
 @Override
 public boolean isRunning() {
   if (!super.isRunning()) return false;
   if (isDone()) {
     super.setEndIn(0);
   }
   return super.isRunning();
 }
Ejemplo n.º 8
0
 private boolean doAction(final String action, final SceneObject obj) {
   if (Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) {
     if (obj.getLocation().distanceTo() > 5) {
       Walking.walk(obj.getLocation());
     } else {
       if (!obj.isOnScreen()) {
         Camera.turnTo(obj);
       } else {
         if (obj.interact(action, obj.getDefinition().getName())) {
           final Timer timeout = new Timer(3000);
           while (Players.getLocal().getAnimation() == -1 && timeout.isRunning()) {
             Task.sleep(50);
           }
           return true;
         }
       }
     }
   }
   return false;
 }
Ejemplo n.º 9
0
  public boolean activate() {
    try {
      if (Players.getLocal() == null) return false;

      if (Inventory.getCount(Constants.CLAY_ID) == 0) {
        return false;
      }

      return Inventory.isFull() && !Players.getLocal().isInCombat() && !softeningTimer.isRunning();
    } catch (Exception e) {
      Utilities.showDebug("SoftenClay-Activate: " + e.getLocalizedMessage());
    }

    return false;
  }
Ejemplo n.º 10
0
 public static String getTtl(int skill) {
   Timer skillTimer = new Timer(sd.timeToLevel(SkillData.Rate.HOUR, skill));
   return skillTimer.toRemainingString();
 }
Ejemplo n.º 11
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.º 12
0
  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;
    }
  }