Пример #1
0
  @Override
  public void run() {

    if (Squeal.isLogoutNeeded()) {

      Game.logout(false);

      Time.sleep(1000);

      Squeal.setLogout(false);
    }

    clientDead = false;

    if (!Lobby.isOpen() || !Lobby.getOpenDialog().isOpen()) {

      while (!Lobby.isOpen()
          && !clientDead
          && !Game.isLoggedIn()
          && Widgets.get(596, 70).isOnScreen()) {

        getId();
        clearDetails();
        enterDetails();
        attemptLog();
      }

    } else {

      if (clientDead == false) {

        while (!Game.isLoggedIn()) {

          if (Lobby.enterGame()) {

            // Method sometimes fails for some unknown reason.

            Time.sleep(3000, 5000);
          }
        }

        if (Widgets.get(1313, 11).isOnScreen()) {

          Widgets.get(1313, 2).click(true);
        }
      }
    }
  }
  @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);
    }
  }
Пример #3
0
 @Override
 public int loop() {
   final Node stateNode = script.state();
   if (Game.getClientState() != Game.INDEX_MAP_LOADED) {
     return 2000;
   }
   if (client != Bot.client()) {
     WidgetCache.purge();
     Bot.context().getEventManager().addListener(this);
     client = Bot.client();
   }
   if (stateNode != null && Game.isLoggedIn()) {
     script.set(stateNode);
     final Node setNode = script.get();
     if (setNode != null) {
       getContainer().submit(setNode);
       setNode.join();
     }
   }
   return 250;
 }
Пример #4
0
 @Override
 public boolean activate() {
   return Game.isLoggedIn() && GcSuperheater.isBanking;
 }
 @Override
 public void onStart() {
   if (Game.isLoggedIn()) {
     startWoodcuttingExp = Skills.getExperience(Skills.WOODCUTTING);
   }
 }
 @Override
 public boolean activate() {
   return Game.isLoggedIn();
 }
 /**
  * Waits for the timer to run out or the {@link Completion} to be met with a specified sleep
  * between checks
  *
  * @param intersleep The time (in millis) to wait between checks
  * @return the value of the Completion when the timer stops
  * @see TimedCondition#waitStop()
  */
 public boolean waitStop(final int intersleep) {
   while (Players.getLocal() != null && Game.isLoggedIn() && isRunning()) {
     Task.sleep(intersleep);
   }
   return isDone() && Game.isLoggedIn();
 }
Пример #8
0
  public boolean paint(Graphics graphics) {
    if (!Game.isLoggedIn()) return false;
    try {
      Graphics2D g = (Graphics2D) graphics;
      PComponent clayout = null;
      try {
        clayout =
            new PColumnLayout(
                227,
                404,
                infoColumnValues,
                infoColumnData,
                new Font("Arial", 0, 9),
                PColumnLayout.ColorScheme.WHITE);
      } catch (Exception e) {
        e.printStackTrace();
      }
      getFrame("options").removeComponent(firstLayout);
      getFrame("options").removeComponent(secondLayout);
      int secondColx = -1;
      int bestLength = -1;
      firstColumn.clear();
      secondColumn.clear();
      if (checkBoxes.size() <= 6) firstColumn.putAll(checkBoxes);
      else {
        for (int i = 0; i < checkBoxes.size(); i++) {
          if (i <= 5) {
            String text;
            Iterator it = checkBoxes.keySet().iterator();
            for (int j = 0; j < i; j++) it.next();
            text = (String) it.next();
            int length = SwingUtilities.computeStringWidth(g.getFontMetrics(g.getFont()), text);
            if (length > bestLength) bestLength = length;
            firstColumn.put(text, checkBoxes.get(text));
          } else {
            String text;
            Iterator it = checkBoxes.keySet().iterator();
            for (int j = 0; j < i; j++) it.next();
            text = (String) it.next();
            secondColumn.put(text, checkBoxes.get(text));
          }
        }
      }
      secondColx = 8 + bestLength;
      firstLayout =
          new PCheckBoxLayout(
              8,
              407,
              firstColumn
                  .keySet()
                  .toArray(new String[(firstColumn.size() > 6) ? 6 : firstColumn.size()]),
              firstColumn
                  .values()
                  .toArray(new PCheckBox[(firstColumn.size() > 6) ? 6 : firstColumn.size()]),
              new Font("Arial", 0, 11),
              PCheckBoxLayout.ColorScheme.WHITE);
      secondLayout =
          new PCheckBoxLayout(
              secondColx + 12,
              407,
              secondColumn
                  .keySet()
                  .toArray(new String[(secondColumn.size() > 6) ? 6 : secondColumn.size()]),
              secondColumn
                  .values()
                  .toArray(new PCheckBox[(secondColumn.size() > 6) ? 6 : secondColumn.size()]),
              new Font("Arial", 0, 11),
              PCheckBoxLayout.ColorScheme.WHITE);
      getFrame("options").addComponent(firstLayout);
      getFrame("options").addComponent(secondLayout);
      if (showPaint) {
        Paint p = g.getPaint();
        g.setPaint(
            new GradientPaint(
                0, 1000, new Color(55, 55, 55, 240), 512, 472, new Color(15, 15, 15, 240)));
        g.fillRect(7, 396, 505, 128);
        final Point loc = Mouse.getLocation();
        if (Mouse.isPressed()) {
          g.fillOval(loc.x - 5, loc.y - 5, 10, 10);
          g.drawOval(loc.x - 5, loc.y - 5, 10, 10);
        }
        g.drawLine(0, loc.y + 1, 766, loc.y + 1);
        g.drawLine(0, loc.y - 1, 766, loc.y - 1);
        g.drawLine(loc.x + 1, 0, loc.x + 1, 505);
        g.drawLine(loc.x - 1, 0, loc.x - 1, 505);
        g.setPaint(p);
      }
      if (clayout != null) getFrame("info").addComponent(clayout);
      PaintController.onRepaint(graphics);
      if (clayout != null) getFrame("info").removeComponent(clayout);
      if (!showPaint) return false;
      String infoTxt = name + " - " + "v" + version;
      g.drawString(
          infoTxt,
          510 - SwingUtilities.computeStringWidth(g.getFontMetrics(g.getFont()), infoTxt),
          468);

      int offset = 0;
      for (Skill skill : skills) {
        if (skill.xpGained() > 0) {
          PSkill skillComp =
              new PSkill(8, 397 + offset, skill.getSkill(), PSkill.ColorScheme.GRAPHITE);
          if (!getFrame("info").containsComponent(skillComp)) {
            getFrame("info").addComponent(skillComp);
          }
          offset += 20;
        }
      }

      // == Mouse ==
      if (Mouse.isPressed()) {
        g.setColor(new Color(255, 252, 0, 150));

        g.setColor(new Color(255, 252, 0, 100));
      } else {
        g.setColor(new Color(255, 252, 0, 50));
      }

      g.setColor(new Color(0, 0, 0, 50));

      // == End mouse ==
    } catch (Exception ignored) {
      // if (Utils.isDevMode())
      //    ignored.printStackTrace();
    }
    return true;
  }
Пример #9
0
  public boolean validate() {

    return !Game.isLoggedIn() || Squeal.isLogoutNeeded();
  }